aboutsummaryrefslogtreecommitdiff
path: root/src/server/bnetserver/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/bnetserver/Server')
-rw-r--r--src/server/bnetserver/Server/Session.cpp31
-rw-r--r--src/server/bnetserver/Server/Session.h2
2 files changed, 30 insertions, 3 deletions
diff --git a/src/server/bnetserver/Server/Session.cpp b/src/server/bnetserver/Server/Session.cpp
index 6e5b16cd477..95c46418a7d 100644
--- a/src/server/bnetserver/Server/Session.cpp
+++ b/src/server/bnetserver/Server/Session.cpp
@@ -21,13 +21,17 @@
#include "CryptoRandom.h"
#include "DatabaseEnv.h"
#include "Errors.h"
+#include "Hash.h"
#include "IPLocation.h"
-#include "QueryCallback.h"
#include "LoginRESTService.h"
+#include "MapUtils.h"
#include "ProtobufJSON.h"
+#include "QueryCallback.h"
#include "RealmList.h"
-#include "ServiceDispatcher.h"
#include "RealmList.pb.h"
+#include "ServiceDispatcher.h"
+#include "Timezone.h"
+#include <rapidjson/document.h>
#include <zlib.h>
void Battlenet::Session::AccountInfo::LoadResult(PreparedQueryResult result)
@@ -229,6 +233,26 @@ uint32 Battlenet::Session::HandleLogon(authentication::v1::LogonRequest const* l
_os = logonRequest->platform();
_build = logonRequest->application_version();
+ _timezoneOffset = [&]
+ {
+ if (!logonRequest->has_device_id())
+ return 0min;
+
+ rapidjson::Document doc;
+ doc.Parse(logonRequest->device_id());
+ if (doc.HasParseError())
+ return 0min;
+
+ auto itr = doc.FindMember("UTCO");
+ if (itr == doc.MemberEnd())
+ return 0min;
+
+ if (!itr->value.IsUint())
+ return 0min;
+
+ return Trinity::Timezone::GetOffsetByHash(itr->value.GetUint());
+ }();
+
if (logonRequest->has_cached_web_credentials())
return VerifyWebCredentials(logonRequest->cached_web_credentials(), continuation);
@@ -670,7 +694,8 @@ uint32 Battlenet::Session::GetRealmList(std::unordered_map<std::string, Variant
uint32 Battlenet::Session::JoinRealm(std::unordered_map<std::string, Variant const*> const& params, game_utilities::v1::ClientResponse* response)
{
if (Variant const* realmAddress = GetParam(params, "Param_RealmAddress"))
- return sRealmList->JoinRealm(realmAddress->uint_value(), _build, GetRemoteIpAddress(), _clientSecret, GetLocaleByName(_locale), _os, _gameAccountInfo->Name, response);
+ return sRealmList->JoinRealm(realmAddress->uint_value(), _build, GetRemoteIpAddress(), _clientSecret, GetLocaleByName(_locale),
+ _os, _timezoneOffset, _gameAccountInfo->Name, response);
return ERROR_WOW_SERVICES_INVALID_JOIN_TICKET;
}
diff --git a/src/server/bnetserver/Server/Session.h b/src/server/bnetserver/Server/Session.h
index fd375b3a19a..01167d38a0b 100644
--- a/src/server/bnetserver/Server/Session.h
+++ b/src/server/bnetserver/Server/Session.h
@@ -19,6 +19,7 @@
#define Session_h__
#include "AsyncCallbackProcessor.h"
+#include "Duration.h"
#include "Realm.h"
#include "SslContext.h"
#include "SslSocket.h"
@@ -173,6 +174,7 @@ namespace Battlenet
std::string _locale;
std::string _os;
uint32 _build;
+ Minutes _timezoneOffset;
std::string _ipCountry;