finish off example 21, updated temp dll's with fixes

This commit is contained in:
CWX
2025-02-10 21:24:17 +00:00
parent 11a7b4fdbd
commit 194e3c1ea1
7 changed files with 84 additions and 13 deletions
@@ -8,5 +8,5 @@ public interface IChatCommand
public string GetCommandPrefix();
public string GetCommandHelp(string command);
public List<string> GetCommands();
public string Handle(string command, UserDialogInfo commandHandler, string sesssionId, SendMessageRequest request);
public string Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request);
}
@@ -1,10 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_21CustomCommandoCommand</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_21CustomCommandoCommand</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
</PropertyGroup>
<!-- TODO: Change to Nuget Package -->
<ItemGroup>
<Reference Include="Core">
<HintPath>..\TempReferences\Core.dll</HintPath>
<Private>false</Private>
<CopyLocal>false</CopyLocal>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="SptCommon">
<HintPath>..\TempReferences\SptCommon.dll</HintPath>
<Private>false</Private>
<CopyLocal>false</CopyLocal>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
<Reference Include="SptDependencyInjection">
<HintPath>..\TempReferences\SptDependencyInjection.dll</HintPath>
<Private>false</Private>
<CopyLocal>false</CopyLocal>
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
</Reference>
</ItemGroup>
</Project>
@@ -1,5 +0,0 @@
namespace _21CustomCommandoCommand;
public class Class1
{
}
@@ -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<string> 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;
}
}
Binary file not shown.
Binary file not shown.