diff --git a/ModExamples/10CustomRoute/10CustomRoute.csproj b/ModExamples/10CustomRoute/10CustomRoute.csproj
index a3adb4ca..40b29f01 100644
--- a/ModExamples/10CustomRoute/10CustomRoute.csproj
+++ b/ModExamples/10CustomRoute/10CustomRoute.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/11RegisterClassesInDI/11RegisterClassesInDI.csproj b/ModExamples/11RegisterClassesInDI/11RegisterClassesInDI.csproj
index 80b593ef..d6570672 100644
--- a/ModExamples/11RegisterClassesInDI/11RegisterClassesInDI.csproj
+++ b/ModExamples/11RegisterClassesInDI/11RegisterClassesInDI.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/12Bundle/12Bundle.csproj b/ModExamples/12Bundle/12Bundle.csproj
index c919d80a..50fab8a5 100644
--- a/ModExamples/12Bundle/12Bundle.csproj
+++ b/ModExamples/12Bundle/12Bundle.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/14AfterDBLoadHook/14AfterDBLoadHook.csproj b/ModExamples/14AfterDBLoadHook/14AfterDBLoadHook.csproj
new file mode 100644
index 00000000..2dcb91d8
--- /dev/null
+++ b/ModExamples/14AfterDBLoadHook/14AfterDBLoadHook.csproj
@@ -0,0 +1,31 @@
+
+
+
+ net9.0
+ _14AfterDBLoadHook
+ enable
+ enable
+
+
+
+
+
+ ..\TempReferences\Core.dll
+ false
+ false
+ false
+
+
+ ..\TempReferences\SptCommon.dll
+ false
+ false
+ false
+
+
+ ..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
+
+
+
diff --git a/ModExamples/14AfterDBLoadHook/AfterDBLoadHook.cs b/ModExamples/14AfterDBLoadHook/AfterDBLoadHook.cs
new file mode 100644
index 00000000..67c91ea3
--- /dev/null
+++ b/ModExamples/14AfterDBLoadHook/AfterDBLoadHook.cs
@@ -0,0 +1,61 @@
+using Core.Models.Eft.Common.Tables;
+using Core.Models.External;
+using Core.Models.Logging;
+using Core.Models.Utils;
+using Core.Servers;
+using SptCommon.Annotations;
+
+namespace _14AfterDBLoadHook;
+
+[Injectable]
+public class AfterDBLoadHook : IPostDBLoadMod, IPostSptLoadMod
+{
+ private readonly ConfigServer _configServer;
+ private readonly DatabaseServer _databaseServer;
+ private readonly ISptLogger _logger;
+ private Dictionary? _itemsDb;
+
+ public AfterDBLoadHook(
+ ConfigServer configServer,
+ DatabaseServer databaseServer,
+ ISptLogger logger
+ )
+ {
+ _configServer = configServer;
+ _databaseServer = databaseServer;
+ _logger = logger;
+ }
+
+ public void PostDBLoad()
+ {
+ _itemsDb = _databaseServer.GetTables().Templates.Items;
+
+ // Database will be loaded, this is the fresh state of the DB so NOTHING from the SPT
+ // logic has modified anything yet. This is the DB loaded straight from the JSON files
+ _logger.LogWithColor($"Database item size: {_itemsDb.Count}", LogTextColor.Red, LogBackgroundColor.Yellow);
+
+ // lets do a quick modification and see how this reflect later on, on the postSptLoad()
+ // find the nvgs item by its Id
+ // this also checks if the item exists before giving you the item
+ // if it doesn't, this if check will fail
+ if (_itemsDb.TryGetValue("5c0558060db834001b735271", out var nvgs))
+ {
+ // Lets log the state before the modification
+ _logger.LogWithColor($"NVGs default CanSellOnRagfair: {nvgs.Properties.CanSellOnRagfair}", LogTextColor.Red, LogBackgroundColor.Yellow);
+ // Update one of its properties to be true
+ nvgs.Properties.CanSellOnRagfair = true;
+ }
+ }
+
+ public void PostSptLoad()
+ {
+ // The modification we made above would have been processed by now by SPT, so any values we changed had
+ // already been passed through the initial lifecycles (OnLoad) of SPT.
+
+ if (_itemsDb.TryGetValue("5c0558060db834001b735271", out var nvgs))
+ {
+ // Lets log the state after the modification
+ _logger.LogWithColor($"NVGs default CanSellOnRagfair: {nvgs.Properties.CanSellOnRagfair}", LogTextColor.Red, LogBackgroundColor.Yellow);
+ }
+ }
+}
diff --git a/ModExamples/15HttpListenerExample/15HttpListenerExample.csproj b/ModExamples/15HttpListenerExample/15HttpListenerExample.csproj
new file mode 100644
index 00000000..27c194cc
--- /dev/null
+++ b/ModExamples/15HttpListenerExample/15HttpListenerExample.csproj
@@ -0,0 +1,34 @@
+
+
+
+ net9.0
+ _15HttpListenerExample
+ enable
+ enable
+
+
+
+
+
+ ..\TempReferences\Core.dll
+ false
+ false
+ false
+
+
+ ..\TempReferences\SptCommon.dll
+ false
+ false
+ false
+
+
+ ..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
+
+
+
+
+
+
diff --git a/ModExamples/15HttpListenerExample/HttpListenerExample.cs b/ModExamples/15HttpListenerExample/HttpListenerExample.cs
new file mode 100644
index 00000000..1b644a6f
--- /dev/null
+++ b/ModExamples/15HttpListenerExample/HttpListenerExample.cs
@@ -0,0 +1,22 @@
+using System.Text;
+using Core.Servers.Http;
+using Microsoft.AspNetCore.Http;
+using SptCommon.Annotations;
+
+namespace _15HttpListenerExample;
+
+[Injectable]
+public class HttpListenerExample : IHttpListener
+{
+ public bool CanHandle(string sessionId, HttpRequest req)
+ {
+ return req.Method == "GET" && req.Method.Contains("/type-custom-url");
+ }
+
+ public void Handle(string sessionId, HttpRequest req, HttpResponse resp)
+ {
+ resp.StatusCode = 200;
+ resp.Body.WriteAsync(Encoding.UTF8.GetBytes("[1] This is the first example of a mod hooking into the HttpServer")).AsTask().Wait();
+ resp.
+ }
+}
diff --git a/ModExamples/1Logging/1Logging.csproj b/ModExamples/1Logging/1Logging.csproj
index 8d82e03b..c34a4a82 100644
--- a/ModExamples/1Logging/1Logging.csproj
+++ b/ModExamples/1Logging/1Logging.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/2EditDatabase/2EditDatabase.csproj b/ModExamples/2EditDatabase/2EditDatabase.csproj
index f181c6fc..ae5c2b6b 100644
--- a/ModExamples/2EditDatabase/2EditDatabase.csproj
+++ b/ModExamples/2EditDatabase/2EditDatabase.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/3EditSptConfig/3EditSptConfig.csproj b/ModExamples/3EditSptConfig/3EditSptConfig.csproj
index ef1ff413..f4c94218 100644
--- a/ModExamples/3EditSptConfig/3EditSptConfig.csproj
+++ b/ModExamples/3EditSptConfig/3EditSptConfig.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/4ReadCustomJson5Config/4ReadCustomJson5Config.csproj b/ModExamples/4ReadCustomJson5Config/4ReadCustomJson5Config.csproj
index 69f41dee..16b2cbef 100644
--- a/ModExamples/4ReadCustomJson5Config/4ReadCustomJson5Config.csproj
+++ b/ModExamples/4ReadCustomJson5Config/4ReadCustomJson5Config.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/5ReadCustomJsonConfig/5ReadCustomJsonConfig.csproj b/ModExamples/5ReadCustomJsonConfig/5ReadCustomJsonConfig.csproj
index 103a9ddd..97140f9f 100644
--- a/ModExamples/5ReadCustomJsonConfig/5ReadCustomJsonConfig.csproj
+++ b/ModExamples/5ReadCustomJsonConfig/5ReadCustomJsonConfig.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/6OverrideMethod/6OverrideMethod.csproj b/ModExamples/6OverrideMethod/6OverrideMethod.csproj
index 7f4b6a3d..446f3b1b 100644
--- a/ModExamples/6OverrideMethod/6OverrideMethod.csproj
+++ b/ModExamples/6OverrideMethod/6OverrideMethod.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/7UseMultipleClasses/7UseMultipleClasses.csproj b/ModExamples/7UseMultipleClasses/7UseMultipleClasses.csproj
index ebc01bb5..c81c2fb4 100644
--- a/ModExamples/7UseMultipleClasses/7UseMultipleClasses.csproj
+++ b/ModExamples/7UseMultipleClasses/7UseMultipleClasses.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/8OnLoad/8OnLoad.csproj b/ModExamples/8OnLoad/8OnLoad.csproj
index cf5b187e..3025943c 100644
--- a/ModExamples/8OnLoad/8OnLoad.csproj
+++ b/ModExamples/8OnLoad/8OnLoad.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/9OnUpdate/9OnUpdate.csproj b/ModExamples/9OnUpdate/9OnUpdate.csproj
index 7e5a74ce..4ae0ad98 100644
--- a/ModExamples/9OnUpdate/9OnUpdate.csproj
+++ b/ModExamples/9OnUpdate/9OnUpdate.csproj
@@ -11,12 +11,21 @@
..\TempReferences\Core.dll
+ false
+ false
+ false
..\TempReferences\SptCommon.dll
+ false
+ false
+ false
..\TempReferences\SptDependencyInjection.dll
+ false
+ false
+ false
diff --git a/ModExamples/ModExamples.sln b/ModExamples/ModExamples.sln
index 2877cacf..016ce083 100644
--- a/ModExamples/ModExamples.sln
+++ b/ModExamples/ModExamples.sln
@@ -29,6 +29,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12Bundle", "12Bundle\12Bund
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13AddTraderWithAssortJson", "13AddTraderWithAssortJson\13AddTraderWithAssortJson\13AddTraderWithAssortJson.csproj", "{636D5797-E37F-425A-B8DB-E3FBE4573F71}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "14AfterDBLoadHook", "14AfterDBLoadHook\14AfterDBLoadHook.csproj", "{B4DDC0E8-99D1-405E-9E01-823523FE642B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "15HttpListenerExample", "15HttpListenerExample\15HttpListenerExample.csproj", "{15F2B434-439E-498E-9B85-B7BBC2F4AFA4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -90,5 +94,13 @@ Global
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+ {B4DDC0E8-99D1-405E-9E01-823523FE642B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B4DDC0E8-99D1-405E-9E01-823523FE642B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B4DDC0E8-99D1-405E-9E01-823523FE642B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B4DDC0E8-99D1-405E-9E01-823523FE642B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15F2B434-439E-498E-9B85-B7BBC2F4AFA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal