Core/Commands: Change way we handle optional args. Fixes #43

This commit is contained in:
hondacrx
2022-08-20 18:43:31 -04:00
parent 135760cbed
commit 56d9dc6190
4 changed files with 75 additions and 19 deletions
+2 -2
View File
@@ -87,7 +87,7 @@ namespace Game.Chat
}
[Command("create", CypherStrings.CommandAccCreateHelp, RBACPermissions.CommandAccountCreate, true)]
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, string email)
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, OptionalArg<string> email)
{
if (accountName.Contains("@"))
{
@@ -95,7 +95,7 @@ namespace Game.Chat
return false;
}
AccountOpResult result = Global.AccountMgr.CreateAccount(accountName, password, email);
AccountOpResult result = Global.AccountMgr.CreateAccount(accountName, password, email.ValueOr(""));
switch (result)
{
case AccountOpResult.Ok:
+3 -3
View File
@@ -733,10 +733,10 @@ namespace Game.Chat
}
[CommandNonGroup("help", RBACPermissions.CommandHelp, true)]
static bool HandleHelpCommand(CommandHandler handler, string cmd)
static bool HandleHelpCommand(CommandHandler handler, OptionalArg<string> cmd)
{
ChatCommandNode.SendCommandHelpFor(handler, cmd);
if (cmd.IsEmpty())
ChatCommandNode.SendCommandHelpFor(handler, cmd.ValueOr(""));
if (!cmd.HasValue)
ChatCommandNode.SendCommandHelpFor(handler, "help");
return true;