2017 support in the works

This commit is contained in:
recroom2016
2022-02-22 00:30:48 -05:00
parent a8e081602a
commit 033634f104
8 changed files with 146 additions and 79 deletions

View File

@@ -5,6 +5,7 @@ using System.Text;
using System.Threading; using System.Threading;
using api; using api;
using api2018; using api2018;
using api2017;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace server namespace server
@@ -30,7 +31,7 @@ namespace server
try try
{ {
this.listener.Prefixes.Add("http://localhost:" + start.Program.version + "/"); this.listener.Prefixes.Add("http://localhost:" + start.Program.version + "/");
if (start.Program.version == "2016") if (start.Program.version == "2017")
{ {
for (; ; ) for (; ; )
{ {
@@ -68,60 +69,34 @@ namespace server
{ {
s = Config2.GetDebugConfig(); s = Config2.GetDebugConfig();
} }
Console.WriteLine("API Response: " + s); if (Url == "platformlogin/v1/profiles")
byte[] bytes = Encoding.UTF8.GetBytes(s); {
response.ContentLength64 = (long)bytes.Length; s = getorcreate.GetOrCreateArray((ulong.Parse(text.Remove(0, 32))));
Stream outputStream = response.OutputStream; CachedPlayerID = ulong.Parse(text.Remove(0, 32));
outputStream.Write(bytes, 0, bytes.Length); CachedPlatformID = ulong.Parse(text.Remove(0, 22));
Thread.Sleep(400);
outputStream.Close();
this.listener.Stop();
} }
if (Url == "platformlogin/v6")
{
s = PlatformLogin.v4(CachedPlayerID);
} }
else if (start.Program.version == "2017") if (Url == "PlayerReporting/v1/moderationBlockDetails")
{ {
for (; ; ) s = ModerationBlockDetails;
{
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; if (Url == "config/v1/amplitude")
string s = "";
using (StreamReader streamReader = new StreamReader(request.InputStream, request.ContentEncoding))
{ {
text = streamReader.ReadToEnd(); s = Amplitude.amplitude();
} }
if (!(Url == "")) if (Url.StartsWith("players/v1/"))
{ {
Console.WriteLine("API Requested: " + Url); s = getorcreate.GetOrCreate(CachedPlayerID);
}
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); Console.WriteLine("API Response: " + s);
byte[] bytes = Encoding.UTF8.GetBytes(s); byte[] bytes = Encoding.UTF8.GetBytes(s);
response.ContentLength64 = (long)bytes.Length; response.ContentLength64 = (long)bytes.Length;
Stream outputStream = response.OutputStream; Stream outputStream = response.OutputStream;
outputStream.Write(bytes, 0, bytes.Length); outputStream.Write(bytes, 0, bytes.Length);
Thread.Sleep(400); Thread.Sleep(200);
outputStream.Close(); outputStream.Close();
this.listener.Stop(); this.listener.Stop();
} }
@@ -299,7 +274,7 @@ namespace server
response.ContentLength64 = (long)bytes.Length; response.ContentLength64 = (long)bytes.Length;
Stream outputStream = response.OutputStream; Stream outputStream = response.OutputStream;
outputStream.Write(bytes, 0, bytes.Length); outputStream.Write(bytes, 0, bytes.Length);
Thread.Sleep(100); Thread.Sleep(200);
outputStream.Close(); outputStream.Close();
this.listener.Stop(); this.listener.Stop();
} }

View File

@@ -11,7 +11,7 @@ namespace api
{ {
return JsonConvert.SerializeObject(new Amplitude return JsonConvert.SerializeObject(new Amplitude
{ {
AmplitudeKey = "e1693a1003671058b6abc356c8ba8d59" AmplitudeKey = "NoKeyProvided"
}); });
} }

View File

@@ -65,20 +65,20 @@ namespace gamesessions2018
public static string Create(string jsonData) public static string Create(string jsonData)
{ {
Console.WriteLine("Custom Room Test..."); Console.WriteLine("Custom Room Test...");
GameSessions.CreateRequest createRequest = JsonConvert.DeserializeObject<GameSessions.CreateRequest>(jsonData); GameSessions.JoinRandomRequest createRequest = JsonConvert.DeserializeObject<GameSessions.JoinRandomRequest>(jsonData);
{ {
Config.localGameSession = new GameSessions.SessionInstance Config.localGameSession = new GameSessions.SessionInstance
{ {
GameSessionId = 1L, GameSessionId = 20181L,
RegionId = "us", RegionId = "us",
RoomId = createRequest.ActivityLevelIds, RoomId = createRequest.ActivityLevelIds[0],
RecRoomId = null, RecRoomId = null,
EventId = null, EventId = null,
CreatorPlayerId = (long?)APIServer.CachedPlayerID, CreatorPlayerId = (long?)APIServer.CachedPlayerID,
Name = "Custom Room", Name = "Custom Room",
ActivityLevelId = createRequest.ActivityLevelIds, ActivityLevelId = createRequest.ActivityLevelIds[0],
Private = false, Private = false,
Sandbox = createRequest.IsSandbox, Sandbox = true,
SupportsScreens = true, SupportsScreens = true,
SupportsVR = true, SupportsVR = true,
GameInProgress = false, GameInProgress = false,
@@ -275,7 +275,7 @@ namespace gamesessions2018
{ {
public bool IsSandbox { get; set; } public bool IsSandbox { get; set; }
public string ActivityLevelIds { get; set; } public string[] ActivityLevelIds { get; set; }
public ulong[] ExpectedPlayerIds { get; set; } public ulong[] ExpectedPlayerIds { get; set; }

63
GetOrCreates.cs Normal file
View File

@@ -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");
}
}
}

36
PlatformLogin.cs Normal file
View File

@@ -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);
}
}
}

View File

@@ -2,12 +2,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace api2016 namespace api2017
{ {
class Profiles class Profiles
{ {
public ulong Id { get; set; } public ulong Id { get; set; }
public string Username { get; set; } public string Username { get; set; }
public string DisplayName { get; set; } public string DisplayName { get; set; }
@@ -15,27 +13,13 @@ namespace api2016
public int Level { get; set; } public int Level { get; set; }
public int Reputation { get; set; } public int Reputation { get; set; }
public bool Verified { get; set; } public bool Verified { get; set; }
public bool Developer { get; set; } public bool Developer { get; set; }
public bool HasEmail { get; set; } public bool HasEmail { get; set; }
public bool CanReceiveInvites { get; set; } public bool CanReceiveInvites { get; set; }
public string ProfileImageName { get; set; } public string ProfileImageName { get; set; }
public bool JuniorProfile { get; set; } public bool JuniorProfile { get; set; }
public bool ForceJuniorImages { get; set; } public bool ForceJuniorImages { get; set; }
public bool PendingJunior { get; set; } public bool PendingJunior { get; set; }
public bool HasBirthday { get; set; } public bool HasBirthday { get; set; }
} }
} }

View File

@@ -23,11 +23,20 @@ namespace start
Console.WriteLine("Discord: https://discord.gg/daC8QUhnFP" + Environment.NewLine); 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))) 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(); string readline = Console.ReadLine();
if (readline == "1") 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(); Console.Clear();
goto Settings; goto Settings;
@@ -69,7 +78,7 @@ namespace start
goto Start; goto Start;
} }
} }
if (readline == "2") if (readline == "3")
{ {
Console.Clear(); Console.Clear();
goto Profile; goto Profile;
@@ -152,7 +161,7 @@ namespace start
goto Start; goto Start;
} }
} }
if (readline == "3") if (readline == "4")
{ {
Console.WriteLine("Please select the version of RecRoom the server should host: (2017, 2018)"); Console.WriteLine("Please select the version of RecRoom the server should host: (2017, 2018)");
string readline2 = Console.ReadLine(); string readline2 = Console.ReadLine();

BIN
icon.ico

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB