Decompiled source of MyFishingGuide v0.11.22

JayBirdMyFishingGuide.dll

Decompiled 17 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 JayBirdMyFishingGuide
{
	[BepInPlugin("jaybird.myfishingguide", "My Fishing Guide", "0.11.22")]
	public class Plugin : BaseUnityPlugin
	{
		private class Entry
		{
			public string name;

			public string bait;

			public float distance;

			public Sprite icon;

			public int count;

			public string direction;
		}

		private ConfigEntry<float> refresh;

		private ConfigEntry<float> boatRange;

		private ConfigEntry<float> boatRefresh;

		private ConfigEntry<float> boatAlertCooldown;

		private ConfigEntry<float> scale;

		private ConfigEntry<float> mapRightInset;

		private ConfigEntry<float> topOffset;

		private ConfigEntry<float> panelWidth;

		private ConfigEntry<float> savedX;

		private ConfigEntry<float> savedY;

		private ConfigEntry<float> catchDuration;

		private ConfigEntry<bool> darkBackdropEnabled;

		private ConfigEntry<float> darkBackdropOpacity;

		private float lastGuidePanelHeight = 300f;

		private ConfigEntry<KeyboardShortcut> editKey;

		private bool editMode;

		private bool dragging;

		private bool oldCursorVisible;

		private CursorLockMode oldCursorLock;

		private Vector2 dragOffset;

		private readonly Dictionary<string, int> lastFishCounts = new Dictionary<string, int>();

		private bool catchBaselineReady;

		private string catchText;

		private float catchTextUntil;

		private int catchSayingsIndex;

		private bool rodPreviouslyEquipped;

		private ConfigEntry<int> maxRows;

		private ConfigEntry<int> titleFont;

		private ConfigEntry<int> fishFont;

		private ConfigEntry<int> boatMinFish;

		private ConfigEntry<bool> showUnknown;

		private readonly List<Entry> nearby = new List<Entry>();

		private readonly List<Entry> wildlife = new List<Entry>();

		private readonly List<Entry> seaAnimalsWildlife = new List<Entry>();

		private readonly List<Entry> seaAnimalsThreats = new List<Entry>();

		private float nextScan;

		private string currentBiome = "Meadows";

		private bool serpentNearby;

		private bool bonemawNearby;

		private bool aboardShipForWarnings;

		private ConfigEntry<bool> showSeaThreatWarnings;

		private GUIStyle threatTitleStyle;

		private GUIStyle threatDetailStyle;

		private GUIStyle wildlifeCautionStyle;

		private static readonly HashSet<string> SeaThreatPrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
		{
			"Shark", "GreatWhiteShark", "HammerheadShark", "Megalodon", "MurkPod", "BoneFish", "BoneSquid", "LuminousLooker", "Squid", "Reptile",
			"ReptileWanderer", "MirLizard", "MirRake", "Belzor"
		};

		private static readonly HashSet<string> SeaThreatNames = new HashSet<string>(SeaThreatPrefabs.Select(DisplayCreatureName), StringComparer.OrdinalIgnoreCase);

		private string selectedBait;

		private bool rtDOceanLoaded;

		private bool seaAnimalsLoaded;

		private ConfigEntry<bool> enableSeaAnimals;

		private ConfigEntry<float> adviceCycle;

		private Type fishType;

		private GUIStyle headerStyle;

		private GUIStyle rowStyle;

		private GUIStyle baitStyle;

		private GUIStyle iconStyle;

		private GUIStyle actionStyle;

		private GUIStyle spiritStyle;

		private GUIStyle rangeStyle;

		private GUIStyle celebrationStyle;

		private bool guideOwnsCursor;

		private string lastIconBait;

		private Sprite cachedBaitIcon;

		private static readonly BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private bool warned;

		private bool boatMode;

		private Transform boatTransform;

		private string scoutMessage;

		private string lastScoutKey;

		private float lastScoutAnnouncement = -999f;

		private readonly Dictionary<string, int> boatLastCounts = new Dictionary<string, int>();

		private static readonly HashSet<string> RtDWildlife = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
		{
			"Cod", "Crab", "Dolphin", "GreatWhiteShark", "HammerheadShark", "HumpbackWhale", "Manta", "Marlin", "Orca", "SpermWhale",
			"Squid", "Tuna", "Turtle", "Shark", "Megalodon", "MurkPod", "BoneFish", "BoneSquid", "LuminousLooker", "CatFish",
			"CatFishWanderer", "Reptile", "ReptileWanderer", "MirLizard", "MirRake", "Belzor"
		};

		private static readonly Dictionary<string, string> SeaAnimalsPrefabs = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
		{
			{ "SA_Orca", "Orca" },
			{ "SA_Dolphin", "Dolphin" },
			{ "SA_Crocodile", "Crocodile" },
			{ "SA_WhiteShark", "White Shark" },
			{ "SA_BlueShark", "Blue Shark" },
			{ "SA_HammerHeadShark", "Hammerhead Shark" },
			{ "SA_TigerShark", "Tiger Shark" },
			{ "SA_WhaleShark", "Whale Shark" },
			{ "SA_RightWhale", "Right Whale" },
			{ "SA_HumboldtSquid", "Humboldt Squid" },
			{ "SA_LeatherbackSeaTurtle", "Leatherback Sea Turtle" },
			{ "SA_BlueTurtle", "Blue Turtle" },
			{ "SA_GreenTurtle", "Green Turtle" },
			{ "SA_RedTurtle", "Red Turtle" },
			{ "SA_YellowTurtle", "Yellow Turtle" }
		};

		private static readonly HashSet<string> SeaAnimalsBoatThreatPrefabs = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "SA_Crocodile", "SA_WhiteShark", "SA_BlueShark", "SA_HammerHeadShark", "SA_TigerShark", "SA_HumboldtSquid" };

		private const float FishingRodRangeMeters = 25f;

		private Harmony audioHarmony;

		private ConfigEntry<bool> audioEnabled;

		private ConfigEntry<bool> audioDiagnostics;

		private AudioClip catchClip;

		private ConfigEntry<float> biteVolume;

		private ConfigEntry<float> splashVolume;

		private AudioSource audioOneShot;

		private AudioClip biteClip;

		private AudioClip hookClip;

		private AudioClip splashClip;

		private object trackedHookedFish;

		private float lastHookAt = -100f;

		private bool fighting;

		private float nextAudioProbe;

		private float nextHookProbe;

		private const float HookProbeInterval = 0.5f;

		private const float StruggleProbeInterval = 0.75f;

		private bool loggedMissingLocalFloat;

		private float lastBiteAt = -100f;

		private float lastSplashAt = -100f;

		private float lastFightAt = -100f;

		private static Plugin audioInstance;

		private string preferredBait;

		private float preferredBaitChangedAt = -100f;

		private float lastAudioErrorAt = -100f;

		private static readonly string[] CatchSayings = new string[16]
		{
			"A fine catch, Viking! The waters have rewarded your patience.", "Well hooked! That's a fish worth a fisher's tale.", "By Odin's favor, you've brought one home!", "Steady hands and a sharp hook. Nicely done!", "There's supper in the boat tonight, Viking!", "The sea gives up another of its secrets. Well caught!", "A patient fisher never returns empty-handed forever. Well done!", "Ha! That one won't be stealing your bait again!", "Your line was true and your timing better. A worthy catch!", "Even the old skalds would smile at that catch.",
			"A good day for the hook and line. Keep your luck alive!", "Another fish for the storybook, and perhaps the cooking fire.", "The waters tested you, and you prevailed!", "That fish chose the wrong Viking to challenge!", "A splendid catch! May the next one be just as eager.", "Well played! The sea has paid its dues today."
		};

		private static readonly string[] DifferentBaitAdvice = new string[4] { "That bait may tempt a different catch, but these waters usually favor {0}.", "A fisher knows when to change the hook. You might have better luck with {0} here.", "An unusual choice for these shores! Consider trying {0} instead.", "Perhaps your bait will surprise us. Still, I'd pack {0} for these waters." };

		private static readonly string[] RtDOceanAdvice = new string[4] { "The ocean teems with unfamiliar life. Watch for catchable fish and choose bait suited to your quarry.", "These waters hold more than the old fishing tales describe. Keep your tackle ready and observe what takes the hook.", "A seasoned fisher studies the catch before choosing bait. Not every creature in these seas can be caught on a line.", "The sea has new surprises, Viking. Try your usual ocean bait, but do not mistake every swimming beast for a fish." };

		private static readonly string[] SerpentAdvice = new string[4] { "BY ODIN'S BEARD! A sea serpent lurks nearby. Forget the bait: ready a harpoon and your ship!", "That shadow is no fish! A serpent hunt calls for a harpoon, strong arms, and a stout vessel.", "Mind the waves, Viking! No fishing bait will tame a sea serpent. Prepare for battle!", "The sea itself has teeth today. Keep your harpoon close and your crew closer!" };

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Expected O, but got Unknown
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Expected O, but got Unknown
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: Expected O, but got Unknown
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Expected O, but got Unknown
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Expected O, but got Unknown
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			refresh = ((BaseUnityPlugin)this).Config.Bind<float>("Detection", "RefreshSeconds", 3f, new ConfigDescription("Shore scan interval (1-10 seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
			boatRange = ((BaseUnityPlugin)this).Config.Bind<float>("Boat Scout", "RangeMeters", 150f, new ConfigDescription("Boat scouting radius (50-300 meters; fish must be loaded in the world).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(50f, 300f), Array.Empty<object>()));
			boatRefresh = ((BaseUnityPlugin)this).Config.Bind<float>("Boat Scout", "RefreshSeconds", 3f, new ConfigDescription("Seconds between boat scans (1-15; default 3).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>()));
			boatAlertCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Boat Scout", "MessageCooldownSeconds", 45f, new ConfigDescription("Minimum seconds between new spirit scouting messages (15-180).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(15f, 180f), Array.Empty<object>()));
			boatMinFish = ((BaseUnityPlugin)this).Config.Bind<int>("Boat Scout", "MinimumFishAlert", 3, new ConfigDescription("Minimum fish required for a scouting announcement (1-10).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
			maxRows = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "MaxFishRows", 8, new ConfigDescription("Maximum fish species shown (1-20).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			scale = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "UIScale", 1f, new ConfigDescription("HUD scale (0.6-2).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.6f, 2f), Array.Empty<object>()));
			titleFont = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "TitleFontSize", 22, new ConfigDescription("Title font size (12-40).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 40), Array.Empty<object>()));
			fishFont = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "FishFontSize", 19, new ConfigDescription("Fish and bait font size (12-36).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 36), Array.Empty<object>()));
			mapRightInset = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "RightInsetPixels", 1297f, "Distance from right screen edge to left side of guide at scale 1; increase to move left.");
			topOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "TopOffsetPixels", 110f, "Legacy guide top position; overridden after dragging.");
			savedX = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "SavedPositionX", -1f, "Absolute screen X after dragging (-1 uses legacy RightInsetPixels).");
			savedY = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "SavedPositionY", -1f, "Absolute screen Y after dragging (-1 uses legacy TopOffsetPixels).");
			editKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Display", "MoveGuideKey", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Press F8 with rod equipped to unlock the mouse and drag the guide; F8 saves and restores gameplay.");
			catchDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Advice", "CatchMessageSeconds", 9f, new ConfigDescription("Catch message duration (1-30 seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>()));
			panelWidth = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "AdviceWidthPixels", 560f, new ConfigDescription("Guide width (280-850 pixels).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(280f, 850f), Array.Empty<object>()));
			darkBackdropEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "DarkBackdropEnabled", true, "Draw a dark translucent panel behind the guide for readability against bright ocean and sky.");
			darkBackdropOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "DarkBackdropOpacity", 0.82f, new ConfigDescription("Dark guide panel opacity (0.25-0.95).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 0.95f), Array.Empty<object>()));
			adviceCycle = ((BaseUnityPlugin)this).Config.Bind<float>("Advice", "VariationSeconds", 35f, new ConfigDescription("Advice variation interval (8-180 seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(8f, 180f), Array.Empty<object>()));
			showUnknown = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "ShowUnknownBait", true, "Show fish even when bait data cannot be resolved.");
			showSeaThreatWarnings = ((BaseUnityPlugin)this).Config.Bind<bool>("Safety", "ShowSeaThreatWarnings", true, "Show a prominent warning for sea serpents and Bonemaw, plus compact cautions for selected predators from RtDOcean or SeaAnimals. Does not affect AI or damage.");
			enableSeaAnimals = ((BaseUnityPlugin)this).Config.Bind<bool>("SeaAnimals", "EnableIntegration", true, "Show nearby SeaAnimals wildlife. Sharks, Humboldt Squid and Crocodile trigger cautions; Orca and Whale Shark remain peaceful sightings. SeaAnimals is optional.");
			audioEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Fishing Audio", "Enabled", true, "Enable fishing bite, hook, struggle and catch celebration audio cues.");
			audioDiagnostics = ((BaseUnityPlugin)this).Config.Bind<bool>("Fishing Audio", "Diagnostics", true, "Log fishing audio hook events and ownership decisions to BepInEx log for troubleshooting.");
			biteVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Fishing Audio", "BiteVolume", 0.42f, new ConfigDescription("Bite plink volume (0-1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			splashVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Fishing Audio", "SplashVolume", 0.35f, new ConfigDescription("Struggle splash volume (0-1).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			audioInstance = this;
			try
			{
				SetupFishingAudio();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Fishing audio disabled: " + ex.Message));
			}
			rtDOceanLoaded = Chainloader.PluginInfos.Values.Any((PluginInfo info) => (info.Metadata.GUID ?? "").Equals("soloredis.rtdocean", StringComparison.OrdinalIgnoreCase) || (info.Metadata.Name ?? "").Equals("RtDOcean", StringComparison.OrdinalIgnoreCase));
			seaAnimalsLoaded = IsSeaAnimalsInstalled();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("My Fishing Guide 0.11.22 loaded. Fishing mode: " + (rtDOceanLoaded ? "RtDOcean + vanilla" : "vanilla") + ((seaAnimalsLoaded && enableSeaAnimals.Value) ? " + SeaAnimals wildlife" : "") + "."));
		}

		private void SetupFishingAudio()
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Expected O, but got Unknown
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Expected O, but got Unknown
			audioOneShot = ((Component)this).gameObject.AddComponent<AudioSource>();
			audioOneShot.playOnAwake = false;
			audioOneShot.spatialBlend = 0f;
			biteClip = MakeAudio("Guide bite plink", 0.28f, 44100, (float t) => (float)(Math.Sin(Math.PI * 2.0 * (double)(1450f - 780f * t) * (double)t) * Math.Exp(-22f * t) * 0.65));
			hookClip = MakeAudio("Guide hook set", 0.32f, 44100, (float t) => (float)((Math.Sin(Math.PI * 2.0 * (double)(610f + 900f * t) * (double)t) * 0.38 + (double)Noise(t, 43) * 0.11) * Math.Exp(-15f * t)));
			splashClip = MakeAudio("Guide struggle splash", 0.52f, 44100, (float t) => (float)((Math.Sin(Math.PI * 2240.0 * (double)t) * 0.2 + (double)Noise(t, 77) * 0.6) * Math.Exp(-7f * t)));
			catchClip = MakeAudio("Guide Viking catch fanfare", 1.55f, 44100, delegate(float t)
			{
				double num = 0.0;
				double[] array = new double[3] { 0.0, 0.3, 0.91 };
				double[] array2 = new double[3] { 196.0, 246.94, 293.66 };
				double[] array3 = new double[3] { 0.36, 0.43, 0.58 };
				for (int i = 0; i < array.Length; i++)
				{
					double num2 = (double)t - array[i];
					if (!(num2 < 0.0) && !(num2 >= array3[i]))
					{
						double num3 = Math.Min(1.0, num2 / 0.045);
						double num4 = Math.Min(1.0, (array3[i] - num2) / 0.14);
						double num5 = num3 * num4;
						double num6 = Math.PI * 2.0 * array2[i] * num2;
						num += num5 * (0.27 * Math.Sin(num6) + 0.14 * Math.Sin(2.0 * num6) + 0.07 * Math.Sin(3.0 * num6) + 0.025 * Math.Sin(4.0 * num6));
					}
				}
				double num7 = 0.0;
				double[] array4 = new double[2] { 0.58, 0.79 };
				for (int j = 0; j < array4.Length; j++)
				{
					double num8 = (double)t - array4[j];
					if (!(num8 < 0.0) && !(num8 >= 0.24))
					{
						double num9 = Math.Sin(Math.PI * 2.0 * (100.0 - 48.0 * num8) * num8) * Math.Exp(-18.0 * num8) * 0.42;
						double num10 = (double)Noise((float)((double)t + (double)j * 0.37), 137 + j * 13) * Math.Exp(-70.0 * num8) * 0.16;
						num7 += num9 + num10;
					}
				}
				return (float)Math.Max(-0.9, Math.Min(0.9, num + num7));
			});
			audioHarmony = new Harmony("jaybird.myfishingguide.audio");
			Type type = AccessType("FishingFloat");
			Type type2 = AccessType("Fish");
			MethodInfo methodInfo = type?.GetMethods(Flags).FirstOrDefault((MethodInfo m) => m.Name == "RPC_Nibble");
			MethodInfo methodInfo2 = type2?.GetMethod("IsEscaping", Flags, null, Type.EmptyTypes, null);
			if (methodInfo != null)
			{
				audioHarmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Plugin).GetMethod("OnNibble", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Fishing audio: patched " + methodInfo.DeclaringType.FullName + "." + methodInfo.Name));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Fishing audio: RPC_Nibble not found; bite plink unavailable.");
			}
			if (methodInfo2 != null)
			{
				audioHarmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin).GetMethod("OnEscaping", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Fishing audio: patched " + methodInfo2.DeclaringType.FullName + "." + methodInfo2.Name));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Fishing audio: Fish.IsEscaping not found; struggle cues unavailable.");
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Fishing audio: clips initialized (bite=" + ((Object)(object)biteClip != (Object)null) + ", hook=" + ((Object)(object)hookClip != (Object)null) + ", splash=" + ((Object)(object)splashClip != (Object)null) + ")."));
		}

		private static float Noise(float t, int seed)
		{
			double num = Math.Sin((Math.Floor(t * 19000f) + (double)seed) * 12.9898) * 43758.5453;
			return (float)((num - Math.Floor(num)) * 2.0 - 1.0);
		}

		private static AudioClip MakeAudio(string name, float seconds, int rate, Func<float, float> wave)
		{
			int num = (int)(seconds * (float)rate);
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = Mathf.Clamp(wave((float)i / (float)rate), -1f, 1f);
			}
			AudioClip val = AudioClip.Create(name, num, 1, rate, false);
			MethodInfo? method = typeof(AudioClip).GetMethod("SetData", new Type[2]
			{
				typeof(float[]),
				typeof(int)
			});
			if (method == null)
			{
				throw new MissingMethodException("AudioClip.SetData(float[], int) is unavailable.");
			}
			method.Invoke(val, new object[2] { array, 0 });
			return val;
		}

		private static bool LocalFloat(object fishingFloat)
		{
			if (fishingFloat == null)
			{
				return false;
			}
			object obj = AccessType("Player")?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
			if (obj == null)
			{
				return false;
			}
			object obj2 = Member(obj, "m_fishingFloat", "m_fishingBobber", "m_fishingFloatInstance");
			if (obj2 != null)
			{
				return obj2 == fishingFloat;
			}
			object obj3 = Member(fishingFloat, "m_owner", "m_player", "m_ownerPlayer", "m_ownerCharacter");
			if (obj3 != null)
			{
				return obj3 == obj;
			}
			object obj4 = Member(fishingFloat, "m_ownerID", "m_ownerId");
			object obj5 = Member(obj, "m_playerID", "m_playerId");
			if (obj4 != null && obj5 != null)
			{
				return obj4.Equals(obj5);
			}
			return false;
		}

		private static void OnNibble(object __instance)
		{
			//IL_011e: 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)
			Plugin plugin = audioInstance;
			if ((Object)(object)plugin == (Object)null || !plugin.audioEnabled.Value)
			{
				return;
			}
			bool flag = LocalFloat(__instance);
			if (plugin.audioDiagnostics.Value)
			{
				((BaseUnityPlugin)plugin).Logger.LogInfo((object)("Fishing audio: RPC_Nibble invoked; local float=" + flag + "; player float=" + (Member(AccessType("Player")?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null), "m_fishingFloat", "m_fishingBobber", "m_fishingFloatInstance") != null) + "."));
			}
			if (!flag)
			{
				Component val = (Component)((__instance is Component) ? __instance : null);
				object? obj = AccessType("Player")?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				Component val2 = (Component)((obj is Component) ? obj : null);
				flag = (Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && Vector3.Distance(val.transform.position, val2.transform.position) < 25f;
				if (flag && plugin.audioDiagnostics.Value)
				{
					((BaseUnityPlugin)plugin).Logger.LogInfo((object)"Fishing audio: nearby bobber fallback accepted (ComfyFishing compatibility candidate).");
				}
			}
			if (flag && !(Time.time - plugin.lastBiteAt < 0.65f))
			{
				plugin.lastBiteAt = Time.time;
				if ((Object)(object)plugin.audioOneShot != (Object)null && (Object)(object)plugin.biteClip != (Object)null)
				{
					plugin.audioOneShot.PlayOneShot(plugin.biteClip, plugin.biteVolume.Value);
				}
			}
		}

		private static void OnEscaping(object __instance, bool __result)
		{
			Plugin plugin = audioInstance;
			if ((Object)(object)plugin == (Object)null || !plugin.audioEnabled.Value || !__result)
			{
				return;
			}
			Type type = AccessType("FishingFloat");
			if (type == null)
			{
				return;
			}
			object obj = null;
			FieldInfo[] fields = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (FieldInfo fieldInfo in fields)
			{
				if (typeof(IEnumerable).IsAssignableFrom(fieldInfo.FieldType))
				{
					obj = fieldInfo.GetValue(null);
					if (obj != null)
					{
						break;
					}
				}
			}
			if (!(obj is IEnumerable enumerable))
			{
				if (plugin.audioDiagnostics.Value && !plugin.loggedMissingLocalFloat)
				{
					plugin.loggedMissingLocalFloat = true;
					((BaseUnityPlugin)plugin).Logger.LogWarning((object)"Fishing audio: no static FishingFloat collection; using instance probe for hooked fish instead.");
				}
				return;
			}
			foreach (object item in enumerable)
			{
				if (!LocalFloat(item) || Member(item, "m_fish", "m_hookedFish") != __instance)
				{
					continue;
				}
				plugin.lastFightAt = Time.time;
				if (!plugin.fighting && Time.time - plugin.lastSplashAt > 0.8f)
				{
					plugin.lastSplashAt = Time.time;
					if ((Object)(object)plugin.audioOneShot != (Object)null && (Object)(object)plugin.splashClip != (Object)null)
					{
						plugin.audioOneShot.PlayOneShot(plugin.splashClip, plugin.splashVolume.Value);
					}
				}
				plugin.fighting = true;
				break;
			}
		}

		private void ProbeHookedFish()
		{
			if (!audioEnabled.Value || Time.time < nextAudioProbe)
			{
				return;
			}
			nextAudioProbe = Time.time + 0.75f;
			try
			{
				Type type = AccessType("FishingFloat");
				if (type == null)
				{
					return;
				}
				Object[] array = Object.FindObjectsOfType(type);
				bool flag2 = default(bool);
				foreach (object obj in array)
				{
					if (!LocalFloat(obj))
					{
						continue;
					}
					object obj2 = Member(obj, "m_fish", "m_hookedFish");
					if (obj2 == null)
					{
						continue;
					}
					bool flag = false;
					MethodInfo method = obj2.GetType().GetMethod("IsEscaping", Flags, null, Type.EmptyTypes, null);
					if (method != null)
					{
						object obj3 = method.Invoke(obj2, null);
						int num;
						if (obj3 is bool)
						{
							flag2 = (bool)obj3;
							num = 1;
						}
						else
						{
							num = 0;
						}
						flag = (byte)((uint)num & (flag2 ? 1u : 0u)) != 0;
					}
					if (!flag)
					{
						continue;
					}
					lastFightAt = Time.time;
					if (!fighting && Time.time - lastSplashAt > 0.8f)
					{
						lastSplashAt = Time.time;
						if (audioDiagnostics.Value)
						{
							((BaseUnityPlugin)this).Logger.LogInfo((object)"Fishing audio: local hooked fish struggling; splash and tension starting.");
						}
						if ((Object)(object)audioOneShot != (Object)null && (Object)(object)splashClip != (Object)null)
						{
							audioOneShot.PlayOneShot(splashClip, splashVolume.Value);
						}
					}
					fighting = true;
					break;
				}
			}
			catch (Exception ex)
			{
				if (audioDiagnostics.Value && Time.time - lastAudioErrorAt > 15f)
				{
					lastAudioErrorAt = Time.time;
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Fishing audio probe: " + ex.Message));
				}
			}
		}

		private void DetectHookAndReel()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				object? obj = AccessType("Player")?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				Component val = (Component)((obj is Component) ? obj : null);
				Type type = AccessType("FishingFloat");
				if ((Object)(object)val == (Object)null || type == null)
				{
					trackedHookedFish = null;
					return;
				}
				object obj2 = null;
				float num = float.MaxValue;
				bool flag = Time.time - lastBiteAt < 12f;
				Object[] array = Object.FindObjectsOfType(type);
				foreach (object obj3 in array)
				{
					Component val2 = (Component)((obj3 is Component) ? obj3 : null);
					if (!((Object)(object)val2 == (Object)null))
					{
						float num2 = Vector3.Distance(val.transform.position, val2.transform.position);
						if (!(num2 > 25f) && (LocalFloat(obj3) || flag) && num2 < num)
						{
							obj2 = obj3;
							num = num2;
						}
					}
				}
				if (obj2 == null)
				{
					trackedHookedFish = null;
					return;
				}
				object obj4 = Member(obj2, "m_fish", "m_hookedFish");
				if (obj4 != null && obj4 != trackedHookedFish && Time.time - lastHookAt > 0.7f)
				{
					lastHookAt = Time.time;
					if (audioEnabled.Value && (Object)(object)audioOneShot != (Object)null && (Object)(object)hookClip != (Object)null)
					{
						audioOneShot.PlayOneShot(hookClip, biteVolume.Value);
					}
					if (audioDiagnostics.Value)
					{
						((BaseUnityPlugin)this).Logger.LogInfo((object)"Fishing audio: hooked fish observed; hook confirmation played.");
					}
				}
				trackedHookedFish = obj4;
			}
			catch (Exception ex)
			{
				if (audioDiagnostics.Value && Time.time - lastAudioErrorAt > 15f)
				{
					lastAudioErrorAt = Time.time;
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Fishing audio cast probe: " + ex.Message));
				}
			}
		}

		private void UpdateFishingAudio(bool hasRod)
		{
			if (audioEnabled == null || !audioEnabled.Value || !hasRod)
			{
				trackedHookedFish = null;
				fighting = false;
				return;
			}
			if (Time.time >= nextHookProbe)
			{
				nextHookProbe = Time.time + 0.5f;
				DetectHookAndReel();
			}
			ProbeHookedFish();
			if (Time.time - lastFightAt >= 0.35f)
			{
				fighting = false;
			}
		}

		private static object Member(object obj, params string[] names)
		{
			if (obj == null)
			{
				return null;
			}
			Type type = obj.GetType();
			foreach (string name in names)
			{
				try
				{
					FieldInfo field = type.GetField(name, Flags);
					if (field != null)
					{
						return field.GetValue(obj);
					}
					PropertyInfo property = type.GetProperty(name, Flags);
					if (property != null && property.GetIndexParameters().Length == 0)
					{
						return property.GetValue(obj, null);
					}
				}
				catch
				{
				}
			}
			return null;
		}

		private static string ItemName(object item)
		{
			if (item == null)
			{
				return null;
			}
			string value = Member(Member(item, "m_shared"), "m_name") as string;
			if (!string.IsNullOrEmpty(value))
			{
				return Localize(value);
			}
			object obj = Member(item, "m_itemData");
			if (obj != null && obj != item)
			{
				return ItemName(obj);
			}
			Component val = (Component)((item is Component) ? item : null);
			if (val != null)
			{
				return ((Object)val.gameObject).name.Replace("(Clone)", "");
			}
			return null;
		}

		private static string Localize(string value)
		{
			if (string.IsNullOrEmpty(value))
			{
				return value;
			}
			try
			{
				Type type = AccessType("Localization");
				object obj = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public)?.GetValue(null, null) ?? type.GetField("instance", BindingFlags.Static | BindingFlags.Public)?.GetValue(null);
				MethodInfo method = type.GetMethod("Localize", new Type[1] { typeof(string) });
				if (obj != null && method != null)
				{
					return (string)method.Invoke(obj, new object[1] { value });
				}
			}
			catch
			{
			}
			return value;
		}

		private static Type AccessType(string name)
		{
			Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
			for (int i = 0; i < assemblies.Length; i++)
			{
				Type type = assemblies[i].GetType(name, throwOnError: false);
				if (type != null)
				{
					return type;
				}
			}
			return null;
		}

		private static bool RodEquipped(out Vector3 playerPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			playerPos = Vector3.zero;
			try
			{
				Type type = AccessType("Player");
				if (type == null)
				{
					return false;
				}
				object obj = type.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				Component val = (Component)((obj is Component) ? obj : null);
				if (val == null)
				{
					return false;
				}
				playerPos = val.transform.position;
				string[] array = new string[2] { "GetRightItem", "GetCurrentWeapon" };
				foreach (string name in array)
				{
					MethodInfo method = type.GetMethod(name, Flags, null, Type.EmptyTypes, null);
					if (method == null)
					{
						continue;
					}
					object obj2 = method.Invoke(obj, null);
					if (obj2 != null)
					{
						string text = ItemName(obj2) ?? "";
						string text2 = (Member(Member(obj2, "m_dropPrefab"), "name") as string) ?? "";
						if (text.IndexOf("fishing rod", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("FishingRod", StringComparison.OrdinalIgnoreCase) >= 0)
						{
							return true;
						}
					}
				}
			}
			catch
			{
			}
			return false;
		}

		private static string BaitFor(object fish)
		{
			string[] array = new string[5] { "m_baits", "m_bait", "m_baitItem", "m_requiredBait", "m_baitItems" };
			foreach (string text in array)
			{
				object obj = Member(fish, text);
				if (obj == null)
				{
					continue;
				}
				List<string> list = new List<string>();
				if (obj is IEnumerable enumerable && !(obj is string))
				{
					foreach (object item in enumerable)
					{
						string text2 = ItemName(Member(item, "m_bait", "m_item", "m_itemData", "m_baitItem") ?? item);
						if (!string.IsNullOrWhiteSpace(text2) && !list.Contains(text2))
						{
							list.Add(text2);
						}
					}
				}
				else
				{
					string text3 = ItemName(obj);
					if (!string.IsNullOrWhiteSpace(text3))
					{
						list.Add(text3);
					}
				}
				if (list.Count > 0)
				{
					return string.Join(", ", list.ToArray());
				}
			}
			return "Unknown";
		}

		private static bool IsCatchableFishItem(object item)
		{
			string text = ItemName(item) ?? "";
			if (text.IndexOf("bait", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return false;
			}
			object obj = Member(item, "m_dropPrefab");
			GameObject val = (GameObject)((obj is GameObject) ? obj : null);
			if (val != null)
			{
				Type type = AccessType("Fish");
				if (type != null && (Object)(object)val.GetComponent(type) != (Object)null)
				{
					return true;
				}
			}
			string[] array = new string[14]
			{
				"Perch", "Pike", "Tuna", "Coral Cod", "Pufferfish", "Anglerfish", "Giant Herring", "Trollfish", "Grouper", "Magmafish",
				"Northern Salmon", "Tetra", "Misty Fish", "Mistyfish"
			};
			foreach (string b in array)
			{
				if (string.Equals(text, b, StringComparison.OrdinalIgnoreCase))
				{
					return true;
				}
			}
			return false;
		}

		private void CheckNewCatches()
		{
			try
			{
				Type type = AccessType("Player");
				object obj = type?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				if (!(Member(type?.GetMethod("GetInventory", Flags, null, Type.EmptyTypes, null)?.Invoke(obj, null), "m_inventory") is IEnumerable enumerable))
				{
					catchBaselineReady = false;
					return;
				}
				Dictionary<string, int> dictionary = new Dictionary<string, int>();
				foreach (object item in enumerable)
				{
					if (IsCatchableFishItem(item))
					{
						string text = ItemName(item);
						if (!string.IsNullOrEmpty(text))
						{
							object obj2 = Member(item, "m_stack");
							int num = ((!(obj2 is int)) ? 1 : ((int)obj2));
							dictionary[text] = (dictionary.ContainsKey(text) ? dictionary[text] : 0) + num;
						}
					}
				}
				if (catchBaselineReady)
				{
					foreach (KeyValuePair<string, int> item2 in dictionary)
					{
						lastFishCounts.TryGetValue(item2.Key, out var value);
						if (item2.Value <= value)
						{
							continue;
						}
						catchText = CatchSayings[catchSayingsIndex % CatchSayings.Length];
						catchSayingsIndex++;
						catchTextUntil = Time.time + 3.5f;
						((BaseUnityPlugin)this).Logger.LogInfo((object)("Fish added to inventory: " + item2.Key + "; showing catch advice."));
						if (audioEnabled.Value && (Object)(object)audioOneShot != (Object)null && (Object)(object)catchClip != (Object)null)
						{
							audioOneShot.PlayOneShot(catchClip, 0.7f);
							if (audioDiagnostics.Value)
							{
								((BaseUnityPlugin)this).Logger.LogInfo((object)"Fishing audio: inventory fish Viking horn-and-drum fanfare played (auto-catch compatible).");
							}
						}
						break;
					}
				}
				lastFishCounts.Clear();
				foreach (KeyValuePair<string, int> item3 in dictionary)
				{
					lastFishCounts[item3.Key] = item3.Value;
				}
				catchBaselineReady = true;
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogDebug((object)("Catch inventory check: " + ex.Message));
			}
		}

		private void LateUpdate()
		{
			if (editMode)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		private void OnDestroy()
		{
			if (audioHarmony != null)
			{
				audioHarmony.UnpatchSelf();
			}
			if ((Object)(object)audioInstance == (Object)(object)this)
			{
				audioInstance = null;
			}
			if ((Object)(object)biteClip != (Object)null)
			{
				Object.Destroy((Object)(object)biteClip);
			}
			if ((Object)(object)splashClip != (Object)null)
			{
				Object.Destroy((Object)(object)splashClip);
			}
			if ((Object)(object)hookClip != (Object)null)
			{
				Object.Destroy((Object)(object)hookClip);
			}
			if ((Object)(object)catchClip != (Object)null)
			{
				Object.Destroy((Object)(object)catchClip);
			}
		}

		private void OnDisable()
		{
			if (editMode)
			{
				EndEditMode();
			}
		}

		private void EndEditMode()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			editMode = false;
			dragging = false;
			if (guideOwnsCursor)
			{
				Cursor.lockState = oldCursorLock;
				Cursor.visible = oldCursorVisible;
				guideOwnsCursor = false;
			}
			((BaseUnityPlugin)this).Config.Save();
		}

		private static Color BaitColor(string bait)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			string text = (bait ?? "").ToLowerInvariant();
			if (text.Contains("heavy"))
			{
				return new Color(0.36f, 0.73f, 1f);
			}
			if (text.Contains("misty"))
			{
				return new Color(0.79f, 0.62f, 1f);
			}
			if (text.Contains("hot"))
			{
				return new Color(1f, 0.53f, 0.27f);
			}
			if (text.Contains("frost") || text.Contains("cold"))
			{
				return new Color(0.55f, 0.94f, 1f);
			}
			if (text.Contains("sticky") || text.Contains("stingy"))
			{
				return new Color(1f, 0.76f, 0.35f);
			}
			if (text.Contains("moss") || text.Contains("bait"))
			{
				return new Color(0.64f, 0.85f, 0.48f);
			}
			return new Color(0.87f, 0.81f, 0.66f);
		}

		private Sprite FindBaitIcon(string bait)
		{
			if (bait == lastIconBait)
			{
				return cachedBaitIcon;
			}
			lastIconBait = bait;
			cachedBaitIcon = null;
			if (string.IsNullOrWhiteSpace(bait))
			{
				return null;
			}
			try
			{
				if (!(Member(AccessType("ObjectDB")?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null), "m_items") is IEnumerable enumerable))
				{
					return null;
				}
				foreach (object item in enumerable)
				{
					GameObject val = (GameObject)((item is GameObject) ? item : null);
					if (val == null)
					{
						continue;
					}
					Type type = AccessType("ItemDrop");
					if (type == null)
					{
						break;
					}
					object component = val.GetComponent(type);
					if (component == null)
					{
						continue;
					}
					object obj = Member(component, "m_itemData");
					if (string.Equals(ItemName(obj), bait, StringComparison.OrdinalIgnoreCase))
					{
						if (Member(Member(obj, "m_shared"), "m_icons") is Sprite[] array && array.Length != 0)
						{
							cachedBaitIcon = array[0];
						}
						break;
					}
				}
			}
			catch
			{
			}
			return cachedBaitIcon;
		}

		private Sprite FindFishIcon(Component fish, string fishName)
		{
			try
			{
				Type type = AccessType("ItemDrop");
				if (type != null)
				{
					Sprite val = IconFromItemDrop(fish.GetComponent(type));
					if ((Object)(object)val != (Object)null)
					{
						return val;
					}
				}
				if (!(Member(AccessType("ObjectDB")?.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null), "m_items") is IEnumerable enumerable) || type == null)
				{
					return null;
				}
				string b = ((Object)fish.gameObject).name.Replace("(Clone)", "").Trim();
				foreach (object item in enumerable)
				{
					GameObject val2 = (GameObject)((item is GameObject) ? item : null);
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					object component = val2.GetComponent(type);
					if (component != null && (string.Equals(ItemName(Member(component, "m_itemData")), fishName, StringComparison.OrdinalIgnoreCase) || string.Equals(((Object)val2).name, b, StringComparison.OrdinalIgnoreCase)))
					{
						Sprite val3 = IconFromItemDrop(component);
						if ((Object)(object)val3 != (Object)null)
						{
							return val3;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private static Sprite IconFromItemDrop(object drop)
		{
			if (!(Member(Member(Member(drop, "m_itemData"), "m_shared"), "m_icons") is Sprite[] array) || array.Length == 0)
			{
				return null;
			}
			return array[0];
		}

		private static void DrawSprite(Rect bounds, Sprite sprite)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)sprite == (Object)null) && !((Object)(object)sprite.texture == (Object)null))
			{
				Rect textureRect = sprite.textureRect;
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref textureRect)).x / (float)((Texture)sprite.texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)sprite.texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)sprite.texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)sprite.texture).height);
				GUI.DrawTextureWithTexCoords(bounds, (Texture)(object)sprite.texture, val);
			}
		}

		private static Transform GetPlayerShip()
		{
			try
			{
				Type type = AccessType("Player");
				object obj = type?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				Component val = (Component)((obj is Component) ? obj : null);
				if (val == null)
				{
					return null;
				}
				string[] array = new string[2] { "GetStandingOnShip", "GetControlledShip" };
				foreach (string name in array)
				{
					object obj2 = type.GetMethod(name, Flags, null, Type.EmptyTypes, null)?.Invoke(obj, null);
					Component val2 = (Component)((obj2 is Component) ? obj2 : null);
					if (val2 != null)
					{
						return val2.transform;
					}
					GameObject val3 = (GameObject)((obj2 is GameObject) ? obj2 : null);
					if (val3 != null)
					{
						return val3.transform;
					}
				}
				object obj3 = Member(obj, "m_standingOnShip", "m_ship");
				Component val4 = (Component)((obj3 is Component) ? obj3 : null);
				if (val4 != null)
				{
					return val4.transform;
				}
				Type type2 = AccessType("Ship");
				if (type2 != null)
				{
					Transform val5 = val.transform;
					while ((Object)(object)val5 != (Object)null)
					{
						Component component = ((Component)val5).GetComponent(type2);
						if ((Object)(object)component != (Object)null)
						{
							return component.transform;
						}
						val5 = val5.parent;
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private static bool HelmOccupied(Transform ship)
		{
			if ((Object)(object)ship == (Object)null)
			{
				return false;
			}
			try
			{
				Type type = AccessType("Player");
				if (type == null)
				{
					return false;
				}
				if (!(type.GetField("s_players", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null) is IEnumerable enumerable))
				{
					return false;
				}
				foreach (object item in enumerable)
				{
					if (item == null)
					{
						continue;
					}
					if (SameShip(type.GetMethod("GetControlledShip", Flags, null, Type.EmptyTypes, null)?.Invoke(item, null), ship))
					{
						return true;
					}
					object? obj = type.GetMethod("GetDoodadController", Flags, null, Type.EmptyTypes, null)?.Invoke(item, null);
					Component val = (Component)((obj is Component) ? obj : null);
					if (val != null && ((object)val).GetType().Name.IndexOf("ShipControll", StringComparison.OrdinalIgnoreCase) >= 0 && AccessType("Ship") != null)
					{
						Component componentInParent = val.GetComponentInParent(AccessType("Ship"));
						if (componentInParent != null && SameShip(componentInParent, ship))
						{
							return true;
						}
					}
				}
			}
			catch
			{
			}
			return false;
		}

		private static bool SameShip(object candidate, Transform ship)
		{
			GameObject val = (GameObject)((candidate is GameObject) ? candidate : null);
			if (val != null)
			{
				if (!((Object)(object)val.transform == (Object)(object)ship))
				{
					return val.transform.IsChildOf(ship);
				}
				return true;
			}
			Component val2 = (Component)((candidate is Component) ? candidate : null);
			if (val2 != null)
			{
				if (!((Object)(object)val2.transform == (Object)(object)ship))
				{
					return val2.transform.IsChildOf(ship);
				}
				return true;
			}
			return false;
		}

		private static string BoatBearing(Transform ship, Vector3 fishPosition)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ship == (Object)null)
			{
				return "nearby";
			}
			Vector3 val = fishPosition - ship.position;
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude < 1f)
			{
				return "alongside";
			}
			Vector3 forward = ship.forward;
			forward.y = 0f;
			Vector3 right = ship.right;
			right.y = 0f;
			float num = Vector3.Dot(((Vector3)(ref forward)).normalized, ((Vector3)(ref val)).normalized);
			float num2 = Vector3.Dot(((Vector3)(ref right)).normalized, ((Vector3)(ref val)).normalized);
			if (num > 0.7f)
			{
				return "ahead";
			}
			if (num < -0.7f)
			{
				return "astern";
			}
			if (!(num2 > 0f))
			{
				return "port";
			}
			return "starboard";
		}

		private void UpdateScoutMessage()
		{
			int num = nearby.Sum((Entry f) => f.count) + wildlife.Sum((Entry f) => f.count) + seaAnimalsWildlife.Sum((Entry f) => f.count);
			if (num < Mathf.Clamp(boatMinFish.Value, 1, 10))
			{
				scoutMessage = "The waters are quiet, Viking. I'll keep watch for fish and wildlife.";
				lastScoutKey = null;
				return;
			}
			Entry entry = (from f in nearby.Concat(wildlife).Concat(seaAnimalsWildlife)
				orderby f.distance
				select f).FirstOrDefault();
			if (entry != null)
			{
				string text = entry.direction ?? "nearby";
				string text2 = entry.name + ":" + text + ":" + num / 3;
				if (text2 != lastScoutKey && Time.time - lastScoutAnnouncement >= Mathf.Clamp(boatAlertCooldown.Value, 15f, 180f))
				{
					scoutMessage = "By Odin! " + entry.name + " " + text + ", " + entry.distance.ToString("0") + ((wildlife.Contains(entry) || seaAnimalsWildlife.Contains(entry)) ? " m away. Tell the helmsman: wildlife ahead!" : (" m away" + ((entry.distance <= 25f) ? " - Within Fishing Rod Range!" : ". Tell the helmsman to steer toward the fish!")));
					lastScoutKey = text2;
					lastScoutAnnouncement = Time.time;
				}
				if (string.IsNullOrEmpty(scoutMessage))
				{
					scoutMessage = "Keep your eyes on the waves, Viking. The spirit watches for fish.";
				}
			}
		}

		private void Update()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: 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_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			Vector3 playerPos;
			bool flag = RodEquipped(out playerPos);
			UpdateFishingAudio(flag);
			KeyboardShortcut value = editKey.Value;
			if (((KeyboardShortcut)(ref value)).IsDown() && (flag || editMode))
			{
				if (editMode)
				{
					EndEditMode();
				}
				else
				{
					oldCursorVisible = Cursor.visible;
					oldCursorLock = Cursor.lockState;
					guideOwnsCursor = true;
					editMode = true;
					dragging = false;
					Cursor.lockState = (CursorLockMode)0;
					Cursor.visible = true;
				}
			}
			if (!flag && editMode)
			{
				EndEditMode();
			}
			if (flag && !rodPreviouslyEquipped)
			{
				catchBaselineReady = false;
			}
			rodPreviouslyEquipped = flag;
			Transform playerShip = GetPlayerShip();
			aboardShipForWarnings = (Object)(object)playerShip != (Object)null;
			bool flag2 = flag && (Object)(object)playerShip != (Object)null && HelmOccupied(playerShip);
			if (boatMode != flag2)
			{
				nextScan = 0f;
			}
			boatMode = flag2;
			boatTransform = playerShip;
			if (Time.time < nextScan)
			{
				return;
			}
			nextScan = Time.time + (boatMode ? Mathf.Clamp(boatRefresh.Value, 1f, 15f) : Mathf.Clamp(refresh.Value, 1f, 10f));
			nearby.Clear();
			wildlife.Clear();
			seaAnimalsWildlife.Clear();
			seaAnimalsThreats.Clear();
			serpentNearby = false;
			bonemawNearby = false;
			selectedBait = null;
			Vector3 pos = playerPos;
			if (!flag)
			{
				if (!aboardShipForWarnings || !showSeaThreatWarnings.Value || !TryLocalPlayerPosition(out pos))
				{
					return;
				}
				ScanSerpentThreats(pos);
				if (!rtDOceanLoaded)
				{
					rtDOceanLoaded = Chainloader.PluginInfos.ContainsKey("soloredis.rtdocean");
				}
				if (rtDOceanLoaded)
				{
					ScanRtDWildlife(pos);
				}
				if (enableSeaAnimals.Value)
				{
					if (!seaAnimalsLoaded)
					{
						seaAnimalsLoaded = IsSeaAnimalsInstalled();
					}
					if (seaAnimalsLoaded)
					{
						ScanSeaAnimalsWildlife(pos);
					}
				}
				return;
			}
			CheckNewCatches();
			currentBiome = ReadBiome();
			selectedBait = ReadSelectedBait();
			ScanSerpentThreats(pos);
			if (!rtDOceanLoaded)
			{
				rtDOceanLoaded = Chainloader.PluginInfos.ContainsKey("soloredis.rtdocean");
			}
			if (rtDOceanLoaded)
			{
				ScanRtDWildlife(pos);
			}
			if (enableSeaAnimals.Value)
			{
				if (!seaAnimalsLoaded)
				{
					seaAnimalsLoaded = IsSeaAnimalsInstalled();
				}
				if (seaAnimalsLoaded)
				{
					ScanSeaAnimalsWildlife(pos);
				}
			}
			if (fishType == null)
			{
				fishType = AccessType("Fish");
			}
			if (fishType == null)
			{
				if (!warned)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"Fish class not found; vanilla fish scan unavailable.");
					warned = true;
				}
				if (boatMode)
				{
					UpdateScoutMessage();
				}
				return;
			}
			try
			{
				Object[] array = Object.FindObjectsOfType(fishType);
				foreach (Object val in array)
				{
					Component val2 = (Component)(object)((val is Component) ? val : null);
					if ((Object)(object)val2 == (Object)null || !val2.gameObject.activeInHierarchy)
					{
						continue;
					}
					Vector3 val3 = val2.transform.position - pos;
					Vector2 val4 = new Vector2(val3.x, val3.z);
					float magnitude = ((Vector2)(ref val4)).magnitude;
					if (magnitude > (boatMode ? Mathf.Clamp(boatRange.Value, 50f, 300f) : 25f))
					{
						continue;
					}
					string fishName = Localize(Member(val, "m_name") as string);
					if (string.IsNullOrWhiteSpace(fishName))
					{
						fishName = ((Object)val2.gameObject).name.Replace("(Clone)", "");
					}
					string text = BaitFor(val);
					if (text == "Unknown" && !showUnknown.Value)
					{
						continue;
					}
					Entry entry = nearby.FirstOrDefault((Entry f) => string.Equals(f.name, fishName, StringComparison.OrdinalIgnoreCase));
					if (entry != null)
					{
						entry.count++;
						if (magnitude < entry.distance)
						{
							entry.distance = magnitude;
							entry.icon = FindFishIcon(val2, fishName);
							entry.direction = (boatMode ? BoatBearing(boatTransform, val2.transform.position) : null);
						}
						if (entry.bait == "Unknown" && text != "Unknown")
						{
							entry.bait = text;
						}
					}
					else
					{
						nearby.Add(new Entry
						{
							name = fishName,
							bait = text,
							distance = magnitude,
							icon = FindFishIcon(val2, fishName),
							count = 1,
							direction = (boatMode ? BoatBearing(boatTransform, val2.transform.position) : null)
						});
					}
				}
				nearby.Sort((Entry a, Entry b) => a.distance.CompareTo(b.distance));
				if (boatMode)
				{
					UpdateScoutMessage();
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Fish scan failed: " + ex.Message));
			}
		}

		private static bool IsWindowOpen(string className)
		{
			try
			{
				Type type = AccessType(className);
				if (type == null)
				{
					return false;
				}
				object obj = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null) ?? type.GetField("m_instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				if (obj == null)
				{
					return false;
				}
				MethodInfo method = type.GetMethod("IsVisible", Flags, null, Type.EmptyTypes, null);
				if (method != null && method.ReturnType == typeof(bool))
				{
					return (bool)method.Invoke(obj, null);
				}
				object obj2 = Member(obj, "m_root", "m_panel", "m_inventoryRoot");
				GameObject val = (GameObject)((obj2 is GameObject) ? obj2 : null);
				if (val != null)
				{
					return val.activeInHierarchy;
				}
				Component val2 = (Component)((obj2 is Component) ? obj2 : null);
				if (val2 != null)
				{
					return val2.gameObject.activeInHierarchy;
				}
			}
			catch
			{
			}
			return false;
		}

		private static string ReadBiome()
		{
			try
			{
				Type type = AccessType("Player");
				object obj = type?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				object obj2 = (type?.GetMethod("GetCurrentBiome", Flags, null, Type.EmptyTypes, null))?.Invoke(obj, null);
				if (obj2 != null)
				{
					return obj2.ToString();
				}
			}
			catch
			{
			}
			return "Unknown";
		}

		private static bool TryLocalPlayerPosition(out Vector3 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			pos = Vector3.zero;
			try
			{
				object? obj = AccessType("Player")?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				Component val = (Component)((obj is Component) ? obj : null);
				if (val != null)
				{
					pos = val.transform.position;
					return true;
				}
			}
			catch
			{
			}
			return false;
		}

		private static string DisplayCreatureName(string key)
		{
			return Regex.Replace(key, "([a-z])([A-Z])", "$1 $2");
		}

		private void ScanRtDWildlife(Vector3 pos)
		{
			//IL_00fc: 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_0102: 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_0109: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			Type type = AccessType("Character");
			if (type == null)
			{
				return;
			}
			float num = ((boatMode || aboardShipForWarnings) ? Mathf.Clamp(boatRange.Value, 50f, 300f) : 25f);
			try
			{
				Object[] array = Object.FindObjectsOfType(type);
				foreach (Object obj in array)
				{
					Component val = (Component)(object)((obj is Component) ? obj : null);
					if ((Object)(object)val == (Object)null || !val.gameObject.activeInHierarchy)
					{
						continue;
					}
					string text = ((Object)val.gameObject).name.Replace("(Clone)", "").Trim();
					if (!text.EndsWith("_RtD", StringComparison.OrdinalIgnoreCase))
					{
						continue;
					}
					string text2 = text.Substring(0, text.Length - 4);
					if (text2.StartsWith("Animal_", StringComparison.OrdinalIgnoreCase))
					{
						text2 = text2.Substring(7);
					}
					if (!RtDWildlife.Contains(text2))
					{
						continue;
					}
					Vector3 val2 = val.transform.position - pos;
					Vector2 val3 = new Vector2(val2.x, val2.z);
					float magnitude = ((Vector2)(ref val3)).magnitude;
					if (magnitude > num)
					{
						continue;
					}
					string name = DisplayCreatureName(text2);
					Entry entry = wildlife.FirstOrDefault((Entry w) => string.Equals(w.name, name, StringComparison.OrdinalIgnoreCase));
					if (entry == null)
					{
						wildlife.Add(new Entry
						{
							name = name,
							bait = null,
							count = 1,
							distance = magnitude,
							direction = (boatMode ? BoatBearing(boatTransform, val.transform.position) : null)
						});
					}
					else
					{
						entry.count++;
						if (magnitude < entry.distance)
						{
							entry.distance = magnitude;
							entry.direction = (boatMode ? BoatBearing(boatTransform, val.transform.position) : null);
						}
					}
				}
				wildlife.Sort((Entry a, Entry b) => a.distance.CompareTo(b.distance));
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("RtDOcean wildlife scan failed: " + ex.Message));
			}
		}

		private static bool IsSeaAnimalsInstalled()
		{
			return Chainloader.PluginInfos.Values.Any((PluginInfo info) => (info.Metadata.Name ?? "").Replace(" ", "").Equals("SeaAnimals", StringComparison.OrdinalIgnoreCase) || (info.Metadata.GUID ?? "").Replace("_", "").Replace("-", "").IndexOf("seaanimals", StringComparison.OrdinalIgnoreCase) >= 0);
		}

		private static bool IsTamedCharacter(Component c)
		{
			try
			{
				MethodInfo method = ((object)c).GetType().GetMethod("IsTamed", Flags, null, Type.EmptyTypes, null);
				if (method != null && method.ReturnType == typeof(bool))
				{
					return (bool)method.Invoke(c, null);
				}
			}
			catch
			{
			}
			return false;
		}

		private void ScanSeaAnimalsWildlife(Vector3 pos)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			Type type = AccessType("Character");
			if (type == null)
			{
				return;
			}
			float num = ((boatMode || aboardShipForWarnings) ? Mathf.Clamp(boatRange.Value, 50f, 300f) : 25f);
			try
			{
				Object[] array = Object.FindObjectsOfType(type);
				foreach (Object obj in array)
				{
					Component val = (Component)(object)((obj is Component) ? obj : null);
					if ((Object)(object)val == (Object)null || !val.gameObject.activeInHierarchy)
					{
						continue;
					}
					string text = ((Object)val.gameObject).name.Replace("(Clone)", "").Trim();
					if (!SeaAnimalsPrefabs.TryGetValue(text, out var name))
					{
						continue;
					}
					Vector3 val2 = val.transform.position - pos;
					Vector2 val3 = new Vector2(val2.x, val2.z);
					float magnitude = ((Vector2)(ref val3)).magnitude;
					if (magnitude > num)
					{
						continue;
					}
					if (SeaAnimalsBoatThreatPrefabs.Contains(text) && !IsTamedCharacter(val))
					{
						seaAnimalsThreats.Add(new Entry
						{
							name = name,
							distance = magnitude,
							direction = (boatMode ? BoatBearing(boatTransform, val.transform.position) : null)
						});
					}
					Entry entry = seaAnimalsWildlife.FirstOrDefault((Entry w) => string.Equals(w.name, name, StringComparison.OrdinalIgnoreCase));
					if (entry == null)
					{
						seaAnimalsWildlife.Add(new Entry
						{
							name = name,
							bait = null,
							count = 1,
							distance = magnitude,
							direction = (boatMode ? BoatBearing(boatTransform, val.transform.position) : null)
						});
					}
					else
					{
						entry.count++;
						if (magnitude < entry.distance)
						{
							entry.distance = magnitude;
							entry.direction = (boatMode ? BoatBearing(boatTransform, val.transform.position) : null);
						}
					}
				}
				seaAnimalsWildlife.Sort((Entry a, Entry b) => a.distance.CompareTo(b.distance));
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("SeaAnimals wildlife scan failed: " + ex.Message));
			}
		}

		private void ScanSerpentThreats(Vector3 pos)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			Type type = AccessType("Character");
			if (type == null)
			{
				return;
			}
			try
			{
				Object[] array = Object.FindObjectsOfType(type);
				foreach (Object obj in array)
				{
					Component val = (Component)(object)((obj is Component) ? obj : null);
					if ((Object)(object)val == (Object)null || !val.gameObject.activeInHierarchy)
					{
						continue;
					}
					string text = ((Object)val.gameObject).name.Replace("(Clone)", "").Trim();
					bool flag = text.IndexOf("bonemaw", StringComparison.OrdinalIgnoreCase) >= 0 && text.IndexOf("serpent", StringComparison.OrdinalIgnoreCase) >= 0;
					bool flag2 = string.Equals(text, "Serpent", StringComparison.OrdinalIgnoreCase);
					if (!flag && !flag2)
					{
						continue;
					}
					Vector3 val2 = val.transform.position - pos;
					Vector2 val3 = new Vector2(val2.x, val2.z);
					if (!(((Vector2)(ref val3)).magnitude > 110f))
					{
						if (flag)
						{
							bonemawNearby = true;
						}
						else
						{
							serpentNearby = true;
						}
						if (serpentNearby && bonemawNearby)
						{
							break;
						}
					}
				}
			}
			catch
			{
			}
		}

		private static string ReadSelectedBait()
		{
			try
			{
				Type type = AccessType("Player");
				object obj = type?.GetField("m_localPlayer", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null);
				if (obj == null)
				{
					return null;
				}
				object obj2 = type.GetMethod("GetRightItem", Flags, null, Type.EmptyTypes, null)?.Invoke(obj, null);
				MethodInfo[] methods = type.GetMethods(Flags);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.Name != "GetAmmoItem")
					{
						continue;
					}
					ParameterInfo[] parameters = methodInfo.GetParameters();
					try
					{
						string text = ItemName((parameters.Length == 0) ? methodInfo.Invoke(obj, null) : ((parameters.Length == 1 && obj2 != null && parameters[0].ParameterType.IsInstanceOfType(obj2)) ? methodInfo.Invoke(obj, new object[1] { obj2 }) : null));
						if (!string.IsNullOrEmpty(text) && text.IndexOf("bait", StringComparison.OrdinalIgnoreCase) >= 0)
						{
							return text;
						}
					}
					catch
					{
					}
				}
				if (Member(type.GetMethod("GetInventory", Flags, null, Type.EmptyTypes, null)?.Invoke(obj, null), "m_inventory") is IEnumerable enumerable)
				{
					foreach (object item in enumerable)
					{
						object obj4 = Member(item, "m_equipped");
						if (obj4 is bool && (bool)obj4)
						{
							string text2 = ItemName(item);
							if (!string.IsNullOrEmpty(text2) && text2.IndexOf("bait", StringComparison.OrdinalIgnoreCase) >= 0)
							{
								return text2;
							}
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private static string ExpectedBait(string biome)
		{
			return (biome ?? "").ToLowerInvariant() switch
			{
				"meadows" => "Fishing Bait", 
				"blackforest" => "Mossy Fishing Bait", 
				"swamp" => "Sticky Fishing Bait", 
				"ocean" => "Heavy Fishing Bait", 
				"plains" => "Stingy Fishing Bait", 
				"mistlands" => "Misty Fishing Bait", 
				"ashlands" => "Hot Fishing Bait", 
				"deepnorth" => "Frosty Fishing Bait", 
				"mountain" => "Cold Fishing Bait", 
				_ => null, 
			};
		}

		private Entry PrimaryTarget()
		{
			List<Entry> source = (from f in nearby
				where !string.IsNullOrWhiteSpace(f.bait) && !f.bait.Equals("Unknown", StringComparison.OrdinalIgnoreCase)
				orderby f.distance, f.count descending, f.name
				select f).ToList();
			Entry entry = source.FirstOrDefault();
			if (entry == null)
			{
				preferredBait = null;
				return null;
			}
			Entry entry2 = source.FirstOrDefault((Entry f) => string.Equals(f.bait, preferredBait, StringComparison.OrdinalIgnoreCase));
			if (entry2 != null && Time.time - preferredBaitChangedAt < 15f)
			{
				return entry2;
			}
			if (!string.Equals(preferredBait, entry.bait, StringComparison.OrdinalIgnoreCase))
			{
				preferredBait = entry.bait;
				preferredBaitChangedAt = Time.time;
			}
			return entry;
		}

		private string AlternativeBaits(Entry primary)
		{
			if (primary == null)
			{
				return null;
			}
			string[] array = (from f in nearby
				where f != primary && !string.IsNullOrWhiteSpace(f.bait) && !f.bait.Equals("Unknown", StringComparison.OrdinalIgnoreCase)
				orderby f.count descending, f.distance
				select f.bait into b
				where !b.Equals(primary.bait, StringComparison.OrdinalIgnoreCase)
				select b).Distinct<string>(StringComparer.OrdinalIgnoreCase).ToArray();
			if (array.Length != 0)
			{
				return string.Join(", ", array);
			}
			return null;
		}

		private static bool BaitMatches(string selected, string required)
		{
			if (string.IsNullOrWhiteSpace(selected) || string.IsNullOrWhiteSpace(required))
			{
				return false;
			}
			return required.Split(new char[1] { ',' }).Any((string b) => string.Equals(b.Trim(), selected.Trim(), StringComparison.OrdinalIgnoreCase));
		}

		private static string[] Advice(string biome)
		{
			return biome.ToLowerInvariant() switch
			{
				"meadows" => new string[3] { "Gentle waters are a fine place to begin. Ordinary Fishing Bait should serve you well.", "A patient hand and ordinary Fishing Bait may bring a pleasant catch here.", "These quiet shores favor simple tackle. Try ordinary Fishing Bait." }, 
				"blackforest" => new string[3] { "The forest waters reward a watchful eye. Mossy Fishing Bait is worth trying.", "Among the dark pines, I'd cast with Mossy Fishing Bait.", "A good fishing spot, perhaps. Keep Mossy Fishing Bait at hand." }, 
				"swamp" => new string[3] { "Murky water hides curious catches. Try Sticky Fishing Bait.", "The bog is no place for clean boots, but Sticky Fishing Bait may pay off.", "Cast carefully in these marshes. Sticky Fishing Bait is a sound choice." }, 
				"ocean" => new string[4] { "Open water calls for sturdier tackle. Heavy Fishing Bait is a good choice.", "The deep may hold tuna and coral cod. I'd bring Heavy Fishing Bait.", "Far from shore, patience and Heavy Fishing Bait may be rewarded.", "These rolling seas look promising. Try Heavy Fishing Bait." }, 
				"plains" => new string[3] { "The warm shores invite a cast. Stingy Fishing Bait is worth a try.", "There may be fine fishing along these plains. Bring Stingy Fishing Bait.", "Keep an eye on the waterline. Stingy Fishing Bait should serve." }, 
				"mistlands" => new string[3] { "The mist conceals more than rocks. Misty Fishing Bait may reveal a catch.", "Trust your line where your eyes cannot. Try Misty Fishing Bait.", "These veiled waters demand patience and Misty Fishing Bait." }, 
				"ashlands" => new string[3] { "Hot shores and perilous waters. Bring Hot Fishing Bait, and mind your footing.", "Even here a fisher may find fortune. Hot Fishing Bait is the choice.", "I'd not linger by these flames, but Hot Fishing Bait may tempt a catch." }, 
				"deepnorth" => new string[3] { "Ice and silence surround us. Frosty Fishing Bait may be worth a cast.", "A hardy fisher needs patience here. Try Frosty Fishing Bait.", "The frozen coast keeps its secrets. Pack Frosty Fishing Bait." }, 
				"mountain" => new string[3] { "Cold waters demand care. Cold Fishing Bait may be worth trying.", "The mountain streams are unforgiving. Keep Cold Fishing Bait ready.", "A chilly place for fishing. Cold Fishing Bait is a sensible start." }, 
				_ => new string[2] { "Unfamiliar waters, friend. Watch what bites before choosing your bait.", "Every shore has its secrets. Study the water before you cast." }, 
			};
		}

		private Entry ClosestSeaThreat()
		{
			return (from w in wildlife.Where((Entry w) => SeaThreatNames.Contains(w.name)).Concat(seaAnimalsThreats)
				orderby w.distance
				select w).FirstOrDefault();
		}

		private string SeaThreatMessage(Entry closest)
		{
			if (bonemawNearby)
			{
				return "BONEMAW DETECTED - Your ship is in danger. Ready weapons and prepare to evade!";
			}
			if (serpentNearby)
			{
				return "SEA SERPENT DETECTED - Your ship may be in danger. Ready weapons and prepare to evade!";
			}
			if (closest == null)
			{
				return null;
			}
			return "Caution: " + closest.name + " nearby - " + closest.distance.ToString("0") + " m" + ((boatMode && !string.IsNullOrEmpty(closest.direction)) ? (" " + closest.direction) : "") + ". Keep watch and steer clear.";
		}

		private void DrawCatchCelebration()
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_0120: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			if (!string.IsNullOrEmpty(catchText) && !(Time.time >= catchTextUntil) && !IsWindowOpen("InventoryGui") && !IsWindowOpen("Menu") && !IsWindowOpen("StoreGui") && !IsWindowOpen("TextInput"))
			{
				if (celebrationStyle == null)
				{
					GUIStyle val = new GUIStyle(GUI.skin.label)
					{
						alignment = (TextAnchor)4,
						fontSize = 29,
						fontStyle = (FontStyle)3,
						wordWrap = true
					};
					val.normal.textColor = new Color(1f, 0.91f, 0.3f, 1f);
					celebrationStyle = val;
				}
				float num = Mathf.Clamp01((catchTextUntil - Time.time) / 0.8f);
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num);
				string text = "✦ " + catchText + " ✦";
				float num2 = Mathf.Min((float)Screen.width * 0.86f, 1050f);
				float num3 = celebrationStyle.CalcHeight(new GUIContent(text), num2);
				GUI.Label(new Rect(((float)Screen.width - num2) / 2f, (float)Screen.height * 0.18f, num2, Mathf.Max(75f, num3 + 12f)), text, celebrationStyle);
				GUI.color = color;
			}
		}

		private void DrawBoatSafetyOnly()
		{
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: 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_00d8: 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_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_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			Entry closest = ClosestSeaThreat();
			string text = SeaThreatMessage(closest);
			if (string.IsNullOrEmpty(text))
			{
				return;
			}
			float num = Mathf.Clamp(scale.Value, 0.6f, 2f);
			float num2 = Mathf.Clamp(panelWidth.Value, 280f, 850f);
			float num3 = Mathf.Max(8f, ((savedX.Value >= 0f) ? savedX.Value : ((float)Screen.width - mapRightInset.Value)) / num);
			float num4 = Mathf.Max(8f, ((savedY.Value >= 0f) ? savedY.Value : topOffset.Value) / num);
			int depth = GUI.depth;
			Matrix4x4 matrix = GUI.matrix;
			Color color = GUI.color;
			try
			{
				GUI.depth = 0;
				GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = Mathf.Clamp(fishFont.Value, 12, 36),
					fontStyle = (FontStyle)1,
					wordWrap = true
				};
				val.normal.textColor = Color.white;
				GUIStyle val2 = val;
				float num5 = Mathf.Max(45f, val2.CalcHeight(new GUIContent(text), num2 - 24f) + 20f);
				GUI.color = ((serpentNearby || bonemawNearby) ? new Color(0.35f, 0.075f, 0.085f, 0.95f) : new Color(0.4f, 0.12f, 0.1f, 0.94f));
				GUI.DrawTexture(new Rect(num3, num4, num2, num5), (Texture)(object)Texture2D.whiteTexture);
				GUI.color = color;
				GUI.Label(new Rect(num3 + 12f, num4 + 9f, num2 - 24f, num5 - 12f), text, val2);
			}
			finally
			{
				GUI.depth = depth;
				GUI.matrix = matrix;
				GUI.color = color;
			}
		}

		private void OnGUI()
		{
			//IL_18d2: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_015e: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Expected O, but got Unknown
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Expected O, but got Unknown
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Expected O, but got Unknown
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Expected O, but got Unknown
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Expected O, but got Unknown
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Expected O, but got Unknown
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b4: Invalid comparison between Unknown and I4
			//IL_074f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bd: Invalid comparison between Unknown and I4
			//IL_0954: Unknown result type (might be due to invalid IL or missing references)
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_0992: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0926: Unknown result type (might be due to invalid IL or missing references)
			//IL_0877: Unknown result type (might be due to invalid IL or missing references)
			//IL_087d: Invalid comparison between Unknown and I4
			//IL_077b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0791: Unknown result type (might be due to invalid IL or missing references)
			//IL_079a: Unknown result type (might be due to invalid IL or missing references)
			//IL_079f: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fa: Expected O, but got Unknown
			//IL_0a19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2b: Expected O, but got Unknown
			//IL_0a48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a71: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0814: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f94: Unknown result type (might be due to invalid IL or missing references)
			//IL_104d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1059: Expected O, but got Unknown
			//IL_1079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aeb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af7: Expected O, but got Unknown
			//IL_0b0c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b18: Expected O, but got Unknown
			//IL_0b50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bb5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bfe: Expected O, but got Unknown
			//IL_0c2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_140d: Unknown result type (might be due to invalid IL or missing references)
			//IL_141f: Expected O, but got Unknown
			//IL_1445: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1499: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_14b7: Expected O, but got Unknown
			//IL_14cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_14f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_16a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_16bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_16c7: Expected O, but got Unknown
			//IL_16dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1709: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d72: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da0: Expected O, but got Unknown
			//IL_0db6: Unknown result type (might be due to invalid IL or missing references)
			//IL_117d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1189: Expected O, but got Unknown
			//IL_11b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c1: Expected O, but got Unknown
			//IL_0dcd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddf: Expected O, but got Unknown
			//IL_123a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e05: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e17: Expected O, but got Unknown
			//IL_0e34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e75: Unknown result type (might be due to invalid IL or missing references)
			//IL_125d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f34: Expected O, but got Unknown
			//IL_0f55: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea2: Unknown result type (might be due to invalid IL or missing references)
			//IL_12f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_15cc: Expected O, but got Unknown
			//IL_17ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_17ff: Expected O, but got Unknown
			//IL_160d: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_134a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1356: Expected O, but got Unknown
			//IL_137c: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_1847: Unknown result type (might be due to invalid IL or missing references)
			//IL_1831: Unknown result type (might be due to invalid IL or missing references)
			//IL_162b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1648: Unknown result type (might be due to invalid IL or missing references)
			//IL_1865: Unknown result type (might be due to invalid IL or missing references)
			//IL_1882: Unknown result type (might be due to invalid IL or missing references)
			DrawCatchCelebration();
			if (!editMode && !RodEquipped(out var _))
			{
				if (showSeaThreatWarnings.Value && aboardShipForWarnings && (serpentNearby || bonemawNearby || ClosestSeaThreat() != null) && !IsWindowOpen("InventoryGui") && !IsWindowOpen("Menu") && !IsWindowOpen("StoreGui") && !IsWindowOpen("TextInput"))
				{
					DrawBoatSafetyOnly();
				}
			}
			else
			{
				if (!editMode && (IsWindowOpen("InventoryGui") || IsWindowOpen("Menu") || IsWindowOpen("StoreGui") || IsWindowOpen("TextInput")))
				{
					return;
				}
				float num = Mathf.Clamp(scale.Value, 0.6f, 2f);
				int num2 = Mathf.Clamp(titleFont.Value, 12, 40);
				int num3 = Mathf.Clamp(fishFont.Value, 12, 36);
				if (headerStyle == null || headerStyle.fontSize != num2 || rowStyle.fontSize != num3)
				{
					GUIStyle val = new GUIStyle(GUI.skin.label)
					{
						fontSize = num2,
						fontStyle = (FontStyle)1
					};
					val.normal.textColor = Color.white;
					headerStyle = val;
					GUIStyle val2 = new GUIStyle(GUI.skin.label)
					{
						fontSize = num3,
						wordWrap = true
					};
					val2.normal.textColor = Color.white;
					rowStyle = val2;
					baitStyle = new GUIStyle(GUI.skin.label)
					{
						fontSize = num3,
						fontStyle = (FontStyle)1,
						wordWrap = true
					};
					iconStyle = new GUIStyle(GUI.skin.label)
					{
						fontSize = num3 + 3,
						fontStyle = (FontStyle)1
					};
					GUIStyle val3 = new GUIStyle(GUI.skin.label)
					{
						fontSize = Mathf.Clamp(num3 + 3, 15, 40),
						fontStyle = (FontStyle)3,
						wordWrap = true
					};
					val3.normal.textColor = new Color(1f, 0.92f, 0.24f);
					spiritStyle = val3;
					GUIStyle val4 = new GUIStyle(GUI.skin.label)
					{
						fontSize = Mathf.Clamp(num3 - 1, 12, 34),
						fontStyle = (FontStyle)1,
						alignment = (TextAnchor)3
					};
					val4.normal.textColor = new Color(0.5f, 1f, 0.6f);
					rangeStyle = val4;
					actionStyle = new GUIStyle(GUI.skin.label)
					{
						fontSize = Mathf.Clamp(num3 - 2, 13, 32),
						fontStyle = (FontStyle)1,
						wordWrap = true,
						alignment = (TextAnchor)3
					};
					GUIStyle val5 = new GUIStyle(GUI.skin.label)
					{
						fontSize = Mathf.Clamp(num3 + 4, 17, 40),
						fontStyle = (FontStyle)1,
						wordWrap = true
					};
					val5.normal.textColor = new Color(1f, 0.88f, 0.72f);
					threatTitleStyle = val5;
					GUIStyle val6 = new GUIStyle(GUI.skin.label)
					{
						fontSize = Mathf.Clamp(num3, 13, 36),
						fontStyle = (FontStyle)1,
						wordWrap = true
					};
					val6.normal.textColor = Color.white;
					threatDetailStyle = val6;
					GUIStyle val7 = new GUIStyle(GUI.skin.label)
					{
						fontSize = Mathf.Clamp(num3 - 2, 12, 30),
						fontStyle = (FontStyle)0,
						wordWrap = true
					};
					val7.normal.textColor = new Color(1f, 0.83f, 0.55f);
					wildlifeCautionStyle = val7;
				}
				bool flag = Time.time < catchTextUntil && !string.IsNullOrEmpty(catchText);
				Entry entry = ClosestSeaThreat();
				bool flag2 = serpentNearby || bonemawNearby || entry != null;
				string text = (flag2 ? SeaThreatMessage(entry) : null);
				Entry entry2 = PrimaryTarget();
				string text2 = entry2?.bait;
				string text3 = AlternativeBaits(entry2);
				int num4 = (int)(Time.time / Mathf.Max(8f, adviceCycle.Value));
				string text4;
				if (bonemawNearby)
				{
					text4 = "BONEMAW! That monster can tear into your ship. Ready weapons and steer clear!";
				}
				else if (serpentNearby)
				{
					text4 = SerpentAdvice[num4 % SerpentAdvice.Length];
				}
				else if (entry != null)
				{
					text4 = "By Odin, " + entry.name + " lurks nearby! Guard your ship, Viking, and prepare to turn away!";
				}
				else if (boatMode)
				{
					text4 = scoutMessage ?? "Keep a sharp eye on the waves, Viking. The spirit watches with you.";
				}
				else if (nearby.Count == 0 && (wildlife.Count > 0 || seaAnimalsWildlife.Count > 0))
				{
					string[] array = new string[3] { "By Odin, creatures stir in these waters. Keep your eyes keen!", "The sea has secrets beyond the hook, Viking. Watch the waves!", "I spy life beneath the surface. A watchful hunter finds the way." };
					text4 = array[num4 % array.Length];
				}
				else if (nearby.Count == 0)
				{
					string[] array2 = new string[3] { "Not a fin stirs near us. Shall we seek richer waters?", "The sea keeps its fish hidden today, Viking. Sail on!", "Patience, friend. Even Odin cannot summon fish to an empty shore." };
					text4 = array2[num4 % array2.Length];
				}
				else if (string.IsNullOrEmpty(text2))
				{
					string[] array3 = new string[2] { "Fish swim close, but their taste in bait is a mystery to me!", "I sense fish nearby, Viking. Let us learn what tempts them." };
					text4 = array3[num4 % array3.Length];
				}
				else if (string.IsNullOrWhiteSpace(selectedBait))
				{
					string[] array4 = new string[2]
					{
						"A hook without bait? Even Thor would struggle! Ready your " + text2 + ".",
						"The fish are waiting, Viking. Equip " + text2 + " and tempt your fortune!"
					};
					text4 = array4[num4 % array4.Length];
				}
				else if (BaitMatches(selectedBait, text2))
				{
					string[] array5 = new string[3] { "A fine choice of bait, Viking! Now let the sea decide our fortune.", "That bait suits our nearest quarry. Cast true, and may Odin smile!", "You've chosen wisely, friend. Let the fish come to us." };
					text4 = array5[num4 % array5.Length];
				}
				else
				{
					string[] array6 = new string[2]
					{
						"That bait may not tempt our nearest fish. Try " + text2 + ", Viking!",
						"The sea whispers of " + text2 + ". Change your bait and cast again!"
					};
					text4 = array6[num4 % array6.Length];
				}
				if (flag && !boatMode)
				{
					text4 = catchText;
				}
				Matrix4x4 matrix = GUI.matrix;
				int depth = GUI.depth;
				try
				{
					GUI.depth = 0;
					GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
					float num5 = Mathf.Max(8f, ((savedX.Value >= 0f) ? savedX.Value : ((float)Screen.width - mapRightInset.Value)) / num);
					float num6 = Mathf.Max(8f, ((savedY.Value >= 0f) ? savedY.Value : topOffset.Value) / num);
					float num7 = Mathf.Clamp(panelWidth.Value, 280f, 850f);
					float num8 = (float)num2 + 12f;
					Rect val8 = default(Rect);
					((Rect)(ref val8))..ctor(num5, num6, num7, num8 + 8f);
					if (editMode)
					{
						GUI.Box(new Rect(num5 - 5f, num6 - 5f, num7 + 10f, 170f), "");
						Event current = Event.current;
						if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref val8)).Contains(current.mousePosition))
						{
							dragging = true;
							dragOffset = current.mousePosition - new Vector2(num5, num6);
							current.Use();
						}
						else if ((int)current.type == 3 && dragging &