From 11c3c456b7e135cb749e65d47e39cdc8f267a599 Mon Sep 17 00:00:00 2001 From: Roc13x Date: Wed, 18 Apr 2018 18:27:45 +0100 Subject: Core/Bnet: Improve client ban messages (#21837) * Don't hide banned game accounts from list. * Display proper ban messages with suspension time remaining. * More appropriate error codes for bans and locks --- src/server/bnetserver/Server/Session.cpp | 22 +++++++++++++--------- src/server/bnetserver/Server/Session.h | 1 + 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src/server/bnetserver/Server') diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp index d1106f7a42b..55a6827854a 100644 --- a/src/server/bnetserver/Server/Session.cpp +++ b/src/server/bnetserver/Server/Session.cpp @@ -52,11 +52,12 @@ void Battlenet::Session::AccountInfo::LoadResult(PreparedQueryResult result) void Battlenet::Session::GameAccountInfo::LoadResult(Field* fields) { - // a.id, a.username, ab.unbandate > UNIX_TIMESTAMP() OR ab.unbandate = ab.bandate, ab.unbandate = ab.bandate, aa.gmlevel + // a.id, a.username, ab.unbandate, ab.unbandate = ab.bandate, aa.gmlevel Id = fields[0].GetUInt32(); Name = fields[1].GetString(); - IsBanned = fields[2].GetUInt64() != 0; - IsPermanenetlyBanned = fields[3].GetUInt64() != 0; + UnbanDate = fields[2].GetUInt32(); + IsPermanenetlyBanned = fields[3].GetUInt32() != 0; + IsBanned = IsPermanenetlyBanned || UnbanDate > time(nullptr); SecurityLevel = AccountTypes(fields[4].GetUInt8()); std::size_t hashPos = Name.find('#'); @@ -371,12 +372,9 @@ uint32 Battlenet::Session::VerifyWebCredentials(std::string const& webCredential logonResult.mutable_account_id()->set_high(UI64LIT(0x100000000000000)); for (auto itr = _accountInfo->GameAccounts.begin(); itr != _accountInfo->GameAccounts.end(); ++itr) { - if (!itr->second.IsBanned) - { - EntityId* gameAccountId = logonResult.add_game_account_id(); - gameAccountId->set_low(itr->second.Id); - gameAccountId->set_high(UI64LIT(0x200000200576F57)); - } + EntityId* gameAccountId = logonResult.add_game_account_id(); + gameAccountId->set_low(itr->second.Id); + gameAccountId->set_high(UI64LIT(0x200000200576F57)); } if (!_ipCountry.empty()) @@ -436,6 +434,7 @@ uint32 Battlenet::Session::HandleGetGameAccountState(account::v1::GetGameAccount { response->mutable_state()->mutable_game_status()->set_is_suspended(itr->second.IsBanned); response->mutable_state()->mutable_game_status()->set_is_banned(itr->second.IsPermanenetlyBanned); + response->mutable_state()->mutable_game_status()->set_suspension_expires(uint64(itr->second.UnbanDate) * 1000000); } response->mutable_state()->mutable_game_status()->set_program(5730135); // WoW @@ -508,6 +507,11 @@ uint32 Battlenet::Session::GetRealmListTicket(std::unordered_mapIsPermanenetlyBanned) + return ERROR_GAME_ACCOUNT_BANNED; + else if (_gameAccountInfo->IsBanned) + return ERROR_GAME_ACCOUNT_SUSPENDED; + bool clientInfoOk = false; if (Variant const* clientInfo = GetParam(params, "Param_ClientInfo")) { diff --git a/src/server/bnetserver/Server/Session.h b/src/server/bnetserver/Server/Session.h index 88fd5c36cca..22b9e0a7b44 100644 --- a/src/server/bnetserver/Server/Session.h +++ b/src/server/bnetserver/Server/Session.h @@ -99,6 +99,7 @@ namespace Battlenet uint32 Id; std::string Name; std::string DisplayName; + uint32 UnbanDate; bool IsBanned; bool IsPermanenetlyBanned; AccountTypes SecurityLevel; -- cgit v1.2.3