Decompiled source of BetterFishing v1.0.0

On-Together_BetterFishing.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using PurrNet;
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("On-Together_SkipFishing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("On-Together_SkipFishing")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9abe18c1-a3ce-401f-aef8-4471ed01212b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("Wan7.OnTogether.BetterFishing", "BetterFishing", "1.0.0")]
public class AutoFishWin : BaseUnityPlugin
{
	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		new Harmony("Wan7.OnTogether.BetterFishing").PatchAll();
		Log.LogInfo((object)"[BetterFishing] Loaded");
	}
}
[HarmonyPatch(typeof(FishingManager), "StartMiniGame")]
internal static class Patch_FishingManager_StartMiniGame
{
	private static void Postfix(FishingManager __instance)
	{
		FieldInfo fieldInfo = AccessTools.Field(typeof(FishingManager), "_counter");
		if (!(fieldInfo == null))
		{
			fieldInfo.SetValue(__instance, 1);
		}
	}
}
[HarmonyPatch(typeof(FishingManager), "FishingCircleClick")]
internal static class Patch_FishingManager_FishingCircleClick
{
	private static bool Prefix(FishingManager __instance)
	{
		//IL_00a7: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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_00f2: 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_0101: 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_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: 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_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Expected I4, but got Unknown
		FieldInfo fieldInfo = AccessTools.Field(typeof(FishingManager), "_counter");
		if (fieldInfo == null)
		{
			return true;
		}
		int num = (int)fieldInfo.GetValue(__instance);
		if (num != 1)
		{
			return true;
		}
		AccessTools.Method(typeof(FishingManager), "CloseMiniGameUI", (Type[])null, (Type[])null)?.Invoke(__instance, null);
		fieldInfo.SetValue(__instance, 0);
		__instance.IsFishShow = true;
		CaughtFish val = (CaughtFish)(AccessTools.Field(typeof(FishingManager), "_currentFish")?.GetValue(__instance));
		FishRarityScale val2 = (FishRarityScale)(AccessTools.Field(typeof(FishingManager), "_rarityInfo")?.GetValue(__instance));
		TextChannelManager i = NetworkSingleton<TextChannelManager>.I;
		__instance.FishingCont.CatchFishRpc(val, val2, i.MainNetTransform, default(RPCInfo));
		__instance.FishingCont.CatchFishLocal(val, val2, MonoSingleton<EconomyManager>.I.AddFishTicket(val));
		MonoSingleton<FishingUIManager>.I.UpdateFishCatalogue((int)val2.FishRarity, val.FishIndex, val.Size, val.Source);
		MonoSingleton<SFXManager>.I.PlayFishSuccess();
		return false;
	}
}
[HarmonyPatch(typeof(FishingManager), "ButtonReleaseFish")]
internal static class Patch_ButtonReleaseFish
{
	private static bool Prefix(FishingManager __instance)
	{
		return true;
	}
}
[HarmonyPatch(typeof(FishingManager), "DetermineFish")]
internal static class Patch_DetermineFish_ForcedSize
{
	private static void Postfix(FishingManager __instance)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		FieldInfo fieldInfo = AccessTools.Field(typeof(FishingManager), "_currentFish");
		if (!(fieldInfo == null))
		{
			CaughtFish val = (CaughtFish)fieldInfo.GetValue(__instance);
			val.SizeRatio = (val.Size = Random.Range(1f, 1000f)) / 100f;
			fieldInfo.SetValue(__instance, val);
		}
	}
}
[HarmonyPatch(typeof(FishingManager), "Awake")]
internal class Patch_FishingRodRange
{
	private static void Postfix(FishingManager __instance)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		FishingRod fishingRodSettings = __instance.FishingRodSettings;
		if (!((object)(FishingRod)(ref fishingRodSettings)).Equals((object)default(FishingRod)))
		{
			fishingRodSettings.CastRange = 100f;
			FieldInfo fieldInfo = AccessTools.Field(typeof(FishingManager), "_castHorizontalSpeed");
			if (fieldInfo != null)
			{
				fieldInfo.SetValue(__instance, 20f);
			}
			AccessTools.Property(typeof(FishingManager), "FishingRodSettings").SetValue(__instance, fishingRodSettings);
		}
	}
}