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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Fishing;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("InstantHook")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("InstantHook")]
[assembly: AssemblyTitle("InstantHook")]
[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 InstantHook
{
[BepInPlugin("com.voodoofishin.instanthook", "Instant Hook", "2.0.0")]
public class Plugin : BasePlugin
{
public const string PluginGuid = "com.voodoofishin.instanthook";
public const string PluginName = "Instant Hook";
public const string PluginVersion = "2.0.0";
internal static ManualLogSource Logger;
internal static ConfigEntry<bool> Enabled;
internal static ConfigEntry<float> MinBiteDelay;
internal static ConfigEntry<float> MaxBiteDelay;
internal static ConfigEntry<bool> VerboseLogging;
public override void Load()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Expected O, but got Unknown
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
Enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch. When true, the random 'wait for a fish to bite' delay is removed.");
MinBiteDelay = ((BasePlugin)this).Config.Bind<float>("General", "MinBiteDelay", 0f, new ConfigDescription("Minimum seconds before a fish bites after your bobber lands. 0 = bites as soon as the game allows. The bite, hook-set and fight all stay normal.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
MaxBiteDelay = ((BasePlugin)this).Config.Bind<float>("General", "MaxBiteDelay", 0.1f, new ConfigDescription("Maximum seconds before a fish bites. Keep this at or just above MinBiteDelay. A tiny value like 0.1 is recommended over a hard 0 so the game's bite routine has one frame to set everything up.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>()));
VerboseLogging = ((BasePlugin)this).Config.Bind<bool>("Debug", "VerboseLogging", false, "Log when the bite delays are overridden.");
Harmony val = new Harmony("com.voodoofishin.instanthook");
bool flag = default(bool);
try
{
val.PatchAll();
ManualLogSource logger = Logger;
BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Instant Hook");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" v");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("2.0.0");
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded. Patches applied.");
}
logger.LogInfo(val2);
}
catch (Exception ex)
{
ManualLogSource logger2 = Logger;
BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed to apply Harmony patches: ");
((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Exception>(ex);
}
logger2.LogError(val3);
}
}
}
[HarmonyPatch(typeof(FishingManager), "Awake")]
internal static class FishingManagerPatch
{
[HarmonyPostfix]
private static void Postfix(FishingManager __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
try
{
if (Plugin.Enabled.Value)
{
Apply(__instance, "Awake");
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("InstantHook Awake postfix error: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogError(val);
}
}
internal static void Apply(FishingManager mgr, string where)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
if ((Object)(object)mgr == (Object)null)
{
return;
}
float value = Plugin.MinBiteDelay.Value;
float num = Plugin.MaxBiteDelay.Value;
if (num < value)
{
num = value;
}
mgr._minFishBiteDelay = value;
mgr._maxFishBiteDelay = num;
if (Plugin.VerboseLogging.Value)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(44, 3, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("InstantHook: bite delay set to [");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(value, "0.###");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("..");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num, "0.###");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]s (via ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(where);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(").");
}
logger.LogInfo(val);
}
}
}
[HarmonyPatch(typeof(FishingManager), "StartLookingForFishServerRpc")]
internal static class FishingManagerStartPatch
{
[HarmonyPrefix]
private static void Prefix(FishingManager __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
try
{
if (Plugin.Enabled.Value)
{
FishingManagerPatch.Apply(__instance, "StartLookingForFish");
}
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.Logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("InstantHook Start prefix error: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogError(val);
}
}
}
}