diff --git a/Libraries/Core/Helpers/Dialogue/Commando/IChatCommand.cs b/Libraries/Core/Helpers/Dialogue/Commando/IChatCommand.cs index 7e7e8c7c..568ce654 100644 --- a/Libraries/Core/Helpers/Dialogue/Commando/IChatCommand.cs +++ b/Libraries/Core/Helpers/Dialogue/Commando/IChatCommand.cs @@ -8,5 +8,5 @@ public interface IChatCommand public string GetCommandPrefix(); public string GetCommandHelp(string command); public List GetCommands(); - public string Handle(string command, UserDialogInfo commandHandler, string sesssionId, SendMessageRequest request); + public string Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request); } diff --git a/ModExamples/21CustomCommandoCommand/21CustomCommandoCommand.csproj b/ModExamples/21CustomCommandoCommand/21CustomCommandoCommand.csproj index fe8a000c..c3ae756b 100644 --- a/ModExamples/21CustomCommandoCommand/21CustomCommandoCommand.csproj +++ b/ModExamples/21CustomCommandoCommand/21CustomCommandoCommand.csproj @@ -1,10 +1,32 @@ - + - - net9.0 - _21CustomCommandoCommand - enable - enable - + + net9.0 + _21CustomCommandoCommand + 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/21CustomCommandoCommand/Class1.cs b/ModExamples/21CustomCommandoCommand/Class1.cs deleted file mode 100644 index b2845257..00000000 --- a/ModExamples/21CustomCommandoCommand/Class1.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace _21CustomCommandoCommand; - -public class Class1 -{ -} diff --git a/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs b/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs new file mode 100644 index 00000000..2e4be708 --- /dev/null +++ b/ModExamples/21CustomCommandoCommand/CustomCommandoCommand.cs @@ -0,0 +1,54 @@ +using Core.Helpers.Dialog.Commando; +using Core.Models.Eft.Dialog; +using Core.Models.Eft.Profile; +using Core.Servers; +using Core.Services; + +namespace _21CustomCommandoCommand; + +public class CustomCommandoCommand : IChatCommand +{ + private DatabaseServer _databaseServer; + private MailSendService _mailSendService; + + public CustomCommandoCommand( + DatabaseServer databaseServer, + MailSendService mailSendService + ) + { + _databaseServer = databaseServer; + _mailSendService = mailSendService; + } + + public string GetCommandPrefix() + { + return "test"; + } + + public string? GetCommandHelp(string command) + { + if (command == "talk") + { + return "Usage: test talk"; + } + + return null; + } + + public List GetCommands() + { + return ["talk"]; + } + + // spelling of sessionId is fixed in server + public string? Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request) + { + if (command == "talk") + { + _mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"IM TALKING! OKAY?!\nHere's the walk speed X config from the DB: {_databaseServer.GetTables().Globals.Configuration.WalkSpeed.X}"); + return request.DialogId; + } + + return null; + } +} diff --git a/ModExamples/TempReferences/Core.dll b/ModExamples/TempReferences/Core.dll index 4956458a..7a59d266 100644 Binary files a/ModExamples/TempReferences/Core.dll and b/ModExamples/TempReferences/Core.dll differ diff --git a/ModExamples/TempReferences/SptCommon.dll b/ModExamples/TempReferences/SptCommon.dll index 53a34ccf..4651fa1c 100644 Binary files a/ModExamples/TempReferences/SptCommon.dll and b/ModExamples/TempReferences/SptCommon.dll differ diff --git a/ModExamples/TempReferences/SptDependencyInjection.dll b/ModExamples/TempReferences/SptDependencyInjection.dll index 3a564f79..067e4093 100644 Binary files a/ModExamples/TempReferences/SptDependencyInjection.dll and b/ModExamples/TempReferences/SptDependencyInjection.dll differ