Decompiled source of UltraCoins v1.0.8

plugins/Ultracoins/Ultracoins.dll

Decompiled 6 days 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.Decorators;
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.8";
}
public static class ConfigManager
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static BoolValueChangeEventDelegate <>9__6_0;

		public static FloatValueChangeEventDelegate <>9__6_1;

		public static BoolValueChangeEventDelegate <>9__6_2;

		public static FloatValueChangeEventDelegate <>9__6_3;

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

		internal void <Setup>b__6_1(FloatValueChangeEvent e)
		{
			UltraCoins.spread = e.value;
		}

		internal void <Setup>b__6_2(BoolValueChangeEvent e)
		{
			UltraCoins.altSpam = e.value;
		}

		internal void <Setup>b__6_3(FloatValueChangeEvent e)
		{
			UltraCoins.tossDelay = e.value;
			UltraCoins.Revolver_Patch.coinReady = true;
			((ConfigField)tossNeg).hidden = !(e.value < 0f);
		}
	}

	private static PluginConfigurator config;

	public static BoolField isEnabled;

	public static FloatField spread;

	public static ConfigHeader tossNeg;

	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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Expected O, but got Unknown
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Expected O, but got Unknown
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Expected O, but got Unknown
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Expected O, but got Unknown
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: 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);
		tossNeg = new ConfigHeader(config.rootPanel, "<color=red>-1 = two coins per frame, -2 = three coins, etc.</color>", 15);
		tossDelay = new FloatField(config.rootPanel, "Toss Delay", "field.tossdelay", 0f, -100f, 100000f, true, true);
		altSpam = new BoolField(config.rootPanel, "Alt Instant Reload", "field.altspam", false, true);
		BoolField obj = isEnabled;
		object obj2 = <>c.<>9__6_0;
		if (obj2 == null)
		{
			BoolValueChangeEventDelegate val = delegate(BoolValueChangeEvent e)
			{
				((ConfigField)spread).hidden = !e.value;
				((ConfigField)tossDelay).hidden = !e.value;
				((ConfigField)altSpam).hidden = !e.value;
				UltraCoins.isEnabled = e.value;
			};
			<>c.<>9__6_0 = val;
			obj2 = (object)val;
		}
		obj.onValueChange += (BoolValueChangeEventDelegate)obj2;
		FloatField obj3 = spread;
		object obj4 = <>c.<>9__6_1;
		if (obj4 == null)
		{
			FloatValueChangeEventDelegate val2 = delegate(FloatValueChangeEvent e)
			{
				UltraCoins.spread = e.value;
			};
			<>c.<>9__6_1 = val2;
			obj4 = (object)val2;
		}
		obj3.onValueChange += (FloatValueChangeEventDelegate)obj4;
		BoolField obj5 = altSpam;
		object obj6 = <>c.<>9__6_2;
		if (obj6 == null)
		{
			BoolValueChangeEventDelegate val3 = delegate(BoolValueChangeEvent e)
			{
				UltraCoins.altSpam = e.value;
			};
			<>c.<>9__6_2 = val3;
			obj6 = (object)val3;
		}
		obj5.onValueChange += (BoolValueChangeEventDelegate)obj6;
		FloatField obj7 = tossDelay;
		object obj8 = <>c.<>9__6_3;
		if (obj8 == null)
		{
			FloatValueChangeEventDelegate val4 = delegate(FloatValueChangeEvent e)
			{
				UltraCoins.tossDelay = e.value;
				UltraCoins.Revolver_Patch.coinReady = true;
				((ConfigField)tossNeg).hidden = !(e.value < 0f);
			};
			<>c.<>9__6_3 = val4;
			obj8 = (object)val4;
		}
		obj7.onValueChange += (FloatValueChangeEventDelegate)obj8;
		tossDelay.TriggerValueChangeEvent();
		altSpam.TriggerValueChangeEvent();
		spread.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.8")]
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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: 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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
			if (isEnabled)
			{
				if (!coinReady)
				{
					return false;
				}
				float spread = UltraCoins.spread;
				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 - spread, spread)) + Vector3.up * 15f + __instance.camObj.transform.up * Random.Range(0f - spread, spread) + __instance.camObj.transform.right * Random.Range(0f - spread, spread) + (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 (!isEnabled)
			{
				return;
			}
			if (coinWait > tossDelay)
			{
				coinReady = true;
			}
			else
			{
				coinWait += Time.deltaTime;
			}
			if (!MonoSingleton<InputManager>.Instance.InputSource.Fire2.IsPressed || GameStateManager.Instance.PlayerInputLocked || __instance.gunVariation != 1)
			{
				return;
			}
			if (coinReady)
			{
				if (tossDelay < 0f)
				{
					coinsPerFrameCounter += tossDelay * -1f + 1f;
					while (coinsPerFrameCounter > 1f)
					{
						coinsPerFrameCounter -= 1f;
						__instance.ThrowCoin();
					}
				}
				else
				{
					coinWait -= tossDelay;
					__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 (altSpam && isEnabled)
			{
				__instance.shootReady = true;
			}
		}
	}

	public static float tossDelay = 0f;

	public static float spread = 5f;

	public static bool altSpam = true;

	public static bool isEnabled = true;

	private static float coinsPerFrameCounter = 0f;

	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();
	}
}