Core/Calendar: Implement different timezone support for ingame calendar

Port From (https://github.com/TrinityCore/TrinityCore/commit/b888b1b09f71a8b8b4a9d45c804a1f164fb65ac3)
This commit is contained in:
hondacrx
2024-02-21 16:36:19 -05:00
parent 47a64b8782
commit 0f4130704a
25 changed files with 831 additions and 322 deletions
@@ -4,11 +4,13 @@
using Bgs.Protocol;
using Bgs.Protocol.Authentication.V1;
using Bgs.Protocol.Challenge.V1;
using Framework;
using Framework.Constants;
using Framework.Database;
using Framework.Realm;
using Google.Protobuf;
using System;
using System.Text.Json;
namespace BNetServer.Networking
{
@@ -39,6 +41,20 @@ namespace BNetServer.Networking
os = logonRequest.Platform;
build = (uint)logonRequest.ApplicationVersion;
_timezoneOffset = TimeSpan.Zero;
if (logonRequest.HasDeviceId)
{
var doc = JsonSerializer.Deserialize<JsonDocument>(logonRequest.DeviceId);
if (doc != null)
{
var itr = doc.RootElement.GetProperty("UTCO");
{
if (itr.TryGetUInt32(out uint value))
_timezoneOffset = Timezone.GetOffsetByHash(value);
}
}
}
ChallengeExternalRequest externalChallenge = new();
externalChallenge.PayloadType = "web_auth_url";
externalChallenge.Payload = ByteString.CopyFromUtf8($"https://{Global.LoginService.GetHostnameForClient(GetRemoteIpAddress())}:{Global.LoginService.GetPort()}/bnetserver/login/");