Fix Regex used by SptCommando And default message maxstoragetime if null

This commit is contained in:
KaenoDev
2025-02-02 22:24:19 +00:00
parent ba1726c3ef
commit 92d66351d8
5 changed files with 8 additions and 7 deletions
@@ -81,7 +81,7 @@ public abstract class AbstractDialogChatBot(
_mailSendService.SendUserMessageToPlayer(
sessionId,
GetChatBot(),
$"Subcommand {subCommand}:\\n{chatCommand.GetCommandHelp(subCommand)}",
$"Subcommand {subCommand}:\n{chatCommand.GetCommandHelp(subCommand)}",
[],
null
);
@@ -27,7 +27,7 @@ public class GiveSptCommand(
) : ISptCommand
{
protected Dictionary<string, SavedCommand> _savedCommand = new();
private static readonly Regex _commandRegex = new("""/^spt give(((([a - z]{ 2,5}) )?"(.+)"|\w+) )?([0 - 9]+)$/""");
private static readonly Regex _commandRegex = new(@"^spt give (((([a-z]{2,5}) )?""(.+)""|\w+) )?([0-9]+)$");
private const double _acceptableConfidence = 0.9d;
// Exception for flares
@@ -33,8 +33,8 @@ public class ProfileSptCommand(
* spt profile skill metabolism 10
*/
// TODO: Fix this shit as Valens doesn't know Regex.
protected Regex _commandRegex = new("""^spt profile (?<command>level|skill)((?<=.*skill) (?<skill>[\w]+)){0,1} (?<quantity>(?!0+)[0-9]+)$/""");
protected Regex _examineRegex = new ("""/^spt profile (?<command>examine)/""");
protected Regex _commandRegex = new(@"^spt profile (?<command>level|skill)((?<=.*skill) (?<skill>[\w]+))? (?<quantity>(?!0+)[0-9]+)$");
protected Regex _examineRegex = new (@"^spt profile (?<command>examine)");
//
protected SavedCommand _savedCommand = null;
@@ -85,7 +85,7 @@ public class ProfileSptCommand(
break;
case "skill": {
var enumSkill = Enum.GetValues(typeof(SkillTypes)).Cast<SkillTypes>().FirstOrDefault(
(t) => t.ToString() == skill);
(t) => t.ToString().ToLower() == skill);
if (enumSkill == null) {
_mailSendService.SendUserMessageToPlayer(
@@ -12,7 +12,8 @@ public class TraderSptCommand(
ISptLogger<TraderSptCommand> _logger,
MailSendService _mailSendService) : ISptCommand
{
protected Regex _commandRegex = new("""/^spt trader(?<trader>[\w]+) (?<command>rep|spend) (?<quantity>(?!0+)[0 - 9]+)$/""");
protected Regex _commandRegex = new(@"^spt trader (?<trader>[\w]+) (?<command>rep|spend) (?<quantity>(?!0+)[0-9]+)$"
);
public string GetCommand()
{
+1 -1
View File
@@ -415,7 +415,7 @@ public class MailSendService(
{
message.Items = itemsToSendToPlayer;
message.HasRewards = true;
message.MaxStorageTime = maxStorageTimeSeconds;
message.MaxStorageTime = maxStorageTimeSeconds ?? 172800;
message.RewardCollected = false;
}
}