More Cleanups

This commit is contained in:
hondacrx
2021-06-08 12:56:09 -04:00
parent 302a1f293c
commit 52e43853fe
58 changed files with 223 additions and 257 deletions
+1 -2
View File
@@ -21,7 +21,6 @@ using Framework.Database;
using Game.DataStorage;
using Game.Entities;
using Game.Maps;
using Game.Networking;
using Game.Networking.Packets;
using System;
using System.Collections.Generic;
@@ -83,7 +82,7 @@ namespace Game.Chat
for (var i = 0; i < tokens.Length; ++i)
{
ObjectGuid bannedGuid = new();
if (ulong.TryParse(tokens[i].Substring(0, 16), out ulong highguid) && ulong.TryParse(tokens[i].Substring(16), out ulong lowguid))
if (ulong.TryParse(tokens[i].Substring(0, 16), out ulong highguid) && ulong.TryParse(tokens[i][16..], out ulong lowguid))
bannedGuid.SetRawValue(highguid, lowguid);
if (!bannedGuid.IsEmpty())
+1 -1
View File
@@ -39,7 +39,7 @@ namespace Game.Chat
// Security level required
WorldSession session = handler.GetSession();
bool hasRBAC = (session.HasPermission(RBACPermissions.EmailConfirmForPassChange) ? true : false);
bool hasRBAC = (session.HasPermission(RBACPermissions.EmailConfirmForPassChange));
uint pwConfig = 0; // 0 - PW_NONE, 1 - PW_EMAIL, 2 - PW_RBAC
handler.SendSysMessage(CypherStrings.AccountSecType, (pwConfig == 0 ? "Lowest level: No Email input required." :
@@ -100,7 +100,7 @@ namespace Game.Chat.Commands
string accountName = accountId.ToString() + '#' + index;
// Generate random hex string for password, these accounts must not be logged on with GRUNT
byte[] randPassword = new byte[0].GenerateRandomKey(8);
byte[] randPassword = Array.Empty<byte>().GenerateRandomKey(8);
switch (Global.AccountMgr.CreateAccount(accountName, randPassword.ToHexString(), bnetAccountName, accountId, index))
{
case AccountOpResult.Ok:
@@ -179,7 +179,7 @@ namespace Game.Chat.Commands
{
int index = name.IndexOf('#');
if (index > 0)
return "WoW" + name.Substring(++index);
return "WoW" + name[++index..];
else
return name;
});
@@ -288,7 +288,7 @@ namespace Game.Chat
}
uint oldAccountId = characterInfo.AccountId;
uint newAccountId = oldAccountId;
uint newAccountId;
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME);
stmt.AddValue(0, accountName);
+1 -3
View File
@@ -369,17 +369,15 @@ namespace Game.Chat.Commands
if (args.Empty())
return false;
Player target;
ObjectGuid targetGuid;
string targetName;
ObjectGuid parseGUID = ObjectGuid.Create(HighGuid.Player, args.NextUInt64());
if (Global.CharacterCacheStorage.GetCharacterNameByGuid(parseGUID, out targetName))
{
target = Global.ObjAccessor.FindPlayer(parseGUID);
targetGuid = parseGUID;
}
else if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
else if (!handler.ExtractPlayerTarget(args, out _, out targetGuid, out targetName))
return false;
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT);
+1 -1
View File
@@ -1580,7 +1580,7 @@ namespace Game.Chat
Locale locale = handler.GetSessionDbcLocale();
uint totalPlayerTime;
uint level;
string alive = handler.GetCypherString(CypherStrings.Error);
string alive;
ulong money;
uint xp = 0;
uint xptotal = 0;