diff --git a/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs b/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs index 2e4be708..f43a1ade 100644 --- a/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs +++ b/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs @@ -3,9 +3,11 @@ using Core.Models.Eft.Dialog; using Core.Models.Eft.Profile; using Core.Servers; using Core.Services; +using SptCommon.Annotations; namespace _21CustomCommandoCommand; +[Injectable] public class CustomCommandoCommand : IChatCommand { private DatabaseServer _databaseServer; diff --git a/ModExamples/21CustomCommandoCommand/package.json b/ModExamples/21CustomCommandoCommand/package.json new file mode 100644 index 00000000..d2034199 --- /dev/null +++ b/ModExamples/21CustomCommandoCommand/package.json @@ -0,0 +1,13 @@ +{ + "Name": "21CustomCommandoCommand", + "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/22CustomSptCommand/22CustomSptCommand.csproj b/ModExamples/22CustomSptCommand/22CustomSptCommand.csproj new file mode 100644 index 00000000..5b833eca --- /dev/null +++ b/ModExamples/22CustomSptCommand/22CustomSptCommand.csproj @@ -0,0 +1,39 @@ + + + + net9.0 + _22CustomSptCommand + enable + enable + Library + + + + + + ..\TempReferences\Core.dll + false + false + false + + + ..\TempReferences\SptCommon.dll + false + false + false + + + ..\TempReferences\SptDependencyInjection.dll + false + false + false + + + + + true + PreserveNewest + PreserveNewest + + + diff --git a/ModExamples/22CustomSptCommand/CustomSptCommand.cs b/ModExamples/22CustomSptCommand/CustomSptCommand.cs new file mode 100644 index 00000000..df28eb97 --- /dev/null +++ b/ModExamples/22CustomSptCommand/CustomSptCommand.cs @@ -0,0 +1,41 @@ +using Core.Helpers; +using Core.Helpers.Dialog.Commando.SptCommands; +using Core.Models.Eft.Dialog; +using Core.Models.Eft.Profile; +using Core.Services; +using SptCommon.Annotations; + +namespace _22CustomSptCommand; + +[Injectable] +public class CustomSptCommand : ISptCommand +{ + private readonly MailSendService _mailSendService; + private readonly ItemHelper _itemHelper; + + public CustomSptCommand( + MailSendService mailSendService, + ItemHelper itemHelper + ) + { + _mailSendService = mailSendService; + _itemHelper = itemHelper; + } + + public string GetCommand() + { + return "getName"; + } + + public string GetCommandHelp() + { + return "Usage: spt getName tplId"; + } + + public string PerformAction(UserDialogInfo commandHandler, string sessionId, SendMessageRequest request) + { + var splitCommand = request.Text.Split(" "); + _mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"That templateId belongs to item {_itemHelper.GetItem(splitCommand[2]).Value?.Properties?.Name ?? ""}"); + return request.DialogId; + } +} diff --git a/ModExamples/22CustomSptCommand/package.json b/ModExamples/22CustomSptCommand/package.json new file mode 100644 index 00000000..28d9f492 --- /dev/null +++ b/ModExamples/22CustomSptCommand/package.json @@ -0,0 +1,13 @@ +{ + "Name": "22CustomSptCommand", + "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 3e6906b9..f89cb5a2 100644 --- a/ModExamples/ModExamples.sln +++ b/ModExamples/ModExamples.sln @@ -38,10 +38,13 @@ 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 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "13.1AddTraderWithDynamicAssorts", "13.1AddTraderWithDynamicAssorts\13.1AddTraderWithDynamicAssorts.csproj", "{9038FA64-E484-4549-9728-C50F12BBE643}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "21CustomCommandoCommand", "21CustomCommandoCommand\21CustomCommandoCommand.csproj", "{A7D491BC-94C0-4AC9-9190-1FCA05D09B19}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "22CustomSptCommand", "22CustomSptCommand\22CustomSptCommand.csproj", "{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -128,6 +131,10 @@ Global {A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Debug|Any CPU.Build.0 = Debug|Any CPU {A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Release|Any CPU.ActiveCfg = Release|Any CPU {A7D491BC-94C0-4AC9-9190-1FCA05D09B19}.Release|Any CPU.Build.0 = Release|Any CPU + {7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE