Fixes bnet account create command.

This commit is contained in:
hondacrx
2022-07-07 13:44:01 -04:00
parent ba6c30add4
commit db83da417a
4 changed files with 12 additions and 25 deletions
+2 -2
View File
@@ -30,10 +30,10 @@ namespace Game
{
gameAccountName = "";
if (email.Length > 320)
if (email.IsEmpty() || email.Length > 320)
return AccountOpResult.NameTooLong;
if (password.Length > 16)
if (password.IsEmpty() || password.Length > 16)
return AccountOpResult.PassTooLong;
if (GetId(email) != 0)
+7 -20
View File
@@ -30,28 +30,15 @@ namespace Game.Chat
{
List<object> arguments = new();
arguments.Add(handler);
for (var i = 1; i < parameterTypes.Length; i++)
arguments.Add(default);
//for each arg we need to see if its a:
//1: hyperlink
//2: Optional arg
//3: reg arg.
int index = 1;
while (index < parameterTypes.Length)
for (var i = 1; i < parameterTypes.Length; i++)
{
int oldPos = args.GetCurrentPosition();
if (!ParseArgument(out dynamic value, parameterTypes[i], args))
break;
if (ParseArgument(out dynamic value, parameterTypes[index], args))
index++;
if (args.IsAtEnd() && index < parameterTypes.Length)
{
//We found a optional arg and we dont have the correct amount of args
args.SetCurrentPosition(oldPos);
arguments.Add(default);
index++;
}
else
arguments.Add(value);
arguments[i] = value;
}
return arguments.ToArray();
@@ -123,7 +110,7 @@ namespace Game.Chat
default:
return false;
}
return true;
break;
default:
return false;
}
@@ -28,7 +28,7 @@ namespace Game.Chat.Commands
[Command("create", RBACPermissions.CommandBnetAccountCreate, true)]
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, bool? createGameAccount)
{
if (!accountName.Contains('@'))
if (accountName.IsEmpty() || !accountName.Contains('@'))
{
handler.SendSysMessage(CypherStrings.AccountInvalidBnetName);
return false;
@@ -38,7 +38,7 @@ namespace Game.Chat.Commands
switch (Global.BNetAccountMgr.CreateBattlenetAccount(accountName, password, createGameAccount.GetValueOrDefault(true), out gameAccountName))
{
case AccountOpResult.Ok:
if (createGameAccount.Value)
if (createGameAccount.HasValue && createGameAccount.Value)
handler.SendSysMessage(CypherStrings.AccountCreatedBnetWithGame, accountName, gameAccountName);
else
handler.SendSysMessage(CypherStrings.AccountCreated, accountName);
+1 -1
View File
@@ -879,7 +879,7 @@ namespace Game.Chat
return false;
}
if (state == 0)
if (!state.HasValue)
{
// reset all states
for (AuraStateType s = 0; s < AuraStateType.Max; ++s)