Core/Bnet: Improve client ban messages

This commit is contained in:
hondacrx
2018-04-18 19:52:28 -04:00
parent ef05e1f113
commit a7097486bf
3 changed files with 21 additions and 16 deletions
+14 -9
View File
@@ -324,13 +324,10 @@ namespace BNetServer.Networking
logonResult.AccountId.High = 0x100000000000000;
foreach (var pair in _accountInfo.GameAccounts)
{
if (!pair.Value.IsBanned)
{
EntityId gameAccountId = new EntityId();
gameAccountId.Low = pair.Value.Id;
gameAccountId.High = 0x200000200576F57;
logonResult.GameAccountId.Add(gameAccountId);
}
EntityId gameAccountId = new EntityId();
gameAccountId.Low = pair.Value.Id;
gameAccountId.High = 0x200000200576F57;
logonResult.GameAccountId.Add(gameAccountId);
}
if (!_ipCountry.IsEmpty())
@@ -396,6 +393,7 @@ namespace BNetServer.Networking
{
response.State.GameStatus.IsSuspended = gameAccountInfo.IsBanned;
response.State.GameStatus.IsBanned = gameAccountInfo.IsPermanenetlyBanned;
response.State.GameStatus.SuspensionExpires = (gameAccountInfo.UnbanDate * 1000000);
}
response.State.GameStatus.Program = 5730135; // WoW
@@ -457,6 +455,11 @@ namespace BNetServer.Networking
if (_gameAccountInfo == null)
return BattlenetRpcErrorCode.UtilServerInvalidIdentityArgs;
if (_gameAccountInfo.IsPermanenetlyBanned)
return BattlenetRpcErrorCode.GameAccountBanned;
else if (_gameAccountInfo.IsBanned)
return BattlenetRpcErrorCode.GameAccountSuspended;
bool clientInfoOk = false;
Variant clientInfo = GetParam(Params, "Param_ClientInfo");
if (clientInfo != null)
@@ -675,8 +678,9 @@ namespace BNetServer.Networking
{
Id = fields.Read<uint>(startColumn + 0);
Name = fields.Read<string>(startColumn + 1);
IsBanned = fields.Read<ulong>(startColumn + 2) != 0;
IsPermanenetlyBanned = fields.Read<ulong>(startColumn + 3) != 0;
UnbanDate = fields.Read<uint>(startColumn + 2);
IsPermanenetlyBanned = fields.Read<uint>(startColumn + 3) != 0;
IsBanned = IsPermanenetlyBanned || UnbanDate > Time.UnixTime;
SecurityLevel = (AccountTypes)fields.Read<byte>(startColumn + 4);
int hashPos = Name.IndexOf('#');
@@ -689,6 +693,7 @@ namespace BNetServer.Networking
public uint Id;
public string Name;
public string DisplayName;
public uint UnbanDate;
public bool IsBanned;
public bool IsPermanenetlyBanned;
public AccountTypes SecurityLevel;
@@ -22,7 +22,7 @@ namespace Framework.Database
public override void PreparedStatements()
{
const string BnetAccountInfo = "ba.id, ba.email, ba.locked, ba.lock_country, ba.last_ip, ba.LoginTicketExpiry, bab.unbandate > UNIX_TIMESTAMP() OR bab.unbandate = bab.bandate, bab.unbandate = bab.bandate";
const string BnetGameAccountInfo = "a.id, a.username, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, aa.gmlevel";
const string BnetGameAccountInfo = "a.id, a.username, ab.unbandate, ab.unbandate = ab.bandate, aa.gmlevel";
PrepareStatement(LoginStatements.SEL_REALMLIST, "SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild, Region, Battlegroup FROM realmlist WHERE flag <> 3 ORDER BY name");
PrepareStatement(LoginStatements.DEL_EXPIRED_IP_BANS, "DELETE FROM ip_banned WHERE unbandate<>bandate AND unbandate<=UNIX_TIMESTAMP()");
+6 -6
View File
@@ -464,7 +464,7 @@ namespace Game.Network
{
if (account.battleNet.LastIP != address)
{
SendAuthResponseError(BattlenetRpcErrorCode.Denied);
SendAuthResponseError(BattlenetRpcErrorCode.RiskAccountLocked);
Log.outDebug(LogFilter.Network, "HandleAuthSession: Sent Auth Response (Account IP differs).");
CloseSocket();
return;
@@ -474,7 +474,7 @@ namespace Game.Network
{
if (account.battleNet.LockCountry != _ipCountry)
{
SendAuthResponseError(BattlenetRpcErrorCode.Denied);
SendAuthResponseError(BattlenetRpcErrorCode.RiskAccountLocked);
Log.outDebug(LogFilter.Network, "WorldSocket.HandleAuthSession: Sent Auth Response (Account country differs. Original country: {0}, new country: {1}).", account.battleNet.LockCountry, _ipCountry);
CloseSocket();
return;
@@ -495,7 +495,7 @@ namespace Game.Network
if (account.IsBanned()) // if account banned
{
SendAuthResponseError(BattlenetRpcErrorCode.Denied);
SendAuthResponseError(BattlenetRpcErrorCode.GameAccountBanned);
Log.outError(LogFilter.Network, "WorldSocket:HandleAuthSession: Sent Auth Response (Account banned).");
CloseSocket();
return;
@@ -505,7 +505,7 @@ namespace Game.Network
AccountTypes allowedAccountType = Global.WorldMgr.GetPlayerSecurityLimit();
if (allowedAccountType > AccountTypes.Player && account.game.Security < allowedAccountType)
{
SendAuthResponseError(BattlenetRpcErrorCode.Denied);
SendAuthResponseError(BattlenetRpcErrorCode.ServerIsPrivate);
Log.outInfo(LogFilter.Network, "WorldSocket:HandleAuthSession: User tries to login but his security level is not enough");
CloseSocket();
return;
@@ -737,8 +737,8 @@ namespace Game.Network
game.OS = fields.Read<string>(9);
battleNet.Id = fields.Read<uint>(10);
game.Security = (AccountTypes)fields.Read<byte>(11);
battleNet.IsBanned = fields.Read<ulong>(12) != 0;
game.IsBanned = fields.Read<ulong>(13) != 0;
battleNet.IsBanned = fields.Read<uint>(12) != 0;
game.IsBanned = fields.Read<uint>(13) != 0;
game.IsRectuiter = fields.Read<uint>(14) != 0;
if (battleNet.Locale >= LocaleConstant.Total)