Decompiled source of UltraCoins v1.0.6

plugins/Ultracoins/Ultracoins.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using PluginConfig.API;
using PluginConfig.API.Fields;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Ultracoins")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ultracoins")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9e04a71c-24d2-4cd7-b19b-0da76f660cc9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Ultracoins;

internal class PluginInfo
{
	public const string Name = "UltraCoins!";

	public const string GUID = "ironfarm.uk.uc";

	public const string Version = "1.0.6";
}
public static class ConfigManager
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static BoolValueChangeEventDelegate <>9__5_0;

		public static FloatValueChangeEventDelegate <>9__5_1;

		internal void <Setup>b__5_0(BoolValueChangeEvent e)
		{
			((ConfigField)spread).hidden = !e.value;
			((ConfigField)tossDelay).hidden = !e.value;
			((ConfigField)altSpam).hidden = !e.value;
		}

		internal void <Setup>b__5_1(FloatValueChangeEvent e)
		{
			UltraCoins.Revolver_Patch.coinReady = true;
		}
	}

	private static PluginConfigurator config;

	public static BoolField isEnabled;

	public static FloatField spread;

	public static FloatField tossDelay;

	public static BoolField altSpam;

	public static void Setup()
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Expected O, but got Unknown
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Expected O, but got Unknown
		config = PluginConfigurator.Create("UltraCoins!", "ironfarm.uk.uc");
		isEnabled = new BoolField(config.rootPanel, "Enable Ultracoins", "field.isenabled", true, true);
		spread = new FloatField(config.rootPanel, "Coin Spread", "field.spread", 5f, true);
		tossDelay = new FloatField(config.rootPanel, "Toss Delay", "field.tossdelay", 0f, true);
		altSpam = new BoolField(config.rootPanel, "Alt Instant Reload", "field.altspam", false, true);
		BoolField obj = isEnabled;
		object obj2 = <>c.<>9__5_0;
		if (obj2 == null)
		{
			BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent e)
			{
				((ConfigField)spread).hidden = !e.value;
				((ConfigField)tossDelay).hidden = !e.value;
				((ConfigField)altSpam).hidden = !e.value;
			};
			<>c.<>9__5_0 = val;
			obj2 = (object)val;
		}
		obj.onValueChange += (BoolValueChangeEventDelegate)obj2;
		FloatField obj3 = tossDelay;
		object obj4 = <>c.<>9__5_1;
		if (obj4 == null)
		{
			FloatValueChangeEventDelegate val2 = delegate
			{
				UltraCoins.Revolver_Patch.coinReady = true;
			};
			<>c.<>9__5_1 = val2;
			obj4 = (object)val2;
		}
		obj3.onValueChange += (FloatValueChangeEventDelegate)obj4;
		tossDelay.TriggerValueChangeEvent();
		isEnabled.TriggerValueChangeEvent();
		string text = Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Data"), "icon.png");
		config.SetIconWithURL("file://" + text);
	}
}
[BepInPlugin("ironfarm.uk.uc", "UltraCoins!", "1.0.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class UltraCoins : BaseUnityPlugin
{
	[HarmonyPatch]
	public static class Revolver_Patch
	{
		public static float coinWait = 0f;

		public static bool coinReady = true;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Revolver), "ThrowCoin")]
		public static bool patch_ThrowCoin(Revolver __instance)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_011a: 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)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigManager.isEnabled.value)
			{
				if (!coinReady)
				{
					return false;
				}
				float value = ConfigManager.spread.value;
				if ((Object)(object)__instance.punch == (Object)null || !((Component)__instance.punch).gameObject.activeInHierarchy)
				{
					__instance.punch = MonoSingleton<FistControl>.Instance.currentPunch;
				}
				if (Object.op_Implicit((Object)(object)__instance.punch) && !MonoSingleton<InputManager>.Instance.InputSource.Punch.IsPressed)
				{
					__instance.punch.CoinFlip();
				}
				GameObject obj = Object.Instantiate<GameObject>(__instance.coin, __instance.camObj.transform.position + __instance.camObj.transform.up * -0.5f, __instance.camObj.transform.rotation);
				obj.GetComponent<Coin>().sourceWeapon = __instance.gc.currentWeapon;
				MonoSingleton<RumbleManager>.Instance.SetVibration(RumbleProperties.CoinToss);
				Vector3 zero = Vector3.zero;
				obj.GetComponent<Rigidbody>().AddForce(__instance.camObj.transform.forward * (20f + Random.Range(0f - value, value)) + Vector3.up * 15f + __instance.camObj.transform.up * Random.Range(0f - value, value) + __instance.camObj.transform.right * Random.Range(0f - value, value) + (Object.op_Implicit((Object)(object)MonoSingleton<NewMovement>.Instance.ridingRocket) ? MonoSingleton<NewMovement>.Instance.ridingRocket.rb.velocity : MonoSingleton<NewMovement>.Instance.rb.velocity) + zero, (ForceMode)2);
				__instance.pierceCharge = 0f;
				__instance.pierceReady = false;
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Revolver), "Update")]
		public static void patch_CoinGatling(Revolver __instance)
		{
			if (!ConfigManager.isEnabled.value)
			{
				return;
			}
			if (coinWait > ConfigManager.tossDelay.value)
			{
				coinReady = true;
			}
			else
			{
				coinWait += Time.deltaTime;
			}
			if (MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed && !GameStateManager.Instance.PlayerInputLocked && __instance.gunVariation == 1)
			{
				if (coinReady)
				{
					coinWait -= ConfigManager.tossDelay.value;
					__instance.ThrowCoin();
					coinReady = false;
				}
				__instance.coinCharge = 399f;
				__instance.wc.rev1charge = 399f;
			}
		}

		[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
		[HarmonyPrefix]
		public static bool no(LeaderboardController __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
		[HarmonyPrefix]
		public static bool nope(LeaderboardController __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(LeaderboardController), "SubmitFishSize")]
		[HarmonyPrefix]
		public static bool notevenfish(LeaderboardController __instance)
		{
			return false;
		}

		[HarmonyPatch(typeof(Revolver), "InstaClick")]
		[HarmonyPostfix]
		public static void instaclicknochill(Revolver __instance)
		{
			__instance.gunReady = true;
			if (ConfigManager.altSpam.value && ConfigManager.isEnabled.value)
			{
				__instance.shootReady = true;
			}
		}
	}

	public void Start()
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Ding!!!!!!!!!!!!!!!!!!");
		ConfigManager.Setup();
		new Harmony("ironfarm.uk.uc").PatchAll();
	}
}