Decompiled source of BetterFishing v1.2.1

BetterFishing\BetterFishing.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Crest;
using HarmonyLib;
using HooksHangMore;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BetterFishing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("raddude")]
[assembly: AssemblyProduct("BetterFishing")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("82f3c728-6dca-4f41-8943-6b16d063f243")]
[assembly: AssemblyFileVersion("1.2.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.1.0")]
[module: UnverifiableCode]
namespace BetterFishing
{
	[BepInPlugin("com.raddude82.betterfishing", "BetterFishing", "1.2.1")]
	[BepInDependency("com.raddude82.hookshangmore", "1.0.4")]
	public class BF_Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.raddude82.betterfishing";

		public const string PLUGIN_NAME = "BetterFishing";

		public const string PLUGIN_VERSION = "1.2.1";

		public const string HOOKS_HANG_MORE_GUID = "com.raddude82.hookshangmore";

		public const string HOOKS_HANG_MORE_VERSION = "1.0.4";

		private static ManualLogSource _logger;

		internal static BF_Plugin Instance { get; private set; }

		internal static void LogDebug(string message)
		{
			_logger.LogDebug((object)message);
		}

		internal static void LogInfo(string message)
		{
			_logger.LogInfo((object)message);
		}

		internal static void LogWarning(string message)
		{
			_logger.LogWarning((object)message);
		}

		internal static void LogError(string message)
		{
			_logger.LogError((object)message);
		}

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			_logger = ((BaseUnityPlugin)this).Logger;
			((MonoBehaviour)this).StartCoroutine(AssetLoader.LoadAssets());
			Configs.InitializeConfigs();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.raddude82.betterfishing");
			SceneManager.sceneLoaded += AddShopItems.SceneLoaded;
			SceneManager.sceneLoaded += RemoveWholeFish.SceneLoaded;
		}
	}
	internal class LurePatches
	{
		[HarmonyPatch(typeof(LookUI), "RegisterPointer")]
		private class GetGoPointer
		{
			public static void Prefix(GoPointer goPointer)
			{
				Go.Pointer = goPointer;
			}
		}

		[HarmonyPatch(typeof(ShipItemFishingRod), "OnItemClick")]
		private class ShipItemFishingRodPatches
		{
			[HarmonyPrefix]
			public static bool AttachHookType(PickupableItem heldItem, ShipItemFishingRod __instance, GameObject ___hookVisuals, ref bool __result)
			{
				ShipItemFishingHook component = ((Component)heldItem).GetComponent<ShipItemFishingHook>();
				if ((Object)(object)component == (Object)null)
				{
					__result = true;
					return false;
				}
				___hookVisuals.SetActive(true);
				if (((ShipItem)__instance).health > 0f)
				{
					if (((Object)___hookVisuals).name == "hook")
					{
						GameObject prefab = PrefabsDirectory.instance.directory[99];
						((MonoBehaviour)__instance).StartCoroutine(SwappingLures(prefab, heldItem));
					}
					else
					{
						Lure lure = Lure.Lures.FirstOrDefault((Lure l) => l.Name == ((Object)___hookVisuals).name);
						((MonoBehaviour)__instance).StartCoroutine(SwappingLures(lure.Item, heldItem));
					}
				}
				else
				{
					((Component)component).GetComponent<ShipItem>().DestroyItem();
				}
				((ShipItem)__instance).health = 1f;
				BF_Plugin.LogDebug("Attaching " + ((Object)heldItem).name);
				AttachLure(((Object)heldItem).name, ref ___hookVisuals);
				__result = true;
				return false;
			}
		}

		[HarmonyPatch(typeof(SaveablePrefab))]
		private class SaveablePrefabPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("PrepareSaveData")]
			public static void SaveLure(ShipItem ___item, ref SavePrefabData __result)
			{
				if (!(___item is ShipItemFishingRod))
				{
					return;
				}
				GameObject hookVisuals = ((Component)___item).GetComponent<ShipItemFishingRod>().GetPrivateField<GameObject>("hookVisuals");
				if (((Object)hookVisuals).name == "hook")
				{
					__result.extraValue0 = 0f;
					return;
				}
				Lure lure = Lure.Lures.FirstOrDefault((Lure l) => l.Name == ((Object)hookVisuals).name);
				if (lure != null)
				{
					__result.extraValue0 = lure.SaveData;
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch("Load")]
			public static void LoadLure(SavePrefabData data, SaveablePrefab __instance)
			{
				ShipItem component = ((Component)__instance).GetComponent<ShipItem>();
				if (!((Object)(object)component != (Object)null))
				{
					return;
				}
				ShipItemFishingRod val = (ShipItemFishingRod)(object)((component is ShipItemFishingRod) ? component : null);
				if (val == null)
				{
					return;
				}
				BF_Plugin.LogDebug($"Loading lure for fishing rod with saved data extraValue0: {data.extraValue0}");
				GameObject hookVisuals = val.GetPrivateField<GameObject>("hookVisuals");
				string text = "99 fishing hook";
				if (data.extraValue0 > 0f)
				{
					Lure lure = Lure.Lures.FirstOrDefault((Lure l) => l.SaveData == data.extraValue0);
					if (lure != null)
					{
						text = lure.Name;
					}
				}
				AttachLure(text + "(Clone)", ref hookVisuals);
			}
		}

		[CompilerGenerated]
		private sealed class <SwappingLures>d__5 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject prefab;

			public PickupableItem heldItem;

			private Vector3 <heldPos>5__1;

			private Quaternion <heldRot>5__2;

			private Transform <heldParent>5__3;

			private GameObject <lure>5__4;

			private ShipItemFishingHook <shipItem>5__5;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SwappingLures>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<heldParent>5__3 = null;
				<lure>5__4 = null;
				<shipItem>5__5 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: Expected O, but got Unknown
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					BF_Plugin.LogDebug("Swapping lure " + ((Object)prefab).name + " for " + ((Object)heldItem).name);
					<heldPos>5__1 = ((Component)heldItem).transform.position;
					<heldRot>5__2 = ((Component)heldItem).transform.rotation;
					<heldParent>5__3 = ((Component)heldItem).transform.parent;
					((Component)heldItem).GetComponent<ShipItem>().DestroyItem();
					<lure>5__4 = Object.Instantiate<GameObject>(prefab, <heldPos>5__1, <heldRot>5__2, <heldParent>5__3);
					<lure>5__4.GetComponent<SaveablePrefab>().RegisterToSave();
					<shipItem>5__5 = <lure>5__4.GetComponent<ShipItemFishingHook>();
					((ShipItem)<shipItem>5__5).sold = true;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 2;
					return true;
				case 2:
					<>1__state = -1;
					Go.Pointer.PickUpItem((PickupableItem)(object)<shipItem>5__5);
					BF_Plugin.LogDebug("Swapped lures");
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		internal static Material hookMaterial;

		internal static Mesh hookMesh;

		private static void AttachLure(string heldItemName, ref GameObject hookVisuals)
		{
			//IL_00af: 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)
			if (heldItemName == "99 fishing hook(Clone)")
			{
				hookVisuals.GetComponent<MeshFilter>().mesh = hookMesh;
				((Renderer)hookVisuals.GetComponent<MeshRenderer>()).material = hookMaterial;
				hookVisuals.transform.localPosition = Vector3.zero;
				((Object)hookVisuals).name = "hook";
				return;
			}
			Lure lure = Lure.Lures.FirstOrDefault((Lure l) => l.Name + "(Clone)" == heldItemName);
			hookVisuals.GetComponent<MeshFilter>().mesh = lure.LureMesh;
			((Renderer)hookVisuals.GetComponent<MeshRenderer>()).material = lure.LureMaterial;
			hookVisuals.transform.localPosition = lure.Offset;
			((Object)hookVisuals).name = lure.Name;
		}

		[IteratorStateMachine(typeof(<SwappingLures>d__5))]
		private static IEnumerator SwappingLures(GameObject prefab, PickupableItem heldItem)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SwappingLures>d__5(0)
			{
				prefab = prefab,
				heldItem = heldItem
			};
		}
	}
	internal class PreservingMethodPatches
	{
		[HarmonyPatch(typeof(ShipItem), "OnLoad")]
		private class ShipItemPatches
		{
			public static void Postfix(ShipItem __instance)
			{
				if (!Configs.adjustStoveEfficiency.Value)
				{
					return;
				}
				ShipItemStove val = (ShipItemStove)(object)((__instance is ShipItemStove) ? __instance : null);
				if (val != null)
				{
					if (((ShipItem)val).name == "stove")
					{
						float privateField = val.GetPrivateField<float>("cookEfficiency");
						val.SetPrivateField("cookEfficiency", privateField * 1.303f);
					}
					else if (((ShipItem)val).name == "smoker")
					{
						float privateField2 = val.GetPrivateField<float>("cookEfficiency");
						val.SetPrivateField("cookEfficiency", privateField2 * 1.125f);
					}
				}
			}
		}

		[HarmonyPatch(typeof(ShipItemSalt), "OnLoad")]
		private class ShipItemSaltPatches
		{
			public static void Postfix(ShipItemSalt __instance)
			{
				if (Configs.adjustSaltPrice.Value)
				{
					((ShipItem)__instance).value = ((ShipItem)__instance).value / 2;
				}
			}
		}
	}
	internal class RemoveWholeFish
	{
		internal static void SceneLoaded(Scene scene, LoadSceneMode _)
		{
			if (Configs.removeWholeFish.Value)
			{
				if (((Scene)(ref scene)).name == "island 1 A Gold Rock")
				{
					PlaceSlices("island 1 A (gold rock) scenery");
				}
				if (((Scene)(ref scene)).name == "island 2 A AlNilem")
				{
					PlaceSlices("island 2 A (alnilem) scenery");
				}
				if (((Scene)(ref scene)).name == "island 3 A Neverdin")
				{
					PlaceSlices("island 3 A (neverdin) scenery");
				}
				if (((Scene)(ref scene)).name == "island 4 A Albacore Town")
				{
					AlbacoreTown("island 4 A (fish island) scenery");
				}
				if (((Scene)(ref scene)).name == "island 9 E Dragon Cliffs")
				{
					PlaceSlices("island 9 E (dragon cliffs) scenery");
				}
				if (((Scene)(ref scene)).name == "island 10 E (Sanctuary)")
				{
					PlaceSlices("island 10 E (sanctuary) scenery");
				}
				if (((Scene)(ref scene)).name == "island 11 E (Crab Beach)")
				{
					PlaceSlices("island 11 E (crab beach) scenery");
				}
				if (((Scene)(ref scene)).name == "island 12 E (New Port)")
				{
					NewPort("island 12 E (new port) scenery");
				}
				if (((Scene)(ref scene)).name == "island 13 E (Sage Hills)")
				{
					PlaceSlices("island 13 E (sage hills) scenery");
				}
				if (((Scene)(ref scene)).name == "island 15 M (Fort)")
				{
					PlaceSlices("island 15 M (Fort) scenery");
				}
				if (((Scene)(ref scene)).name == "island 16 M (Sunspire)")
				{
					PlaceSlices("island 16 M (sunspire) scenery");
				}
				if (((Scene)(ref scene)).name == "island 17 M (Mount Malefic)")
				{
					PlaceSlices("island 17 M (mount malefic) scenery");
				}
				if (((Scene)(ref scene)).name == "island 18 M (Oasis)")
				{
					PlaceSlices("island 18 M (Oasis) scenery");
				}
				if (((Scene)(ref scene)).name == "island 19 M (Eastwind)")
				{
					Eastwind("island 19 M (Eastwind) scenery");
				}
				if (((Scene)(ref scene)).name == "island 20 A (Oasis)")
				{
					Oasis("island 20 A (oasis) scenery");
				}
				if (((Scene)(ref scene)).name == "island 21 M (siren song)")
				{
					PlaceSlices("island 21 M (siren song) scenery");
				}
				if (((Scene)(ref scene)).name == "island 22 E (Serpent Isle)")
				{
					PlaceSlices("island 22 E (serpent isle) scenery");
				}
				if (((Scene)(ref scene)).name == "island 25 (chronos)")
				{
					PlaceSlices("island 25 (chronos) scenery");
				}
				if (((Scene)(ref scene)).name == "island 26 Lagoon SwampTemple")
				{
					PlaceSlices("island lagoon Temple scenery");
				}
				if (((Scene)(ref scene)).name == "island 27 Lagoon SwampShipyard")
				{
					PlaceSlices("island scenery Lagoon Shipyard");
				}
				if (((Scene)(ref scene)).name == "island 33 M (cave)")
				{
					PlaceSlices("scenery");
				}
			}
		}

		internal static void PlaceSlices(string sceneObject)
		{
			GameObject val = GameObject.Find(sceneObject);
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Scenery not found: " + sceneObject + ".");
				return;
			}
			foreach (FishData fish in FishData.SealableFish)
			{
				IEnumerable<ShopItemSpawner> enumerable = from s in val.GetComponentsInChildren<ShopItemSpawner>()
					where ((Object)s.itemPrefab).name == fish.PrefabName
					select s;
				foreach (ShopItemSpawner item in enumerable)
				{
					BF_Plugin.LogDebug("Changing " + fish.ItemName + " spawner: " + ((Object)item).name);
					item.itemPrefab = PrefabsDirectory.instance.directory[fish.SliceIndex];
				}
			}
		}

		internal static void AlbacoreTown(string sceneObject)
		{
			GameObject val = GameObject.Find(sceneObject);
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Scenery not found: " + sceneObject + ".");
				return;
			}
			IEnumerable<ShopItemSpawner> enumerable = from s in val.GetComponentsInChildren<ShopItemSpawner>()
				where ((Object)s.itemPrefab).name == "46 tuna (A)"
				select s;
			foreach (ShopItemSpawner item in enumerable)
			{
				BF_Plugin.LogDebug("Changing tuna spawner: " + ((Object)item).name);
				item.itemPrefab = PrefabsDirectory.instance.directory[140];
			}
		}

		internal static void NewPort(string sceneObject)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find(sceneObject);
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Scenery not found: " + sceneObject + ".");
				return;
			}
			string[] array = new string[3] { "shop item (5)", "shop item (6)", "shop item (9)" };
			string[] array2 = array;
			foreach (string spawnerName in array2)
			{
				ShopItemSpawner val2 = ((IEnumerable<ShopItemSpawner>)val.GetComponentsInChildren<ShopItemSpawner>()).FirstOrDefault((Func<ShopItemSpawner, bool>)((ShopItemSpawner s) => ((Object)s).name == spawnerName));
				val2.itemPrefab = PrefabsDirectory.instance.directory[31];
				((Component)val2).transform.localPosition = new Vector3(((Component)val2).transform.localPosition.x, 5.214f, ((Component)val2).transform.localPosition.z);
			}
			PlaceSlices(sceneObject);
		}

		internal static void Eastwind(string sceneObject)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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)
			GameObject val = GameObject.Find(sceneObject);
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Scenery not found: " + sceneObject + ".");
				return;
			}
			string[] array = new string[4] { "shop item (3)", "shop item (4)", "shop item (5)", "shop item (6)" };
			string[] array2 = array;
			foreach (string spawnerName in array2)
			{
				ShopItemSpawner val2 = ((IEnumerable<ShopItemSpawner>)val.GetComponentsInChildren<ShopItemSpawner>()).FirstOrDefault((Func<ShopItemSpawner, bool>)((ShopItemSpawner s) => ((Object)s).name == spawnerName));
				val2.itemPrefab = PrefabsDirectory.instance.directory[38];
				((Component)val2).transform.localPosition = new Vector3(((Component)val2).transform.localPosition.x, 3.383f, ((Component)val2).transform.localPosition.z);
			}
			PlaceSlices(sceneObject);
		}

		internal static void Oasis(string sceneObject)
		{
			//IL_00a6: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find(sceneObject);
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Scenery not found: " + sceneObject + ".");
				return;
			}
			IEnumerable<ShopItemSpawner> enumerable = from s in val.GetComponentsInChildren<ShopItemSpawner>()
				where ((Object)s.itemPrefab).name == "46 tuna (A)"
				select s;
			foreach (ShopItemSpawner item in enumerable)
			{
				BF_Plugin.LogDebug("Changing tuna spawner: " + ((Object)item).name);
				item.itemPrefab = PrefabsDirectory.instance.directory[31];
				((Component)item).transform.localPosition = new Vector3(((Component)item).transform.localPosition.x, 16.36f, ((Component)item).transform.localPosition.z);
			}
			PlaceSlices(sceneObject);
		}
	}
	public class CrateSealer : MonoBehaviour
	{
		private ShipItemCrate crate;

		private CrateInventory crateInventory;

		private void Awake()
		{
			crate = ((Component)this).GetComponent<ShipItemCrate>();
			crateInventory = ((Component)this).GetComponent<CrateInventory>();
		}

		public void SealCrate(ShipItemHammer hammer)
		{
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)crateInventory))
			{
				BF_Plugin.LogError(((Object)((Component)this).gameObject).name + ": Cannot seal because no CrateInventory");
				return;
			}
			int prefabIndex = crateInventory.containedItems[0].GetPrefabIndex();
			int count = crateInventory.containedItems.Count;
			for (int num = count - 1; num >= 0; num--)
			{
				BF_Plugin.LogDebug($"Removing item {num}");
				ShipItem val = crateInventory.containedItems[num];
				crateInventory.containedItems.Remove(val);
				val.GetItemRigidbody().attached = false;
				val.GetItemRigidbody().disableCol = false;
				val.GetItemRigidbody().inStove = false;
				((Component)val).GetComponent<SaveablePrefab>().Unregister();
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			hammer.SwapCrate(prefabIndex, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.parent);
		}

		internal void UpdateDescription(bool nailsNotInRange)
		{
			((GoPointerButton)crate).description = string.Empty;
			if ((Object)(object)crateInventory == (Object)null)
			{
				return;
			}
			List<ShipItem> inv = crateInventory.containedItems;
			if (inv.Count > 0)
			{
				CratePatches.HintText.anchor = (TextAnchor)1;
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.AppendLine();
				int num = (from f in FishData.Fish
					where f.ItemName == inv[0].name
					select f.NumberInCrate).FirstOrDefault();
				if (IsNotStandardCrateSize())
				{
					stringBuilder.AppendLine("need standard size crate to seal");
				}
				if (nailsNotInRange)
				{
					stringBuilder.AppendLine("no sealing nails nearby");
				}
				if (inv.Any((ShipItem ci) => ci.name != inv[0].name))
				{
					stringBuilder.AppendLine("all items in crate must be the same to seal");
				}
				else if (!FishData.SealableFishNames.Contains(inv[0].name))
				{
					stringBuilder.AppendLine("items in crate are not sealable");
				}
				if (num > 0 && inv.Count != num)
				{
					stringBuilder.AppendLine($"not enough items in crate to seal {inv.Count}/{num}");
				}
				if (inv.Any((ShipItem ci) => (double?)((Component)ci).GetComponent<FoodState>()?.spoiled > 0.9))
				{
					stringBuilder.AppendLine("can not seal with spoiled items in the crate");
				}
				if (inv.Any((ShipItem ci) => (double)ci.amount >= 1.5))
				{
					stringBuilder.AppendLine("can not seal with burnt items in the crate");
				}
				if (inv.Any((ShipItem ci) => (double?)((Component)ci).GetComponent<FoodState>()?.smoked < 0.99 && (double?)((Component)ci).GetComponent<FoodState>()?.salted < 0.99 && (double?)((Component)ci).GetComponent<FoodState>()?.dried < 0.99))
				{
					stringBuilder.AppendLine("can not seal with non preserved items in the crate");
				}
				((GoPointerButton)crate).description = BuildDescription(stringBuilder.ToString());
			}
		}

		private string BuildDescription(string desc)
		{
			return "<color=#4D0000>" + desc + "</color>";
		}

		public bool CanSealCrate(bool nailsNotInRange)
		{
			List<ShipItem> inv = crateInventory.containedItems;
			if (IsNotStandardCrateSize() || nailsNotInRange || inv.Count <= 0 || !FishData.SealableFishNames.Contains(inv[0].name) || inv.Count != (from f in FishData.Fish
				where f.ItemName == inv[0].name
				select f.NumberInCrate).FirstOrDefault() || inv.Any((ShipItem ci) => ci.name != inv[0].name || (double)ci.amount >= 1.5 || (double?)((Component)ci).GetComponent<FoodState>()?.spoiled > 0.9 || ((double?)((Component)ci).GetComponent<FoodState>()?.smoked < 0.99 && (double?)((Component)ci).GetComponent<FoodState>()?.salted < 0.99 && (double?)((Component)ci).GetComponent<FoodState>()?.dried < 0.99)))
			{
				return false;
			}
			return true;
		}

		private bool IsNotStandardCrateSize()
		{
			bool flag = ((Component)crate).GetComponent<Good>()?.sizeDescription == "standard crate" || ((ShipItem)crate).name == "empty crate";
			return !flag;
		}
	}
	public class ShipItemHammer : ShipItem
	{
		[CompilerGenerated]
		private sealed class <SwappingCrates>d__10 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public int crateIndex;

			public Vector3 position;

			public Quaternion rotation;

			public Transform parent;

			public ShipItemHammer <>4__this;

			private ShipItem <prefab>5__1;

			private ShipItem <crate>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SwappingCrates>d__10(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<prefab>5__1 = null;
				<crate>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Expected O, but got Unknown
				//IL_0059: 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)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = (object)new WaitForEndOfFrame();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<prefab>5__1 = PrefabsDirectory.instance.GetItem(crateIndex);
					<crate>5__2 = Object.Instantiate<ShipItem>(<prefab>5__1, position, rotation, parent);
					((Component)<crate>5__2).GetComponent<SaveablePrefab>().RegisterToSave();
					<crate>5__2.sold = true;
					((Component)<crate>5__2).GetComponent<Good>().RegisterAsMissionless();
					BF_Plugin.LogDebug("Swapped crates");
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private bool swingingBack;

		private float initialHoldDistance;

		private float hammerTime;

		private ShipItemSealingNails closestNailsInRange;

		public override void OnLoad()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			initialHoldDistance = ((PickupableItem)this).holdDistance;
			HolderAttachable val = ((Component)this).gameObject.AddComponent<HolderAttachable>();
			val.PositionOffset = new Vector3(0.02f, -0.15f, -0.12f);
			val.RotationOffset = new Vector3(270f, 270f, 0f);
		}

		public override void OnAltActivate()
		{
			((ShipItem)this).OnAltActivate();
			if (base.sold)
			{
				ShipItem pointedAtItem = ((PickupableItem)this).held.GetPointedAtItem();
				if (Object.op_Implicit((Object)(object)pointedAtItem) && pointedAtItem.sold && (Object)(object)((Component)pointedAtItem).GetComponent<CrateSealer>() != (Object)null && ((Component)pointedAtItem).GetComponent<CrateSealer>().CanSealCrate(!NailsInRange()))
				{
					((PickupableItem)this).heldRotationOffset = 0f;
					hammerTime = 0.25f;
					SealCrate(((Component)pointedAtItem).GetComponent<ShipItemCrate>());
				}
			}
		}

		public override void ExtraLateUpdate()
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			if (hammerTime > 0f)
			{
				if (((PickupableItem)this).heldRotationOffset < -85f)
				{
					swingingBack = true;
				}
				if (((PickupableItem)this).heldRotationOffset > 0f)
				{
					swingingBack = false;
				}
				if (swingingBack)
				{
					((PickupableItem)this).heldRotationOffset = ((PickupableItem)this).heldRotationOffset + Time.deltaTime * 550f;
				}
				else
				{
					((PickupableItem)this).heldRotationOffset = ((PickupableItem)this).heldRotationOffset - Time.deltaTime * 550f;
				}
				hammerTime -= Time.deltaTime;
			}
			if (!Object.op_Implicit((Object)(object)((PickupableItem)this).held))
			{
				return;
			}
			float num = 2.5f;
			Vector3 position = ((Component)this).transform.position;
			Collider[] array = Physics.OverlapSphere(position, num);
			Collider val = null;
			float num2 = float.PositiveInfinity;
			Collider[] array2 = array;
			foreach (Collider val2 in array2)
			{
				ShipItemSealingNails component = ((Component)val2).gameObject.GetComponent<ShipItemSealingNails>();
				if (!((Object)(object)component == (Object)null) && ((ShipItem)component).sold && !(((ShipItem)component).amount <= 0f))
				{
					Vector3 val3 = ((Component)val2).transform.position - position;
					float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
					if (sqrMagnitude < num2)
					{
						val = val2;
						num2 = sqrMagnitude;
					}
				}
			}
			object obj;
			if (val == null)
			{
				obj = null;
			}
			else
			{
				GameObject gameObject = ((Component)val).gameObject;
				obj = ((gameObject != null) ? gameObject.GetComponent<ShipItemSealingNails>() : null);
			}
			closestNailsInRange = (ShipItemSealingNails)obj;
		}

		private bool NailsInRange()
		{
			if ((Object)(object)closestNailsInRange == (Object)null)
			{
				return false;
			}
			return ((ShipItem)closestNailsInRange).amount > 0f;
		}

		public void SealCrate(ShipItemCrate crate)
		{
			ShipItemSealingNails shipItemSealingNails = closestNailsInRange;
			((ShipItem)shipItemSealingNails).amount = ((ShipItem)shipItemSealingNails).amount - 1f;
			((Component)crate).GetComponent<CrateSealer>().SealCrate(this);
			((Component)crate).GetComponent<SaveablePrefab>().Unregister();
			Object.Destroy((Object)(object)((Component)crate).gameObject);
			UISoundPlayer.instance.PlaySmallItemDropSound();
		}

		public void SwapCrate(int itemIndex, Vector3 position, Quaternion rotation, Transform parent)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			int crateIndex = (from f in FishData.Fish
				where f.ItemIndex == itemIndex
				select f.CrateIndex).FirstOrDefault();
			((MonoBehaviour)this).StartCoroutine(SwappingCrates(crateIndex, position, rotation, parent));
		}

		[IteratorStateMachine(typeof(<SwappingCrates>d__10))]
		private IEnumerator SwappingCrates(int crateIndex, Vector3 position, Quaternion rotation, Transform parent)
		{
			//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SwappingCrates>d__10(0)
			{
				<>4__this = this,
				crateIndex = crateIndex,
				position = position,
				rotation = rotation,
				parent = parent
			};
		}

		public override bool AllowOnItemClick(GoPointerButton lookedAtButton)
		{
			if (lookedAtButton != null)
			{
				((Component)lookedAtButton).GetComponent<CrateSealer>()?.UpdateDescription(!NailsInRange());
			}
			if ((Object)(object)((Component)lookedAtButton).GetComponent<ShipItemHolder>() != (Object)null && !((Component)lookedAtButton).GetComponent<ShipItemHolder>().IsOccupied)
			{
				return true;
			}
			if (!((PickupableItem)this).big && lookedAtButton.allowPlacingItems)
			{
				return true;
			}
			return false;
		}
	}
	public class ShipItemSealingNails : ShipItem
	{
		public override void UpdateLookText()
		{
			if (base.sold)
			{
				((GoPointerButton)this).lookText = $"sealing nails\n({base.amount})";
			}
		}
	}
	internal class CratePatches
	{
		[HarmonyPatch(typeof(LookUI), "RegisterPointer")]
		private class LookUIPatches
		{
			public static void Prefix(GoPointer goPointer, TextMesh ___hintText)
			{
				_goPointer = goPointer;
				if ((Object)(object)HintText == (Object)null)
				{
					HintText = ___hintText;
				}
			}
		}

		[HarmonyPatch(typeof(ShipItemCrate))]
		private class ShipItemCratePatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("OnLoad")]
			public static void AddCrateSealer(ShipItemCrate __instance)
			{
				((Component)__instance).gameObject.AddComponent<CrateSealer>();
				if (((ShipItem)__instance).name == "empty crate")
				{
					((ShipItem)__instance).value = 45;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("UpdateLookText")]
			public static void ClearDescription(ShipItemCrate __instance)
			{
				if (!GameState.currentlyLoading && GameState.playing && ((ShipItem)__instance).sold && !(_goPointer.GetHeldItem() is ShipItemHammer))
				{
					((GoPointerButton)__instance).description = string.Empty;
					HintText.anchor = (TextAnchor)4;
				}
			}
		}

		[HarmonyPatch(typeof(CrateInventoryUI))]
		private class CrateInventoryUIPatches
		{
			[HarmonyPrefix]
			[HarmonyPatch("GetCrateDimensions")]
			public static bool GetCrateDimensionsPatch(CrateInventoryUI __instance, ref Vector2 __result)
			{
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: 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)
				if (((Object)__instance.currentCrate).name == "empty crate(Clone)")
				{
					__result = new Vector2(5f, 4f);
					return false;
				}
				if (_lureCrateNames.Contains(((Object)__instance.currentCrate).name))
				{
					__result = new Vector2(4f, 2f);
					return false;
				}
				return true;
			}
		}

		private static GoPointer _goPointer;

		private static readonly string[] _lureCrateNames = new string[3] { "crate of spoon lures(Clone)", "crate of swimbait lures(Clone)", "crate of topwater lures(Clone)" };

		internal static TextMesh HintText { get; private set; }
	}
	internal class FishingPatches
	{
		[HarmonyPatch(typeof(FishingRodFish))]
		private class FishingRodFishPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("Awake")]
			public static void SetFishMovement(FishingRodFish __instance)
			{
				if (Configs.enableFishMovement.Value)
				{
					FishMovement fishMovement = ((Component)__instance).gameObject.AddComponent<FishMovement>();
					fishMovement.Fish = __instance;
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch("FixedUpdate")]
			public static bool FishingLineTension(FishingRodFish __instance, Transform ___rodRotator, ShipItemFishingRod ___rod, Rigidbody ___bobber, ConfigurableJoint ___bobberJoint, SimpleFloatingObject ___floater, AudioSource ___tensionAudio, float ___fishPullForce, ref float ___pullTensionMult, float ___lowerForceThreshold, float ___reelBendMult, ref float ___currentTargetTension, ref float ___lastLineLength, ref float ___currentFishForce, float ___angleBendMult, ref float ___pullForce, float ___fishEnergy, ref bool ___shakePong, ref float ___snapTimer)
			{
				//IL_0324: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: 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)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: 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_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: 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_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_0226: Unknown result type (might be due to invalid IL or missing references)
				//IL_0230: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: Unknown result type (might be due to invalid IL or missing references)
				if (!Configs.enableFishTension.Value)
				{
					return true;
				}
				if (!((ShipItem)___rod).sold)
				{
					return false;
				}
				SoftJointLimit linearLimit;
				if ((Object)(object)__instance.currentFish != (Object)null)
				{
					if (((FloatingObjectBase)___floater).InWater && !__instance.fishDead && ___fishEnergy > 0f)
					{
						___currentFishForce = ___fishPullForce;
					}
					else
					{
						___currentFishForce = 0f;
					}
					Vector3 val = ((Component)___rod).transform.position - ((Component)___bobber).transform.position;
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					___bobber.AddForce(-normalized * Time.deltaTime * ___currentFishForce);
					float num = ___pullForce;
					val = ((Joint)___bobberJoint).currentForce;
					___pullForce = Mathf.Lerp(num, ((Vector3)(ref val)).magnitude, Time.deltaTime * 1.5f);
					if (___pullForce >= ___lowerForceThreshold && ___currentTargetTension < 0.5f)
					{
						___currentTargetTension += Time.deltaTime * ___pullTensionMult;
						if (___currentTargetTension > 0.5f)
						{
							___currentTargetTension = 0.5f;
						}
					}
					if (___pullForce >= ___lowerForceThreshold)
					{
						float num2 = ___currentTargetTension;
						float num3 = ___lastLineLength;
						linearLimit = ___bobberJoint.linearLimit;
						___currentTargetTension = num2 + (num3 - ((SoftJointLimit)(ref linearLimit)).limit) * ___reelBendMult;
					}
					if (___pullForce <= 0f || ___currentFishForce <= 0f || __instance.fishDead)
					{
						___currentTargetTension -= Time.deltaTime * 1.25f;
					}
					else if (___currentTargetTension > 0.5f)
					{
						___currentTargetTension -= Time.deltaTime * ___pullTensionMult * 0.2f;
					}
					double num4 = ((___lastLineLength < 15f) ? 0.95 : ((double)FishMovement.FishTension(((Object)__instance.currentFish).name)));
					if ((double)___currentTargetTension > num4)
					{
						___snapTimer += Time.deltaTime;
						if (___shakePong)
						{
							___rodRotator.Translate(Vector3.forward * 0.01f, (Space)1);
						}
						else
						{
							___rodRotator.Translate(Vector3.back * 0.01f, (Space)1);
						}
						___shakePong = !___shakePong;
						if (!___tensionAudio.isPlaying)
						{
							___tensionAudio.Play();
						}
						if (___snapTimer > 3.1f)
						{
							__instance.ReleaseFish();
						}
					}
					else
					{
						___snapTimer -= Time.deltaTime;
						if (___snapTimer < 0f)
						{
							___snapTimer = 0f;
						}
						if (___tensionAudio.isPlaying)
						{
							___tensionAudio.Stop();
						}
					}
				}
				else
				{
					___currentTargetTension = 0f;
					if (___tensionAudio.isPlaying)
					{
						___tensionAudio.Stop();
					}
				}
				if (___currentTargetTension > 1f)
				{
					___currentTargetTension = 1f;
				}
				if (___currentTargetTension < 0f)
				{
					___currentTargetTension = 0f;
				}
				___rod.SetRodTension(___currentTargetTension * ___angleBendMult);
				linearLimit = ___bobberJoint.linearLimit;
				___lastLineLength = ((SoftJointLimit)(ref linearLimit)).limit;
				return false;
			}

			[HarmonyAfter(new string[] { "com.raddude82.sailadex" })]
			[HarmonyPrefix]
			[HarmonyPatch("CollectFish")]
			public static bool AdjustHookLossChance(FishingRodFish __instance, ShipItemFishingRod ___rod, ref ShipItem __result)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				ShipItem component = Object.Instantiate<GameObject>(__instance.currentFish, ((Component)__instance).gameObject.transform.position, ((Component)__instance).gameObject.transform.rotation).GetComponent<ShipItem>();
				component.sold = true;
				((Component)component).GetComponent<SaveablePrefab>().RegisterToSave();
				((Component)__instance).GetComponent<MeshFilter>().sharedMesh = null;
				((Component)__instance).GetComponent<Renderer>().enabled = false;
				__instance.currentFish = null;
				if (Random.Range(0, 100) < Configs.hookLossChance.Value)
				{
					___rod.DetachHook();
				}
				((PickupableItem)___rod).big = false;
				__result = component;
				return false;
			}

			[HarmonyPrefix]
			[HarmonyPatch("CatchFish")]
			public static bool CatchWithLure(FishingRodFish __instance, ref float ___fishTimer, ref float ___fishEnergy, Rigidbody ___bobber)
			{
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				string lureName = ((Object)((Component)___bobber).transform.GetChild(2)).name;
				if (lureName == "hook")
				{
					return true;
				}
				Lure lure = Lure.Lures.FirstOrDefault((Lure l) => l.Name == lureName);
				float num = Mathf.Abs(FloatingOriginManager.instance.GetGlobeCoords(((Component)__instance).gameObject.transform).z - (float)lure.PeakLatitude);
				if (num > 6f)
				{
					BF_Plugin.LogDebug(lure.Name + " is not effective at this latitude");
					return true;
				}
				int num2 = 25;
				if (num <= 4f)
				{
					num2 = 50;
				}
				if (num <= 2f)
				{
					num2 = 75;
				}
				BF_Plugin.LogDebug($"Lure {lure.Name} chance: {num2}");
				if (Random.Range(0, 100) > num2)
				{
					BF_Plugin.LogDebug(lure.Name + " caught other fish type");
					return true;
				}
				BF_Plugin.LogInfo("============== Catching fish! ==============");
				__instance.currentFish = PrefabsDirectory.instance.directory[lure.TargetFishPrefabIndex];
				((Component)__instance).GetComponent<MeshFilter>().sharedMesh = __instance.currentFish.GetComponent<MeshFilter>().sharedMesh;
				((Component)__instance).GetComponent<Renderer>().enabled = true;
				___fishTimer = 6f;
				___fishEnergy = 1f;
				__instance.fishDead = false;
				return false;
			}
		}
	}
	internal class HammerPatches
	{
		[HarmonyPatch(typeof(LookUI))]
		private class LookUIPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("ShowLookText")]
			public static void ShowLookText(GoPointerButton button, TextMesh ___controlsText, GoPointer ___pointer, TextMesh ___textLicon, TextMesh ___textRIcon, ref bool ___showingIcon)
			{
				if (Object.op_Implicit((Object)(object)((Component)button).GetComponent<ShipItemCrate>()) && ((ShipItem)((Component)button).GetComponent<ShipItemCrate>()).amount <= 0f && Object.op_Implicit((Object)(object)((Component)button).GetComponent<Good>()) && ((Component)button).GetComponent<Good>().GetMissionIndex() == -1 && Object.op_Implicit((Object)(object)___pointer.GetHeldItem()) && Object.op_Implicit((Object)(object)((Component)___pointer.GetHeldItem()).GetComponent<ShipItemHammer>()))
				{
					((Component)___textLicon).gameObject.SetActive(true);
					((Component)___textRIcon).gameObject.SetActive(true);
					___showingIcon = true;
					___controlsText.text = "place item\nseal crate";
				}
			}
		}
	}
	internal class PrefabLoadingPatches
	{
		[HarmonyPatch(typeof(PrefabsDirectory), "PopulateShipItems")]
		internal class PrefabDirectoryPatches
		{
			public static void Prefix(PrefabsDirectory __instance)
			{
				if (__instance.directory.Length <= 809)
				{
					Array.Resize(ref __instance.directory, 809);
				}
				Material sharedMaterial = ((Renderer)__instance.directory[1].GetComponent<MeshRenderer>()).sharedMaterial;
				((Renderer)Items.EmptyCrate.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
				((Renderer)Items.SealingNails.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
				((Renderer)Items.CrateSpoonLures.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
				((Renderer)Items.CrateSwimbaitLures.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
				((Renderer)Items.CrateTopwaterLures.GetComponent<MeshRenderer>()).sharedMaterial = sharedMaterial;
				LurePatches.hookMesh = __instance.directory[99].GetComponent<MeshFilter>().sharedMesh;
				LurePatches.hookMaterial = ((Renderer)__instance.directory[99].GetComponent<MeshRenderer>()).sharedMaterial;
				__instance.directory[800] = Items.EmptyCrate;
				__instance.directory[801] = Items.Hammer;
				__instance.directory[802] = Items.SealingNails;
				__instance.directory[803] = Items.SpoonLure;
				__instance.directory[804] = Items.SwimbaitLure;
				__instance.directory[805] = Items.TopwaterLure;
				__instance.directory[806] = Items.CrateSpoonLures;
				__instance.directory[807] = Items.CrateSwimbaitLures;
				__instance.directory[808] = Items.CrateTopwaterLures;
			}
		}

		private const int NEW_PREFAB_DIR_SIZE = 809;
	}
	internal class PricePatches
	{
		[HarmonyPatch(typeof(IslandMarket))]
		private class IslandMarketPatches
		{
			[HarmonyBefore(new string[] { "com.raddude82.economicevents" })]
			[HarmonyPostfix]
			[HarmonyPatch("GetGoodPriceAtSupply")]
			public static void FishPriceAdjust(int goodIndex, ref int __result)
			{
				FishData fishData = FishData.Fish.FirstOrDefault((FishData f) => f.CrateIndex == goodIndex);
				if (fishData != null)
				{
					__result = Mathf.RoundToInt((float)__result * fishData.PriceMultiplier);
				}
			}
		}

		[HarmonyPatch(typeof(Shopkeeper))]
		private class ShopkeeperPatches
		{
			[HarmonyBefore(new string[] { "com.raddude82.economicevents" })]
			[HarmonyPostfix]
			[HarmonyPatch("GetPrice")]
			public static void FishPriceAdjust(ShipItem item, ref int __result)
			{
				if (!item.IsBulk())
				{
					int index = item.GetPrefabIndex();
					FishData fishData = FishData.Fish.FirstOrDefault((FishData f) => f.CrateIndex == index || f.ItemIndex == index || f.SliceIndex == index);
					if (fishData != null)
					{
						__result = Mathf.RoundToInt((float)__result * fishData.PriceMultiplier);
					}
				}
			}
		}
	}
	public class FishMovement : MonoBehaviour
	{
		public readonly struct FishProperties
		{
			public float Force { get; }

			public float Tension { get; }

			public FishProperties(float force, float tension)
			{
				Force = force;
				Tension = tension;
			}
		}

		private float _timer;

		private float _fishForce;

		private FishingRodFish _fish;

		public FishingRodFish Fish
		{
			get
			{
				return _fish;
			}
			set
			{
				_fish = value;
			}
		}

		private void Awake()
		{
			_timer = 0f;
			_fishForce = 0f;
		}

		private void Update()
		{
			//IL_01ea: 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)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			if (GameState.wasInSettingsMenu)
			{
				return;
			}
			bool privateField = _fish.GetPrivateField<bool>("fishDead");
			float privateField2 = _fish.GetPrivateField<float>("lastLineLength");
			float privateField3 = _fish.GetPrivateField<float>("fishEnergy");
			SimpleFloatingObject privateField4 = _fish.GetPrivateField<SimpleFloatingObject>("floater");
			Rigidbody privateField5 = _fish.GetPrivateField<Rigidbody>("bobber");
			privateField = privateField && privateField2 <= 15f;
			_fish.SetPrivateField("fishDead", privateField);
			if (privateField || _fish.currentFish == null || privateField3 <= 0f || !((FloatingObjectBase)privateField4).InWater)
			{
				_fishForce = 0f;
				privateField4.SetPrivateField("_buoyancyCoeff", 3f);
				return;
			}
			if (_fishForce == 0f)
			{
				if (FishData.Fish.Any((FishData f) => f.PrefabName == ((Object)_fish.currentFish).name))
				{
					_fishForce = (from f in FishData.Fish
						where f.PrefabName == ((Object)_fish.currentFish).name
						select f.Force).FirstOrDefault();
				}
				else
				{
					_fishForce = 10f;
					BF_Plugin.LogWarning(((Object)_fish.currentFish).name + " not found");
				}
			}
			if (_timer <= 0f)
			{
				_fishForce = 0f - _fishForce;
				_timer = 10f + Random.Range(0f, 0.3f * _fishForce);
			}
			privateField4.SetPrivateField("_buoyancyCoeff", 1f);
			privateField5.AddRelativeForce(Vector3.right * _fishForce);
			privateField5.AddRelativeForce(Vector3.forward * Random.Range(0f, 5f));
			privateField5.AddRelativeForce(Vector3.up * Random.Range(-3f, 0f));
			_timer -= 2f * Time.deltaTime;
		}

		public static float FishTension(string fishName)
		{
			if (FishData.Fish.Any((FishData f) => f.PrefabName == fishName))
			{
				return (from f in FishData.Fish
					where f.PrefabName == fishName
					select f.Tension).FirstOrDefault();
			}
			BF_Plugin.LogWarning(fishName + " not found in fish data.");
			return 0.95f;
		}
	}
	internal class AddShopItems
	{
		internal static void SceneLoaded(Scene scene, LoadSceneMode _)
		{
			if (((Scene)(ref scene)).name == "island 1 A Gold Rock")
			{
				GoldRockCity();
			}
			if (((Scene)(ref scene)).name == "island 15 M (Fort)")
			{
				FortAestrin();
			}
			if (((Scene)(ref scene)).name == "island 9 E Dragon Cliffs")
			{
				DragonCliffs();
			}
			if (((Scene)(ref scene)).name == "island 26 Lagoon SwampTemple")
			{
				FireFishTown();
			}
		}

		internal static void GoldRockCity()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00fc: 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_013a: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("island 1 A (gold rock) scenery");
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Gold Rock City scenery not found.");
				return;
			}
			MakeShopItem("shop item 300", val.transform, new Vector3(1539.86f, 7.235f, -385.06f), new Vector3(358f, 0f, 270f), Items.Hammer);
			MakeShopItem("shop item 301", val.transform, new Vector3(1538.75f, 5.71f, -385.08f), new Vector3(0f, 55f, 0f), Items.SealingNails);
			MakeShopItem("shop item 302", val.transform, new Vector3(1538.75f, 6.17f, -385.08f), new Vector3(0f, 55f, 0f), Items.SealingNails);
			MakeShopItem("shop item 303", val.transform, new Vector3(1542.949f, 5.54f, -389.34f), new Vector3(0f, 325.504f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item 304", val.transform, new Vector3(1535.669f, 6.54f, -378.58f), new Vector3(90f, 325.504f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item 305", val.transform, new Vector3(1537.369f, 5.5f, -381.38f), new Vector3(0f, 325.504f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item 306", val.transform, new Vector3(1539.86f, 7.215f, -385.86f), new Vector3(90f, 0f, 0f), Items.SpoonLure);
			MakeShopItem("shop item 307", val.transform, new Vector3(1539.05f, 5.87f, -386.2f), new Vector3(270f, 55f, 0f), Items.CrateSpoonLures);
			MakeShopItem("shop item 308", val.transform, new Vector3(1539.6f, 5.87f, -387f), new Vector3(270f, 55f, 0f), Items.CrateSpoonLures);
		}

		internal static void FortAestrin()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00fc: 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_013a: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("island 15 M (Fort) scenery");
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Fort Aestrin scenery not found.");
				return;
			}
			MakeShopItem("shop item (300)", val.transform, new Vector3(-76.959f, 3.08f, 44.419f), new Vector3(358f, 80f, 270f), Items.Hammer);
			MakeShopItem("shop item (301)", val.transform, new Vector3(-75.854f, 2.21f, 44.5095f), new Vector3(0f, 180f, 0f), Items.SealingNails);
			MakeShopItem("shop item (302)", val.transform, new Vector3(-75.854f, 2.44f, 44.5095f), new Vector3(0f, 180f, 0f), Items.SealingNails);
			MakeShopItem("shop item (303)", val.transform, new Vector3(-72.2f, 2.097f, 43.8f), new Vector3(0f, 90f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item (304)", val.transform, new Vector3(-71.16f, 2.097f, 43.8f), new Vector3(0f, 90f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item (305)", val.transform, new Vector3(-71.68f, 2.783f, 43.8f), new Vector3(0f, 90f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item (306)", val.transform, new Vector3(-23.349f, 2.926f, 64.353f), new Vector3(90f, 64.1654f, 0f), Items.TopwaterLure);
			MakeShopItem("shop item (307)", val.transform, new Vector3(-23.523f, 2.045f, 64.27f), new Vector3(0f, 24.2985f, 0f), Items.CrateTopwaterLures);
			MakeShopItem("shop item (308)", val.transform, new Vector3(-23.523f, 2.275f, 64.27f), new Vector3(0f, 24.2985f, 0f), Items.CrateTopwaterLures);
		}

		internal static void DragonCliffs()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("island 9 E (dragon cliffs) scenery");
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Dragon Cliffs scenery not found.");
				return;
			}
			MakeShopItem("shop item spawner (300)", val.transform, new Vector3(-81.859f, 4.379f, -549.696f), new Vector3(358f, 308f, 260f), Items.Hammer);
			MakeShopItem("shop item spawner (301)", val.transform, new Vector3(-81.333f, 3.715f, -549.545f), new Vector3(0f, 224f, 0f), Items.SealingNails);
			MakeShopItem("shop item spawner (302)", val.transform, new Vector3(-80.973f, 3.715f, -549.895f), new Vector3(0f, 224f, 0f), Items.SealingNails);
			Transform val2 = val.GetComponentsInChildren<Transform>()?.FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "shop item spawner (158)"));
			if ((Object)(object)val2 != (Object)null)
			{
				val2.localPosition = new Vector3(-85f, 4.116f, -548.19f);
			}
			MakeShopItem("shop item spawner (303)", val.transform, new Vector3(-86.5f, 4.116f, -546.9f), new Vector3(90f, 44.117f, 270f), Items.EmptyCrate);
			MakeShopItem("shop item spawner (304)", val.transform, new Vector3(-81.403f, 4.216f, -551.395f), new Vector3(0f, 134.117f, 270f), Items.EmptyCrate);
			MakeShopItem("shop item spawner (305)", val.transform, new Vector3(-82.403f, 4.216f, -550.395f), new Vector3(0f, 134.117f, 270f), Items.EmptyCrate);
			MakeShopItem("shop item spawner (306)", val.transform, new Vector3(-84.48f, 4.266f, -548.85f), new Vector3(90f, 214.8614f, 0f), Items.SwimbaitLure);
			MakeShopItem("shop item spawner (307)", val.transform, new Vector3(-83.82f, 3.752f, -548.424f), new Vector3(0f, 221.5683f, 0f), Items.CrateSwimbaitLures);
			MakeShopItem("shop item spawner (308)", val.transform, new Vector3(-83.82f, 3.977f, -548.424f), new Vector3(0f, 221.5683f, 0f), Items.CrateSwimbaitLures);
		}

		internal static void FireFishTown()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00fc: 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_013a: 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_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("island lagoon Temple scenery");
			if ((Object)(object)val == (Object)null)
			{
				BF_Plugin.LogError("Fire Fish Town scenery not found.");
				return;
			}
			MakeShopItem("shop item (300)", val.transform, new Vector3(-4.05f, 0.515f, -2.8f), new Vector3(358f, 0f, 90f), Items.Hammer);
			MakeShopItem("shop item (301)", val.transform, new Vector3(-4.1f, 0.365f, -2.97f), new Vector3(0f, 276f, 0f), Items.SealingNails);
			MakeShopItem("shop item (302)", val.transform, new Vector3(-4.05f, 0.365f, -2.485f), new Vector3(0f, 276f, 0f), Items.SealingNails);
			MakeShopItem("shop item (303)", val.transform, new Vector3(-4.4767f, 0.24f, 0.15f), new Vector3(0f, 5.3656f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item (304)", val.transform, new Vector3(-7f, 0.2f, 0.75f), new Vector3(0f, 95.3656f, 0f), Items.EmptyCrate);
			MakeShopItem("shop item (305)", val.transform, new Vector3(-7f, 0.88f, 0.75f), new Vector3(0f, 95.3656f, 0f), Items.EmptyCrate);
		}

		private static void MakeShopItem(string name, Transform parent, Vector3 position, Vector3 rotation, GameObject go)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			val.transform.parent = parent;
			val.transform.localPosition = position;
			val.transform.localRotation = Quaternion.Euler(rotation);
			MeshFilter val2 = val.AddComponent<MeshFilter>();
			val2.mesh = go.GetComponent<MeshFilter>().mesh;
			val.AddComponent<MeshRenderer>();
			ShopItemSpawner val3 = val.AddComponent<ShopItemSpawner>();
			val3.itemPrefab = go;
		}
	}
	internal class AssetLoader
	{
		[CompilerGenerated]
		private sealed class <LoadAssets>d__2 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			private string <bundlePath>5__1;

			private AssetBundleCreateRequest <assetBundleRequest>5__2;

			private AssetBundle <assetBundle>5__3;

			private AssetBundleRequest <request>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LoadAssets>d__2(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<bundlePath>5__1 = null;
				<assetBundleRequest>5__2 = null;
				<assetBundle>5__3 = null;
				<request>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					BF_Plugin.LogDebug("Loading bundle");
					<bundlePath>5__1 = FindAssetPath("tools_bundle");
					if (string.IsNullOrEmpty(<bundlePath>5__1))
					{
						BF_Plugin.LogError("Asset bundle not found");
						return false;
					}
					<assetBundleRequest>5__2 = AssetBundle.LoadFromFileAsync(<bundlePath>5__1);
					<>2__current = <assetBundleRequest>5__2;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					<assetBundle>5__3 = <assetBundleRequest>5__2.assetBundle;
					if ((Object)(object)<assetBundle>5__3 == (Object)null)
					{
						BF_Plugin.LogError("Failed to load " + <bundlePath>5__1);
					}
					<request>5__4 = <assetBundle>5__3.LoadAllAssetsAsync();
					<>2__current = <request>5__4;
					<>1__state = 2;
					return true;
				case 2:
				{
					<>1__state = -1;
					Object? obj = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "hammer"));
					Items.Hammer = (GameObject)(object)((obj is GameObject) ? obj : null);
					Object? obj2 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "empty crate"));
					Items.EmptyCrate = (GameObject)(object)((obj2 is GameObject) ? obj2 : null);
					Object? obj3 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "sealing nails"));
					Items.SealingNails = (GameObject)(object)((obj3 is GameObject) ? obj3 : null);
					Object? obj4 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "spoon lure"));
					Items.SpoonLure = (GameObject)(object)((obj4 is GameObject) ? obj4 : null);
					Object? obj5 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "swimbait lure"));
					Items.SwimbaitLure = (GameObject)(object)((obj5 is GameObject) ? obj5 : null);
					Object? obj6 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "topwater lure"));
					Items.TopwaterLure = (GameObject)(object)((obj6 is GameObject) ? obj6 : null);
					Object? obj7 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "crate of spoon lures"));
					Items.CrateSpoonLures = (GameObject)(object)((obj7 is GameObject) ? obj7 : null);
					Object? obj8 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "crate of swimbait lures"));
					Items.CrateSwimbaitLures = (GameObject)(object)((obj8 is GameObject) ? obj8 : null);
					Object? obj9 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name == "crate of topwater lures"));
					Items.CrateTopwaterLures = (GameObject)(object)((obj9 is GameObject) ? obj9 : null);
					if ((Object)(object)Items.Hammer == (Object)null || (Object)(object)Items.EmptyCrate == (Object)null || (Object)(object)Items.SealingNails == (Object)null || (Object)(object)Items.SpoonLure == (Object)null || (Object)(object)Items.SwimbaitLure == (Object)null || (Object)(object)Items.TopwaterLure == (Object)null || (Object)(object)Items.CrateSpoonLures == (Object)null || (Object)(object)Items.CrateSwimbaitLures == (Object)null || (Object)(object)Items.CrateTopwaterLures == (Object)null)
					{
						BF_Plugin.LogError("Failed to load all required assets from the bundle");
						return false;
					}
					BF_Plugin.LogInfo("Assets loaded");
					Items.Initialize();
					return false;
				}
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static readonly List<string> assetPaths = new List<string>
		{
			Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BF_Plugin.Instance).Info.Location), "Assets"),
			Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BF_Plugin.Instance).Info.Location))
		};

		public static string FindAssetPath(string fileName)
		{
			foreach (string assetPath in assetPaths)
			{
				string text = Path.Combine(assetPath, fileName);
				if (File.Exists(text))
				{
					return text;
				}
			}
			return null;
		}

		[IteratorStateMachine(typeof(<LoadAssets>d__2))]
		internal static IEnumerator LoadAssets()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LoadAssets>d__2(0);
		}
	}
	internal class Configs
	{
		internal static ConfigEntry<bool> enableFishMovement;

		internal static ConfigEntry<bool> enableFishTension;

		internal static ConfigEntry<int> hookLossChance;

		internal static ConfigEntry<float> templeFishPriceMult;

		internal static ConfigEntry<float> sunspotFishPriceMult;

		internal static ConfigEntry<float> tunaPriceMult;

		internal static ConfigEntry<float> shimmertailPriceMult;

		internal static ConfigEntry<float> salmonPriceMult;

		internal static ConfigEntry<float> eelPriceMult;

		internal static ConfigEntry<float> blackfinHunterPriceMult;

		internal static ConfigEntry<float> troutPriceMult;

		internal static ConfigEntry<float> northFishPriceMult;

		internal static ConfigEntry<float> swampSnapperPriceMult;

		internal static ConfigEntry<float> blueBubblerPriceMult;

		internal static ConfigEntry<float> fireFishPriceMult;

		internal static ConfigEntry<float> goldAlbacorePriceMult;

		internal static ConfigEntry<bool> adjustStoveEfficiency;

		internal static ConfigEntry<bool> adjustSaltPrice;

		internal static ConfigEntry<bool> removeWholeFish;

		internal static void InitializeConfigs()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_0259: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Expected O, but got Unknown
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Expected O, but got Unknown
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Expected O, but got Unknown
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)BF_Plugin.Instance).Config;
			enableFishMovement = config.Bind<bool>("Settings", "Enable fish movement", true, "Enables fish movement when fish caught. Fish will move around instead of just sitting still.");
			enableFishTension = config.Bind<bool>("Settings", "Enable fish tension", true, "Enables fish tension. Some fish will cause more tension on the rod when reeling in.");
			hookLossChance = config.Bind<int>("Settings", "Fishing hook loss chance", 31, new ConfigDescription("Precent chance that your fishing hook is lost after collecting a caught fish.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			templeFishPriceMult = config.Bind<float>("Fish Price Multipliers", "templefish", 2f, new ConfigDescription("Price multiplier when buying or selling this fish individually or sealed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			sunspotFishPriceMult = config.Bind<float>("Fish Price Multipliers", "sunspot fish", 2f, new ConfigDescription("Price multiplier when buying or selling this fish individually or sealed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			tunaPriceMult = config.Bind<float>("Fish Price Multipliers", "tuna", 3f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			shimmertailPriceMult = config.Bind<float>("Fish Price Multipliers", "blue shimmertail", 2f, new ConfigDescription("Price multiplier when buying or selling this fish individually or sealed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			salmonPriceMult = config.Bind<float>("Fish Price Multipliers", "salmon", 2f, new ConfigDescription("Price multiplier when buying or selling this fish individually or sealed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			eelPriceMult = config.Bind<float>("Fish Price Multipliers", "eel", 2f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			blackfinHunterPriceMult = config.Bind<float>("Fish Price Multipliers", "blackfin hunter", 2f, new ConfigDescription("Price multiplier when buying or selling this fish individually or sealed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			troutPriceMult = config.Bind<float>("Fish Price Multipliers", "trout", 2f, new ConfigDescription("Price multiplier when buying or selling this fish individually or sealed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			northFishPriceMult = config.Bind<float>("Fish Price Multipliers", "north fish", 3f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			swampSnapperPriceMult = config.Bind<float>("Fish Price Multipliers", "swamp snapper", 5f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			blueBubblerPriceMult = config.Bind<float>("Fish Price Multipliers", "blue bubbler", 2f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			fireFishPriceMult = config.Bind<float>("Fish Price Multipliers", "fire fish", 2f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			goldAlbacorePriceMult = config.Bind<float>("Fish Price Multipliers", "gold albacore", 6f, new ConfigDescription("Price multiplier when buying or selling this fish.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
			adjustStoveEfficiency = config.Bind<bool>("Settings", "Adjust stove efficiency", true, "This will make the stove and smoker cook faster. On the stove, fish will generally cook completely with one piece of firewood.");
			adjustSaltPrice = config.Bind<bool>("Settings", "Adjust salt price", true, "This will make salt half the price.");
			removeWholeFish = config.Bind<bool>("Settings", "Remove crateable whole fish from stores", true, "This will remove the whole fish that you are able to seal in a crate, from stores. In most instances they are replaced with fish slices.");
		}
	}
	internal static class Extensions
	{
		public static T GetPrivateField<T>(this object obj, string field)
		{
			return (T)Traverse.Create(obj).Field(field).GetValue();
		}

		public static void SetPrivateField(this object obj, string field, object value)
		{
			Traverse.Create(obj).Field(field).SetValue(value);
		}
	}
	internal sealed class FishData
	{
		internal string PrefabName { get; }

		internal string ItemName { get; }

		internal float Force { get; }

		internal float Tension { get; }

		internal int CrateIndex { get; }

		internal int ItemIndex { get; }

		internal int SliceIndex { get; }

		internal float PriceMultiplier { get; }

		internal int NumberInCrate { get; }

		internal static IReadOnlyList<FishData> Fish
		{
			get
			{
				List<FishData> list = new List<FishData>
				{
					new FishData("31 templefish (A)", "templefish", 10f, 0.95f, -1, 31, 351, Configs.templeFishPriceMult.Value, -1),
					new FishData("32 sunspot fish (A)", "sunspot fish", 13f, 0.85f, 9, 32, 352, Configs.sunspotFishPriceMult.Value, 16),
					new FishData("46 tuna (A)", "tuna", 20f, 0.78f, 6, 46, 366, Configs.tunaPriceMult.Value, 16),
					new FishData("35 shimmertail (E)", "blue shimmertail", 18f, 0.83f, -1, 35, 355, Configs.shimmertailPriceMult.Value, -1),
					new FishData("33 salmon (E)", "salmon", 26f, 0.77f, 1, 33, 45, Configs.salmonPriceMult.Value, 12),
					new FishData("34 eel (E)", "eel", 30f, 0.72f, 19, 34, 354, Configs.eelPriceMult.Value, 9),
					new FishData("38 blackfin hunter (M)", "blackfin hunter", 20f, 0.85f, -1, 38, 358, Configs.blackfinHunterPriceMult.Value, -1),
					new FishData("36 trout (M)", "trout", 25f, 0.74f, 18, 36, 356, Configs.troutPriceMult.Value, 16),
					new FishData("37 north fish (M)", "north fish", 22f, 0.79f, 14, 37, 357, Configs.northFishPriceMult.Value, 16),
					new FishData("141 swamp fish 1 (snapper", "swamp snapper", 21f, 0.83f, -1, 141, 353, Configs.swampSnapperPriceMult.Value, -1),
					new FishData("142 swamp fish 2 (bubbler)", "blue bubbler", 15f, 0.9f, -1, 142, 362, Configs.blueBubblerPriceMult.Value, -1),
					new FishData("148 swamp fish 3", "fire fish", 28f, 0.76f, -1, 148, 365, Configs.fireFishPriceMult.Value, -1),
					new FishData("140 gold albacore", "gold albacore", 32f, 0.7f, -1, 140, 348, Configs.goldAlbacorePriceMult.Value, -1)
				};
				return list.AsReadOnly();
			}
		}

		internal static IReadOnlyList<string> SealableFishNames
		{
			get
			{
				List<string> list = new List<string>();
				foreach (FishData item in Fish)
				{
					if (item.CrateIndex > 0)
					{
						list.Add(item.ItemName);
					}
				}
				return list.AsReadOnly();
			}
		}

		internal static IReadOnlyList<FishData> SealableFish
		{
			get
			{
				List<FishData> list = new List<FishData>();
				foreach (FishData item in Fish)
				{
					if (item.CrateIndex > 0)
					{
						list.Add(item);
					}
				}
				return list.AsReadOnly();
			}
		}

		private FishData(string prefabName, string itemName, float force, float tension, int crateIndex, int itemIndex, int sliceIndex, float priceMultiplier, int numberInCrate)
		{
			PrefabName = prefabName;
			ItemName = itemName;
			Force = force;
			Tension = tension;
			CrateIndex = crateIndex;
			ItemIndex = itemIndex;
			SliceIndex = sliceIndex;
			PriceMultiplier = priceMultiplier;
			NumberInCrate = numberInCrate;
		}
	}
	internal class Go
	{
		public static GoPointer Pointer { get; set; }
	}
	public class Items
	{
		public static GameObject Hammer { get; internal set; }

		public static GameObject EmptyCrate { get; internal set; }

		public static GameObject SealingNails { get; internal set; }

		public static GameObject SpoonLure { get; internal set; }

		public static GameObject SwimbaitLure { get; internal set; }

		public static GameObject TopwaterLure { get; internal set; }

		public static GameObject CrateSpoonLures { get; internal set; }

		public static GameObject CrateSwimbaitLures { get; internal set; }

		public static GameObject CrateTopwaterLures { get; internal set; }

		internal static void InitializeHammer()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			ShipItemHammer shipItemHammer = Hammer.AddComponent<ShipItemHammer>();
			((PickupableItem)shipItemHammer).holdDistance = 0.875f;
			((PickupableItem)shipItemHammer).furniturePlaceHeight = 0.5f;
			((PickupableItem)shipItemHammer).heldRotationOffset = -50f;
			((ShipItem)shipItemHammer).mass = 1f;
			((ShipItem)shipItemHammer).value = 120;
			((ShipItem)shipItemHammer).name = "hammer";
			((ShipItem)shipItemHammer).category = (TransactionCategory)3;
			((ShipItem)shipItemHammer).inventoryScale = 1f;
			((ShipItem)shipItemHammer).inventoryRotation = 90f;
			((ShipItem)shipItemHammer).inventoryRotationX = -90f;
			((ShipItem)shipItemHammer).floaterHeight = 1.6f;
		}

		internal static void InitializeNails()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			ShipItemSealingNails shipItemSealingNails = SealingNails.AddComponent<ShipItemSealingNails>();
			((PickupableItem)shipItemSealingNails).holdDistance = 1.25f;
			((PickupableItem)shipItemSealingNails).furniturePlaceHeight = 0.15f;
			((PickupableItem)shipItemSealingNails).heldRotationOffset = -45f;
			((ShipItem)shipItemSealingNails).mass = 3f;
			((ShipItem)shipItemSealingNails).value = 60;
			((ShipItem)shipItemSealingNails).name = "sealing nails";
			((ShipItem)shipItemSealingNails).category = (TransactionCategory)3;
			((ShipItem)shipItemSealingNails).inventoryScale = 1f;
			((ShipItem)shipItemSealingNails).inventoryRotation = 180f;
			((ShipItem)shipItemSealingNails).inventoryRotationX = 270f;
			((ShipItem)shipItemSealingNails).floaterHeight = 1.6f;
			((ShipItem)shipItemSealingNails).amount = 15f;
			((GoPointerButton)shipItemSealingNails).allowPlacingItems = true;
			((PickupableItem)shipItemSealingNails).big = false;
		}

		internal static void InitializeLure(GameObject lure, string desc)
		{
			ShipItemFishingHook component = lure.GetComponent<ShipItemFishingHook>();
			((GoPointerButton)component).description = ((GoPointerButton)component).description + "\n" + desc;
			((ShipItem)component).value = 10;
		}

		internal static void Initialize()
		{
			InitializeHammer();
			InitializeNails();
			InitializeLure(SpoonLure, "good for catching tuna");
			InitializeLure(SwimbaitLure, "good for catching eel");
			InitializeLure(TopwaterLure, "good for catching north fish");
		}
	}
	internal sealed class Lure
	{
		private readonly string _name;

		private readonly int _peakLatitude;

		private readonly int _targetFishPrefabIndex;

		private readonly GameObject _item;

		private readonly Material _material;

		private readonly Mesh _mesh;

		private readonly Vector3 _offset;

		private readonly float _saveData;

		public static readonly Lure SpoonLure = new Lure("spoon lure", 30, 46, Items.SpoonLure, Items.SpoonLure.GetComponent<MeshFilter>().mesh, ((Renderer)Items.SpoonLure.GetComponent<MeshRenderer>()).material, new Vector3(0f, -0.08f, 0f), 1f);

		public static readonly Lure SwimbaitLure = new Lure("swimbait lure", 35, 34, Items.SwimbaitLure, Items.SwimbaitLure.GetComponent<MeshFilter>().mesh, ((Renderer)Items.SwimbaitLure.GetComponent<MeshRenderer>()).material, new Vector3(0f, -0.22f, 0f), 2f);

		public static readonly Lure TopwaterLure = new Lure("topwater lure", 45, 37, Items.TopwaterLure, Items.TopwaterLure.GetComponent<MeshFilter>().mesh, ((Renderer)Items.TopwaterLure.GetComponent<MeshRenderer>()).material, new Vector3(0f, -0.24f, 0f), 3f);

		public static readonly IReadOnlyList<Lure> Lures = new List<Lure> { SpoonLure, SwimbaitLure, TopwaterLure }.AsReadOnly();

		public string Name => _name;

		public int PeakLatitude => _peakLatitude;

		public int TargetFishPrefabIndex => _targetFishPrefabIndex;

		public GameObject Item => _item;

		public Mesh LureMesh => _mesh;

		public Material LureMaterial => _material;

		public Vector3 Offset => _offset;

		public float SaveData => _saveData;

		private Lure(string name, int peakLatitude, int targetFishPrefabIndex, GameObject item, Mesh mesh, Material material, Vector3 offset, float saveData)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			_name = name;
			_peakLatitude = peakLatitude;
			_targetFishPrefabIndex = targetFishPrefabIndex;
			_item = item;
			_mesh = mesh;
			_material = material;
			_offset = offset;
			_saveData = saveData;
		}
	}
}
namespace BetterFishing.Patches
{
	internal class FishSlicePricePatches
	{
		[HarmonyPatch(typeof(ShipItemFood), "OnLoad")]
		private class ShipItemFoodPatches
		{
			public static void Postfix(ShipItemFood __instance)
			{
				if (((ShipItem)__instance).name == "sunspot fish slice")
				{
					((ShipItem)__instance).value = 6;
				}
				else if (((ShipItem)__instance).name == "tuna slice")
				{
					((ShipItem)__instance).value = 9;
				}
				else if (((ShipItem)__instance).name == "templefish slice")
				{
					((ShipItem)__instance).value = 8;
				}
				else if (((ShipItem)__instance).name == "salmon slice")
				{
					((ShipItem)__instance).value = 12;
				}
				else if (((ShipItem)__instance).name == "eel slice")
				{
					((ShipItem)__instance).value = 23;
				}
				else if (((ShipItem)__instance).name == "shimmertail slice")
				{
					((ShipItem)__instance).value = 9;
				}
				else if (((ShipItem)__instance).name == "trout slice")
				{
					((ShipItem)__instance).value = 8;
				}
				else if (((ShipItem)__instance).name == "north fish slice")
				{
					((ShipItem)__instance).value = 10;
				}
				else if (((ShipItem)__instance).name == "blackfin slice")
				{
					((ShipItem)__instance).value = 9;
				}
			}
		}
	}
}