]> git.deb.at Git - rhonda/impostor.git/commitdiff
Implement GameData 205
authorjs6pak <kubastaron@hotmail.com>
Sun, 7 Mar 2021 15:40:33 +0000 (16:40 +0100)
committerjs6pak <kubastaron@hotmail.com>
Sun, 7 Mar 2021 15:41:19 +0000 (16:41 +0100)
src/Impostor.Api/Unity/RuntimePlatform.cs [new file with mode: 0644]
src/Impostor.Server/Net/Inner/GameDataTag.cs
src/Impostor.Server/Net/State/ClientPlayer.cs
src/Impostor.Server/Net/State/Game.Data.cs

diff --git a/src/Impostor.Api/Unity/RuntimePlatform.cs b/src/Impostor.Api/Unity/RuntimePlatform.cs
new file mode 100644 (file)
index 0000000..6951ca2
--- /dev/null
@@ -0,0 +1,42 @@
+namespace Impostor.Api.Unity
+{
+    public enum RuntimePlatform
+    {
+        OSXEditor = 0,
+        OSXPlayer = 1,
+        WindowsPlayer = 2,
+        OSXWebPlayer = 3,
+        OSXDashboardPlayer = 4,
+        WindowsWebPlayer = 5,
+        WindowsEditor = 7,
+        IPhonePlayer = 8,
+        PS3 = 9,
+        XBOX360 = 10,
+        Android = 11,
+        NaCl = 12,
+        LinuxPlayer = 13,
+        FlashPlayer = 15,
+        LinuxEditor = 16,
+        WebGLPlayer = 17,
+        MetroPlayerX86 = 18,
+        WSAPlayerX86 = 18,
+        MetroPlayerX64 = 19,
+        WSAPlayerX64 = 19,
+        MetroPlayerARM = 20,
+        WSAPlayerARM = 20,
+        WP8Player = 21,
+        BlackBerryPlayer = 22,
+        TizenPlayer = 23,
+        PSP2 = 24,
+        PS4 = 25,
+        PSM = 26,
+        XboxOne = 27,
+        SamsungTVPlayer = 28,
+        WiiU = 30,
+        TvOs = 31,
+        Switch = 32,
+        Lumin = 33,
+        Stadia = 34,
+        CloudRendering = 35,
+    }
+}
index fa9ddb8cb23222b13e430b4acad74a1b69be1293..818f11ff7bfc6cc53e1db7967d58bfc3bd86a3db 100644 (file)
@@ -9,5 +9,6 @@
         public const byte SceneChangeFlag = 6;
         public const byte ReadyFlag = 7;
         public const byte ChangeSettingsFlag = 8;
+        public const byte ClientInfoFlag = 205;
     }
-}
\ No newline at end of file
+}
index 107edbfef3d457a439f307c0d67aca43273e023a..ceb73b49eca5021d388782a5eb67d28c6a3a15a6 100644 (file)
@@ -3,6 +3,7 @@ using System.Threading;
 using System.Threading.Tasks;
 using Impostor.Api.Net;
 using Impostor.Api.Net.Inner;
+using Impostor.Api.Unity;
 using Impostor.Server.Net.Inner.Objects;
 using Microsoft.Extensions.Logging;
 
@@ -36,6 +37,8 @@ namespace Impostor.Server.Net.State
 
         public string Scene { get; internal set; }
 
+        public RuntimePlatform? Platform { get; internal set; }
+
         public void InitializeSpawnTimeout()
         {
             _spawnTimeout.Change(Constants.SpawnTimeout, -1);
index eda8986cb37c00bf25793f8d921cf8007e12bdfa..a2eaa09d33fc71474bd75b991868af0fa1560a93 100644 (file)
@@ -7,6 +7,7 @@ using Impostor.Api.Innersloth;
 using Impostor.Api.Net.Inner;
 using Impostor.Api.Net.Messages;
 using Impostor.Api.Net.Messages.S2C;
+using Impostor.Api.Unity;
 using Impostor.Hazel;
 using Impostor.Server.Events.Meeting;
 using Impostor.Server.Events.Player;
@@ -357,10 +358,21 @@ namespace Impostor.Server.Net.State
                         break;
                     }
 
-                    case 205:
-                    case 206:
+                    case GameDataTag.ClientInfoFlag:
                     {
-                        // TODO figure out what the hell is going on here
+                        var clientId = reader.ReadPackedInt32();
+                        var platform = (RuntimePlatform)reader.ReadPackedInt32();
+
+                        if (clientId != sender.Client.Id)
+                        {
+                            if (await sender.Client.ReportCheatAsync(new CheatContext(nameof(GameDataTag.ClientInfoFlag)), "Client sent info with wrong client id"))
+                            {
+                                return false;
+                            }
+                        }
+
+                        sender.Platform = platform;
+
                         break;
                     }