Flip.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Flip")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Flip")]
[assembly: AssemblyTitle("Flip")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Flip;

[BepInPlugin("com.coolchair.flip", "Flip", "1.0.0")]
internal class Loader : BaseUnityPlugin
{
	internal static ConfigEntry<bool> en;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.coolchair.flip");
		val.PatchAll();
		en = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, (ConfigDescription)null);
	}
}
internal static class Data
{
	internal const string GUID = "com.coolchair.flip";

	internal const string Name = "Flip";

	internal const string Version = "1.0.0";
}
[HarmonyPatch(typeof(PlayerAvatar))]
internal class Patcher
{
	private static object getval(object o, string field)
	{
		FieldInfo field2 = o.GetType().GetField(field, BindingFlags.Instance | BindingFlags.NonPublic);
		return field2.GetValue(o);
	}

	[HarmonyPatch("OnPhotonSerializeView")]
	[HarmonyPrefix]
	private static bool OnPhotonSerializeView(PlayerAvatar __instance, PhotonStream stream, PhotonMessageInfo info)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		if (!SemiFunc.MasterAndOwnerOnlyRPC(info, __instance.photonView))
		{
			return false;
		}
		if (stream.IsWriting)
		{
			if (!Loader.en.Value)
			{
				return true;
			}
			stream.SendNext((object)(bool)getval(__instance, "isCrouching"));
			stream.SendNext((object)(bool)getval(__instance, "isSprinting"));
			stream.SendNext((object)(bool)getval(__instance, "isCrawling"));
			stream.SendNext((object)(bool)getval(__instance, "isSliding"));
			stream.SendNext((object)(bool)getval(__instance, "isMoving"));
			stream.SendNext((object)(bool)getval(__instance, "isGrounded"));
			stream.SendNext((object)(bool)getval(__instance, "Interact"));
			stream.SendNext((object)(Vector3)getval(__instance, "InputDirectionRaw"));
			stream.SendNext((object)(Vector3)getval(__instance, "rbVelocity"));
			stream.SendNext((object)(Vector3)getval(__instance, "rbVelocityRaw"));
			stream.SendNext((object)(((Component)PlayerController.instance).transform.position + new Vector3(0f, 1.7f, 0f)));
			Quaternion rotation = ((Component)PlayerController.instance).transform.rotation;
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			eulerAngles.z = 180f;
			((Quaternion)(ref rotation)).eulerAngles = eulerAngles;
			stream.SendNext((object)rotation);
			stream.SendNext((object)(bool)getval(__instance, "rotationDisabled"));
			stream.SendNext((object)(bool)getval(__instance, "rotationOverrideActive"));
			stream.SendNext((object)PlayerController.instance.CollisionGrounded.physRiding);
			stream.SendNext((object)PlayerController.instance.CollisionGrounded.physRidingID);
			stream.SendNext((object)PlayerController.instance.CollisionGrounded.physRidingPosition);
			stream.SendNext((object)false);
			stream.SendNext((object)(int)getval(__instance, "playerPing"));
			return false;
		}
		return true;
	}
}