Decompiled source of JumpstartScreenFix v1.0.1

JumpstartScreenFix.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("JumpstartScreenFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JumpstartScreenFix")]
[assembly: AssemblyTitle("JumpstartScreenFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
public class ColourBlindGetWithHslStuff : MonoBehaviour
{
	public float hMult = 1f;

	public float sMult = 1f;

	public float lMult = 1f;

	private Image _img;

	private Light _lit;

	private SpriteRenderer _sr;

	private TMP_Text _txt;

	private bool _gotTarget;

	public int variationNumber;

	public bool customColorRenderer;

	private Renderer _rend;

	private MaterialPropertyBlock _block;

	private void Start()
	{
		UpdateColor();
	}

	private void OnEnable()
	{
		UpdateColor();
	}

	public void UpdateColor()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		if (!_gotTarget)
		{
			GetTarget();
		}
		Color val = MonoSingleton<ColorBlindSettings>.Instance.variationColors[variationNumber];
		float num = default(float);
		float num2 = default(float);
		float num3 = default(float);
		Color.RGBToHSV(val, ref num, ref num2, ref num3);
		val = Color.HSVToRGB(num * hMult, num2 * sMult, num3 * lMult);
		if (Object.op_Implicit((Object)(object)_rend))
		{
			_rend.GetPropertyBlock(_block);
			_block.SetColor("_CustomColor1", val);
			_rend.SetPropertyBlock(_block);
			return;
		}
		if (Object.op_Implicit((Object)(object)_img))
		{
			((Graphic)_img).color = val;
		}
		if (Object.op_Implicit((Object)(object)_txt))
		{
			((Graphic)_txt).color = val;
		}
		if (Object.op_Implicit((Object)(object)_lit))
		{
			_lit.color = val;
		}
		if (Object.op_Implicit((Object)(object)_sr))
		{
			_sr.color = val;
		}
	}

	private void GetTarget()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		_gotTarget = true;
		if (customColorRenderer)
		{
			_rend = ((Component)this).GetComponent<Renderer>();
			_block = new MaterialPropertyBlock();
		}
		_img = ((Component)this).GetComponent<Image>();
		_txt = ((Component)this).GetComponent<TMP_Text>();
		_lit = ((Component)this).GetComponent<Light>();
		_sr = ((Component)this).GetComponent<SpriteRenderer>();
	}
}
namespace JumpstartScreenFix
{
	[HarmonyPatch]
	[BepInPlugin("bobot.jumpstartscreenfix", "Jumpstart Screen Fix", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "bobot.jumpstartscreenfix";

		private static Harmony _harmony;

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_harmony = new Harmony("bobot.jumpstartscreenfix");
			_harmony.PatchAll();
		}

		[HarmonyPatch(typeof(Nailgun), "Start")]
		[HarmonyPostfix]
		private static void NailgunStart(Nailgun __instance)
		{
			if (__instance != null && __instance.variation == 2)
			{
				Slider zapMeter = __instance.zapMeter;
				object obj;
				if (zapMeter == null)
				{
					obj = null;
				}
				else
				{
					Transform obj2 = ((Component)zapMeter).transform.Find("Background");
					obj = ((obj2 != null) ? ((Component)obj2).gameObject.AddComponent<ColorBlindGet>() : null);
				}
				ColorBlindGet val = (ColorBlindGet)obj;
				RectTransform handleRect = __instance.distanceMeter.handleRect;
				ColorBlindGet val2 = ((handleRect != null) ? ((Component)handleRect).gameObject.AddComponent<ColorBlindGet>() : null);
				RectTransform fillRect = __instance.distanceMeter.fillRect;
				ColourBlindGetWithHslStuff colourBlindGetWithHslStuff = ((fillRect != null) ? ((Component)fillRect).gameObject.AddComponent<ColourBlindGetWithHslStuff>() : null);
				Transform obj3 = ((Component)__instance.distanceMeter).transform.Find("Handle (3)");
				ColourBlindGetWithHslStuff colourBlindGetWithHslStuff2 = ((obj3 != null) ? ((Component)obj3).gameObject.AddComponent<ColourBlindGetWithHslStuff>() : null);
				Transform obj4 = ((Component)__instance.distanceMeter).transform.Find("Handle (2)");
				ColourBlindGetWithHslStuff colourBlindGetWithHslStuff3 = ((obj4 != null) ? ((Component)obj4).gameObject.AddComponent<ColourBlindGetWithHslStuff>() : null);
				val.variationColor = true;
				val.variationNumber = 2;
				val2.variationColor = true;
				val2.variationNumber = 2;
				colourBlindGetWithHslStuff.variationNumber = 2;
				colourBlindGetWithHslStuff.lMult = 0.5f;
				colourBlindGetWithHslStuff2.variationNumber = 2;
				colourBlindGetWithHslStuff2.lMult = 0.4f;
				colourBlindGetWithHslStuff3.variationNumber = 2;
				colourBlindGetWithHslStuff3.lMult = 0.4f;
				colourBlindGetWithHslStuff3.sMult = 0.5f;
			}
		}

		[HarmonyPatch(typeof(Nailgun), "UpdateZapHud")]
		[HarmonyPostfix]
		private static void NailgunUpdateZapHud(Nailgun __instance)
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)__instance.currentZapper))
			{
				if (__instance.currentZapper.distance > __instance.currentZapper.maxDistance || __instance.currentZapper.raycastBlocked)
				{
					((Behaviour)__instance.warningX).enabled = true;
					((Graphic)__instance.warningX).color = ((__instance.currentZapper.breakTimer % 0.1f > 0.05f) ? MonoSingleton<ColorBlindSettings>.Instance.variationColors[2] : Color.white);
					__instance.distanceMeter.value = 1f;
					__instance.statusText.text = (__instance.currentZapper.raycastBlocked ? "BLOCKED" : (__instance.altVersion ? "TOO FAR" : "OUT OF RANGE"));
					((Graphic)__instance.statusText).color = MonoSingleton<ColorBlindSettings>.Instance.variationColors[2];
				}
				else
				{
					((Graphic)__instance.statusText).color = Color.Lerp(MonoSingleton<ColorBlindSettings>.Instance.variationColors[2], Color.white, (__instance.currentZapper.maxDistance - __instance.currentZapper.distance) / __instance.currentZapper.maxDistance);
				}
			}
		}
	}
}