From 033634f10483fdbc65ad9f0cbf9e50b4cedad0e1 Mon Sep 17 00:00:00 2001 From: recroom2016 Date: Tue, 22 Feb 2022 00:30:48 -0500 Subject: [PATCH] 2017 support in the works --- APIServer.cs | 77 ++++++++++++++++------------------------------- Amplitude.cs | 2 +- GameSessions.cs | 12 ++++---- GetOrCreates.cs | 63 ++++++++++++++++++++++++++++++++++++++ PlatformLogin.cs | 36 ++++++++++++++++++++++ Profiles.cs | 18 +---------- Program.cs | 17 ++++++++--- icon.ico | Bin 93062 -> 0 bytes 8 files changed, 146 insertions(+), 79 deletions(-) create mode 100644 GetOrCreates.cs create mode 100644 PlatformLogin.cs delete mode 100644 icon.ico diff --git a/APIServer.cs b/APIServer.cs index 30ff45a..553e637 100644 --- a/APIServer.cs +++ b/APIServer.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading; using api; using api2018; +using api2017; using Newtonsoft.Json; namespace server @@ -30,7 +31,7 @@ namespace server try { this.listener.Prefixes.Add("http://localhost:" + start.Program.version + "/"); - if (start.Program.version == "2016") + if (start.Program.version == "2017") { for (; ; ) { @@ -68,60 +69,34 @@ namespace server { s = Config2.GetDebugConfig(); } + if (Url == "platformlogin/v1/profiles") + { + s = getorcreate.GetOrCreateArray((ulong.Parse(text.Remove(0, 32)))); + CachedPlayerID = ulong.Parse(text.Remove(0, 32)); + CachedPlatformID = ulong.Parse(text.Remove(0, 22)); + } + if (Url == "platformlogin/v6") + { + s = PlatformLogin.v4(CachedPlayerID); + } + if (Url == "PlayerReporting/v1/moderationBlockDetails") + { + s = ModerationBlockDetails; + } + if (Url == "config/v1/amplitude") + { + s = Amplitude.amplitude(); + } + if (Url.StartsWith("players/v1/")) + { + s = getorcreate.GetOrCreate(CachedPlayerID); + } Console.WriteLine("API Response: " + s); byte[] bytes = Encoding.UTF8.GetBytes(s); response.ContentLength64 = (long)bytes.Length; Stream outputStream = response.OutputStream; outputStream.Write(bytes, 0, bytes.Length); - Thread.Sleep(400); - outputStream.Close(); - this.listener.Stop(); - } - } - else if (start.Program.version == "2017") - { - for (; ; ) - { - this.listener.Start(); - Console.WriteLine("APIServer.cs is listening."); - HttpListenerContext context = this.listener.GetContext(); - HttpListenerRequest request = context.Request; - HttpListenerResponse response = context.Response; - string rawUrl = request.RawUrl; - string Url = ""; - if (rawUrl.StartsWith("/api/")) - { - Url = rawUrl.Remove(0, 5); - } - string text; - string s = ""; - using (StreamReader streamReader = new StreamReader(request.InputStream, request.ContentEncoding)) - { - text = streamReader.ReadToEnd(); - } - if (!(Url == "")) - { - Console.WriteLine("API Requested: " + Url); - } - else - { - Console.WriteLine("API Requested: " + rawUrl); - } - Console.WriteLine("API Data: " + text); - if (Url.StartsWith("versioncheck")) - { - s = VersionCheckResponse; - } - if (Url == ("config/v2")) - { - s = Config2.GetDebugConfig(); - } - Console.WriteLine("API Response: " + s); - byte[] bytes = Encoding.UTF8.GetBytes(s); - response.ContentLength64 = (long)bytes.Length; - Stream outputStream = response.OutputStream; - outputStream.Write(bytes, 0, bytes.Length); - Thread.Sleep(400); + Thread.Sleep(200); outputStream.Close(); this.listener.Stop(); } @@ -299,7 +274,7 @@ namespace server response.ContentLength64 = (long)bytes.Length; Stream outputStream = response.OutputStream; outputStream.Write(bytes, 0, bytes.Length); - Thread.Sleep(100); + Thread.Sleep(200); outputStream.Close(); this.listener.Stop(); } diff --git a/Amplitude.cs b/Amplitude.cs index f139aa5..5421db7 100644 --- a/Amplitude.cs +++ b/Amplitude.cs @@ -11,7 +11,7 @@ namespace api { return JsonConvert.SerializeObject(new Amplitude { - AmplitudeKey = "e1693a1003671058b6abc356c8ba8d59" + AmplitudeKey = "NoKeyProvided" }); } diff --git a/GameSessions.cs b/GameSessions.cs index 433e029..5346517 100644 --- a/GameSessions.cs +++ b/GameSessions.cs @@ -65,20 +65,20 @@ namespace gamesessions2018 public static string Create(string jsonData) { Console.WriteLine("Custom Room Test..."); - GameSessions.CreateRequest createRequest = JsonConvert.DeserializeObject(jsonData); + GameSessions.JoinRandomRequest createRequest = JsonConvert.DeserializeObject(jsonData); { Config.localGameSession = new GameSessions.SessionInstance { - GameSessionId = 1L, + GameSessionId = 20181L, RegionId = "us", - RoomId = createRequest.ActivityLevelIds, + RoomId = createRequest.ActivityLevelIds[0], RecRoomId = null, EventId = null, CreatorPlayerId = (long?)APIServer.CachedPlayerID, Name = "Custom Room", - ActivityLevelId = createRequest.ActivityLevelIds, + ActivityLevelId = createRequest.ActivityLevelIds[0], Private = false, - Sandbox = createRequest.IsSandbox, + Sandbox = true, SupportsScreens = true, SupportsVR = true, GameInProgress = false, @@ -275,7 +275,7 @@ namespace gamesessions2018 { public bool IsSandbox { get; set; } - public string ActivityLevelIds { get; set; } + public string[] ActivityLevelIds { get; set; } public ulong[] ExpectedPlayerIds { get; set; } diff --git a/GetOrCreates.cs b/GetOrCreates.cs new file mode 100644 index 0000000..ed8bd50 --- /dev/null +++ b/GetOrCreates.cs @@ -0,0 +1,63 @@ +using System; +using System.IO; +using Newtonsoft.Json; + +namespace api2017 +{ + // Token: 0x0200003A RID: 58 + internal class getorcreate + { + public static string GetOrCreate(ulong userid) + { + int level = int.Parse(File.ReadAllText("SaveData\\Profile\\level.txt")); + string name = File.ReadAllText("SaveData\\Profile\\username.txt"); + return JsonConvert.SerializeObject(new Profiles + { + Id = userid, + Username = name, + DisplayName = name, + XP = 48, + Level = level, + Reputation = 0, + Verified = true, + Developer = true, + HasEmail = true, + CanReceiveInvites = false, + ProfileImageName = name, + HasBirthday = true + }); + } + // Token: 0x06000197 RID: 407 RVA: 0x0000550C File Offset: 0x0000370C + public static string GetOrCreateArray(ulong userid) + { + int level = int.Parse(File.ReadAllText("SaveData\\Profile\\level.txt")); + string name = File.ReadAllText("SaveData\\Profile\\username.txt"); + return JsonConvert.SerializeObject(new Profiles[] + { + new Profiles + { + Id = userid, + Username = name, + DisplayName = name, + XP = 48, + Level = level, + Reputation = 0, + Verified = true, + Developer = true, + HasEmail = true, + CanReceiveInvites = false, + ProfileImageName = name, + JuniorProfile = false, + ForceJuniorImages = false, + HasBirthday = true + } + }); + } + + // Token: 0x06000199 RID: 409 RVA: 0x00002BBE File Offset: 0x00000DBE + public static string playerName() + { + return File.ReadAllText("playerNameConfig.txt"); + } + } +} diff --git a/PlatformLogin.cs b/PlatformLogin.cs new file mode 100644 index 0000000..133096c --- /dev/null +++ b/PlatformLogin.cs @@ -0,0 +1,36 @@ +using System; +using Newtonsoft.Json; + +namespace api2017 +{ + // Token: 0x02000032 RID: 50 + internal class PlatformLogin + { + // Token: 0x17000070 RID: 112 + // (get) Token: 0x06000137 RID: 311 RVA: 0x00002905 File Offset: 0x00000B05 + // (set) Token: 0x06000138 RID: 312 RVA: 0x0000290D File Offset: 0x00000B0D + public string Token { get; set; } + + // Token: 0x17000071 RID: 113 + // (get) Token: 0x06000139 RID: 313 RVA: 0x00002916 File Offset: 0x00000B16 + // (set) Token: 0x0600013A RID: 314 RVA: 0x0000291E File Offset: 0x00000B1E + public ulong PlayerId { get; set; } + + // Token: 0x17000072 RID: 114 + // (get) Token: 0x0600013B RID: 315 RVA: 0x00002927 File Offset: 0x00000B27 + // (set) Token: 0x0600013C RID: 316 RVA: 0x0000292F File Offset: 0x00000B2F + public string Error { get; set; } + + // Token: 0x0600013D RID: 317 RVA: 0x00005114 File Offset: 0x00003314 + public static string v4(ulong userid) + { + PlatformLogin value = new PlatformLogin + { + Token = "j3923mHJG032jew", + PlayerId = userid, + Error = "" + }; + return JsonConvert.SerializeObject(value); + } + } +} diff --git a/Profiles.cs b/Profiles.cs index c7784d8..a8dd732 100644 --- a/Profiles.cs +++ b/Profiles.cs @@ -2,12 +2,10 @@ using System.Collections.Generic; using System.Text; -namespace api2016 - +namespace api2017 { class Profiles { - public ulong Id { get; set; } public string Username { get; set; } public string DisplayName { get; set; } @@ -15,27 +13,13 @@ namespace api2016 public int Level { get; set; } public int Reputation { get; set; } public bool Verified { get; set; } - public bool Developer { get; set; } - - public bool HasEmail { get; set; } - - public bool CanReceiveInvites { get; set; } - - public string ProfileImageName { get; set; } - - public bool JuniorProfile { get; set; } - - public bool ForceJuniorImages { get; set; } - - public bool PendingJunior { get; set; } - public bool HasBirthday { get; set; } } } diff --git a/Program.cs b/Program.cs index b0307bd..f65a783 100644 --- a/Program.cs +++ b/Program.cs @@ -23,11 +23,20 @@ namespace start Console.WriteLine("Discord: https://discord.gg/daC8QUhnFP" + Environment.NewLine); if (!(new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/version.txt").Contains(version))) { - Console.WriteLine("This version of OpenRec is outdated. We recommend you install the latest version, OpenRec " + new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/version.txt") + Environment.NewLine); + Console.WriteLine("This version of OpenRec is outdated. We recommend you install the latest version, OpenRec " + new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/version.txt")); } - Console.WriteLine("1) Change Settings" + Environment.NewLine + "2) Modify Profile" + Environment.NewLine + "3) Start Server"); + Console.WriteLine("1) Changelog" + Environment.NewLine +"2) Change Settings" + Environment.NewLine + "3) Modify Profile" + Environment.NewLine + "4) Start Server"); string readline = Console.ReadLine(); if (readline == "1") + { + Console.Clear(); + Console.WriteLine(new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/changelog.txt")); + Console.WriteLine("Press any key to continue:"); + Console.ReadKey(); + Console.Clear(); + goto Start; + } + if (readline == "2") { Console.Clear(); goto Settings; @@ -69,7 +78,7 @@ namespace start goto Start; } } - if (readline == "2") + if (readline == "3") { Console.Clear(); goto Profile; @@ -152,7 +161,7 @@ namespace start goto Start; } } - if (readline == "3") + if (readline == "4") { Console.WriteLine("Please select the version of RecRoom the server should host: (2017, 2018)"); string readline2 = Console.ReadLine(); diff --git a/icon.ico b/icon.ico deleted file mode 100644 index 2954838c9b6d8f09df580b5bfbe458786d14c126..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 93062 zcmeI5S(_9^7C@UnFpu**kMp^KI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