Decompiled source of FishingAnywhere OnToWC v1.0.1

plugins/FishingAnywherePlNESOTWC.dll

Decompiled 7 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClassLibrary1fishhhhh")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1fishhhhh")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("64e74615-901c-4c38-bc28-47bd919e1a2e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.test.Fish", "testfish", "1.0.0")]
public class ONTCFISHMOD : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("com.testfish.anywheremods").PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"test fish Mods loaded!");
	}
}
[HarmonyPatch(typeof(TaskManager), "IsReadyForFishing")]
public class PatchOTWCReadyForFishing
{
	[HarmonyPostfix]
	private static void Postfix(ref bool __result)
	{
		if (NetworkSingleton<BasketBallManager>.I.IsInBasketBallCourt)
		{
			__result = false;
		}
		else
		{
			__result = true;
		}
	}
}
[HarmonyPatch(typeof(PlayerMovementController), "get_IsInWater")]
public class OTWCPatchIsInWater
{
	[HarmonyPostfix]
	private static void Postfix(ref bool __result)
	{
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive)
		{
			__result = false;
		}
	}
}
[HarmonyPatch(typeof(PlayerMovementController), "get_MovementState")]
public class OTWCPatchMovementStateForFocusFishing
{
	[HarmonyPostfix]
	private static void Postfix(ref MovementState __result)
	{
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive && NetworkSingleton<TextChannelManager>.I.MainFocusController.IsFocus)
		{
			__result = (MovementState)0;
		}
	}
}
[HarmonyPatch(typeof(PlayerMovementController), "get_GroundState")]
public class OTWCPatchGroundStateForFocusFishing
{
	[HarmonyPostfix]
	private static void Postfix(ref GroundState __result)
	{
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive && NetworkSingleton<TextChannelManager>.I.MainFocusController.IsFocus)
		{
			__result = (GroundState)0;
		}
	}
}
[HarmonyPatch(typeof(PlayerMovementController), "get_GroundState")]
public class OTWCPatchGroundStateForFishing
{
	[HarmonyPostfix]
	private static void Postfix(ref GroundState __result)
	{
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive)
		{
			__result = (GroundState)0;
		}
	}
}
[HarmonyPatch(typeof(PlayerMovementController), "get_MovementState")]
public class PatchMovementStateForFishing
{
	[HarmonyPostfix]
	private static void Postfix(ref MovementState __result)
	{
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive)
		{
			__result = (MovementState)0;
		}
	}
}
[HarmonyPatch(typeof(TaskManager), "IsReadyForContinueFishing")]
public class PatchReadyForContinueFishing
{
	[HarmonyPostfix]
	private static void Postfix(ref bool __result)
	{
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive)
		{
			__result = true;
		}
	}
}
[HarmonyPatch(typeof(InputManager), "MouseUIObject")]
public class PatchMouseUIObject
{
	[HarmonyPatch(typeof(PlayerMovementController), "CheckSwim")]
	public class PatchCheckSwim
	{
		private static readonly FieldInfo IsInWaterField = AccessTools.Field(typeof(PlayerMovementController), "<IsInWater>k__BackingField");

		private static readonly FieldInfo IsSwimField = AccessTools.Field(typeof(PlayerMovementController), "<IsSwim>k__BackingField");

		private static readonly FieldInfo IsLakeField = AccessTools.Field(typeof(PlayerMovementController), "<IsLake>k__BackingField");

		[HarmonyPostfix]
		private static void Postfix(PlayerMovementController __instance)
		{
			if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive)
			{
				IsInWaterField.SetValue(__instance, false);
				IsSwimField.SetValue(__instance, false);
				IsLakeField.SetValue(__instance, false);
			}
		}
	}

	[HarmonyPostfix]
	private static void Postfix(ref GameObject __result)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Invalid comparison between Unknown and I4
		if ((Object)(object)MonoSingleton<FishingManager>.I != (Object)null && MonoSingleton<FishingManager>.I.IsActive && (int)MonoSingleton<FishingManager>.I.FishingState == 0)
		{
			__result = null;
		}
	}
}
[HarmonyPatch(typeof(FishingManager), "CastingRay")]
public class PatchCastingRay
{
	[HarmonyPostfix]
	private static void Postfix(ref bool __result)
	{
		__result = true;
	}
}
[HarmonyPatch(typeof(FishingManager), "Update")]
public class PatchFishingUpdate
{
	private static readonly FieldInfo IsWaterField = AccessTools.Field(typeof(FishingManager), "_isWater");

	private static readonly FieldInfo ReelSpeedField = AccessTools.Field(typeof(FishingManager), "_reelSpeed");

	private static readonly FieldInfo CollisionLayersField = AccessTools.Field(typeof(FishingManager), "_collisionLayers");

	private static readonly FieldInfo IsWaitReelingField = AccessTools.Field(typeof(FishingManager), "_isWaitReeling");

	private static readonly FieldInfo FishingStateField = AccessTools.Field(typeof(FishingManager), "<FishingState>k__BackingField");

	private static bool _reelHandled = false;

	[HarmonyPrefix]
	private static void Prefix(FishingManager __instance)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Invalid comparison between Unknown and I4
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: 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_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		IsWaterField.SetValue(__instance, true);
		_reelHandled = false;
		if ((int)__instance.FishingState != 2 || (Object)(object)__instance.FishingCont == (Object)null || __instance.FishingCont.CastingRod || __instance.FishingCont.GetAlert() || !MonoSingleton<InputManager>.I.IsMouseButton0)
		{
			return;
		}
		Vector3 position = __instance.FishingCont.FishHook.position;
		Vector3 val = NetworkSingleton<TextChannelManager>.I.MainPlayer.position - position;
		val.y = 0f;
		float magnitude = ((Vector3)(ref val)).magnitude;
		if (magnitude < ScriptableSingleton<FishingSettings>.I.HookReelDistanceCancel)
		{
			__instance.CancelFishing();
			return;
		}
		float num = (float)ReelSpeedField.GetValue(__instance);
		position += val / magnitude * (num * Time.deltaTime);
		if (!(bool)IsWaitReelingField.GetValue(__instance))
		{
			__instance.FishingCont.ReelFish(__instance.FishingCont);
			IsWaitReelingField.SetValue(__instance, true);
		}
		LayerMask val2 = (LayerMask)CollisionLayersField.GetValue(__instance);
		RaycastHit val3 = default(RaycastHit);
		RaycastHit val4 = default(RaycastHit);
		if (Physics.Raycast(position + Vector3.up * 80f, Vector3.down, ref val3, 100f, LayerMask.op_Implicit(val2)))
		{
			position.y = ((RaycastHit)(ref val3)).point.y;
			__instance.FishingCont.SetFishHookPos(position, __instance.FishingCont);
		}
		else if (Physics.Raycast(position + Vector3.up * 80f, Vector3.down, ref val4, 100f))
		{
			position.y = ((RaycastHit)(ref val4)).point.y;
			__instance.FishingCont.SetFishHookPos(position, __instance.FishingCont);
		}
		FishingStateField.SetValue(__instance, (object)(FishingState)99);
		_reelHandled = true;
	}

	[HarmonyPostfix]
	private static void Postfix(FishingManager __instance)
	{
		if (_reelHandled)
		{
			FishingStateField.SetValue(__instance, (object)(FishingState)2);
		}
	}
}
namespace ClassLibrary1fishhhhh;

public class Class1
{
}