Decompiled source of BetterFishing v1.1.3

BetterFishing\BetterFishing.dll

Decompiled 5 hours 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.1.3.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.3.0")]
[module: UnverifiableCode]
namespace BetterFishing;

[BepInPlugin("com.raddude82.betterfishing", "BetterFishing", "1.1.3")]
[BepInDependency("com.raddude82.hookshangmore", "1.0.0")]
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.1.3";

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

	public const string HOOKS_HANG_MORE_VERSION = "1.0.0";

	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;
	}
}
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.SealableFish.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.SealableFish.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)
			if (((Object)__instance.currentCrate).name == "empty crate(Clone)")
			{
				__result = new Vector2(5f, 4f);
				return false;
			}
			return true;
		}
	}

	private static GoPointer _goPointer;

	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;
		}
	}
}
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 <= 803)
			{
				Array.Resize(ref __instance.directory, 803);
			}
			__instance.directory[800] = Items.EmptyCrate;
			__instance.directory[801] = Items.Hammer;
			__instance.directory[802] = Items.SealingNails;
		}
	}

	private const int NEW_PREFAB_DIR_SIZE = 803;
}
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);
				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 static readonly Dictionary<string, FishProperties> _fishData = new Dictionary<string, FishProperties>
	{
		{
			"31 templefish (A)",
			new FishProperties(10f, 0.95f)
		},
		{
			"32 sunspot fish (A)",
			new FishProperties(13f, 0.85f)
		},
		{
			"46 tuna (A)",
			new FishProperties(20f, 0.78f)
		},
		{
			"35 shimmertail (E)",
			new FishProperties(18f, 0.83f)
		},
		{
			"33 salmon (E)",
			new FishProperties(26f, 0.77f)
		},
		{
			"34 eel (E)",
			new FishProperties(30f, 0.72f)
		},
		{
			"38 blackfin hunter (M)",
			new FishProperties(20f, 0.85f)
		},
		{
			"36 trout (M)",
			new FishProperties(25f, 0.74f)
		},
		{
			"37 north fish (M)",
			new FishProperties(22f, 0.79f)
		},
		{
			"141 swamp fish 1 (snapper",
			new FishProperties(21f, 0.83f)
		},
		{
			"142 swamp fish 2 (bubbler)",
			new FishProperties(15f, 0.9f)
		},
		{
			"148 swamp fish 3",
			new FishProperties(28f, 0.76f)
		},
		{
			"140 gold albacore",
			new FishProperties(32f, 0.7f)
		}
	};

	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)
		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.7f, 7.235f, -385.26f), 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);
	}

	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)
		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);
	}

	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_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.233f, 4.116f, -547.05f), 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);
	}

	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__0 : 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__0(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 = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BF_Plugin.Instance).Info.Location), "Assets", "tools_bundle");
				<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);
				if ((Object)(object)Items.Hammer == (Object)null || (Object)(object)Items.EmptyCrate == (Object)null || (Object)(object)Items.SealingNails == (Object)null)
				{
					BF_Plugin.LogError("Failed to load all assets from the bundle.");
				}
				Items.InitializeHammer();
				Items.InitializeNails();
				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();
		}
	}

	[IteratorStateMachine(typeof(<LoadAssets>d__0))]
	internal static IEnumerator LoadAssets()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <LoadAssets>d__0(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 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", 1f, 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", 1f, 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", 1f, 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", 1f, 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", 1f, 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", 1f, 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", 1f, 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", 1f, 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>()));
	}
}
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 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, Configs.templeFishPriceMult.Value, -1),
				new FishData("32 sunspot fish (A)", "sunspot fish", 13f, 0.85f, 9, 32, Configs.sunspotFishPriceMult.Value, 16),
				new FishData("46 tuna (A)", "tuna", 20f, 0.78f, 6, 46, Configs.tunaPriceMult.Value, 16),
				new FishData("35 shimmertail (E)", "blue shimmertail", 18f, 0.83f, -1, 35, Configs.shimmertailPriceMult.Value, -1),
				new FishData("33 salmon (E)", "salmon", 26f, 0.77f, 1, 33, Configs.salmonPriceMult.Value, 12),
				new FishData("34 eel (E)", "eel", 30f, 0.72f, 19, 34, Configs.eelPriceMult.Value, 9),
				new FishData("38 blackfin hunter (M)", "blackfin hunter", 20f, 0.85f, -1, 38, Configs.blackfinHunterPriceMult.Value, -1),
				new FishData("36 trout (M)", "trout", 25f, 0.74f, 18, 36, Configs.troutPriceMult.Value, 16),
				new FishData("37 north fish (M)", "north fish", 22f, 0.79f, 14, 37, Configs.northFishPriceMult.Value, 16),
				new FishData("141 swamp fish 1 (snapper", "swamp snapper", 21f, 0.83f, -1, 141, Configs.swampSnapperPriceMult.Value, -1),
				new FishData("142 swamp fish 2 (bubbler)", "blue bubbler", 15f, 0.9f, -1, 142, Configs.blueBubblerPriceMult.Value, -1),
				new FishData("148 swamp fish 3", "fire fish", 28f, 0.76f, -1, 148, Configs.fireFishPriceMult.Value, -1),
				new FishData("140 gold albacore", "gold albacore", 32f, 0.7f, -1, 140, Configs.goldAlbacorePriceMult.Value, -1)
			};
			return list.AsReadOnly();
		}
	}

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

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

	public static GameObject EmptyCrate { get; internal set; }

	public static GameObject SealingNails { get; internal set; }

	internal static GameObject NailsLabel { get; 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 = 180f;
		((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 = 0f;
		((ShipItem)shipItemSealingNails).inventoryRotationX = 0f;
		((ShipItem)shipItemSealingNails).floaterHeight = 1.6f;
		((ShipItem)shipItemSealingNails).amount = 15f;
		((GoPointerButton)shipItemSealingNails).allowPlacingItems = true;
		((PickupableItem)shipItemSealingNails).big = true;
	}

	internal static void InitializeNailsBroken()
	{
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: 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)
		((Object)SealingNails).name = "sealing nails";
		Object.Destroy((Object)(object)SealingNails.GetComponent<ShipItemCrate>());
		Component component = SealingNails.GetComponent("EmbarkTracker");
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
		SealingNails.GetComponent<SaveablePrefab>().prefabIndex = 802;
		ShipItemSealingNails shipItemSealingNails = SealingNails.AddComponent<ShipItemSealingNails>();
		((PickupableItem)shipItemSealingNails).holdDistance = 1.25f;
		((PickupableItem)shipItemSealingNails).furniturePlaceHeight = 0.15f;
		((PickupableItem)shipItemSealingNails).heldRotationOffset = 180f;
		((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 = 0f;
		((ShipItem)shipItemSealingNails).inventoryRotationX = 0f;
		((ShipItem)shipItemSealingNails).floaterHeight = 1.6f;
		((ShipItem)shipItemSealingNails).amount = 15f;
		((GoPointerButton)shipItemSealingNails).allowPlacingItems = true;
		((PickupableItem)shipItemSealingNails).big = true;
		NailsLabel.transform.parent = SealingNails.transform;
		NailsLabel.transform.localPosition = new Vector3(0f, 0.1252f, 0f);
		NailsLabel.transform.localRotation = Quaternion.Euler(90f, 22f, 0f);
		NailsLabel.transform.localScale = new Vector3(0.14f, 0.25f, 0.2f);
		((Renderer)NailsLabel.GetComponent<MeshRenderer>()).sharedMaterial.renderQueue = 2999;
		Object.DontDestroyOnLoad((Object)(object)SealingNails);
		SealingNails.SetActive(false);
		SealingNails.GetComponent<SaveablePrefab>().Unregister();
		SealingNails.tag = "Untagged";
		BF_Plugin.LogDebug("Sealing nails initialized");
	}

	internal static void InitializeEmptyCrateBroken()
	{
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		((Object)EmptyCrate).name = "empty crate";
		Object.Destroy((Object)(object)EmptyCrate.GetComponent<Good>());
		Component component = EmptyCrate.GetComponent("EmbarkTracker");
		if ((Object)(object)component != (Object)null)
		{
			Object.Destroy((Object)(object)component);
		}
		EmptyCrate.GetComponent<SaveablePrefab>().prefabIndex = 800;
		ShipItemCrate component2 = EmptyCrate.GetComponent<ShipItemCrate>();
		((ShipItem)component2).mass = 5f;
		((ShipItem)component2).value = 45;
		((ShipItem)component2).name = "empty crate";
		((ShipItem)component2).category = (TransactionCategory)3;
		((ShipItem)component2).amount = 0f;
		Object.DontDestroyOnLoad((Object)(object)EmptyCrate);
		EmptyCrate.SetActive(false);
		EmptyCrate.GetComponent<SaveablePrefab>().Unregister();
		BF_Plugin.LogDebug("Empty crate initialized");
	}
}