This commit is contained in:
2026-02-16 15:53:20 -05:00
parent 3b8f32c19b
commit acbefc568c
4 changed files with 51 additions and 16 deletions

View File

@@ -4,8 +4,7 @@ using Newtonsoft.Json;
using Photon.Realtime;
using PhotonLogger.Core;
using System;
using System.Collections;
using System.IO;
using System.Collections.Generic;
using System.Reflection;
[HarmonyPatch]
@@ -15,21 +14,24 @@ public class OnEventPatch
public class SerializableEventData
{
public byte Code { get; set; }
public NonAllocDictionary<byte, object> Parameters { get; set; }
public Dictionary<byte, object> Parameters { get; set; }
}
static MethodInfo TargetMethod() => typeof(LoadBalancingClient).GetRuntimeMethod("OnEvent", [ typeof(EventData) ]);
static void Postfix(ref EventData photonEvent)
static void Postfix(ref EventData photonEvent, ref LoadBalancingClient __instance)
{
var newMsg = new Message
{
Time = DateTimeOffset.UtcNow.ToUnixTimeSeconds(),
Type = MessageType.Event,
Server = __instance.CurrentServerAddress,
Data = new SerializableEventData
{
Code = photonEvent.Code,
Parameters = photonEvent.Parameters.paramDict
Parameters = OperationNormalizer.NormalizeDictionaryValues(
new Dictionary<byte, object>(photonEvent.Parameters.paramDict)
)
}
};