Decompiled source of officerballs FishingTweaks v1.0.0

BepInEx/plugins/officerballs/officerballs.FishingTweaks.dll

Decompiled 16 hours 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 BepInEx.Logging;
using FishingTweaks.patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("officerballs.FishingTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("officerballs.FishingTweaks")]
[assembly: AssemblyTitle("officerballs.FishingTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FishingTweaks
{
	[BepInPlugin("officerballs.FishingTweaks", "Fishing Tweaks", "1.0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "officerballs.FishingTweaks";

		public const string modName = "Fishing Tweaks";

		public const string modVersion = "1.0.0.0";

		private Harmony harmony = new Harmony("officerballs.FishingTweaks");

		public ManualLogSource mls = Logger.CreateLogSource("officerballs.FishingTweaks");

		private void Awake()
		{
			mls.LogInfo((object)"Fishing tweaked.");
			harmony.PatchAll(typeof(FishingPatch));
			harmony.PatchAll(typeof(FishingPatch2));
			harmony.PatchAll(typeof(GroundCheckPatch));
		}
	}
}
namespace FishingTweaks.patches
{
	[HarmonyPatch(typeof(FishingManager))]
	internal class FishingPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void FishingTweaks(ref float ____catchWait)
		{
			____catchWait = 60f;
		}

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void UpdateTweak()
		{
			if (MonoSingleton<InputManager>.I.IsMouseButton0Down)
			{
				NetworkSingleton<TextChannelManager>.I.MainMovementController.GroundState = (GroundState)0;
				NetworkSingleton<TextChannelManager>.I.MainMovementController.MovementState = (MovementState)0;
			}
		}
	}
	[HarmonyPatch(typeof(TaskManager))]
	internal class FishingPatch2
	{
		[HarmonyPatch("IsReadyForFishing")]
		public static void Postfix(ref bool __result)
		{
			__result = true;
		}
	}
	[HarmonyPatch(typeof(IsGroundedChecker))]
	internal class GroundCheckPatch
	{
		[HarmonyPatch("FixedUpdate")]
		[HarmonyPrefix]
		public static bool GroundPatch(IsGroundedChecker __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			if ((int)MonoSingleton<FishingManager>.I.FishingState == 1 || (int)MonoSingleton<FishingManager>.I.FishingState == 2 || (int)MonoSingleton<FishingManager>.I.FishingState == 3)
			{
				__instance.IsGrounded = true;
				return false;
			}
			return true;
		}
	}
}