mirror of
https://github.com/recroom2016/OpenRec.git
synced 2026-04-22 13:25:51 +00:00
0.6.1
This commit is contained in:
223
APIServer.cs
223
APIServer.cs
@@ -30,7 +30,7 @@ namespace server
|
||||
{
|
||||
try
|
||||
{
|
||||
//2 different servers for 2 different stages of the game, the apis change so much idk anymore
|
||||
//2 different servers for 3 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 == "2016")
|
||||
{
|
||||
@@ -43,6 +43,8 @@ namespace server
|
||||
HttpListenerResponse response = context.Response;
|
||||
string rawUrl = request.RawUrl;
|
||||
string Url = "";
|
||||
bool image = false;
|
||||
byte[] imagebyte = null;
|
||||
if (rawUrl.StartsWith("/api/"))
|
||||
{
|
||||
Url = rawUrl.Remove(0, 5);
|
||||
@@ -86,9 +88,14 @@ namespace server
|
||||
{
|
||||
s = Amplitude.amplitude();
|
||||
}
|
||||
if (Url.StartsWith("players/v1/"))
|
||||
if (Url == "players/v1/getorcreate")
|
||||
{
|
||||
s = BracketResponse;
|
||||
s = getorcreate.GetOrCreate((ulong.Parse(text.Remove(0, 32).Remove(7, text.Length - 39))));
|
||||
}
|
||||
if (Url.StartsWith("images/v1/profile/"))
|
||||
{
|
||||
image = true;
|
||||
imagebyte = File.ReadAllBytes("SaveData\\profileimage.png");
|
||||
}
|
||||
if (Url == "avatar/v2")
|
||||
{
|
||||
@@ -141,11 +148,19 @@ namespace server
|
||||
s = Activities.Charades.words();
|
||||
}
|
||||
Console.WriteLine("API Response: " + s);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(s);
|
||||
byte[] bytes = null;
|
||||
if (image == true)
|
||||
{
|
||||
bytes = imagebyte;
|
||||
}
|
||||
else
|
||||
{
|
||||
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(20);
|
||||
outputStream.Close();
|
||||
this.listener.Stop();
|
||||
}
|
||||
@@ -293,7 +308,7 @@ namespace server
|
||||
response.ContentLength64 = (long)bytes.Length;
|
||||
Stream outputStream = response.OutputStream;
|
||||
outputStream.Write(bytes, 0, bytes.Length);
|
||||
Thread.Sleep(200);
|
||||
Thread.Sleep(20);
|
||||
outputStream.Close();
|
||||
this.listener.Stop();
|
||||
}
|
||||
@@ -459,9 +474,16 @@ namespace server
|
||||
s = BracketResponse;
|
||||
}
|
||||
if (Url == "avatar/v3/items")
|
||||
{
|
||||
if (CachedVersionMonth == 09)
|
||||
{
|
||||
s = File.ReadAllText("SaveData\\avataritems2.txt");
|
||||
}
|
||||
else
|
||||
{
|
||||
s = File.ReadAllText("SaveData\\avataritems.txt");
|
||||
}
|
||||
}
|
||||
if (Url == "equipment/v1/getUnlocked")
|
||||
{
|
||||
s = File.ReadAllText("SaveData\\equipment.txt");
|
||||
@@ -569,22 +591,22 @@ namespace server
|
||||
{
|
||||
s = BracketResponse; //JsonConvert.SerializeObject(c000099.m00000a(text));
|
||||
}
|
||||
if (Url.StartsWith("!rooms/v2/saveData"))
|
||||
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());
|
||||
//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")
|
||||
{
|
||||
@@ -601,6 +623,10 @@ namespace server
|
||||
if (Url.StartsWith("rooms/v2/instancedetails"))
|
||||
{
|
||||
s = BracketResponse;
|
||||
}
|
||||
if (Url.StartsWith("rooms/v2/search?value="))
|
||||
{
|
||||
s = CustomRooms.RoomSearch(Url.Remove(0, 22));
|
||||
}
|
||||
if (Url == "rooms/v4/details/29")
|
||||
{
|
||||
@@ -616,7 +642,7 @@ namespace server
|
||||
response.ContentLength64 = (long)bytes.Length;
|
||||
Stream outputStream = response.OutputStream;
|
||||
outputStream.Write(bytes, 0, bytes.Length);
|
||||
Thread.Sleep(50);
|
||||
Thread.Sleep(20);
|
||||
outputStream.Close();
|
||||
this.listener.Stop();
|
||||
|
||||
@@ -629,7 +655,7 @@ namespace server
|
||||
File.WriteAllText("crashdump.txt", Convert.ToString(ex4));
|
||||
}
|
||||
}
|
||||
public static ulong CachedPlayerID = 1;
|
||||
public static ulong CachedPlayerID = 9999999;
|
||||
public static ulong CachedPlatformID = 10000;
|
||||
public static int CachedVersionMonth = 01;
|
||||
|
||||
@@ -639,159 +665,12 @@ namespace server
|
||||
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 ImagesV2Named = "[{\"FriendlyImageName\":\"DormRoomBucket\",\"ImageName\":\"DormRoomBucket\",\"StartTime\":\"2021-12-27T21:27:38.1880175-08:00\",\"EndTime\":\"2025-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 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<byte> list = new List<byte>();
|
||||
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<byte> list2 = new List<byte>();
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace api
|
||||
|
||||
return JsonConvert.SerializeObject(new Config2
|
||||
{
|
||||
MessageOfTheDay = "Default MOTD",
|
||||
MessageOfTheDay = new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Update/motd.txt"),
|
||||
CdnBaseUri = "http://localhost:20182/",
|
||||
LevelProgressionMaps = new List<LevelProgressionEntry>
|
||||
{
|
||||
|
||||
@@ -23,12 +23,81 @@ namespace api
|
||||
File.WriteAllText("SaveData\\Rooms\\Downloaded\\cheercount.txt", Convert.ToString(root2.Stats.CheerCount));
|
||||
File.WriteAllText("SaveData\\Rooms\\Downloaded\\favcount.txt", Convert.ToString(root2.Stats.FavoriteCount));
|
||||
File.WriteAllText("SaveData\\Rooms\\Downloaded\\visitcount.txt", Convert.ToString(root2.Stats.VisitCount));
|
||||
ulong rand = Convert.ToUInt64(new Random().Next(0, 99));
|
||||
room = new Room
|
||||
{
|
||||
RoomId = 29,
|
||||
Name = root2.Name,
|
||||
Description = "OpenRec Downloaded Room",
|
||||
ImageName = root2.ImageName,
|
||||
CreatorPlayerId = Convert.ToUInt64(File.ReadAllText("SaveData\\Profile\\userid.txt")),
|
||||
State = 0,
|
||||
Accessibility = 1,
|
||||
SupportsLevelVoting = false,
|
||||
IsAGRoom = false,
|
||||
CloningAllowed = false,
|
||||
SupportsScreens = true,
|
||||
SupportsWalkVR = true,
|
||||
SupportsTeleportVR = true,
|
||||
ReplicationId = null,
|
||||
ReleaseStatus = 0
|
||||
|
||||
};
|
||||
scene = new List<Scene>
|
||||
{
|
||||
new Scene()
|
||||
{
|
||||
RoomSceneId = 1,
|
||||
RoomId = 29,
|
||||
RoomSceneLocationId = root2.SubRooms[0].UnitySceneId,
|
||||
Name = "Home",
|
||||
IsSandbox = true,
|
||||
DataBlobName = root2.SubRooms[0].DataBlob,
|
||||
MaxPlayers = 20,
|
||||
CanMatchmakeInto = true,
|
||||
DataModifiedAt = root2.SubRooms[0].DataSavedAt,
|
||||
ReplicationId = null,
|
||||
UseLevelBasedMatchmaking = false,
|
||||
UseAgeBasedMatchmaking = false,
|
||||
UseRecRoyaleMatchmaking = false,
|
||||
ReleaseStatus = 0,
|
||||
SupportsJoinInProgress = true
|
||||
}
|
||||
};
|
||||
root = new Root
|
||||
{
|
||||
Room = room,
|
||||
Scenes = scene,
|
||||
CoOwners = new List<ulong>(),
|
||||
InvitedCoOwners = new List<ulong>(),
|
||||
Hosts = new List<ulong>(),
|
||||
InvitedHosts = new List<ulong>(),
|
||||
CheerCount = root2.Stats.CheerCount,
|
||||
FavoriteCount = root2.Stats.FavoriteCount,
|
||||
VisitCount = root2.Stats.VisitCount,
|
||||
Tags = new List<aTag>
|
||||
{
|
||||
new aTag()
|
||||
{
|
||||
Tag = "rro",
|
||||
Type = 2
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
File.WriteAllText("SaveData\\Rooms\\Downloaded\\RoomDetails.json", JsonConvert.SerializeObject(root));
|
||||
}
|
||||
|
||||
public static string RoomSearch(string roomnames)
|
||||
{
|
||||
try
|
||||
{
|
||||
string webdata = new WebClient().DownloadString("https://rooms.rec.net/rooms?name=" + roomnames + "&include=297");
|
||||
ModernRooms.Root root2 = JsonConvert.DeserializeObject<ModernRooms.Root>(webdata);
|
||||
room = new Room
|
||||
{
|
||||
RoomId = root2.RoomId,
|
||||
Name = root2.Name,
|
||||
Description = "OpenRec Downloaded Room",
|
||||
Description = root2.Description,
|
||||
ImageName = root2.ImageName,
|
||||
CreatorPlayerId = APIServer.CachedPlayerID,
|
||||
State = 0,
|
||||
@@ -83,11 +152,14 @@ namespace api
|
||||
Type = 2
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
File.WriteAllText("SaveData\\Rooms\\Downloaded\\RoomDetails.json", JsonConvert.SerializeObject(root));
|
||||
return JsonConvert.SerializeObject(room);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static Room room { get; set; }
|
||||
public static List<Scene> scene { get; set; }
|
||||
public static Root root { get; set; }
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace gamesesh
|
||||
{
|
||||
return JsonConvert.SerializeObject(new GameSessions.PlayerStatus
|
||||
{
|
||||
PlayerId = APIServer.CachedPlayerID,
|
||||
PlayerId = Convert.ToUInt64(File.ReadAllText("SaveData\\Profile\\userid.txt")),
|
||||
IsOnline = true,
|
||||
InScreenMode = false,
|
||||
GameSession = Config.localGameSession
|
||||
@@ -110,7 +110,7 @@ namespace gamesesh
|
||||
{
|
||||
return new GameSessions.PlayerStatus
|
||||
{
|
||||
PlayerId = APIServer.CachedPlayerID,
|
||||
PlayerId = Convert.ToUInt64(File.ReadAllText("SaveData\\Profile\\userid.txt")),
|
||||
IsOnline = true,
|
||||
InScreenMode = false,
|
||||
GameSession = Config.localGameSession
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace start
|
||||
}
|
||||
}
|
||||
public static string version = "";
|
||||
public static string appversion = "0.6.0";
|
||||
public static string appversion = "0.6.1";
|
||||
public static bool bannedflag = false;
|
||||
}
|
||||
|
||||
|
||||
4
Setup.cs
4
Setup.cs
@@ -30,6 +30,10 @@ namespace start
|
||||
{
|
||||
File.WriteAllText("SaveData\\avataritems.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/avataritems.txt"));
|
||||
}
|
||||
if (!(File.Exists("SaveData\\avataritems2.txt")))
|
||||
{
|
||||
File.WriteAllText("SaveData\\avataritems2.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/avataritems2.txt"));
|
||||
}
|
||||
if (!(File.Exists("SaveData\\equipment.txt")))
|
||||
{
|
||||
File.WriteAllText("SaveData\\equipment.txt", new WebClient().DownloadString("https://raw.githubusercontent.com/recroom2016/OpenRec/master/Download/equipment.txt"));
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using server;
|
||||
using System.IO;
|
||||
|
||||
namespace vaultgamesesh
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace vaultgamesesh
|
||||
}
|
||||
return new c000020.c000022
|
||||
{
|
||||
PlayerId = APIServer.CachedPlayerID,
|
||||
PlayerId = Convert.ToUInt64(File.ReadAllText("SaveData\\Profile\\userid.txt")),
|
||||
IsOnline = true,
|
||||
PlayerType = 2,
|
||||
GameSession = gameSession
|
||||
|
||||
Reference in New Issue
Block a user