Initial commit

This commit is contained in:
2026-02-16 12:19:45 -05:00
commit 3b8f32c19b
10 changed files with 375 additions and 0 deletions

41
Patches/EventPatch.cs Normal file
View File

@@ -0,0 +1,41 @@
using ExitGames.Client.Photon;
using HarmonyLib;
using Newtonsoft.Json;
using Photon.Realtime;
using PhotonLogger.Core;
using System;
using System.Collections;
using System.IO;
using System.Reflection;
[HarmonyPatch]
public class OnEventPatch
{
[Serializable]
public class SerializableEventData
{
public byte Code { get; set; }
public NonAllocDictionary<byte, object> Parameters { get; set; }
}
static MethodInfo TargetMethod() => typeof(LoadBalancingClient).GetRuntimeMethod("OnEvent", [ typeof(EventData) ]);
static void Postfix(ref EventData photonEvent)
{
var newMsg = new Message
{
Time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
Type = MessageType.Event,
Data = new SerializableEventData
{
Code = photonEvent.Code,
Parameters = photonEvent.Parameters.paramDict
}
};
SocketProvider.Instance.Write(JsonConvert.SerializeObject(newMsg, Formatting.Indented, new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
}));
}
}