diff --git a/Source/BNetServer/Networking/Session.cs b/Source/BNetServer/Networking/Session.cs index b671ce94b..b358d295a 100644 --- a/Source/BNetServer/Networking/Session.cs +++ b/Source/BNetServer/Networking/Session.cs @@ -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(startColumn + 0); Name = fields.Read(startColumn + 1); - IsBanned = fields.Read(startColumn + 2) != 0; - IsPermanenetlyBanned = fields.Read(startColumn + 3) != 0; + UnbanDate = fields.Read(startColumn + 2); + IsPermanenetlyBanned = fields.Read(startColumn + 3) != 0; + IsBanned = IsPermanenetlyBanned || UnbanDate > Time.UnixTime; SecurityLevel = (AccountTypes)fields.Read(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; diff --git a/Source/Framework/Database/Databases/LoginDatabase.cs b/Source/Framework/Database/Databases/LoginDatabase.cs index 1e10d5490..033b10924 100644 --- a/Source/Framework/Database/Databases/LoginDatabase.cs +++ b/Source/Framework/Database/Databases/LoginDatabase.cs @@ -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()"); diff --git a/Source/Game/Network/WorldSocket.cs b/Source/Game/Network/WorldSocket.cs index 95c3bcad1..ac87f3b59 100644 --- a/Source/Game/Network/WorldSocket.cs +++ b/Source/Game/Network/WorldSocket.cs @@ -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(9); battleNet.Id = fields.Read(10); game.Security = (AccountTypes)fields.Read(11); - battleNet.IsBanned = fields.Read(12) != 0; - game.IsBanned = fields.Read(13) != 0; + battleNet.IsBanned = fields.Read(12) != 0; + game.IsBanned = fields.Read(13) != 0; game.IsRectuiter = fields.Read(14) != 0; if (battleNet.Locale >= LocaleConstant.Total)