From 76c86ca4f62288cc3e33e566ac9470242fc1f47c Mon Sep 17 00:00:00 2001 From: recroom2016tutorial Date: Sun, 27 Mar 2022 22:12:15 -0400 Subject: [PATCH] new openrec change dropped guys --- .cs | 10 - APIServer.cs | 511 +++++++++++++++++++++++++++++++-------- Config.cs | 2 +- CustomRooms.cs | 146 +++++++++++ GameSessions.cs | 5 +- ImageServer.cs | 4 + NameServer.cs | 2 +- NewGameSessions.cs | 102 ++++++++ Notification.cs | 2 +- OpenRec_.sln | 2 + Program.cs | 82 +++++-- Settings.cs | 2 +- Setup.cs | 1 + Vault2018CustomRooms.cs | 298 +++++++++++++++++++++++ Vault2018GameSessions.cs | 5 +- Vault2018Rooms.cs | 80 +++++- 16 files changed, 1107 insertions(+), 147 deletions(-) delete mode 100644 .cs create mode 100644 CustomRooms.cs create mode 100644 NewGameSessions.cs create mode 100644 Vault2018CustomRooms.cs diff --git a/.cs b/.cs deleted file mode 100644 index 95f5fbc..0000000 --- a/.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenRec -{ - class Vault2018Rooms - { - } -} diff --git a/APIServer.cs b/APIServer.cs index 6ba687a..b395e0c 100644 --- a/APIServer.cs +++ b/APIServer.cs @@ -8,6 +8,7 @@ using api2018; using api2017; using Newtonsoft.Json; using vaultgamesesh; +using System.Collections.Generic; namespace server { @@ -31,7 +32,7 @@ namespace server { //2 different servers for 2 different stages of the game, the apis change so much idk anymore this.listener.Prefixes.Add("http://localhost:" + start.Program.version + "/"); - if (start.Program.version == "2017") + if (start.Program.version == "2016") { for (; ; ) { @@ -69,23 +70,9 @@ namespace server { s = Config2.GetDebugConfig(); } - if (Url == "platformlogin/v1/profiles") + if (Url == "notification/v2") { - s = getorcreate.GetOrCreateArray((ulong.Parse(text.Remove(0, 32)))); - CachedPlayerID = ulong.Parse(text.Remove(0, 32)); - CachedPlatformID = ulong.Parse(text.Remove(0, 22)); - File.WriteAllText("SaveData\\Profile\\userid.txt", Convert.ToString(CachedPlayerID)); - if (new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt"))) - { - Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine("You are banned. Using this version of OpenRec will not work, please download OpenRec 0.4.2 or prior."); - Console.ForegroundColor = ConsoleColor.Green; - start.Program.bannedflag = true; - } - } - if (Url == "platformlogin/v6") - { - s = PlatformLogin.v4(CachedPlayerID); + s = "[]"; } if (Url == "PlayerReporting/v1/moderationBlockDetails") { @@ -100,9 +87,9 @@ namespace server s = Amplitude.amplitude(); } if (Url.StartsWith("players/v1/")) - { + { s = getorcreate.GetOrCreate(CachedPlayerID); - } + } if (Url == "avatar/v2") { s = File.ReadAllText("SaveData\\avatar.txt"); @@ -154,16 +141,164 @@ namespace server s = PlayerEventsResponse; } if (Url == "activities/charades/v1/words") - { + { s = Activities.Charades.words(); - } + } if (Url == "gamesessions/v2/joinrandom") { - s = gamesesh2018.GameSessions.JoinRandom(text); + s = gamesesh.GameSessions.JoinRandom(text); } if (Url == "gamesessions/v2/create") { - s = gamesesh2018.GameSessions.Create(text); + s = gamesesh.GameSessions.Create(text); + } + if (rawUrl == "//api/sanitize/v1/isPure") + { + s = JsonConvert.SerializeObject(Sanitize.GetSanitize()); + } + 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(200); + outputStream.Close(); + this.listener.Stop(); + } + } + 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): " + rawUrl); + } + Console.WriteLine("API Data: " + text); + if (Url.StartsWith("versioncheck")) + { + s = VersionCheckResponse; + } + if (Url == ("config/v2")) + { + 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)); + File.WriteAllText("SaveData\\Profile\\userid.txt", Convert.ToString(CachedPlayerID)); + if (new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/banned.txt").Contains(File.ReadAllText("SaveData\\Profile\\userid.txt"))) + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine("You are banned. Using this version of OpenRec will not work, please download OpenRec 0.4.2 or prior."); + Console.ForegroundColor = ConsoleColor.Green; + start.Program.bannedflag = true; + } + } + if (Url == "platformlogin/v6") + { + s = PlatformLogin.v4(CachedPlayerID); + } + if (Url == "PlayerReporting/v1/moderationBlockDetails") + { + s = ModerationBlockDetails; + if (start.Program.bannedflag == true) + { + s = Banned; + } + } + if (Url == "config/v1/amplitude") + { + s = Amplitude.amplitude(); + } + if (Url.StartsWith("players/v1/")) + { + s = getorcreate.GetOrCreate(CachedPlayerID); + } + if (Url == "avatar/v2") + { + s = File.ReadAllText("SaveData\\avatar.txt"); + } + if (Url == "avatar/v2/set") + { + //for later 2018 builds compatibility + if (!(text.Contains("FaceFeatures"))) + { + string postdatacache = text; + text = postdatacache.Remove(postdatacache.Length - 1, 1) + File.ReadAllText("SaveData\\App\\facefeaturesadd.txt"); + } + File.WriteAllText("SaveData\\avatar.txt", text); + } + if (Url == "messages/v2/get") + { + s = BracketResponse; + } + if (Url == "relationships/v2/get") + { + s = BracketResponse; + } + if (Url == "settings/v2/") + { + s = File.ReadAllText("SaveData\\settings.txt"); + } + if (Url == "settings/v2/set") + { + Settings.SetPlayerSettings(text); + } + if (Url == "avatar/v3/items") + { + s = File.ReadAllText("SaveData\\avataritems.txt"); + } + if (Url == "equipment/v1/getUnlocked") + { + s = File.ReadAllText("SaveData\\equipment.txt"); + } + if (Url == "avatar/v2/gifts") + { + s = BracketResponse; + } + if (Url == "events/v3/list") + { + s = Events.list(); + } + if (Url == "playerevents/v1/all") + { + s = PlayerEventsResponse; + } + if (Url == "activities/charades/v1/words") + { + s = Activities.Charades.words(); + } + if (Url == "gamesessions/v2/joinrandom") + { + s = gamesesh.GameSessions.JoinRandom(text); + } + if (Url == "gamesessions/v2/create") + { + s = gamesesh.GameSessions.Create(text); } if (rawUrl == "//api/sanitize/v1/isPure") { @@ -188,6 +323,7 @@ namespace server HttpListenerContext context = this.listener.GetContext(); HttpListenerRequest request = context.Request; HttpListenerResponse response = context.Response; + List list = new List(); string rawUrl = request.RawUrl; string Url = ""; byte[] bytes = null; @@ -214,13 +350,13 @@ namespace server if (Url.StartsWith("versioncheck")) { if (Url.Contains("201809")) - { + { CachedVersionMonth = 09; - } + } else - { + { CachedVersionMonth = 05; - } + } s = VersionCheckResponse; } if (Url == ("config/v2")) @@ -242,9 +378,9 @@ namespace server } } if (Url == "platformlogin/v1/loginaccount") - { + { s = logincached.loginCache(CachedPlayerID, CachedPlatformID); - } + } if (Url == "platformlogin/v1/createaccount") { s = logincached.loginCache(CachedPlayerID, CachedPlatformID); @@ -258,65 +394,65 @@ namespace server s = BlankResponse; } if (Url == "players/v1/list") - { + { s = BracketResponse; - } + } if (Url == "config/v1/amplitude") { s = Amplitude.amplitude(); } if (Url == "images/v2/named") - { + { s = ImagesV2Named; - } + } if (Url == "PlayerReporting/v1/moderationBlockDetails") - { + { s = ModerationBlockDetails; if (start.Program.bannedflag == true) - { + { s = Banned; - } - } + } + } if (Url == "//api/chat/v2/myChats?mode=0&count=50") - { + { s = BracketResponse; - } - if (Url == "messages/v2/get") - { - s = BracketResponse; - } + } + if (Url == "messages/v2/get") + { + s = BracketResponse; + } if (Url == "relationships/v2/get") { s = BracketResponse; } if (Url == "gameconfigs/v1/all") - { + { s = File.ReadAllText("SaveData\\gameconfigs.txt"); - } + } if (Url.StartsWith("storefronts/v3/giftdropstore")) - { + { if (CachedVersionMonth == 09) - { + { s = File.ReadAllText("SaveData\\storefronts2.txt"); } else - { + { s = BracketResponse; - } - } + } + } if (Url.StartsWith("storefronts/v3/balance/")) - { + { s = BracketResponse; - } + } if (Url == "avatar/v2") - { + { s = File.ReadAllText("SaveData\\avatar.txt"); - } + } if (Url == "avatar/v2/set") { //for later 2018 builds compatibility if (!(text.Contains("FaceFeatures"))) - { + { string postdatacache = text; text = postdatacache.Remove(postdatacache.Length - 1, 1) + File.ReadAllText("SaveData\\App\\facefeaturesadd.txt"); } @@ -331,15 +467,15 @@ namespace server Settings.SetPlayerSettings(text); } if (rawUrl == "//api/chat/v2/myChats?mode=0&count=50") - { + { s = BracketResponse; - } + } if (Url == "playersubscriptions/v1/my") - { + { s = BracketResponse; - } + } if (Url == "avatar/v3/items") - { + { s = File.ReadAllText("SaveData\\avataritems.txt"); } if (Url == "equipment/v1/getUnlocked") @@ -347,44 +483,48 @@ namespace server s = File.ReadAllText("SaveData\\equipment.txt"); } if (Url == "avatar/v1/saved") - { + { s = BracketResponse; - } + } if (Url == "consumables/v1/getUnlocked") { if (CachedVersionMonth == 09) - { + { s = BracketResponse; - } + } else - { + { s = File.ReadAllText("SaveData\\consumables.txt"); } } if (Url == "avatar/v2/gifts") + { + s = BracketResponse; + } + if (Url == "storefronts/v2/2") + { + s = BlankResponse; + } + if (Url == "storefronts/v1/allGiftDrops/2") { s = BracketResponse; - } - if (Url == "storefronts/v2/2") - { - s = BlankResponse; } if (Url == "objectives/v1/myprogress") - { + { s = JsonConvert.SerializeObject(new Objective2018()); } if (Url == "rooms/v1/myrooms") - { + { s = File.ReadAllText("SaveData\\myrooms.txt"); - } + } if (Url == "rooms/v2/myrooms") - { + { s = BracketResponse; - } + } if (Url == "rooms/v2/baserooms") - { + { s = File.ReadAllText("SaveData\\baserooms.txt"); - } + } if (Url == "rooms/v1/mybookmarkedrooms") { s = BracketResponse; @@ -406,12 +546,12 @@ namespace server s = Activities.Charades.words(); } if (Url == "gamesessions/v2/joinrandom") - { - s = gamesesh2018.GameSessions.JoinRandom(text); + { + s = gamesesh.GameSessions.JoinRandom(text); } if (Url == "gamesessions/v2/create") { - s = gamesesh2018.GameSessions.Create(text); + s = gamesesh.GameSessions.Create(text); } if (Url == "gamesessions/v3/joinroom") { @@ -419,7 +559,7 @@ namespace server } if (rawUrl == "//api/sanitize/v1/isPure") { - s = JsonConvert.SerializeObject(Sanitize.GetSanitize()); + s = "{\"IsPure\":true}"; } if (Url == "avatar/v3/saved") { @@ -430,57 +570,234 @@ namespace server s = ChecklistV1Current; } if (Url == "presence/v1/setplayertype") - { + { s = BracketResponse; - } + } if (Url == "challenge/v1/getCurrent") - { + { s = ChallengesV1GetCurrent; - } + } if (Url == "rooms/v1/featuredRoomGroup") - { + { s = BracketResponse; - } + } + if (Url == "rooms/v1/clone") + { + s = BracketResponse; //JsonConvert.SerializeObject(c000099.m00000a(text)); + } + if (Url.StartsWith("rooms/v2/saveData")) + { + string text26 = "5GDNL91ZY43PXN2YJENTBL"; + string path = c000004.m000007() + c000041.f000043.Room.Name; + File.WriteAllBytes(string.Concat(new string[] + { + c000004.m000007(), + c000041.f000043.Room.Name, + "\\room\\", + text26, + ".room" + }), m00005d(list.ToArray(), "data.dat")); + c000041.f000043.Scenes[0].DataBlobName = text26 + ".room"; + c000041.f000043.Scenes[0].DataModifiedAt = DateTime.Now; + File.WriteAllText(c000004.m000007() + c000041.f000043.Room.Name + "\\RoomDetails.json", JsonConvert.SerializeObject(c000041.f000043)); + s = JsonConvert.SerializeObject(c00005d.m000035()); + } if (Url == "presence/v3/heartbeat") - { + { s = JsonConvert.SerializeObject(Notification2018.Reponse.createResponse(4, c000020.m000027())); } if (Url == "rooms/v1/featuredRoomGroup") - { + { s = new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/dormslideshow.txt"); - } + } + if (Url.StartsWith("rooms/v1/hot")) + { + s = new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/hotrooms.txt"); + } + if (Url.StartsWith("rooms/v4/details/29")) + { + s = File.ReadAllText("SaveData\\Rooms\\Downloaded\\RoomDetails.json"); + } Console.WriteLine("API Response: " + s); bytes = Encoding.UTF8.GetBytes(s); response.ContentLength64 = (long)bytes.Length; Stream outputStream = response.OutputStream; outputStream.Write(bytes, 0, bytes.Length); - Thread.Sleep(200); + Thread.Sleep(100); outputStream.Close(); this.listener.Stop(); } } } catch (Exception ex4) - { + { Console.WriteLine(ex4); File.WriteAllText("crashdump.txt", Convert.ToString(ex4)); - } - } - public static ulong CachedPlayerID = 1; + } + } + public static ulong CachedPlayerID = 1; public static ulong CachedPlatformID = 10000; public static int CachedVersionMonth = 01; public static string BlankResponse = ""; public static string BracketResponse = "[]"; - public static string PlayerEventsResponse = "{\"Created\":[],\"Responses\":[]}"; - public static string VersionCheckResponse = "{\"ValidVersion\":true}"; + public static string PlayerEventsResponse = "{\"Created\":[],\"Responses\":[]}"; + public static string VersionCheckResponse = "{\"ValidVersion\":true}"; public static string ModerationBlockDetails = "{\"ReportCategory\":0,\"Duration\":0,\"GameSessionId\":0,\"Message\":\"\"}"; public static string ImagesV2Named = "[{\"FriendlyImageName\":\"DormRoomBucket\",\"ImageName\":\"OpenRec\",\"StartTime\":\"2021-12-27T21:27:38.1880175-08:00\",\"EndTime\":\"2043-12-27T21:27:38.1880399-08:00\"}"; public static string ChallengesV1GetCurrent = "{\"Success\":true,\"Message\":\"OpenRec\"}"; public static string ChecklistV1Current = "[{\"Order\":0,\"Objective\":3000,\"Count\":3,\"CreditAmount\":100},{\"Order\":1,\"Objective\":3001,\"Count\":3,\"CreditAmount\":100},{\"Order\":2,\"Objective\":3002,\"Count\":3,\"CreditAmount\":100}]"; public static string Banned = "{\"ReportCategory\":1,\"Duration\":10000000000000000,\"GameSessionId\":100,\"Message\":\"You have been banned. You are probably a little kid and are now whining at your VR headset. If you aren't a little kid, DM me to appeal.\"}"; - private HttpListener listener = new HttpListener(); + private HttpListener listener = new HttpListener(); + + + + + private static byte[] m00005d(byte[] p0, string p1) + { + BinaryReader binaryReader = new BinaryReader(new MemoryStream(p0)); + try + { + while (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) + { + bool flag = true; + bool flag2 = false; + APIServer.c0000a7 c0000a = new APIServer.c0000a7(); + while (flag) + { + List list = new List(); + bool flag3 = true; + while (flag3) + { + byte b = binaryReader.ReadByte(); + if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) + { + if (b == 13) + { + binaryReader.ReadByte(); + flag3 = false; + } + else + { + list.Add(b); + } + } + else + { + flag3 = false; + } + } + string @string = Encoding.ASCII.GetString(list.ToArray()); + Console.WriteLine(@string); + if (@string.StartsWith("Content-Length: ")) + { + string s = @string.Remove(0, 16); + c0000a.m000017(int.Parse(s)); + } + if (@string.Contains(p1)) + { + Console.WriteLine("Has file"); + flag2 = true; + } + if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) + { + if (binaryReader.ReadByte() == 13) + { + flag = false; + binaryReader.ReadByte(); + } + else + { + binaryReader.BaseStream.Position -= 1L; + } + } + else + { + flag = false; + } + } + if (flag2) + { + List list2 = new List(); + for (; ; ) + { + if (binaryReader.ReadByte() == 13) + { + if (binaryReader.ReadByte() == 10) + { + if (binaryReader.ReadByte() == 45) + { + break; + } + binaryReader.BaseStream.Position -= 3L; + } + else + { + binaryReader.BaseStream.Position -= 2L; + } + } + else + { + binaryReader.BaseStream.Position -= 1L; + } + byte item = binaryReader.ReadByte(); + list2.Add(item); + } + return list2.ToArray(); + } + if (binaryReader.BaseStream.Position != binaryReader.BaseStream.Length) + { + binaryReader.ReadBytes(c0000a.m000016()); + } + } + } + finally + { + ((IDisposable)binaryReader).Dispose(); + } + return null; + } + + public sealed class c0000a7 + { + public string m000001() + { + return this.f00000a; + } + public void m000034(string p0) + { + this.f00000a = p0; + } + public string m000005() + { + return this.f000002; + } + public void m00003f(string p0) + { + this.f000002 = p0; + } + public int m000016() + { + return this.f000020; + } + public void m000017(int p0) + { + this.f000020 = p0; + } + public byte[] m000061() + { + return this.f000084; + } + public void m000062(byte[] p0) + { + this.f000084 = p0; + } + private string f00000a; + private string f000002; + private int f000020; + private byte[] f000084; + } } } diff --git a/Config.cs b/Config.cs index 55ea5f6..d5dc385 100644 --- a/Config.cs +++ b/Config.cs @@ -27,7 +27,7 @@ namespace api Console.WriteLine("Done!"); Console.Clear(); } - public static gamesesh2018.GameSessions.SessionInstance localGameSession; + public static gamesesh.GameSessions.SessionInstance localGameSession; public static Objective[][] dailyObjectives = new Objective[][] { new Objective[] diff --git a/CustomRooms.cs b/CustomRooms.cs new file mode 100644 index 0000000..32c80cb --- /dev/null +++ b/CustomRooms.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Net; +using Newtonsoft.Json; +using vaultgamesesh; +using System.IO; +using server; + +namespace api +{ + class CustomRooms + { + public static void RoomDecode(string roomname, string roomsceneid, string imagename, string datablob) + { + File.WriteAllText("SaveData\\Rooms\\Downloaded\\roomname.txt", roomname); + File.WriteAllText("SaveData\\Rooms\\Downloaded\\datablob.txt", datablob); + File.WriteAllText("SaveData\\Rooms\\Downloaded\\roomsceneid.txt", roomsceneid); + File.WriteAllText("SaveData\\Rooms\\Downloaded\\imagename.txt", imagename); + ulong rand = Convert.ToUInt64(new Random().Next(0, 99)); + room = new Room + { + RoomId = rand, + Name = roomname, + Description = "OpenRec Downloaded Room", + ImageName = imagename, + CreatorPlayerId = APIServer.CachedPlayerID, + State = 0, + Accessibility = 1, + SupportsLevelVoting = false, + IsAGRoom = false, + CloningAllowed = false, + SupportsScreens = true, + SupportsWalkVR = true, + SupportsTeleportVR = true, + ReplicationId = null, + ReleaseStatus = 0 + + }; + scene = new List + { + new Scene() + { + RoomSceneId = 1, + RoomId = rand, + RoomSceneLocationId = "a75f7547-79eb-47c6-8986-6767abcb4f92", + Name = "Home", + IsSandbox = true, + DataBlobName = datablob, + MaxPlayers = 20, + CanMatchmakeInto = true, + DataModifiedAt = DateTime.Now, + ReplicationId = null, + UseLevelBasedMatchmaking = false, + UseAgeBasedMatchmaking = false, + UseRecRoyaleMatchmaking = false, + ReleaseStatus = 0, + SupportsJoinInProgress = true + } + }; + root = new Root + { + Room = room, + Scenes = scene, + CoOwners = new List(), + InvitedCoOwners = new List(), + Hosts = new List(), + InvitedHosts = new List(), + CheerCount = 999, + FavoriteCount = 999, + VisitCount = 999, + Tags = new List + { + new aTag() + { + Tag = "rro", + Type = 2 + } + } + + }; + File.WriteAllText("SaveData\\Rooms\\Downloaded\\RoomDetails.json", JsonConvert.SerializeObject(root)); + } + + public static Room room { get; set; } + public static List scene { get; set; } + public static Root root { get; set; } + //2018 rooms + public class Room + { + public ulong RoomId { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public ulong CreatorPlayerId { get; set; } + public string ImageName { get; set; } + public int State { get; set; } + public int Accessibility { get; set; } + public bool SupportsLevelVoting { get; set; } + public bool IsAGRoom { get; set; } + public bool CloningAllowed { get; set; } + public bool SupportsScreens { get; set; } + public bool SupportsWalkVR { get; set; } + public bool SupportsTeleportVR { get; set; } + public object ReplicationId { get; set; } + public int ReleaseStatus { get; set; } + } + + public class Scene + { + public int RoomSceneId { get; set; } + public ulong RoomId { get; set; } + public string RoomSceneLocationId { get; set; } + public string Name { get; set; } + public bool IsSandbox { get; set; } + public string DataBlobName { get; set; } + public int MaxPlayers { get; set; } + public bool CanMatchmakeInto { get; set; } + public DateTime DataModifiedAt { get; set; } + public object ReplicationId { get; set; } + public bool UseLevelBasedMatchmaking { get; set; } + public bool UseAgeBasedMatchmaking { get; set; } + public bool UseRecRoyaleMatchmaking { get; set; } + public int ReleaseStatus { get; set; } + public bool SupportsJoinInProgress { get; set; } + } + + public class Root + { + public Room Room { get; set; } + public List Scenes { get; set; } + public List CoOwners { get; set; } + public List InvitedCoOwners { get; set; } + public List Hosts { get; set; } + public List InvitedHosts { get; set; } + public int CheerCount { get; set; } + public int FavoriteCount { get; set; } + public int VisitCount { get; set; } + public List Tags { get; set; } + } + public class aTag + { + public string Tag { get; set; } + public int Type { get; set; } + } + } +} diff --git a/GameSessions.cs b/GameSessions.cs index 0ac96b6..910b327 100644 --- a/GameSessions.cs +++ b/GameSessions.cs @@ -3,7 +3,8 @@ using Newtonsoft.Json; using api; using server; using System.IO; -namespace gamesesh2018 +namespace gamesesh + { // Token: 0x02000020 RID: 32 public class GameSessions @@ -12,7 +13,7 @@ namespace gamesesh2018 public static string JoinRandom(string jsonData) { long? creatorid = 1243409L; - long gamesessionid = 20181L; + long gamesessionid = long.Parse(start.Program.version + "1"); Console.WriteLine("OpenRec GameSession Room"); GameSessions.JoinRandomRequest joinRandomRequest = JsonConvert.DeserializeObject(jsonData); if (File.ReadAllText("SaveData\\App\\privaterooms.txt") == "Enabled") diff --git a/ImageServer.cs b/ImageServer.cs index 7a882f5..2597875 100644 --- a/ImageServer.cs +++ b/ImageServer.cs @@ -43,6 +43,10 @@ namespace server { text = streamReader.ReadToEnd(); } + if (rawUrl.StartsWith("//room/")) + { + i = new WebClient().DownloadData("https://cdn.rec.net/" + rawUrl.Remove(0, 2)); + } Console.WriteLine("Image Requested: " + rawUrl); Console.WriteLine("Image Data: " + text); Console.WriteLine("Image Response: "); diff --git a/NameServer.cs b/NameServer.cs index 882fc7f..677ab99 100644 --- a/NameServer.cs +++ b/NameServer.cs @@ -28,7 +28,7 @@ namespace server private void StartListen() { //nameserver is ONLY for 2018 - this.listener.Prefixes.Add("http://localhost:56/"); + this.listener.Prefixes.Add("http://localhost:20181/"); for (; ; ) { this.listener.Start(); diff --git a/NewGameSessions.cs b/NewGameSessions.cs new file mode 100644 index 0000000..4be6a46 --- /dev/null +++ b/NewGameSessions.cs @@ -0,0 +1,102 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Newtonsoft.Json; +using vaultgamesesh; + +namespace gamesesh2 +{ + class NewGameSessions + { + public static string JoinRoom(string text) + { + c00006b.c00006c apidata = JsonConvert.DeserializeObject(text); + return string.Empty; + + } + public class GameSession + { + public int GameSessionId { get; set; } + public string PhotonRegionId { get; set; } + public string PhotonRoomId { get; set; } + public string Name { get; set; } + public int RoomId { get; set; } + public int RoomSceneId { get; set; } + public string RoomSceneLocationId { get; set; } + public bool IsSandbox { get; set; } + public string DataBlobName { get; set; } + public object PlayerEventId { get; set; } + public bool Private { get; set; } + public bool GameInProgress { get; set; } + public int MaxCapacity { get; set; } + public bool IsFull { get; set; } + } + + public class Room + { + public int RoomId { get; set; } + public string Name { get; set; } + public string Description { get; set; } + public int CreatorPlayerId { get; set; } + public string ImageName { get; set; } + public int State { get; set; } + public int Accessibility { get; set; } + public bool SupportsLevelVoting { get; set; } + public bool IsAGRoom { get; set; } + public bool CloningAllowed { get; set; } + public bool SupportsScreens { get; set; } + public bool SupportsWalkVR { get; set; } + public bool SupportsTeleportVR { get; set; } + public string ReplicationId { get; set; } + public int ReleaseStatus { get; set; } + } + + public class Scene + { + public int RoomSceneId { get; set; } + public int RoomId { get; set; } + public string RoomSceneLocationId { get; set; } + public string Name { get; set; } + public bool IsSandbox { get; set; } + public string DataBlobName { get; set; } + public int MaxPlayers { get; set; } + public bool CanMatchmakeInto { get; set; } + public DateTime DataModifiedAt { get; set; } + public string ReplicationId { get; set; } + public bool UseLevelBasedMatchmaking { get; set; } + public bool UseAgeBasedMatchmaking { get; set; } + public bool UseRecRoyaleMatchmaking { get; set; } + public int ReleaseStatus { get; set; } + public bool SupportsJoinInProgress { get; set; } + } + + public class aTag + { + public string Tag { get; set; } + public int Type { get; set; } + } + + public class RoomDetails + { + public Room Room { get; set; } + public List Scenes { get; set; } + public List CoOwners { get; set; } + public List InvitedCoOwners { get; set; } + public List Hosts { get; set; } + public List InvitedHosts { get; set; } + public int CheerCount { get; set; } + public int FavoriteCount { get; set; } + public int VisitCount { get; set; } + public List Tags { get; set; } + } + + public class Root + { + public int Result { get; set; } + public GameSession GameSession { get; set; } + public RoomDetails RoomDetails { get; set; } + } + + + } +} diff --git a/Notification.cs b/Notification.cs index 13ed8f7..b9a60d4 100644 --- a/Notification.cs +++ b/Notification.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using gamesesh2018; +using gamesesh; namespace ws { diff --git a/OpenRec_.sln b/OpenRec_.sln index 3034407..218cbe8 100644 --- a/OpenRec_.sln +++ b/OpenRec_.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.31321.278 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenRec_", "OpenRec_.csproj", "{C3C433FC-52FB-4472-81F7-B271A2CDABFE}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C754033C-FE82-4FF2-9189-A7EE0E2E5974}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Program.cs b/Program.cs index 60c87d3..420a607 100644 --- a/Program.cs +++ b/Program.cs @@ -39,7 +39,7 @@ namespace start bannedflag = true; } } - Console.WriteLine("1) Changelog" + Environment.NewLine +"2) Change Settings" + Environment.NewLine + "3) Modify Profile" + Environment.NewLine + "4) Start Server"); + Console.WriteLine("1) Changelog" + Environment.NewLine +"2) Change Settings" + Environment.NewLine + "3) Modify Profile" + Environment.NewLine + "4) Custom Room Downloader" + Environment.NewLine + "5) Start Server"); string readline = Console.ReadLine(); if (readline == "1") { @@ -191,7 +191,7 @@ namespace start File.WriteAllText("SaveData\\Profile\\level.txt", newlevel); Console.Clear(); Console.WriteLine("Success!"); - goto Start; + goto Profile; } else if (readline3 == "4") { @@ -199,13 +199,40 @@ namespace start goto Start; } } - if (readline == "4") + { + Console.Title = "OpenRec Custom Room Downloader"; + Console.Clear(); + Console.WriteLine("Please type in the name of the room you would like to download: (Case sensitive)"); + string roomname = Console.ReadLine(); + Console.WriteLine("Now, please go to the link below and help us gather info about your room for you."); + Console.WriteLine("https://rooms.rec.net/rooms?name=" + roomname + "&include=297"); + Console.WriteLine("Please find the string called ImageName and paste it below:"); + string imagename = Console.ReadLine(); + Console.WriteLine("Please find the string called UnitySceneId and paste it below:"); + string roomsceneid = Console.ReadLine(); + Console.WriteLine("Please find the string called DataBlob and paste it below:"); + string datablob = Console.ReadLine(); + CustomRooms.RoomDecode(roomname, roomsceneid, imagename, datablob); + goto Start; + + } + if (readline == "5") { Console.Title = "OpenRec Version Select"; - Console.WriteLine("Please select the version of RecRoom the server should host: (2017, M2018, S2018)"); + Console.WriteLine("Please select the version of RecRoom the server should host: (2016, 2017, 2018)"); + Console.WriteLine("fuck you all"); string readline2 = Console.ReadLine(); - if (readline2 == "2017") + if (readline2 == "2016") + { + Console.Title = "OpenRec December 25th, 2016"; + version = "2016"; + Console.Clear(); + Console.WriteLine("Version Selected: December 25th, 2016."); + new APIServer(); + new WebSocket(); + } + else if (readline2 == "2017") { Console.Title = "OpenRec October 19th 2017"; version = "2017"; @@ -214,27 +241,32 @@ namespace start new APIServer(); new WebSocket(); } - else if ((readline2 == "M2018") || (readline2 == "m2018")) + else if (readline2 == "2018") { - Console.Title = "OpenRec May 30th 2018"; - version = "2018"; - Console.Clear(); - Console.WriteLine("Version Selected: May 30th, 2018."); - new NameServer(); - new ImageServer(); - new APIServer(); - new WebSocket(); - } - else if ((readline2 == "S2018") || (readline2 == "s2018")) - { - Console.Title = "OpenRec September 27th 2018"; - version = "2018"; - Console.Clear(); - Console.WriteLine("Version Selected: September 27th, 2018."); - new NameServer(); - new ImageServer(); - new APIServer(); - new Late2018WebSock(); + Console.WriteLine("May or September (Beta) 2018: (M, S)"); + string readline3 = Console.ReadLine(); + if ((readline3 == "M") || (readline3 == "m")) + { + Console.Title = "OpenRec May 30th 2018"; + version = "2018"; + Console.Clear(); + Console.WriteLine("Version Selected: May 30th, 2018."); + new NameServer(); + new ImageServer(); + new APIServer(); + new WebSocket(); + } + if ((readline3 == "S") || (readline3 == "s")) + { + Console.Title = "OpenRec September 27th 2018"; + version = "2018"; + Console.Clear(); + Console.WriteLine("Version Selected: September 27th, 2018."); + new NameServer(); + new ImageServer(); + new APIServer(); + new Late2018WebSock(); + } } } } diff --git a/Settings.cs b/Settings.cs index 38129f3..9ae71f8 100644 --- a/Settings.cs +++ b/Settings.cs @@ -106,7 +106,7 @@ namespace api new Setting { Key = "VoiceChat", - Value = 0f.ToString() + Value = 1f.ToString() }, new Setting { diff --git a/Setup.cs b/Setup.cs index c14e2ba..eddf6c2 100644 --- a/Setup.cs +++ b/Setup.cs @@ -16,6 +16,7 @@ namespace start Directory.CreateDirectory("SaveData\\App\\"); Directory.CreateDirectory("SaveData\\Profile\\"); Directory.CreateDirectory("SaveData\\Rooms\\"); + Directory.CreateDirectory("SaveData\\Rooms\\Downloaded\\"); if (!(File.Exists("SaveData\\avatar.txt"))) { File.WriteAllText("SaveData\\avatar.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/avatar.txt")); diff --git a/Vault2018CustomRooms.cs b/Vault2018CustomRooms.cs new file mode 100644 index 0000000..cf96de4 --- /dev/null +++ b/Vault2018CustomRooms.cs @@ -0,0 +1,298 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.CompilerServices; +using Newtonsoft.Json; +using vaultgamesesh; + +namespace vaultgamesesh +{ + + internal sealed class c000099 + { + // Token: 0x06000358 RID: 856 RVA: 0x0000B134 File Offset: 0x00009334 + public static c000099.c00009c m00002f() + { + List list = new List(); + foreach (KeyValuePair keyValuePair in c00005d.f000050) + { + c00005d.c000062 item = new c00005d.c000062 + { + RoomName = keyValuePair.Value.Room.Name, + RoomId = (long)((int)keyValuePair.Value.Room.RoomId), + ImageName = keyValuePair.Value.Room.ImageName + }; + list.Add(item); + } + return new c000099.c00009c + { + Name = "Check Out All The Rooms Today!", + FeaturedRooms = list + }; + } + + // Token: 0x06000359 RID: 857 RVA: 0x0000B204 File Offset: 0x00009404 + public static List m000009() + { + List list = new List(); + foreach (KeyValuePair keyValuePair in c00005d.m00003b()) + { + list.Add(keyValuePair.Value.Room); + } + return list; + } + + // Token: 0x0600035A RID: 858 RVA: 0x0000B268 File Offset: 0x00009468 + public static List m000035() + { + List list = new List(); + foreach (KeyValuePair keyValuePair in c00005d.f000024) + { + list.Add(keyValuePair.Value.Room); + } + return list; + } + + // Token: 0x0600035B RID: 859 RVA: 0x0000B2CC File Offset: 0x000094CC + public static List m000055() + { + List list = new List(); + foreach (KeyValuePair keyValuePair in c00005d.m00003a()) + { + list.Add(keyValuePair.Value.Room); + } + return list; + } + + // Token: 0x0600035C RID: 860 RVA: 0x0000B330 File Offset: 0x00009530 + public static List m000056(string p0) + { + string[] array = p0.Split(new char[] + { + ' ' + }); + List list = new List(); + foreach (KeyValuePair keyValuePair in c00005d.m00003b()) + { + c00005d.c000060 value = keyValuePair.Value; + bool flag = true; + foreach (string text in array) + { + if (flag) + { + if (text.StartsWith("#")) + { + bool flag2 = false; + foreach (c00005d.c000063 c in value.Tags) + { + if ("#" + c.Tag.ToLower() == text.ToLower()) + { + flag2 = true; + } + } + if (!flag2) + { + flag = false; + } + } + else if (!value.Room.Name.ToLower().Contains(text.ToLower())) + { + flag = false; + } + } + } + if (flag) + { + list.Add(value.Room); + } + } + return list; + } + + // Token: 0x0600035D RID: 861 RVA: 0x0000B488 File Offset: 0x00009688 + public static c00005d.c000060 m000057(ulong p0) + { + foreach (KeyValuePair keyValuePair in c00005d.f000024) + { + if (keyValuePair.Value.Room.RoomId == p0) + { + return keyValuePair.Value; + } + } + return null; + } + + // Token: 0x0600035E RID: 862 RVA: 0x0000B4F8 File Offset: 0x000096F8 + public static c000099.c00009b m00000a(string p0) + { + c000099.c00009b c00009b = new c000099.c00009b(); + c000099.c00009a c00009a = JsonConvert.DeserializeObject(p0); + c00005d.c000060 c = c000099.m000057(c00009a.RoomId); + if (c == null) + { + c00009b.Result = (c000099.enum09d)2; + c00009b.RoomDetails = new c00005d.c000060(); + } + else + { + c00009b.Result = (c000099.enum09d)0; + c00009b.RoomDetails = c; + c00009b.RoomDetails.Room.Name = c00009a.Name; + ulong roomId = (ulong)((long)new Random().Next(100, 9999999)); + c00009b.RoomDetails.Room.RoomId = roomId; + c00009b.RoomDetails.Room.IsAGRoom = false; + c00009b.RoomDetails.Scenes[0].IsSandbox = true; + c00009b.RoomDetails.Scenes[0].RoomId = roomId; + c00009b.RoomDetails.Scenes[0].DataBlobName = string.Empty; + c00009b.RoomDetails.Scenes[0].DataModifiedAt = DateTime.Now; + c00009b.RoomDetails.Room.CreatorPlayerId = server.APIServer.CachedPlayerID; + } + c00005d.m00003a().Add(c00009a.Name, c); + string text = c000004.m000007() + c00009b.RoomDetails.Room.Name; + if (!Directory.Exists(text)) + { + Directory.CreateDirectory(text); + } + File.WriteAllText(text + "\\RoomDetails.json", JsonConvert.SerializeObject(c00009b.RoomDetails)); + return c00009b; + } + + // Token: 0x0200009A RID: 154 + public sealed class c00009a + { + // Token: 0x17000105 RID: 261 + // (get) Token: 0x06000360 RID: 864 RVA: 0x0000373A File Offset: 0x0000193A + // (set) Token: 0x06000361 RID: 865 RVA: 0x00003742 File Offset: 0x00001942 + public string Name + { + [CompilerGenerated] + get + { + return this.f00000a; + } + [CompilerGenerated] + set + { + this.f00000a = value; + } + } + + // Token: 0x17000106 RID: 262 + // (get) Token: 0x06000362 RID: 866 RVA: 0x0000374B File Offset: 0x0000194B + // (set) Token: 0x06000363 RID: 867 RVA: 0x00003753 File Offset: 0x00001953 + public ulong RoomId + { + [CompilerGenerated] + get + { + return this.f000023; + } + [CompilerGenerated] + set + { + this.f000023 = value; + } + } + + // Token: 0x040001DD RID: 477 + private string f00000a; + + // Token: 0x040001DE RID: 478 + private ulong f000023; + } + + // Token: 0x0200009B RID: 155 + public sealed class c00009b + { + // Token: 0x17000107 RID: 263 + // (get) Token: 0x06000365 RID: 869 RVA: 0x0000375C File Offset: 0x0000195C + // (set) Token: 0x06000366 RID: 870 RVA: 0x00003764 File Offset: 0x00001964 + public c000099.enum09d Result + { + [CompilerGenerated] + get + { + return this.f000042; + } + [CompilerGenerated] + set + { + this.f000042 = value; + } + } + + // Token: 0x17000108 RID: 264 + // (get) Token: 0x06000367 RID: 871 RVA: 0x0000376D File Offset: 0x0000196D + // (set) Token: 0x06000368 RID: 872 RVA: 0x00003775 File Offset: 0x00001975 + public c00005d.c000060 RoomDetails + { + [CompilerGenerated] + get + { + return this.f00004f; + } + [CompilerGenerated] + set + { + this.f00004f = value; + } + } + + // Token: 0x040001DF RID: 479 + private c000099.enum09d f000042; + + // Token: 0x040001E0 RID: 480 + private c00005d.c000060 f00004f; + } + + // Token: 0x0200009C RID: 156 + public sealed class c00009c + { + // Token: 0x17000109 RID: 265 + // (get) Token: 0x0600036A RID: 874 RVA: 0x0000377E File Offset: 0x0000197E + // (set) Token: 0x0600036B RID: 875 RVA: 0x00003786 File Offset: 0x00001986 + public string Name + { + [CompilerGenerated] + get + { + return this.f00000a; + } + [CompilerGenerated] + set + { + this.f00000a = value; + } + } + + // Token: 0x1700010A RID: 266 + // (get) Token: 0x0600036C RID: 876 RVA: 0x0000378F File Offset: 0x0000198F + // (set) Token: 0x0600036D RID: 877 RVA: 0x00003797 File Offset: 0x00001997 + public List FeaturedRooms + { + [CompilerGenerated] + get + { + return this.f000031; + } + [CompilerGenerated] + set + { + this.f000031 = value; + } + } + + // Token: 0x040001E1 RID: 481 + private string f00000a; + + // Token: 0x040001E2 RID: 482 + private List f000031; + } + + // Token: 0x0200009D RID: 157 + public enum enum09d + { + + } + } +} \ No newline at end of file diff --git a/Vault2018GameSessions.cs b/Vault2018GameSessions.cs index 4a26270..6f8cecb 100644 --- a/Vault2018GameSessions.cs +++ b/Vault2018GameSessions.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Threading; using Newtonsoft.Json; +using System.IO; namespace vaultgamesesh { @@ -52,7 +53,7 @@ namespace vaultgamesesh } else { - c000041.f000043 = c00005d.f000050["DormRoom"]; + c000041.f000043 = c00005d.f000050[File.ReadAllText("SaveData\\Rooms\\Downloaded\\roomname.txt")]; } } int num = 0; @@ -74,7 +75,7 @@ namespace vaultgamesesh bool @private = c00006c.Private; if (@private) { - text += string.Format("Pri{0}", c000079.m000009()[0].Id); + text += string.Format("Pri{0}", server.APIServer.CachedPlayerID); } c000041.f000013 = new c000041.c000044 { diff --git a/Vault2018Rooms.cs b/Vault2018Rooms.cs index 2ebf413..5c478a5 100644 --- a/Vault2018Rooms.cs +++ b/Vault2018Rooms.cs @@ -13,14 +13,24 @@ namespace vaultgamesesh // Token: 0x06000011 RID: 17 RVA: 0x0000264C File Offset: 0x0000084C public static Dictionary m00003a() { - Dictionary result = new Dictionary(); + Dictionary dictionary = new Dictionary(); string[] directories = Directory.GetDirectories(c000004.m000007()); for (int i = 0; i < directories.Length; i++) { + c00005d.c000060 c = JsonConvert.DeserializeObject(File.ReadAllText(directories[i] + "\\RoomDetails.json")); + dictionary.Add(c.Room.Name, c); } - return result; + return dictionary; + } + public static List m000035() + { + List list = new List(); + foreach (KeyValuePair keyValuePair in c00005d.f000024) + { + list.Add(keyValuePair.Value.Room); + } + return list; } - // Token: 0x06000012 RID: 18 RVA: 0x00002688 File Offset: 0x00000888 public static Dictionary m00003b() { @@ -1411,16 +1421,16 @@ namespace vaultgamesesh } }, { - "Bawling", + "Bowling", new c00005d.c000060 { Room = new c00005d.c000061 { RoomId = 28UL, - Name = "Bawling", - Description = "Go to the Two Footware Coridor Bawling Coridor to admire off branded Raw Data, Play Jumbotron on 4 arcade cabinets (each with 4 player split screen, and 16 player multiplayer), take a ball and hit the white cubes, and conimplate life in front of the lockers in this Beta RRO!", + Name = "Bowling", + Description = "shut up coffeeman this bowling description was so annoying", CreatorPlayerId = 782441001UL, - ImageName = "bawling.png", + ImageName = "bowling.png", State = 0, Accessibility = 1, SupportsLevelVoting = false, @@ -1464,6 +1474,62 @@ namespace vaultgamesesh } } } + }, + { + File.ReadAllText("SaveData\\Rooms\\Downloaded\\roomname.txt"), + new c00005d.c000060 + { + Room = new c00005d.c000061 + { + RoomId = 29UL, + Name = File.ReadAllText("SaveData\\Rooms\\Downloaded\\roomname.txt"), + Description = "OpenRec Downloaded Custom Room", + CreatorPlayerId = APIServer.CachedPlayerID, + ImageName = File.ReadAllText("SaveData\\Rooms\\Downloaded\\imagename.txt"), + State = 0, + Accessibility = 1, + SupportsLevelVoting = false, + IsAGRoom = true, + CloningAllowed = false, + SupportsScreens = true, + SupportsTeleportVR = true, + SupportsWalkVR = true + }, + Scenes = new List + { + new c00005d.c00005f + { + RoomSceneId = 1L, + RoomId = 29UL, + RoomSceneLocationId = File.ReadAllText("SaveData\\Rooms\\Downloaded\\roomsceneid.txt"), + Name = "Home", + IsSandbox = true, + DataBlobName = File.ReadAllText("SaveData\\Rooms\\Downloaded\\datablob.txt"), + MaxPlayers = 20, + CanMatchmakeInto = true, + DataModifiedAt = DateTime.Now + } + }, + CoOwners = new List(), + Hosts = new List(), + CheerCount = 1, + FavoriteCount = 1, + VisitCount = 1, + Tags = new List + { + new c00005d.c000063 + { + Tag = "rro", + Type = 2 + }, + new c00005d.c000063 + { + Tag = "sport", + Type = 0 + } + } + + } } };