diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs index 22d70721..7fd7af46 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/DialogueCallbacks.cs @@ -23,11 +23,6 @@ public class DialogueCallbacks( return true; } - public string GetRoute() - { - return "spt-dialogue"; - } - /// /// Handle client/friend/list /// diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs index ec7527ea..a963d122 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/GameCallbacks.cs @@ -24,11 +24,6 @@ public class GameCallbacks( return Task.CompletedTask; } - public string GetRoute() - { - return "spt-game"; - } - /// /// Handle client/game/version/validate /// diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs index 4770445e..4e072ee6 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HandbookCallbacks.cs @@ -12,9 +12,4 @@ public class HandbookCallbacks(HandBookController _handBookController) : IOnLoad _handBookController.Load(); return Task.CompletedTask; } - - public string GetRoute() - { - return "spt-handbook"; - } } diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs index f20499db..ab85b8de 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HideoutCallbacks.cs @@ -28,11 +28,6 @@ public class HideoutCallbacks( return false; } - public string GetRoute() - { - return "spt-hideout"; - } - /// /// Handle HideoutUpgrade event /// diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs index f03df458..4c92ea28 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/HttpCallbacks.cs @@ -14,11 +14,6 @@ public class HttpCallbacks(HttpServer _httpServer) : IOnLoad return Task.CompletedTask; } - public string GetRoute() - { - return "spt-http"; - } - public string GetImage() { return ""; diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs index a73d8fd3..8c271411 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/InsuranceCallbacks.cs @@ -33,11 +33,6 @@ public class InsuranceCallbacks( return false; } - public string GetRoute() - { - return "spt-insurance"; - } - /// /// Handle client/insurance/items/list/cost /// diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs index 5cccd9aa..d9964190 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/PresetCallbacks.cs @@ -12,9 +12,4 @@ public class PresetCallbacks(PresetController _presetController) : IOnLoad _presetController.Initialize(); return Task.CompletedTask; } - - public string GetRoute() - { - return "spt-presets"; - } } diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs index d6113459..20d4837d 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/RagfairCallbacks.cs @@ -30,11 +30,6 @@ public class RagfairCallbacks( return Task.CompletedTask; } - public string GetRoute() - { - return "spt-ragfair"; - } - public bool OnUpdate(long timeSinceLastRun) { if (timeSinceLastRun > _ragfairConfig.RunIntervalSeconds) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs index 351d89ec..c5024340 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/SaveCallbacks.cs @@ -22,11 +22,6 @@ public class SaveCallbacks( _saveServer.Load(); } - public string GetRoute() - { - return "spt-save"; - } - public bool OnUpdate(long timeSinceLastRun) { if (timeSinceLastRun > _coreConfig.ProfileSaveIntervalInSeconds) diff --git a/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs b/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs index 2f07014f..b3969bbd 100644 --- a/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs +++ b/Libraries/SPTarkov.Server.Core/Callbacks/TraderCallbacks.cs @@ -23,11 +23,6 @@ public class TraderCallbacks( return Task.CompletedTask; } - public string GetRoute() - { - return "spt-traders"; - } - public bool OnUpdate(long _) { return _traderController.Update(); diff --git a/Libraries/SPTarkov.Server.Core/DI/IOnLoad.cs b/Libraries/SPTarkov.Server.Core/DI/IOnLoad.cs index 6763eaf4..ad554d37 100644 --- a/Libraries/SPTarkov.Server.Core/DI/IOnLoad.cs +++ b/Libraries/SPTarkov.Server.Core/DI/IOnLoad.cs @@ -3,5 +3,4 @@ namespace SPTarkov.Server.Core.DI; public interface IOnLoad { Task OnLoad(); - string GetRoute(); } diff --git a/Libraries/SPTarkov.Server.Core/DI/IOnUpdate.cs b/Libraries/SPTarkov.Server.Core/DI/IOnUpdate.cs index bcdc667a..a02df08e 100644 --- a/Libraries/SPTarkov.Server.Core/DI/IOnUpdate.cs +++ b/Libraries/SPTarkov.Server.Core/DI/IOnUpdate.cs @@ -3,5 +3,4 @@ namespace SPTarkov.Server.Core.DI; public interface IOnUpdate { bool OnUpdate(long timeSinceLastRun); - string GetRoute(); } diff --git a/Libraries/SPTarkov.Server.Core/DI/OnLoadOrder.cs b/Libraries/SPTarkov.Server.Core/DI/OnLoadOrder.cs index b2bf6340..c8b8f5e3 100644 --- a/Libraries/SPTarkov.Server.Core/DI/OnLoadOrder.cs +++ b/Libraries/SPTarkov.Server.Core/DI/OnLoadOrder.cs @@ -2,15 +2,17 @@ namespace SPTarkov.Server.Core.DI; public static class OnLoadOrder { - public const int Database = 0; - public const int GameCallbacks = 100; - public const int PostDBModLoader = 200; - public const int TraderRegistration = 300; - public const int HandbookCallbacks = 400; - public const int HttpCallbacks = 500; - public const int SaveCallbacks = 600; - public const int TraderCallbacks = 700; - public const int PresetCallbacks = 800; - public const int RagfairCallbacks = 900; - public const int PostSptModLoader = 1000; + public const int Watermark = 0; + public const int PreSptModLoader = 1000; + public const int Database = 2000; + public const int GameCallbacks = 3000; + public const int PostDBModLoader = 4000; + public const int TraderRegistration = 5000; + public const int HandbookCallbacks = 6000; + public const int HttpCallbacks = 7000; + public const int SaveCallbacks = 8000; + public const int TraderCallbacks = 9000; + public const int PresetCallbacks = 10000; + public const int RagfairCallbacks = 11000; + public const int PostSptModLoader = 12000; } diff --git a/Libraries/SPTarkov.Server.Core/DI/OnUpdateOrder.cs b/Libraries/SPTarkov.Server.Core/DI/OnUpdateOrder.cs index d1df5a4f..4efbf394 100644 --- a/Libraries/SPTarkov.Server.Core/DI/OnUpdateOrder.cs +++ b/Libraries/SPTarkov.Server.Core/DI/OnUpdateOrder.cs @@ -2,12 +2,7 @@ namespace SPTarkov.Server.Core.DI; public static class OnUpdateOrder { - public const int PreSptUpdate = 0; - public const int DialogueCallbacks = 1; - public const int HideoutCallbacks = 100; - public const int TraderCallbacks = 200; - public const int RagfairCallbacks = 300; - public const int InsuranceCallbacks = 400; - public const int SaveCallbacks = 500; - public const int PostSptUpdate = 9999; + public const int DialogueCallbacks = 1000; + public const int HideoutCallbacks = 2000; + public const int InsuranceCallbacks = 3000; } diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs index abf604e7..1c7475d4 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs @@ -49,11 +49,6 @@ public class BotGeneratorHelper( return Task.CompletedTask; } - public string GetRoute() - { - return "spt-botGeneratorHelper"; - } - /// /// Adds properties to an item /// e.g. Repairable / HasHinge / Foldable / MaxDurability diff --git a/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs b/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs index 04e1210c..e790ad52 100644 --- a/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs +++ b/Libraries/SPTarkov.Server.Core/Loaders/PostDBModLoader.cs @@ -6,6 +6,7 @@ using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Loaders; +[Obsolete("This mod loader is obsolete and will be removed in 4.1.0. See documentation in IPostDBLoadModAsync for more information.")] [Injectable(TypePriority = OnLoadOrder.PostDBModLoader)] public class PostDBModLoader( ISptLogger _logger, @@ -25,9 +26,4 @@ public class PostDBModLoader( _logger.Info("Finished loading PostDBMods..."); } } - - public string GetRoute() - { - return "spt-post-db-mods"; - } } diff --git a/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs b/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs index bbc7fc6e..9465c69b 100644 --- a/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs +++ b/Libraries/SPTarkov.Server.Core/Loaders/PostSptModLoader.cs @@ -6,6 +6,7 @@ using SPTarkov.Server.Core.Utils; namespace SPTarkov.Server.Core.Loaders; +[Obsolete("This mod loader is obsolete and will be removed in 4.1.0. See documentation in IPostSptLoadModAsync for more information.")] [Injectable(TypePriority = OnLoadOrder.PostSptModLoader)] public class PostSptModLoader( ISptLogger _logger, @@ -25,9 +26,4 @@ public class PostSptModLoader( _logger.Info("Finished loading PostSptMods..."); } } - - public string GetRoute() - { - return "spt-post-spt-mods"; - } } diff --git a/Libraries/SPTarkov.Server.Core/Loaders/PreSptModLoader.cs b/Libraries/SPTarkov.Server.Core/Loaders/PreSptModLoader.cs new file mode 100644 index 00000000..cae27d10 --- /dev/null +++ b/Libraries/SPTarkov.Server.Core/Loaders/PreSptModLoader.cs @@ -0,0 +1,30 @@ +using SPTarkov.DI.Annotations; +using SPTarkov.Server.Core.DI; +using SPTarkov.Server.Core.Models.External; +using SPTarkov.Server.Core.Models.Utils; +using SPTarkov.Server.Core.Utils; + +namespace SPTarkov.Server.Core.Loaders; + +[Obsolete( + "This mod loader is obsolete and will be removed in 4.1.0. See documentation in IPreSptLoadModAsync for more information.")] +[Injectable(InjectionType.Singleton, TypePriority = OnLoadOrder.PreSptModLoader)] +public class PreSptModLoader( + ISptLogger _logger, + IEnumerable _preSptLoadMods +) : IOnLoad +{ + public async Task OnLoad() + { + if (ProgramStatics.MODS()) + { + _logger.Info("Loading PreSptMods..."); + foreach (var postSptLoadMod in _preSptLoadMods) + { + await postSptLoadMod.PreSptLoadAsync(); + } + + _logger.Info("Finished loading PreSptMods..."); + } + } +} diff --git a/Libraries/SPTarkov.Server.Core/Models/External/IPostDBLoadModAsync.cs b/Libraries/SPTarkov.Server.Core/Models/External/IPostDBLoadModAsync.cs index 64db0b60..1880389d 100644 --- a/Libraries/SPTarkov.Server.Core/Models/External/IPostDBLoadModAsync.cs +++ b/Libraries/SPTarkov.Server.Core/Models/External/IPostDBLoadModAsync.cs @@ -1,5 +1,20 @@ namespace SPTarkov.Server.Core.Models.External; +/// +/// This interface used to be used in TS to load mods after the database finished loading. +/// This class is now deprecated and should not be used, see code example below for replacement. +/// +/// +/// [Injectable(TypePriority = OnLoadOrder.Database + 1)] +/// public class MyMod : IOnLoad +/// { +/// // ... implementation +/// } +/// +/// +/// DEPRECATED, see code example above for replacement! +/// +[Obsolete("This interface is obsolete and will be removed in 4.1.0, please use IOnLoad instead with the desired Injectable(TypePriority). See class documentation for examples.")] public interface IPostDBLoadModAsync { Task PostDBLoadAsync(); diff --git a/Libraries/SPTarkov.Server.Core/Models/External/IPostSptLoadModAsync.cs b/Libraries/SPTarkov.Server.Core/Models/External/IPostSptLoadModAsync.cs index e82cdda5..f468c03e 100644 --- a/Libraries/SPTarkov.Server.Core/Models/External/IPostSptLoadModAsync.cs +++ b/Libraries/SPTarkov.Server.Core/Models/External/IPostSptLoadModAsync.cs @@ -1,5 +1,20 @@ namespace SPTarkov.Server.Core.Models.External; +/// +/// This interface used to be used in TS to load mods after SPT finished loading. +/// This class is now deprecated and should not be used, see code example below for replacement. +/// +/// +/// [Injectable(TypePriority = OnLoadOrder.RagfairCallbacks + 1)] +/// public class MyMod : IOnLoad +/// { +/// // ... implementation +/// } +/// +/// +/// DEPRECATED, see code example above for replacement! +/// +[Obsolete("This interface is obsolete and will be removed in 4.1.0, please use IOnLoad instead with the desired Injectable(TypePriority). See class documentation for examples.")] public interface IPostSptLoadModAsync { Task PostSptLoadAsync(); diff --git a/Libraries/SPTarkov.Server.Core/Models/External/IPreSptLoadModAsync.cs b/Libraries/SPTarkov.Server.Core/Models/External/IPreSptLoadModAsync.cs index 241bca30..c319de3a 100644 --- a/Libraries/SPTarkov.Server.Core/Models/External/IPreSptLoadModAsync.cs +++ b/Libraries/SPTarkov.Server.Core/Models/External/IPreSptLoadModAsync.cs @@ -1,5 +1,20 @@ namespace SPTarkov.Server.Core.Models.External; +/// +/// This interface used to be used in TS to load mods before SPT components loading. +/// This class is now deprecated and should not be used, see code example below for replacement. +/// +/// +/// [Injectable(TypePriority = OnLoadOrder.Watermark + 1)] +/// public class MyMod : IOnLoad +/// { +/// // ... implementation +/// } +/// +/// +/// DEPRECATED, see code example above for replacement! +/// +[Obsolete("This interface is obsolete and will be removed in 4.1.0, please use IOnLoad instead with the desired Injectable(TypePriority). See class documentation for examples.")] public interface IPreSptLoadModAsync { Task PreSptLoadAsync(); diff --git a/Libraries/SPTarkov.Server.Core/Services/TraderStore.cs b/Libraries/SPTarkov.Server.Core/Services/TraderStore.cs index 282aeee3..e41f0234 100644 --- a/Libraries/SPTarkov.Server.Core/Services/TraderStore.cs +++ b/Libraries/SPTarkov.Server.Core/Services/TraderStore.cs @@ -67,11 +67,6 @@ public class TraderStore : IOnLoad return Task.CompletedTask; } - public string GetRoute() - { - return "spt-trader-registration"; - } - /// /// Returns a trader by given ID. /// diff --git a/Libraries/SPTarkov.Server.Core/Utils/App.cs b/Libraries/SPTarkov.Server.Core/Utils/App.cs index d610524e..89106664 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/App.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/App.cs @@ -10,52 +10,23 @@ using LogLevel = SPTarkov.Server.Core.Models.Spt.Logging.LogLevel; namespace SPTarkov.Server.Core.Utils; [Injectable(InjectionType.Singleton)] -public class App +public class App( + ISptLogger _logger, + TimeUtil _timeUtil, + RandomUtil _randomUtil, + LocalisationService _localisationService, + ConfigServer _configServer, + EncodingUtil _encodingUtil, + HttpServer _httpServer, + DatabaseService _databaseService, + IEnumerable _onLoadComponents, + IEnumerable _onUpdateComponents, + HttpServerHelper _httpServerHelper +) { - protected readonly RandomUtil _randomUtil; - protected ConfigServer _configServer; - protected CoreConfig _coreConfig; - protected DatabaseService _databaseService; - protected EncodingUtil _encodingUtil; - protected HttpServer _httpServer; - protected HttpServerHelper _httpServerHelper; - protected LocalisationService _localisationService; - - protected ISptLogger _logger; - protected IEnumerable _onLoad; - protected IEnumerable _onUpdate; + protected CoreConfig _coreConfig = _configServer.GetConfig(); protected Dictionary _onUpdateLastRun = new(); protected Timer _timer; - protected TimeUtil _timeUtil; - - public App( - ISptLogger logger, - TimeUtil timeUtil, - RandomUtil randomUtil, - LocalisationService localisationService, - ConfigServer configServer, - EncodingUtil encodingUtil, - HttpServer httpServer, - DatabaseService databaseService, - IEnumerable onLoadComponents, - IEnumerable onUpdateComponents, - HttpServerHelper httpServerHelper - ) - { - _logger = logger; - _timeUtil = timeUtil; - _randomUtil = randomUtil; - _localisationService = localisationService; - _configServer = configServer; - _encodingUtil = encodingUtil; - _httpServer = httpServer; - _httpServerHelper = httpServerHelper; - _databaseService = databaseService; - _onLoad = onLoadComponents; - _onUpdate = onUpdateComponents; - - _coreConfig = configServer.GetConfig(); - } public async Task InitializeAsync() { @@ -90,12 +61,12 @@ public class App } } - foreach (var onLoad in _onLoad) + foreach (var onLoad in _onLoadComponents) { await onLoad.OnLoad(); } - _timer = new Timer(_ => Update(_onUpdate), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5000)); + _timer = new Timer(_ => Update(_onUpdateComponents), null, TimeSpan.Zero, TimeSpan.FromMilliseconds(5000)); } public async Task StartAsync() @@ -133,8 +104,14 @@ public class App foreach (var updateable in onUpdateComponents) { + var updateableName = updateable.GetType().FullName; + if (string.IsNullOrEmpty(updateableName)) + { + updateableName = $"{updateable.GetType().Namespace}.{updateable.GetType().Name}"; + } + var success = false; - if (!_onUpdateLastRun.TryGetValue(updateable.GetRoute(), out var lastRunTimeTimestamp)) + if (!_onUpdateLastRun.TryGetValue(updateableName, out var lastRunTimeTimestamp)) { lastRunTimeTimestamp = 0; } @@ -152,7 +129,7 @@ public class App if (success) { - _onUpdateLastRun[updateable.GetRoute()] = _timeUtil.GetTimeStamp(); + _onUpdateLastRun[updateableName] = _timeUtil.GetTimeStamp(); } else { @@ -163,7 +140,7 @@ public class App { if (_logger.IsLogEnabled(LogLevel.Debug)) { - _logger.Debug(_localisationService.GetText("route_onupdate_no_response", updateable.GetRoute())); + _logger.Debug(_localisationService.GetText("route_onupdate_no_response", updateableName)); } } } @@ -178,7 +155,7 @@ public class App protected void LogUpdateException(Exception err, IOnUpdate updateable) { - _logger.Error(_localisationService.GetText("scheduled_event_failed_to_run", updateable.GetRoute())); + _logger.Error(_localisationService.GetText("scheduled_event_failed_to_run", updateable.GetType().FullName)); _logger.Error(err.ToString()); } } diff --git a/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs b/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs index 553a544d..ba4ebcaa 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/DatabaseImporter.cs @@ -90,11 +90,6 @@ public class DatabaseImporter : IOnLoad CreateRouteMapping(imageFilePath, "files"); } - public string GetRoute() - { - return "spt-database"; - } - /** * Get path to spt data * @returns path to data diff --git a/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs b/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs index 2b458e58..d6cec585 100644 --- a/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs +++ b/Libraries/SPTarkov.Server.Core/Utils/Watermark.cs @@ -1,4 +1,5 @@ using SPTarkov.DI.Annotations; +using SPTarkov.Server.Core.DI; using SPTarkov.Server.Core.Models.Logging; using SPTarkov.Server.Core.Models.Spt.Config; using SPTarkov.Server.Core.Models.Utils; @@ -61,8 +62,8 @@ public class WatermarkLocale } } -[Injectable] -public class Watermark +[Injectable(TypePriority = OnLoadOrder.Watermark)] +public class Watermark : IOnLoad { protected ConfigServer _configServer; protected LocalisationService _localisationService; @@ -87,7 +88,7 @@ public class Watermark sptConfig = _configServer.GetConfig(); } - public virtual void Initialize() + public Task OnLoad() { var description = _watermarkLocale.GetDescription(); var warning = _watermarkLocale.GetWarning(); @@ -121,6 +122,8 @@ public class Watermark SetTitle(); Draw(); + + return Task.CompletedTask; } /// diff --git a/SPTarkov.Server/Program.cs b/SPTarkov.Server/Program.cs index 98fbe1a4..2ae6662a 100644 --- a/SPTarkov.Server/Program.cs +++ b/SPTarkov.Server/Program.cs @@ -52,23 +52,9 @@ public static class Program { SetConsoleOutputMode(); - var watermark = serviceProvider.GetService(); - // Initialize Watermark - watermark?.Initialize(); - var appContext = serviceProvider.GetService(); appContext?.AddValue(ContextVariableType.SERVICE_PROVIDER, serviceProvider); - if (ProgramStatics.MODS()) - { - // Initialize PreSptMods - var preSptLoadMods = serviceProvider.GetServices(); - foreach (var preSptLoadMod in preSptLoadMods) - { - await preSptLoadMod.PreSptLoadAsync(); - } - } - // Get the Built app and run it var app = serviceProvider.GetService(); diff --git a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs index 3dd6df59..3ffc3c06 100644 --- a/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs +++ b/Tools/HideoutCraftQuestIdGenerator/HideoutCraftQuestIdGenerator.cs @@ -20,7 +20,7 @@ public class HideoutCraftQuestIdGenerator( DatabaseServer _databaseServer, LocaleService _localeService, ItemHelper _itemHelper, - IEnumerable _onLoadComponents + DatabaseImporter _databaseImporter ) { private static readonly HashSet _blacklistedProductions = @@ -43,9 +43,7 @@ public class HideoutCraftQuestIdGenerator( public async Task Run() { - // We only need the DB for this, other OnLoad events alter the data - var dbOnload = _onLoadComponents.FirstOrDefault(x => x.GetRoute() == "spt-database"); - await dbOnload.OnLoad(); + await _databaseImporter.OnLoad(); // Build up our dataset BuildQuestProductionList();