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 = ""; gameAccountName = "";
if (email.Length > 320) if (email.IsEmpty() || email.Length > 320)
return AccountOpResult.NameTooLong; return AccountOpResult.NameTooLong;
if (password.Length > 16) if (password.IsEmpty() || password.Length > 16)
return AccountOpResult.PassTooLong; return AccountOpResult.PassTooLong;
if (GetId(email) != 0) if (GetId(email) != 0)
+7 -20
View File
@@ -30,28 +30,15 @@ namespace Game.Chat
{ {
List<object> arguments = new(); List<object> arguments = new();
arguments.Add(handler); arguments.Add(handler);
for (var i = 1; i < parameterTypes.Length; i++)
arguments.Add(default);
//for each arg we need to see if its a: for (var i = 1; i < parameterTypes.Length; i++)
//1: hyperlink
//2: Optional arg
//3: reg arg.
int index = 1;
while (index < parameterTypes.Length)
{ {
int oldPos = args.GetCurrentPosition(); if (!ParseArgument(out dynamic value, parameterTypes[i], args))
break;
if (ParseArgument(out dynamic value, parameterTypes[index], args)) arguments[i] = value;
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);
} }
return arguments.ToArray(); return arguments.ToArray();
@@ -123,7 +110,7 @@ namespace Game.Chat
default: default:
return false; return false;
} }
return true; break;
default: default:
return false; return false;
} }
@@ -28,7 +28,7 @@ namespace Game.Chat.Commands
[Command("create", RBACPermissions.CommandBnetAccountCreate, true)] [Command("create", RBACPermissions.CommandBnetAccountCreate, true)]
static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, bool? createGameAccount) static bool HandleAccountCreateCommand(CommandHandler handler, string accountName, string password, bool? createGameAccount)
{ {
if (!accountName.Contains('@')) if (accountName.IsEmpty() || !accountName.Contains('@'))
{ {
handler.SendSysMessage(CypherStrings.AccountInvalidBnetName); handler.SendSysMessage(CypherStrings.AccountInvalidBnetName);
return false; return false;
@@ -38,7 +38,7 @@ namespace Game.Chat.Commands
switch (Global.BNetAccountMgr.CreateBattlenetAccount(accountName, password, createGameAccount.GetValueOrDefault(true), out gameAccountName)) switch (Global.BNetAccountMgr.CreateBattlenetAccount(accountName, password, createGameAccount.GetValueOrDefault(true), out gameAccountName))
{ {
case AccountOpResult.Ok: case AccountOpResult.Ok:
if (createGameAccount.Value) if (createGameAccount.HasValue && createGameAccount.Value)
handler.SendSysMessage(CypherStrings.AccountCreatedBnetWithGame, accountName, gameAccountName); handler.SendSysMessage(CypherStrings.AccountCreatedBnetWithGame, accountName, gameAccountName);
else else
handler.SendSysMessage(CypherStrings.AccountCreated, accountName); handler.SendSysMessage(CypherStrings.AccountCreated, accountName);
+1 -1
View File
@@ -879,7 +879,7 @@ namespace Game.Chat
return false; return false;
} }
if (state == 0) if (!state.HasValue)
{ {
// reset all states // reset all states
for (AuraStateType s = 0; s < AuraStateType.Max; ++s) for (AuraStateType s = 0; s < AuraStateType.Max; ++s)