Files
OpenRec-Launcher/Websocketapi/Notification.cs
recroom2016tutorial e95084d5fe Add project files.
2022-06-11 21:42:46 -04:00

93 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using OpenRec2.Serverapi;
namespace OpenRec2.Websocketapi
{
// Token: 0x0200002A RID: 42
public class Notification
{
// Token: 0x0600010B RID: 267
public static string ProcessRequest(string jsonData)
{
Dictionary<string, object> dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonData);
string result;
if (dictionary.ContainsKey("api"))
{
string text = (string)dictionary["api"];
string text2 = text;
if (text2 != null)
{
if (text2 == "playerSubscriptions/v1/update")
{
Console.WriteLine("[WSS] Game client sent presence update.");
return JsonConvert.SerializeObject(Notification.Reponse.createResponse(12, GameSessions.StatusSessionInstance()));
}
if (text2 == "heartbeat2")
{
Console.WriteLine("[WSS] Heartbeat 2 sent by game client.");
return JsonConvert.SerializeObject(Notification.Reponse.createResponse(4, GameSessions.StatusSessionInstance()));
}
}
Console.WriteLine("[WSS] Unknown API call: " + text);
result = "";
}
else
{
result = jsonData;
}
return result;
}
// Token: 0x0200002B RID: 43
public enum ResponseResults
{
RelationshipChanged = 1,
MessageReceived,
MessageDeleted,
PresenceHeartbeatResponse,
SubscriptionListUpdated = 9,
SubscriptionUpdateProfile = 11,
SubscriptionUpdatePresence,
SubscriptionUpdateGameSession,
SubscriptionUpdateRoom = 15,
ModerationQuitGame = 20,
ModerationUpdateRequired,
ModerationKick,
ModerationKickAttemptFailed,
ServerMaintenance = 25,
GiftPackageReceived = 30,
ProfileJuniorStatusUpdate = 40,
RelationshipsInvalid = 50,
StorefrontBalanceAdd = 60,
ConsumableMappingAdded = 70,
ConsumableMappingRemoved,
PlayerEventCreated = 80,
PlayerEventUpdated,
PlayerEventDeleted,
PlayerEventResponseChanged,
PlayerEventResponseDeleted,
PlayerEventStateChanged,
ChatMessageReceived = 90
}
public class Reponse
{
public int Id { get; set; }
public object Msg { get; set; }
public static Notification.Reponse createResponse(int id, object msg)
{
return new Notification.Reponse
{
Id = id,
Msg = msg
};
}
}
}
}