Decompiled source of Skillfern Triforce Compat Fix v1.0.0

SkillfernTriforceCompatFix.dll

Decompiled 6 hours ago
using System.Reflection;
using BepInEx;
using Empress.REPO.Triforce;
using ExitGames.Client.Photon;
using HarmonyLib;
using SkillFern.Networking;

[assembly: AssemblyVersion("1.0.0.0")]
namespace Kiddley.SkillfernTriforceCompat;

[BepInPlugin("kiddley.sftrifix", "Skillfern-Triforce Compat Fix", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("kiddley.sftrifix").PatchAll();
	}
}
[HarmonyPatch(typeof(EmpressTriforcePlugin), "OnPhotonEvent")]
internal static class TriforceEventPatch
{
	[HarmonyPrefix]
	private static bool Prefix(EventData __0)
	{
		if (__0.Code != 187)
		{
			return true;
		}
		object[] obj = __0.CustomData as object[];
		if (obj != null && obj.Length == 4 && ((object[])__0.CustomData)[0] is int && ((object[])__0.CustomData)[1] is float && ((object[])__0.CustomData)[2] is float && ((object[])__0.CustomData)[3] is float)
		{
			return true;
		}
		return false;
	}
}
[HarmonyPatch(typeof(SkillNetworkSync), "OnEventReceived")]
internal static class SkillFernEventPatch
{
	[HarmonyPrefix]
	private static bool Prefix(EventData __0)
	{
		if (__0.Code != 187)
		{
			return true;
		}
		object[] obj = __0.CustomData as object[];
		if (obj != null)
		{
			if (obj.Length < 2 || !(((object[])__0.CustomData)[1] is string))
			{
				return false;
			}
			return true;
		}
		return false;
	}
}