Decompiled source of UltraCoins v1.0.7

plugins/Ultracoins/Ultracoins.dll

Decompiled 3 months ago
using System.Diagnostics;
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 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.7";
}
[BepInPlugin("ironfarm.uk.uc", "UltraCoins!", "1.0.7")]
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)
			{
				if (coinReady)
				{
					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;

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