Fix Regex used by SptCommando And default message maxstoragetime if null
This commit is contained in:
@@ -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
|
||||
|
||||
+3
-3
@@ -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(
|
||||
|
||||
+2
-1
@@ -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()
|
||||
{
|
||||
|
||||
@@ -415,7 +415,7 @@ public class MailSendService(
|
||||
{
|
||||
message.Items = itemsToSendToPlayer;
|
||||
message.HasRewards = true;
|
||||
message.MaxStorageTime = maxStorageTimeSeconds;
|
||||
message.MaxStorageTime = maxStorageTimeSeconds ?? 172800;
|
||||
message.RewardCollected = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user