Add mod example 23

This commit is contained in:
CWX
2025-02-10 21:53:14 +00:00
parent 08ec102f99
commit e8f110f488
7 changed files with 200 additions and 2 deletions
@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_23CustomAbstractChatBot</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>
<ItemGroup>
<Content Update="package.json">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
</ItemGroup>
</Project>
@@ -0,0 +1,49 @@
using Core.Helpers.Dialog.Commando;
using Core.Models.Eft.Dialog;
using Core.Models.Eft.Profile;
using Core.Services;
namespace _23CustomAbstractChatBot.Commands;
public class AnotherCoolCommand : IChatCommand
{
private readonly MailSendService _mailSendService;
public AnotherCoolCommand(
MailSendService mailSendService
)
{
_mailSendService = mailSendService;
}
public string GetCommandPrefix()
{
return "anotherExample";
}
public string? GetCommandHelp(string command)
{
if (command == "test")
{
return "Usage: anotherExample test";
}
return null;
}
public List<string> GetCommands()
{
return ["test"];
}
public string? Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request)
{
if (command == "test")
{
_mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"This is another test message shown as a different example!");
return request.DialogId;
}
return null;
}
}
@@ -0,0 +1,49 @@
using Core.Helpers.Dialog.Commando;
using Core.Models.Eft.Dialog;
using Core.Models.Eft.Profile;
using Core.Services;
namespace _23CustomAbstractChatBot.Commands;
public class MyCoolCommand : IChatCommand
{
private readonly MailSendService _mailSendService;
public MyCoolCommand(
MailSendService mailSendService
)
{
_mailSendService = mailSendService;
}
public string GetCommandPrefix()
{
return "example";
}
public string? GetCommandHelp(string command)
{
if (command == "test")
{
return "Usage: example test";
}
return null;
}
public List<string> GetCommands()
{
return ["test"];
}
public string? Handle(string command, UserDialogInfo commandHandler, string sessionId, SendMessageRequest request)
{
if (command == "test")
{
_mailSendService.SendUserMessageToPlayer(sessionId, commandHandler, $"This is a test message shown as an example!");
return request.DialogId;
}
return null;
}
}
@@ -0,0 +1,43 @@
using Core.Helpers.Dialog.Commando;
using Core.Helpers.Dialogue;
using Core.Helpers.Dialogue.SPTFriend.Commands;
using Core.Models.Eft.Profile;
using Core.Models.Enums;
using Core.Models.Utils;
using Core.Services;
namespace _23CustomAbstractChatBot;
public class CustomAbstractChatBot : AbstractDialogChatBot
{
public CustomAbstractChatBot(
ISptLogger<AbstractDialogChatBot> _logger,
MailSendService _mailSendService,
IEnumerable<IChatCommand> _chatCommands,
IEnumerable<IChatMessageHandler> _chatMessageHandlers
) : base(_logger, _mailSendService, _chatCommands)
{
}
public override UserDialogInfo GetChatBot()
{
return new UserDialogInfo
{
Id = "674db14ed849a3727ef24da0", // REQUIRES a valid monogo_id, use online generator to create one
Aid = 1234566,
Info = new UserDialogDetails
{
Level = 69,
MemberCategory = MemberCategory.Developer,
SelectedMemberCategory = MemberCategory.Developer,
Nickname = "CoolAbstractChatBot",
Side = "Bear"
}
};
}
protected override string GetUnrecognizedCommandMessage()
{
return "No clue what you are talking about bud!";
}
}
@@ -0,0 +1,13 @@
{
"Name": "23CustomAbstractChatBot",
"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"
}
+6
View File
@@ -45,6 +45,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "21CustomCommandoCommand", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "22CustomSptCommand", "22CustomSptCommand\22CustomSptCommand.csproj", "{7FB8C9B5-CEBF-4E76-9EC3-670EE57B328B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "23CustomAbstractChatBot", "23CustomAbstractChatBot\23CustomAbstractChatBot.csproj", "{B97A7EE2-04DD-4690-866E-9179F5E01908}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -135,6 +137,10 @@ Global
{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
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B97A7EE2-04DD-4690-866E-9179F5E01908}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE