From: js6pak Date: Wed, 7 Jul 2021 17:01:31 +0000 (+0200) Subject: Log unsupported version X-Git-Tag: v1.5.0~1 X-Git-Url: https://git.deb.at/?a=commitdiff_plain;h=dca26cff59ab2ae440d76ee30b3e36e1eeb71b24;p=rhonda%2Fimpostor.git Log unsupported version --- diff --git a/src/Impostor.Api/Innersloth/GameVersion.cs b/src/Impostor.Api/Innersloth/GameVersion.cs index 5015589..5df8dea 100644 --- a/src/Impostor.Api/Innersloth/GameVersion.cs +++ b/src/Impostor.Api/Innersloth/GameVersion.cs @@ -1,10 +1,20 @@ namespace Impostor.Api.Innersloth { - public class GameVersion + public static class GameVersion { - public static int GetVersion(int year, int month, int day, int rev = 0) + public static int GetVersion(int year, int month, int day, int revision = 0) { - return (year * 25000) + (month * 1800) + (day * 50) + rev; + return (year * 25000) + (month * 1800) + (day * 50) + revision; + } + + public static void ParseVersion(int version, out int year, out int month, out int day, out int revision) + { + year = version / 25000; + version %= 25000; + month = version / 1800; + version %= 1800; + day = version / 50; + revision = version % 50; } } } diff --git a/src/Impostor.Server/Net/Manager/ClientManager.cs b/src/Impostor.Server/Net/Manager/ClientManager.cs index bd5ff51..db9edea 100644 --- a/src/Impostor.Server/Net/Manager/ClientManager.cs +++ b/src/Impostor.Server/Net/Manager/ClientManager.cs @@ -59,6 +59,9 @@ namespace Impostor.Server.Net.Manager { if (!SupportedVersions.Contains(clientVersion)) { + GameVersion.ParseVersion(clientVersion, out var year, out var month, out var day, out var revision); + _logger.LogTrace("Client connected using unsupported version: {clientVersion} ({version})", clientVersion, $"{year}.{month}.{day}{(revision == 0 ? string.Empty : "." + revision)}"); + using var packet = MessageWriter.Get(MessageType.Reliable); Message01JoinGameS2C.SerializeError(packet, false, DisconnectReason.IncorrectVersion); await connection.SendAsync(packet);