From b992eaf33e7beb2cb6ca8d72db5b653a2ff3c193 Mon Sep 17 00:00:00 2001 From: Dev Date: Sun, 31 Mar 2024 16:47:39 +0100 Subject: [PATCH] Update types --- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../13AddTrader/types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../13AddTrader/types/utils/HashUtil.d.ts | 3 ++ .../13AddTrader/types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../16ImporterUtil/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../1LogToConsole/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../20CustomChatBot/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../2EditDatabase/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../5ReplaceMethod/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../7OnLoadHook/types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../7OnLoadHook/types/utils/HashUtil.d.ts | 3 ++ .../7OnLoadHook/types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../8OnUpdateHook/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- .../types/controllers/GameController.d.ts | 2 ++ .../types/controllers/HideoutController.d.ts | 8 ----- .../types/controllers/InraidController.d.ts | 2 ++ .../types/generators/BotGenerator.d.ts | 2 +- .../types/helpers/HideoutHelper.d.ts | 29 +++++++++++++----- .../types/helpers/ProfileHelper.d.ts | 2 +- .../types/helpers/TradeHelper.d.ts | 7 ----- .../types/helpers/TraderHelper.d.ts | 2 +- .../types/loaders/BundleLoader.d.ts | 23 +++++++------- .../types/models/spt/config/IBaseConfig.d.ts | 4 +++ .../models/spt/config/IHideoutConfig.d.ts | 5 +++- .../models/spt/config/IRagfairConfig.d.ts | 6 +--- .../models/spt/config/ITraderConfig.d.ts | 2 -- .../types/servers/HttpServer.d.ts | 4 +-- .../types/services/HashCacheService.d.ts | 30 ------------------- .../types/services/ModCompilerService.d.ts | 6 ++-- .../types/services/TraderServicesService.d.ts | 2 +- .../cache/BundleHashCacheService.d.ts | 18 +++++++++++ .../services/cache/ModHashCacheService.d.ts | 18 +++++++++++ .../9RouterHooks/types/utils/HashUtil.d.ts | 3 ++ .../types/utils/HttpFileUtil.d.ts | 2 +- 504 files changed, 2304 insertions(+), 1944 deletions(-) delete mode 100644 TypeScript/10ScopesAndTypes/types/services/HashCacheService.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/11BundleLoadingSample/types/services/HashCacheService.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/12ClassExtensionOverride/types/services/HashCacheService.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/13AddTrader/types/services/HashCacheService.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/14AfterDBLoadHook/types/services/HashCacheService.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/15HttpListenerExample/types/services/HashCacheService.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/16ImporterUtil/types/services/HashCacheService.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/17AsyncImporterWithDependency1/types/services/HashCacheService.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/17AsyncImporterWithDependency2/types/services/HashCacheService.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/18CustomItemService/types/services/HashCacheService.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/19UseExternalLibraries/types/services/HashCacheService.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/1LogToConsole/types/services/HashCacheService.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/20CustomChatBot/types/services/HashCacheService.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/21CustomCommandoCommand/types/services/HashCacheService.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/22CustomAkiCommand/types/services/HashCacheService.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/2EditDatabase/types/services/HashCacheService.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/3GetSptConfigFile/types/services/HashCacheService.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/4.1UseACustomJson5OrJsonCConfigFile/types/services/HashCacheService.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/4UseACustomConfigFile/types/services/HashCacheService.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/5ReplaceMethod/types/services/HashCacheService.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/6ReferenceAnotherClass/types/services/HashCacheService.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/7OnLoadHook/types/services/HashCacheService.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/8OnUpdateHook/types/services/HashCacheService.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/9RouterHooks/types/services/HashCacheService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/cache/BundleHashCacheService.d.ts create mode 100644 TypeScript/9RouterHooks/types/services/cache/ModHashCacheService.d.ts diff --git a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts +++ b/TypeScript/10ScopesAndTypes/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts b/TypeScript/10ScopesAndTypes/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts +++ b/TypeScript/10ScopesAndTypes/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts b/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts +++ b/TypeScript/10ScopesAndTypes/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/10ScopesAndTypes/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts +++ b/TypeScript/10ScopesAndTypes/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/11BundleLoadingSample/types/controllers/GameController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts +++ b/TypeScript/11BundleLoadingSample/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts b/TypeScript/11BundleLoadingSample/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/11BundleLoadingSample/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts b/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts +++ b/TypeScript/11BundleLoadingSample/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/11BundleLoadingSample/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts +++ b/TypeScript/11BundleLoadingSample/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/12ClassExtensionOverride/types/controllers/GameController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts b/TypeScript/12ClassExtensionOverride/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts b/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts +++ b/TypeScript/12ClassExtensionOverride/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/13AddTrader/types/controllers/GameController.d.ts b/TypeScript/13AddTrader/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/13AddTrader/types/controllers/GameController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/13AddTrader/types/controllers/InraidController.d.ts +++ b/TypeScript/13AddTrader/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts b/TypeScript/13AddTrader/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts +++ b/TypeScript/13AddTrader/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts b/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts +++ b/TypeScript/13AddTrader/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/13AddTrader/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/13AddTrader/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/13AddTrader/types/services/TraderServicesService.d.ts +++ b/TypeScript/13AddTrader/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/14AfterDBLoadHook/types/controllers/GameController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/14AfterDBLoadHook/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts b/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts +++ b/TypeScript/14AfterDBLoadHook/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/15HttpListenerExample/types/controllers/GameController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts +++ b/TypeScript/15HttpListenerExample/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts b/TypeScript/15HttpListenerExample/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts +++ b/TypeScript/15HttpListenerExample/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts b/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts +++ b/TypeScript/15HttpListenerExample/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/15HttpListenerExample/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts +++ b/TypeScript/15HttpListenerExample/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/16ImporterUtil/types/controllers/GameController.d.ts b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts +++ b/TypeScript/16ImporterUtil/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts b/TypeScript/16ImporterUtil/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts +++ b/TypeScript/16ImporterUtil/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts b/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts +++ b/TypeScript/16ImporterUtil/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/16ImporterUtil/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts +++ b/TypeScript/16ImporterUtil/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency1/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts +++ b/TypeScript/17AsyncImporterWithDependency2/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/18CustomItemService/types/controllers/GameController.d.ts b/TypeScript/18CustomItemService/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/18CustomItemService/types/controllers/GameController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts b/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts +++ b/TypeScript/18CustomItemService/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts b/TypeScript/18CustomItemService/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts +++ b/TypeScript/18CustomItemService/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts b/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts +++ b/TypeScript/18CustomItemService/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/18CustomItemService/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts +++ b/TypeScript/18CustomItemService/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/19UseExternalLibraries/types/controllers/GameController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts b/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts +++ b/TypeScript/19UseExternalLibraries/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/19UseExternalLibraries/types/generators/BotGenerator.d.ts b/TypeScript/19UseExternalLibraries/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts b/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts +++ b/TypeScript/19UseExternalLibraries/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts b/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts +++ b/TypeScript/19UseExternalLibraries/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/19UseExternalLibraries/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts +++ b/TypeScript/19UseExternalLibraries/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/1LogToConsole/types/controllers/GameController.d.ts b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/1LogToConsole/types/controllers/GameController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts +++ b/TypeScript/1LogToConsole/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts b/TypeScript/1LogToConsole/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts +++ b/TypeScript/1LogToConsole/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts b/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts +++ b/TypeScript/1LogToConsole/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/1LogToConsole/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts +++ b/TypeScript/1LogToConsole/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/20CustomChatBot/types/controllers/GameController.d.ts b/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts b/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts b/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts +++ b/TypeScript/20CustomChatBot/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/20CustomChatBot/types/generators/BotGenerator.d.ts b/TypeScript/20CustomChatBot/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts b/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts +++ b/TypeScript/20CustomChatBot/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts b/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts +++ b/TypeScript/20CustomChatBot/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/20CustomChatBot/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts +++ b/TypeScript/20CustomChatBot/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/21CustomCommandoCommand/types/controllers/GameController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts b/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/21CustomCommandoCommand/types/generators/BotGenerator.d.ts b/TypeScript/21CustomCommandoCommand/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts b/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts b/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts +++ b/TypeScript/21CustomCommandoCommand/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/22CustomAkiCommand/types/controllers/GameController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts b/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts +++ b/TypeScript/22CustomAkiCommand/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/22CustomAkiCommand/types/generators/BotGenerator.d.ts b/TypeScript/22CustomAkiCommand/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts b/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts +++ b/TypeScript/22CustomAkiCommand/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts b/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts +++ b/TypeScript/22CustomAkiCommand/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/22CustomAkiCommand/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts +++ b/TypeScript/22CustomAkiCommand/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/2EditDatabase/types/controllers/GameController.d.ts b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/2EditDatabase/types/controllers/GameController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts +++ b/TypeScript/2EditDatabase/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts b/TypeScript/2EditDatabase/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts +++ b/TypeScript/2EditDatabase/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts b/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts +++ b/TypeScript/2EditDatabase/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/2EditDatabase/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts +++ b/TypeScript/2EditDatabase/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/3GetSptConfigFile/types/controllers/GameController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/3GetSptConfigFile/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/3GetSptConfigFile/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/3GetSptConfigFile/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/3GetSptConfigFile/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/3GetSptConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts +++ b/TypeScript/3GetSptConfigFile/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..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,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; 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 6bc4f5f..73bd5a8 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts +++ b/TypeScript/4.1UseACustomJson5OrJsonCConfigFile/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/4UseACustomConfigFile/types/controllers/GameController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts b/TypeScript/4UseACustomConfigFile/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts b/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts +++ b/TypeScript/4UseACustomConfigFile/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/5ReplaceMethod/types/controllers/GameController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts +++ b/TypeScript/5ReplaceMethod/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts b/TypeScript/5ReplaceMethod/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts +++ b/TypeScript/5ReplaceMethod/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts b/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts +++ b/TypeScript/5ReplaceMethod/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/5ReplaceMethod/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts +++ b/TypeScript/5ReplaceMethod/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/6ReferenceAnotherClass/types/controllers/GameController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts b/TypeScript/6ReferenceAnotherClass/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts b/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts +++ b/TypeScript/6ReferenceAnotherClass/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/7OnLoadHook/types/controllers/GameController.d.ts b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts +++ b/TypeScript/7OnLoadHook/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts b/TypeScript/7OnLoadHook/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/7OnLoadHook/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts b/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/7OnLoadHook/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/7OnLoadHook/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts +++ b/TypeScript/7OnLoadHook/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/8OnUpdateHook/types/controllers/GameController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts +++ b/TypeScript/8OnUpdateHook/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts b/TypeScript/8OnUpdateHook/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts +++ b/TypeScript/8OnUpdateHook/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts b/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts +++ b/TypeScript/8OnUpdateHook/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/8OnUpdateHook/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts +++ b/TypeScript/8OnUpdateHook/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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/9RouterHooks/types/controllers/GameController.d.ts b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts index 9154999..9feb6cc 100644 --- a/TypeScript/9RouterHooks/types/controllers/GameController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/GameController.d.ts @@ -15,6 +15,7 @@ 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"; @@ -60,6 +61,7 @@ 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; diff --git a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts index 7d6047f..23bdd1e 100644 --- a/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/HideoutController.d.ts @@ -222,14 +222,6 @@ export declare class HideoutController { * @param output Output object to update */ protected handleScavCase(sessionID: string, pmcData: IPmcData, request: IHideoutTakeProductionRequestData, output: IItemEventRouterResponse): void; - /** - * 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; /** * Get quick time event list for hideout * // TODO - implement this diff --git a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts index 3453d2f..1f923dd 100644 --- a/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts +++ b/TypeScript/9RouterHooks/types/controllers/InraidController.d.ts @@ -13,6 +13,7 @@ import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgre 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"; @@ -60,6 +61,7 @@ export declare class InraidController { 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 diff --git a/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts b/TypeScript/9RouterHooks/types/generators/BotGenerator.d.ts index f7cc99c..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"; diff --git a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts index 4147245..282b2f0 100644 --- a/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/HideoutHelper.d.ts @@ -10,6 +10,7 @@ import { IHideoutProduction } from "@spt-aki/models/eft/hideout/IHideoutProducti import { IHideoutSingleProductionStartRequestData } from "@spt-aki/models/eft/hideout/IHideoutSingleProductionStartRequestData"; import { IHideoutTakeProductionRequestData } from "@spt-aki/models/eft/hideout/IHideoutTakeProductionRequestData"; 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"; @@ -149,14 +150,19 @@ export declare class HideoutHelper { * @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, 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 - * @returns + * @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): number; + 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 @@ -174,7 +180,7 @@ export declare class HideoutHelper { * @param baseFilterDrainRate Base drain rate * @returns drain rate (adjusted) */ - protected getAdjustWaterFilterDrainRate(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 @@ -229,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 */ - 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 diff --git a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts index 7490b13..182806d 100644 --- a/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/ProfileHelper.d.ts @@ -167,7 +167,7 @@ export declare class ProfileHelper { /** * Get a speciic common skill from supplied profile * @param pmcData Player profile - * @param skill Skill get get + * @param skill Skill to look up and return value from * @returns Common skill object from desired profile */ getSkillFromProfile(pmcData: IPmcData, skill: SkillTypes): Common; diff --git a/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts index c81ef96..d997dae 100644 --- a/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TradeHelper.d.ts @@ -56,13 +56,6 @@ export declare class TradeHelper { * @param output IItemEventRouterResponse */ sellItem(profileWithItemsToSell: IPmcData, profileToReceiveMoney: IPmcData, sellRequest: IProcessSellTradeRequestData, sessionID: string, output: IItemEventRouterResponse): void; - /** - * 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; /** * Traders allow a limited number of purchases per refresh cycle (default 60 mins) * @param sessionId Session id diff --git a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts index d89daf6..256ebf8 100644 --- a/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts +++ b/TypeScript/9RouterHooks/types/helpers/TraderHelper.d.ts @@ -121,7 +121,7 @@ export declare class TraderHelper { count: number; }[]; traderId: string; - }): void; + }, itemPurchased: Item): void; /** * Get the highest rouble price for an item from traders * UNUSED diff --git a/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts b/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts index 16d768b..90f4ea9 100644 --- a/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts +++ b/TypeScript/9RouterHooks/types/loaders/BundleLoader.d.ts @@ -1,32 +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"; export declare class BundleInfo { - modPath: string; - key: string; - path: string; - filepath: string; - dependencyKeys: string[]; - constructor(modpath: string, bundle: any, bundlePath: string, bundleFilepath: string); + 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[]; } 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/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/IRagfairConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts index 79465d2..33dee7b 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/IRagfairConfig.d.ts @@ -1,5 +1,5 @@ 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 */ @@ -12,10 +12,6 @@ export interface IRagfairConfig extends IBaseConfig { traders: Record; dynamic: Dynamic; } -export interface IRunIntervalValues { - inRaid: number; - outOfRaid: number; -} export interface Sell { /** Should a fee be deducted from player when liting an item for sale */ fees: boolean; diff --git a/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts b/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts index 6bc4f5f..73bd5a8 100644 --- a/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts +++ b/TypeScript/9RouterHooks/types/models/spt/config/ITraderConfig.d.ts @@ -9,8 +9,6 @@ export interface ITraderConfig extends IBaseConfig { 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 { 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/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/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/TraderServicesService.d.ts b/TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts index 84a7db0..4533989 100644 --- a/TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts +++ b/TypeScript/9RouterHooks/types/services/TraderServicesService.d.ts @@ -1,8 +1,8 @@ +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"; -import { ProfileHelper } from "@spt-aki/helpers/ProfileHelper"; export declare class TraderServicesService { protected profileHelper: ProfileHelper; protected jsonUtil: JsonUtil; 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/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; }