diff --git a/ModExamples/18.1CustomItemServiceLootBox/CustomItemServiceLootBox.cs b/ModExamples/18.1CustomItemServiceLootBox/CustomItemServiceLootBox.cs index 0a4bb1d4..17f04e36 100644 --- a/ModExamples/18.1CustomItemServiceLootBox/CustomItemServiceLootBox.cs +++ b/ModExamples/18.1CustomItemServiceLootBox/CustomItemServiceLootBox.cs @@ -5,9 +5,11 @@ using Core.Models.Spt.Mod; using Core.Models.Utils; using Core.Servers; using Core.Services.Mod; +using SptCommon.Annotations; namespace _18._1CustomItemServiceLootBox; +[Injectable] public class CustomItemServiceLootBox : IPostDBLoadMod, IPostSptLoadMod { private CustomItemService _customItemService; diff --git a/ModExamples/18CustomItemService/CustomItemServiceExample.cs b/ModExamples/18CustomItemService/CustomItemServiceExample.cs index 2412d264..b52ce5d8 100644 --- a/ModExamples/18CustomItemService/CustomItemServiceExample.cs +++ b/ModExamples/18CustomItemService/CustomItemServiceExample.cs @@ -5,9 +5,11 @@ using Core.Models.Spt.Mod; using Core.Models.Utils; using Core.Servers; using Core.Services.Mod; +using SptCommon.Annotations; namespace _18CustomItemService; +[Injectable] public class CustomItemServiceExample : IPostDBLoadMod, IPostSptLoadMod { private readonly CustomItemService _customItemService; diff --git a/ModExamples/20CustomChatBot/20CustomChatBot.csproj b/ModExamples/20CustomChatBot/20CustomChatBot.csproj new file mode 100644 index 00000000..f5e2a7d1 --- /dev/null +++ b/ModExamples/20CustomChatBot/20CustomChatBot.csproj @@ -0,0 +1,33 @@ + + + + net9.0 + _20CustomChatBot + enable + enable + Library + + + + + + ..\TempReferences\Core.dll + false + false + false + + + ..\TempReferences\SptCommon.dll + false + false + false + + + ..\TempReferences\SptDependencyInjection.dll + false + false + false + + + + diff --git a/ModExamples/20CustomChatBot/CustomChatBot.cs b/ModExamples/20CustomChatBot/CustomChatBot.cs new file mode 100644 index 00000000..555d9388 --- /dev/null +++ b/ModExamples/20CustomChatBot/CustomChatBot.cs @@ -0,0 +1,48 @@ +using Core.Helpers.Dialogue; +using Core.Models.Eft.Dialog; +using Core.Models.Eft.Profile; +using Core.Models.Enums; +using Core.Services; +using SptCommon.Annotations; + +namespace _20CustomChatBot; + +[Injectable] +public class CustomChatBot : IDialogueChatBot +{ + private MailSendService _mailSendService; + + public CustomChatBot( + MailSendService mailSendService + ) + { + _mailSendService = mailSendService; + } + + public UserDialogInfo GetChatBot() + { + return new UserDialogInfo + { + Id = "modderBuddy", + Aid = 9999999, + Info = new UserDialogDetails + { + Nickname = "Buddy", + Side = "Usec", + Level = 69, + MemberCategory = MemberCategory.Sherpa, + SelectedMemberCategory = MemberCategory.Sherpa + } + }; + } + + public string? HandleMessage(string sessionId, SendMessageRequest request) + { + _mailSendService.SendUserMessageToPlayer( + sessionId, + GetChatBot(), + $"Im Buddy! I just reply back what you typed to me!\n{request.Text}"); + + return request.DialogId; + } +} diff --git a/ModExamples/20CustomChatBot/package.json b/ModExamples/20CustomChatBot/package.json new file mode 100644 index 00000000..22bfbf97 --- /dev/null +++ b/ModExamples/20CustomChatBot/package.json @@ -0,0 +1,13 @@ +{ + "Name": "20CustomChatBot", + "Version": "1.0.0", + "SptVersion": "~4.0", + "LoadBefore": [], + "LoadAfter": [], + "IncompatibileMods": [], + "Url": "https://github.com/sp-tarkov/server-csharp/tree/develop/ExampleMods/Mods", + "IsBundleMod": false, + "Author": "SPT", + "Contributors": [], + "Licence": "MIT" +} diff --git a/ModExamples/ModExamples.sln b/ModExamples/ModExamples.sln index 3d47b25a..32b15f79 100644 --- a/ModExamples/ModExamples.sln +++ b/ModExamples/ModExamples.sln @@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "18CustomItemService", "18Cu EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "18.1CustomItemServiceLootBox", "18.1CustomItemServiceLootBox\18.1CustomItemServiceLootBox.csproj", "{B870C285-B435-4C40-89C4-0220D34CB9BE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "20CustomChatBot", "20CustomChatBot\20CustomChatBot.csproj", "{32271491-8CF1-4014-9A8E-E1EA22EA4292}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -111,6 +113,10 @@ Global {B870C285-B435-4C40-89C4-0220D34CB9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {B870C285-B435-4C40-89C4-0220D34CB9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {B870C285-B435-4C40-89C4-0220D34CB9BE}.Release|Any CPU.Build.0 = Release|Any CPU + {32271491-8CF1-4014-9A8E-E1EA22EA4292}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {32271491-8CF1-4014-9A8E-E1EA22EA4292}.Debug|Any CPU.Build.0 = Debug|Any CPU + {32271491-8CF1-4014-9A8E-E1EA22EA4292}.Release|Any CPU.ActiveCfg = Release|Any CPU + {32271491-8CF1-4014-9A8E-E1EA22EA4292}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE