add missing package.json and attributes, added example 22

This commit is contained in:
CWX
2025-02-10 21:31:44 +00:00
parent 685f2eb39b
commit 08ec102f99
6 changed files with 115 additions and 0 deletions
@@ -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;
}
}