Decompiled source of Invisi Ray Mod v2.0.0

MyFirstBoplMod_invisi_ray.dll

Decompiled a day ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BoplFixedMath;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MyFirstBoplMod_invisi_ray")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyFirstBoplMod_invisi_ray")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("dedaeefc-49bb-47e2-80fb-388d8acb9b9c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MyFirstBoplMod_invisi_ray;

[BepInPlugin("com.YourUsername.InvisiRay", "Invisi-Ray Mod", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Dedicated Invisi-Ray (Blink Replacer) loaded!");
		Harmony val = new Harmony("com.YourUsername.InvisiRay");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(ShootQuantum), "BlinkObject")]
public class UniversalBlinkPatch
{
	private static bool Prefix(RaycastInformation __0)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__0.pp.fixTrans != (Object)null)
		{
			GameObject gameObject = ((Component)__0.pp.fixTrans).gameObject;
			InvisibilityCloak component = gameObject.GetComponent<InvisibilityCloak>();
			if ((Object)(object)component == (Object)null)
			{
				gameObject.AddComponent<InvisibilityCloak>();
			}
			else
			{
				component.timer = 0f;
			}
		}
		return false;
	}
}
public class InvisibilityCloak : MonoBehaviour
{
	public float timer = 0f;

	public float duration = 5f;

	private SpriteRenderer[] sprites;

	private Player player;

	private void Awake()
	{
		if (((Component)this).gameObject.layer == LayerMask.NameToLayer("Player"))
		{
			IPlayerIdHolder component = ((Component)this).GetComponent<IPlayerIdHolder>();
			if (component != null)
			{
				player = PlayerHandler.Get().GetPlayer(component.GetPlayerId());
			}
		}
		else
		{
			sprites = ((Component)this).GetComponentsInChildren<SpriteRenderer>(true);
		}
	}

	private void LateUpdate()
	{
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		timer += Time.deltaTime;
		bool flag = timer < duration;
		if (player != null)
		{
			if (flag)
			{
				player.isInvisible = true;
				player.timeSpentInvisible = Fix.Zero;
			}
			else
			{
				player.isInvisible = false;
				player.timeSpentInvisible = Fix.Zero;
			}
		}
		else if (flag)
		{
			if (sprites != null)
			{
				SpriteRenderer[] array = sprites;
				foreach (SpriteRenderer val in array)
				{
					if ((Object)(object)val != (Object)null)
					{
						((Renderer)val).enabled = false;
					}
				}
			}
		}
		else if (sprites != null)
		{
			SpriteRenderer[] array2 = sprites;
			foreach (SpriteRenderer val2 in array2)
			{
				if ((Object)(object)val2 != (Object)null)
				{
					((Renderer)val2).enabled = true;
				}
			}
		}
		if (!flag)
		{
			Object.Destroy((Object)(object)this);
		}
	}
}