Removed unused injections

This commit is contained in:
Chomp
2025-07-04 09:40:22 +01:00
parent a337b3c4e9
commit 2609db2536
33 changed files with 21 additions and 71 deletions
@@ -18,8 +18,7 @@ public class BtrDeliveryCallbacks(
BtrDeliveryService _btrDeliveryService,
TimeUtil _timeUtil,
ConfigServer _configServer,
SaveServer _saveServer,
HashUtil _hashUtil
SaveServer _saveServer
) : IOnUpdate
{
private readonly BtrDeliveryConfig _btrDeliveryConfig =
@@ -10,7 +10,6 @@ namespace SPTarkov.Server.Core.Callbacks;
[Injectable(TypePriority = OnUpdateOrder.DialogueCallbacks)]
public class DialogueCallbacks(
HashUtil _hashUtil,
TimeUtil _timeUtil,
HttpResponseUtil _httpResponseUtil,
DialogueController _dialogueController
@@ -6,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Insurance;
using SPTarkov.Server.Core.Models.Eft.ItemEvent;
using SPTarkov.Server.Core.Models.Spt.Config;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Callbacks;
@@ -14,7 +13,6 @@ namespace SPTarkov.Server.Core.Callbacks;
[Injectable(TypePriority = OnUpdateOrder.InsuranceCallbacks)]
public class InsuranceCallbacks(
InsuranceController _insuranceController,
InsuranceService _insuranceService,
HttpResponseUtil _httpResponseUtil,
ConfigServer _configServer
) : IOnUpdate
@@ -13,7 +13,6 @@ namespace SPTarkov.Server.Core.Generators;
public class BotLevelGenerator(
ISptLogger<BotLevelGenerator> _logger,
RandomUtil _randomUtil,
MathUtil _mathUtil,
DatabaseService _databaseService
)
{
@@ -4,7 +4,6 @@ using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Services;
namespace SPTarkov.Server.Core.Helpers;
@@ -12,8 +11,6 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class AssortHelper(
ISptLogger<AssortHelper> _logger,
ItemHelper _itemHelper,
DatabaseServer _databaseServer,
ServerLocalisationService _serverLocalisationService,
QuestHelper _questHelper
)
@@ -9,14 +9,12 @@ using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Dialog;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.ProfileCommand;
[Injectable]
public class ProfileSptCommand(
ISptLogger<ProfileSptCommand> _logger,
HashUtil _hashUtil,
MailSendService _mailSendService,
ProfileHelper _profileHelper
) : ISptCommand
@@ -10,14 +10,12 @@ using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Dialog;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Services;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Helpers.Dialogue.Commando.SptCommands.TraderCommand;
[Injectable]
public class TraderSptCommand(
ISptLogger<TraderSptCommand> _logger,
HashUtil _hashUtil,
TraderHelper _traderHelper,
MailSendService _mailSendService
) : ISptCommand
@@ -21,7 +21,6 @@ public class HideoutHelper(
ISptLogger<HideoutHelper> _logger,
TimeUtil _timeUtil,
ServerLocalisationService _serverLocalisationService,
HashUtil _hashUtil,
DatabaseService _databaseService,
EventOutputHolder _eventOutputHolder,
HttpResponseUtil _httpResponseUtil,
@@ -14,7 +14,6 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class InRaidHelper(
InventoryHelper _inventoryHelper,
ItemHelper _itemHelper,
ConfigServer _configServer,
ICloner _cloner,
DatabaseService _databaseService
@@ -5,17 +5,8 @@ using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class ModHelper
public class ModHelper(FileUtil fileUtil, JsonUtil jsonUtil)
{
private readonly FileUtil _fileUtil;
private readonly JsonUtil _jsonUtil;
public ModHelper(FileUtil fileUtil, JsonUtil jsonUtil)
{
_fileUtil = fileUtil;
_jsonUtil = jsonUtil;
}
public string GetAbsolutePathToModFolder(Assembly modAssembly)
{
// The full path to the mod folder
@@ -25,15 +16,15 @@ public class ModHelper
public string GetRawFileData(string pathToFile, string fileName)
{
// Read the content of the config file as a string
return _fileUtil.ReadFile(Path.Combine(pathToFile, fileName));
return fileUtil.ReadFile(Path.Combine(pathToFile, fileName));
}
public T GetJsonDataFromFile<T>(string pathToFile, string fileName)
{
// Read the content of the config file as a string
var rawContent = _fileUtil.ReadFile(Path.Combine(pathToFile, fileName));
var rawContent = fileUtil.ReadFile(Path.Combine(pathToFile, fileName));
// Take the string above and deserialise it into a file with a type (defined between the diamond brackets)
return _jsonUtil.Deserialize<T>(rawContent);
return jsonUtil.Deserialize<T>(rawContent);
}
}
@@ -16,7 +16,6 @@ namespace SPTarkov.Server.Core.Helpers;
public class NotificationSendHelper(
ISptLogger<NotificationSendHelper> _logger,
SptWebSocketConnectionHandler _sptWebSocketConnectionHandler,
HashUtil _hashUtil,
SaveServer _saveServer,
NotificationService _notificationService,
TimeUtil _timeUtil,
@@ -2,12 +2,11 @@ using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Eft.Ws;
using SPTarkov.Server.Core.Utils;
namespace SPTarkov.Server.Core.Helpers;
[Injectable(InjectionType.Singleton)]
public class NotifierHelper(HttpServerHelper httpServerHelper, HashUtil hashUtil)
public class NotifierHelper(HttpServerHelper httpServerHelper)
{
protected static readonly WsPing ping = new();
@@ -15,7 +15,6 @@ public class RagfairHelper(
TraderAssortHelper traderAssortHelper,
DatabaseService databaseService,
HandbookHelper handbookHelper,
ItemHelper itemHelper,
RagfairLinkedItemService ragfairLinkedItemService,
ConfigServer configServer,
ICloner cloner
@@ -21,7 +21,6 @@ namespace SPTarkov.Server.Core.Helpers;
public class RagfairOfferHelper(
ISptLogger<RagfairOfferHelper> _logger,
TimeUtil _timeUtil,
HashUtil _hashUtil,
BotHelper _botHelper,
RagfairSortHelper _ragfairSortHelper,
PresetHelper _presetHelper,
@@ -18,7 +18,6 @@ public class RagfairServerHelper(
TimeUtil timeUtil,
DatabaseService databaseService,
ItemHelper itemHelper,
TraderHelper traderHelper,
WeightedRandomHelper weightedRandomHelper,
MailSendService mailSendService,
ServerLocalisationService localisationService,
@@ -19,7 +19,6 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable]
public class TradeHelper(
ISptLogger<TradeHelper> _logger,
DatabaseService _databaseService,
TraderHelper _traderHelper,
ItemHelper _itemHelper,
QuestHelper _questHelper,
@@ -11,10 +11,10 @@ namespace SPTarkov.Server.Core.Servers;
public class ConfigServer
{
protected readonly string[] acceptableFileExtensions = ["json", "jsonc"];
protected FileUtil _fileUtil;
protected JsonUtil _jsonUtil;
protected ISptLogger<ConfigServer> _logger;
private static Dictionary<string, object> _configs = new();
protected readonly FileUtil _fileUtil;
protected readonly JsonUtil _jsonUtil;
protected readonly ISptLogger<ConfigServer> _logger;
private static readonly Dictionary<string, object> _configs = new();
public ConfigServer(ISptLogger<ConfigServer> logger, JsonUtil jsonUtil, FileUtil fileUtil)
{
@@ -15,15 +15,15 @@ public class BackupService
protected const string _profileDir = "./user/profiles";
protected readonly List<string> _activeServerMods;
protected BackupConfig _backupConfig;
protected readonly BackupConfig _backupConfig;
// Runs Init() every x minutes
protected Timer _backupIntervalTimer;
protected FileUtil _fileUtil;
protected JsonUtil _jsonUtil;
protected ISptLogger<BackupService> _logger;
protected TimeUtil _timeUtil;
protected IReadOnlyList<SptMod> _loadedMods;
protected readonly FileUtil _fileUtil;
protected readonly JsonUtil _jsonUtil;
protected readonly ISptLogger<BackupService> _logger;
protected readonly TimeUtil _timeUtil;
protected readonly IReadOnlyList<SptMod> _loadedMods;
public BackupService(
ISptLogger<BackupService> logger,
@@ -12,7 +12,7 @@ public class BotGenerationCacheService(
ServerLocalisationService _serverLocalisationService
)
{
protected Queue<BotBase> _activeBotsInRaid = [];
protected readonly Queue<BotBase> _activeBotsInRaid = [];
protected readonly ConcurrentDictionary<string, List<BotBase>> _storedBots = new();
/// <summary>
@@ -17,7 +17,6 @@ public class BtrDeliveryService(
ISptLogger<BtrDeliveryService> _logger,
DatabaseService _databaseService,
RandomUtil _randomUtil,
HashUtil _hashUtil,
TimeUtil _timeUtil,
SaveServer _saveServer,
MailSendService _mailSendService,
@@ -10,7 +10,6 @@ using SPTarkov.Server.Core.Models.Spt.Server;
using SPTarkov.Server.Core.Models.Spt.Templates;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Utils;
using Hideout = SPTarkov.Server.Core.Models.Spt.Hideout.Hideout;
using Locations = SPTarkov.Server.Core.Models.Spt.Server.Locations;
using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel;
@@ -24,8 +23,7 @@ namespace SPTarkov.Server.Core.Services;
public class DatabaseService(
ISptLogger<DatabaseService> _logger,
DatabaseServer _databaseServer,
ServerLocalisationService _serverLocalisationService,
HashUtil _hashUtil
ServerLocalisationService _serverLocalisationService
)
{
private bool _isDataValid = true;
@@ -16,7 +16,6 @@ public class GiftService(
ISptLogger<GiftService> _logger,
MailSendService _mailSendService,
ServerLocalisationService _serverLocalisationService,
HashUtil _hashUtil,
TimeUtil _timeUtil,
ProfileHelper _profileHelper,
ConfigServer _configServer
@@ -10,7 +10,6 @@ using SPTarkov.Server.Core.Models.Spt.Services;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
using Insurance = SPTarkov.Server.Core.Models.Eft.Profile.Insurance;
using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel;
@@ -28,8 +27,7 @@ public class InsuranceService(
ProfileHelper _profileHelper,
ServerLocalisationService _serverLocalisationService,
MailSendService _mailSendService,
ConfigServer _configServer,
ICloner _cloner
ConfigServer _configServer
)
{
protected readonly InsuranceConfig _insuranceConfig =
@@ -28,7 +28,6 @@ public class LocationLifecycleService
protected ICloner _cloner;
protected ConfigServer _configServer;
protected DatabaseService _databaseService;
protected HashUtil _hashUtil;
protected HealthHelper _healthHelper;
protected HideoutConfig _hideoutConfig;
protected InRaidConfig _inRaidConfig;
@@ -97,7 +96,6 @@ public class LocationLifecycleService
_timeUtil = timeUtil;
_databaseService = databaseService;
_profileHelper = profileHelper;
_hashUtil = hashUtil;
_profileActivityService = profileActivityService;
_botGenerationCacheService = botGenerationCacheService;
_botNameService = botNameService;
@@ -17,7 +17,6 @@ namespace SPTarkov.Server.Core.Services;
[Injectable]
public class MailSendService(
ISptLogger<MailSendService> _logger,
HashUtil _hashUtil,
TimeUtil _timeUtil,
SaveServer _saveServer,
DatabaseService _databaseService,
@@ -26,7 +25,6 @@ public class MailSendService(
NotificationSendHelper _notificationSendHelper,
ServerLocalisationService _serverLocalisationService,
ItemHelper _itemHelper,
TraderHelper _traderHelper,
ICloner _cloner
)
{
@@ -6,7 +6,6 @@ using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Mod;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
namespace SPTarkov.Server.Core.Services.Mod;
@@ -14,12 +13,10 @@ namespace SPTarkov.Server.Core.Services.Mod;
[Injectable]
public class CustomItemService(
ISptLogger<CustomItemService> logger,
HashUtil hashUtil,
DatabaseService databaseService,
ItemHelper itemHelper,
ItemBaseClassService itemBaseClassService,
ICloner cloner,
LocaleService localeService
ICloner cloner
)
{
/// <summary>
@@ -19,7 +19,6 @@ namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class PaymentService(
ISptLogger<PaymentService> _logger,
HashUtil _hashUtil,
HttpResponseUtil _httpResponseUtil,
HandbookHelper _handbookHelper,
TraderHelper _traderHelper,
@@ -15,11 +15,9 @@ namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class PmcChatResponseService(
ISptLogger<OpenZoneService> _logger,
HashUtil _hashUtil,
RandomUtil _randomUtil,
NotificationSendHelper _notificationSendHelper,
WeightedRandomHelper _weightedRandomHelper,
DatabaseService _databaseService,
ServerLocalisationService _serverLocalisationService,
GiftService _giftService,
LocaleService _localeService,
@@ -5,7 +5,6 @@ using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Config;
using SPTarkov.Server.Core.Models.Utils;
using SPTarkov.Server.Core.Servers;
using SPTarkov.Server.Core.Utils;
using SPTarkov.Server.Core.Utils.Cloners;
namespace SPTarkov.Server.Core.Services;
@@ -13,7 +12,6 @@ namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class PostDbLoadService(
ISptLogger<PostDbLoadService> _logger,
HashUtil _hashUtil,
DatabaseService _databaseService,
ServerLocalisationService _serverLocalisationService,
SeasonalEventService _seasonalEventService,
@@ -17,7 +17,6 @@ namespace SPTarkov.Server.Core.Services;
public class RagfairOfferService(
ISptLogger<RagfairOfferService> logger,
TimeUtil timeUtil,
HashUtil hashUtil,
DatabaseService databaseService,
SaveServer saveServer,
RagfairServerHelper ragfairServerHelper,
@@ -13,7 +13,6 @@ namespace SPTarkov.Server.Core.Utils;
public class App(
IServiceProvider _serviceProvider,
ISptLogger<App> _logger,
DatabaseImporter _databaseImporter,
TimeUtil _timeUtil,
RandomUtil _randomUtil,
ServerLocalisationService _serverLocalisationService,
@@ -6,7 +6,7 @@ using SPTarkov.DI.Annotations;
namespace SPTarkov.Server.Core.Utils;
[Injectable(InjectionType.Singleton)]
public partial class HashUtil(RandomUtil _randomUtil)
public class HashUtil(RandomUtil _randomUtil)
{
public uint GenerateCrc32ForData(string data)
{
@@ -15,7 +15,6 @@ public class RagfairOfferHolder(
ISptLogger<RagfairOfferHolder> _logger,
RagfairServerHelper _ragfairServerHelper,
ProfileHelper _profileHelper,
HashUtil _hashUtil,
ServerLocalisationService _serverLocalisationService,
ItemHelper _itemHelper
)