diff --git a/APIServer.cs b/APIServer.cs index 0db767a..30ff45a 100644 --- a/APIServer.cs +++ b/APIServer.cs @@ -192,7 +192,7 @@ namespace server } if (Url == "images/v2/named") { - s = ImagesV2Named; + s = BracketResponse; } if (Url == "PlayerReporting/v1/moderationBlockDetails") { @@ -278,7 +278,11 @@ namespace server { s = gamesessions2018.GameSessions.JoinRandom(text); } - if (rawUrl == "//api/images/v4/uploadtransient?gameSessionId=2018") + if (Url == "gamesessions/v2/create") + { + s = gamesessions2018.GameSessions.Create(text); + } + if (rawUrl.Contains("images/v4/uploadtransient?gameSessionId=2018")) { File.WriteAllBytes("SaveData\\Images\\image" + Convert.ToString(int.Parse(File.ReadAllText("SaveData\\Images\\count.txt") + 1)) + ".png", Encoding.UTF8.GetBytes(text.Remove(0, 50).Remove(text.Length - 48, 48))); } diff --git a/GameSessions.cs b/GameSessions.cs index fedc49f..433e029 100644 --- a/GameSessions.cs +++ b/GameSessions.cs @@ -11,17 +11,21 @@ namespace gamesessions2018 // Token: 0x060000BE RID: 190 RVA: 0x00004C08 File Offset: 0x00002E08 public static string JoinRandom(string jsonData) { + long gamesessionid = 2018L; bool sandboxmode = false; GameSessions.JoinRandomRequest joinRandomRequest = JsonConvert.DeserializeObject(jsonData); if (File.ReadAllText("SaveData\\App\\sandbox.txt") == "Enabled") { sandboxmode = true; } - - { + if (File.ReadAllText("SaveData\\App\\privatedorm.txt") == "Enabled") + { + gamesessionid = new Random().Next(0, 100); + } + { Config.localGameSession = new GameSessions.SessionInstance { - GameSessionId = 2018L, + GameSessionId = gamesessionid, RegionId = "us", RoomId = joinRandomRequest.ActivityLevelIds[0], RecRoomId = null, @@ -38,7 +42,6 @@ namespace gamesessions2018 IsFull = false }; } - return JsonConvert.SerializeObject(new GameSessions.JoinResult { Result = 0, @@ -61,13 +64,12 @@ namespace gamesessions2018 // Token: 0x060000C0 RID: 192 RVA: 0x00004D24 File Offset: 0x00002F24 public static string Create(string jsonData) { - Console.WriteLine("[API][GameSession] Creating Room..."); + Console.WriteLine("Custom Room Test..."); GameSessions.CreateRequest createRequest = JsonConvert.DeserializeObject(jsonData); - { Config.localGameSession = new GameSessions.SessionInstance { - GameSessionId = 2017L, + GameSessionId = 1L, RegionId = "us", RoomId = createRequest.ActivityLevelIds, RecRoomId = null, @@ -84,7 +86,6 @@ namespace gamesessions2018 IsFull = false }; } - return JsonConvert.SerializeObject(new GameSessions.JoinResult { Result = 0, @@ -272,25 +273,13 @@ namespace gamesessions2018 // Token: 0x02000025 RID: 37 public class CreateRequest { - // Token: 0x17000055 RID: 85 - // (get) Token: 0x060000F2 RID: 242 RVA: 0x0000271C File Offset: 0x0000091C - // (set) Token: 0x060000F3 RID: 243 RVA: 0x00002724 File Offset: 0x00000924 + public bool IsSandbox { get; set; } + public string ActivityLevelIds { get; set; } - - // Token: 0x17000056 RID: 86 - // (get) Token: 0x060000F4 RID: 244 RVA: 0x0000272D File Offset: 0x0000092D - // (set) Token: 0x060000F5 RID: 245 RVA: 0x00002735 File Offset: 0x00000935 + public ulong[] ExpectedPlayerIds { get; set; } - // Token: 0x17000057 RID: 87 - // (get) Token: 0x060000F6 RID: 246 RVA: 0x0000273E File Offset: 0x0000093E - // (set) Token: 0x060000F7 RID: 247 RVA: 0x00002746 File Offset: 0x00000946 public GameSessions.RegionPing[] RegionPings { get; set; } - - // Token: 0x17000058 RID: 88 - // (get) Token: 0x060000F8 RID: 248 RVA: 0x0000274F File Offset: 0x0000094F - // (set) Token: 0x060000F9 RID: 249 RVA: 0x00002757 File Offset: 0x00000957 - public bool IsSandbox { get; set; } } // Token: 0x02000026 RID: 38 diff --git a/OpenRec_.csproj b/OpenRec_.csproj index 8446c6a..3d21215 100644 --- a/OpenRec_.csproj +++ b/OpenRec_.csproj @@ -3,6 +3,16 @@ Exe netcoreapp3.1 + icon2.ico + OpenRec + OpenRec + recroom2016 + icon2.png + + https://github.com/recroom2016/OpenRec + https://discord.gg/daC8QUhnFP + OpenRec + 0.4.0 @@ -15,4 +25,11 @@ + + + True + + + + diff --git a/Program.cs b/Program.cs index 1bcbbfe..b0307bd 100644 --- a/Program.cs +++ b/Program.cs @@ -16,6 +16,7 @@ namespace start goto Start; Start: + Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("OpenRec - Open source RecNet server software. (Version: " + version + ")"); Console.WriteLine("Made and provided by RecRoom 2016."); Console.WriteLine("Download source code here: https://github.com/recroom2016/OpenRec"); @@ -31,8 +32,8 @@ namespace start Console.Clear(); goto Settings; - Settings: - Console.WriteLine("1) Sandbox Mode: " + File.ReadAllText("SaveData\\App\\sandbox.txt") + Environment.NewLine + "2) Go Back"); + Settings: //SaveData\\App\\privatedorm.txt + Console.WriteLine("1) Sandbox Mode: " + File.ReadAllText("SaveData\\App\\sandbox.txt") + Environment.NewLine + "2) Private Dorm: " + File.ReadAllText("SaveData\\App\\privatedorm.txt") + Environment.NewLine + "3) Go Back"); string readline4 = Console.ReadLine(); if (readline4 == "1") { @@ -49,6 +50,20 @@ namespace start goto Settings; } else if (readline4 == "2") + { + if (File.ReadAllText("SaveData\\App\\privatedorm.txt") == "Disabled") + { + File.WriteAllText("SaveData\\App\\privatedorm.txt", "Enabled"); + } + else + { + File.WriteAllText("SaveData\\App\\privatedorm.txt", "Disabled"); + } + Console.Clear(); + Console.WriteLine("Success!"); + goto Settings; + } + else if (readline4 == "3") { Console.Clear(); goto Start; @@ -139,7 +154,7 @@ namespace start } if (readline == "3") { - Console.WriteLine("Please select the version of RecRoom the server should host: (2018)"); + Console.WriteLine("Please select the version of RecRoom the server should host: (2017, 2018)"); string readline2 = Console.ReadLine(); if (readline2 == "2016") { @@ -170,7 +185,7 @@ namespace start } } - public static string version = "0.3"; + public static string version = "0.3.5"; } } diff --git a/Setup.cs b/Setup.cs index 4a6fa31..b19fb4b 100644 --- a/Setup.cs +++ b/Setup.cs @@ -54,6 +54,10 @@ namespace start { File.WriteAllText("SaveData\\App\\sandbox.txt", "Disabled"); } + if (!(File.Exists("SaveData\\App\\privatedorm.txt"))) + { + File.WriteAllText("SaveData\\App\\privatedorm.txt", "Disabled"); + } if (!(File.Exists("SaveData\\Images\\count.txt"))) { File.WriteAllText("SaveData\\Images\\count.txt", "0"); diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..2954838 Binary files /dev/null and b/icon.ico differ diff --git a/icon2.ico b/icon2.ico new file mode 100644 index 0000000..dbe84fa Binary files /dev/null and b/icon2.ico differ