add injectable att, add mod example 20

This commit is contained in:
CWX
2025-02-10 17:07:49 +00:00
parent 478ed639aa
commit eef39e1a54
6 changed files with 104 additions and 0 deletions
@@ -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;
@@ -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;
@@ -0,0 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>_20CustomChatBot</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>
@@ -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;
}
}
+13
View File
@@ -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"
}
+6
View File
@@ -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