Decompiled source of RadRefinements v1.10.0

RadRefinements/RadRefinements.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using cakeslice;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RadRefinements")]
[assembly: AssemblyDescription("https://github.com/bryon82/SailwindRadRefinements")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("raddude")]
[assembly: AssemblyProduct("RadRefinements")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c0c6b307-93f0-4209-8594-7f911e48e709")]
[assembly: AssemblyFileVersion("1.10.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.10.0.0")]
[module: UnverifiableCode]
namespace RadRefinements
{
	internal class AddReadingTextsPatches
	{
		[HarmonyPatch(typeof(ShipItem))]
		private class ShipItemPatches
		{
			private static Transform textMeshTemplate;

			[HarmonyPrefix]
			[HarmonyPatch("Awake")]
			public static void AddTextMesh(ShipItem __instance)
			{
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0255: Unknown result type (might be due to invalid IL or missing references)
				//IL_0269: Unknown result type (might be due to invalid IL or missing references)
				//IL_035b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0362: Unknown result type (might be due to invalid IL or missing references)
				//IL_0368: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0400: Unknown result type (might be due to invalid IL or missing references)
				//IL_0440: Unknown result type (might be due to invalid IL or missing references)
				//IL_0447: Unknown result type (might be due to invalid IL or missing references)
				//IL_044d: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_053c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0543: Unknown result type (might be due to invalid IL or missing references)
				//IL_0549: Unknown result type (might be due to invalid IL or missing references)
				//IL_0668: Unknown result type (might be due to invalid IL or missing references)
				//IL_066f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0675: Unknown result type (might be due to invalid IL or missing references)
				//IL_07be: Unknown result type (might be due to invalid IL or missing references)
				//IL_07c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_07cc: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)textMeshTemplate == (Object)null)
				{
					textMeshTemplate = ((Component)DayLogs.instance).transform.parent.GetChild(0).GetChild(1);
				}
				if (__instance.name == "chronometer")
				{
					float num = ((((Object)((Component)__instance).transform).name == "172 clock M(Clone)") ? (-0.075f) : (-0.2f));
					ReadingText readingText = AddReadingText(__instance, new Vector3(0f, -0.3f, num));
					readingText.instrumentType = InstrumentType.Clock;
				}
				else if (__instance.name == "compass" || __instance.name == "bearing compass")
				{
					ReadingText readingText2 = AddReadingText(__instance, new Vector3(0f, 0.03f, 0f));
					readingText2.textMesh.lineSpacing = 0.6f;
					readingText2.instrumentType = InstrumentType.Compass;
					if (__instance.name == "bearing compass")
					{
						readingText2.isCompassFlipped = true;
						readingText2.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "CompassCard"));
					}
					else
					{
						readingText2.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "compass_base"));
					}
				}
				else if (__instance.name == "sun compass")
				{
					ReadingText readingText3 = AddReadingText(__instance, new Vector3(0f, 0f, 0.18f), new Vector3(45f, 0f, 0f));
					readingText3.textMesh.fontSize = 20;
					readingText3.instrumentType = InstrumentType.SunCompass;
				}
				else if (__instance.name == "quadrant")
				{
					Transform parent = ((IEnumerable<Transform>)((Component)((Component)__instance).transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "dial"));
					ReadingText readingText4 = AddReadingText(__instance, new Vector3(-0.025f, -0.19f, -0.03f), new Vector3(0f, 90f, 270f), parent);
					readingText4.textMesh.fontSize = 40;
					readingText4.instrumentType = InstrumentType.Quadrant;
				}
				else if (__instance.name == "chip log")
				{
					ReadingText readingText5 = AddReadingText(__instance, new Vector3(0f, 0.21f, -0.02f));
					string pointerName = ((((Object)((Component)__instance).transform).name == "93 chip log E(Clone)") ? "pointer_001" : "pointer_002");
					readingText5.instrumentType = InstrumentType.ChipLog;
					readingText5.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == pointerName));
				}
				else if (__instance.name == "barometer")
				{
					ReadingText readingText6 = AddReadingText(__instance, new Vector3(0f, 0.12f, -0.075f));
					readingText6.instrumentType = InstrumentType.Barometer;
				}
				else if (__instance.name == "thermometer")
				{
					ReadingText readingText7 = AddReadingText(__instance, new Vector3(0f, 0.12f, -0.075f));
					readingText7.instrumentType = InstrumentType.Thermometer;
				}
				else if (__instance.name == "hygrometer")
				{
					ReadingText readingText8 = AddReadingText(__instance, new Vector3(0f, 0.12f, -0.075f));
					readingText8.instrumentType = InstrumentType.Hygrometer;
				}
				else if (__instance.name == "inclinometer")
				{
					ReadingText readingText9 = AddReadingText(__instance, new Vector3(0f, 0.12f, -0.05f));
					readingText9.instrumentType = InstrumentType.Inclinometer;
					readingText9.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "Arm"));
				}
				else if (__instance.name == "binnacle")
				{
					ReadingText readingText10 = AddReadingText(__instance, new Vector3(0f, 1.26f, 0f));
					readingText10.textMesh.lineSpacing = 0.6f;
					readingText10.instrumentType = InstrumentType.Compass;
					readingText10.isCompassFlipped = true;
					readingText10.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "CompassFace"));
					ReadingText readingText11 = AddReadingText(__instance, new Vector3(0f, 0.9f, -0.201f));
					readingText11.instrumentType = InstrumentType.Inclinometer;
					readingText11.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "InclinometerArm"));
				}
				else if (__instance.name == "wind compass")
				{
					ReadingText readingText12 = AddReadingText(__instance, new Vector3(0f, 0.12f, -0.075f));
					readingText12.textMesh.lineSpacing = 0.6f;
					readingText12.instrumentType = InstrumentType.WindCompass;
					readingText12.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "indicator"));
				}
				else if (__instance.name == "anemometer" && ((Object)((Component)__instance).transform).name == "514 anemometer B(Clone)")
				{
					ReadingText readingText13 = AddReadingText(__instance, new Vector3(0f, 0.13f, -0.075f));
					readingText13.instrumentType = InstrumentType.Anemometer;
					readingText13.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "pointer_001 (1)"));
					readingText13.indicator2 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "plus_tumbler_3"));
				}
				else
				{
					if (!(__instance.name == "weathervane"))
					{
						return;
					}
					Transform val;
					Vector3 val2 = default(Vector3);
					if (((Object)((Component)__instance).transform).name.Contains("large"))
					{
						val = ((IEnumerable<Transform>)((Component)((Component)__instance).transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "extension"));
						((Vector3)(ref val2))..ctor(0f, 0.4f, 0f);
					}
					else
					{
						val = ((IEnumerable<Transform>)((Component)((Component)__instance).transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "pivot parent"));
						((Vector3)(ref val2))..ctor(0f, 0.5f, 0f);
					}
					Vector3 position = val2;
					Transform parent2 = val;
					ReadingText readingText14 = AddReadingText(__instance, position, default(Vector3), parent2);
					readingText14.textMesh.lineSpacing = 0.6f;
					readingText14.instrumentType = InstrumentType.Weathervane;
					readingText14.indicator1 = ((IEnumerable<Transform>)((Component)__instance).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name == "wind_vane_arrow"));
				}
			}

			private static ReadingText AddReadingText(ShipItem shipItem, Vector3 position, Vector3 rotation = default(Vector3), Transform parent = null)
			{
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)parent == (Object)null)
				{
					parent = ((Component)shipItem).transform;
				}
				Transform val = Object.Instantiate<Transform>(textMeshTemplate);
				((Object)val).name = "reading_text";
				val.SetParent(parent);
				((Component)val).gameObject.layer = 0;
				val.localPosition = position;
				val.localEulerAngles = rotation;
				val.localScale = new Vector3(0.0114f, 0.0127f, 0.0127f);
				TextMesh component = ((Component)val).GetComponent<TextMesh>();
				component.color = Configs.readingTextColor.Value;
				component.fontSize = 55;
				component.fontStyle = (FontStyle)0;
				component.anchor = (TextAnchor)7;
				component.richText = true;
				((Component)val).gameObject.SetActive(false);
				ReadingText readingText = ((Component)shipItem).gameObject.AddComponent<ReadingText>();
				readingText.textMesh = component;
				readingText.shipItem = shipItem;
				return readingText;
			}
		}
	}
	internal class BlueTobaccoPatches
	{
		[HarmonyPatch(typeof(PrefabsDirectory), "PopulateShipItems")]
		private class SetBlueTobaccoType
		{
			public static void Postfix(PrefabsDirectory __instance)
			{
				__instance.directory[318].GetComponent<ShipItemTobacco>().tobaccoType = 5;
			}
		}

		[HarmonyPatch(typeof(PlayerTobacco), "Smoke")]
		private class SetBlueTobaccoPotency
		{
			public static void Postfix(PlayerTobacco __instance, int tobaccoType)
			{
				if (tobaccoType == 5)
				{
					if (!Configs.enableBlueTobacco.Value)
					{
						__instance.green += Time.deltaTime * 2f;
						PlayerNeeds.sleep -= Time.deltaTime * 0.11f;
					}
					else
					{
						__instance.green += Time.deltaTime * 2f * (float)Configs.bluePotencyMult.Value * 0.33f;
						PlayerNeeds.sleep -= Time.deltaTime * 0.11f * (float)Configs.bluePotencyMult.Value;
					}
				}
			}
		}
	}
	internal class ItemPatches
	{
		[HarmonyPatch(typeof(ShipItem), "OnLoad")]
		private class ShipItemPatches
		{
			public static void Postfix(ShipItem __instance)
			{
				if (__instance is ShipItemHammer && Configs.removeItemHints.Value && __instance.sold)
				{
					((GoPointerButton)__instance).description = "";
				}
			}
		}
	}
	internal class PipePatches
	{
		[HarmonyPatch(typeof(ShipItem), "OnAltActivate")]
		private class ShipItemPatches
		{
			public static void Postfix(ShipItem __instance)
			{
				if (Configs.enableSingleClickSmoking.Value)
				{
					ShipItemPipe val = (ShipItemPipe)(object)((__instance is ShipItemPipe) ? __instance : null);
					if (val != null && ((ShipItem)val).sold)
					{
						_clickedCount++;
						((MonoBehaviour)__instance).StartCoroutine(MovePipe(val));
					}
				}
			}

			private static IEnumerator MovePipe(ShipItemPipe pipe)
			{
				while (Object.op_Implicit((Object)(object)((PickupableItem)pipe).held) && (double)((PickupableItem)pipe).holdDistance > 0.25 && _clickedCount % 2 != 0 && ((ShipItem)pipe).amount > 0f)
				{
					((PickupableItem)pipe).holdDistance = Mathf.Lerp(((PickupableItem)pipe).holdDistance, 0.25f, Time.deltaTime * 4.44f);
					((PickupableItem)pipe).holdHeight = Mathf.Lerp(((PickupableItem)pipe).holdHeight, pipe.height, Time.deltaTime * 4.44f);
					((PickupableItem)pipe).heldRotationOffset = Mathf.Lerp(((PickupableItem)pipe).heldRotationOffset, 0f - pipe.maxRot, Time.deltaTime * pipe.rotRate);
					pipe.SetPrivateField("inhaling", !PipeExhaleEffect.instance.exhaling);
					pipe.SetPrivateField("drinking", true);
					yield return null;
				}
				if (!Object.op_Implicit((Object)(object)((PickupableItem)pipe).held) || ((ShipItem)pipe).amount <= 0f)
				{
					_clickedCount = 0;
				}
			}
		}

		[HarmonyPatch(typeof(ShipItemPipe), "OnAltHeld")]
		public class ShipItemPipePatches
		{
			public static bool Prefix()
			{
				if (Configs.enableSingleClickSmoking.Value)
				{
					return false;
				}
				return true;
			}
		}

		private static int _clickedCount;
	}
	internal class PlayerNeedsPatches
	{
		[HarmonyPatch(typeof(PlayerNeeds), "Start")]
		internal class MovementNeedsPatches
		{
			private static float runningWaterCost;

			private static float swimmingWaterCost;

			private static float swimmingFoodCost;

			public static void Postfix(PlayerNeeds __instance)
			{
				runningWaterCost = __instance.runningWaterCost;
				swimmingWaterCost = __instance.swimmingWaterCost;
				swimmingFoodCost = __instance.swimmingFoodCost;
				__instance.runningWaterCost = runningWaterCost * (1f - Configs.runningNeedsMult.Value);
				__instance.swimmingWaterCost = swimmingWaterCost * (1f - Configs.fastSwimmingNeedsMult.Value);
				__instance.swimmingFoodCost = swimmingFoodCost * (1f - Configs.fastSwimmingNeedsMult.Value);
			}

			internal static void UpdateMovementNeeds(object sender, EventArgs e)
			{
				PlayerNeeds.instance.runningWaterCost = runningWaterCost * (1f - Configs.runningNeedsMult.Value);
				PlayerNeeds.instance.swimmingWaterCost = swimmingWaterCost * (1f - Configs.fastSwimmingNeedsMult.Value);
				PlayerNeeds.instance.swimmingFoodCost = swimmingFoodCost * (1f - Configs.fastSwimmingNeedsMult.Value);
			}
		}

		[HarmonyPatch(typeof(BilgePump))]
		internal class BilgePumpNeedsPatches
		{
			private static float bilgePumpWaterCost;

			private static float bilgePumpFoodCost;

			[HarmonyPostfix]
			[HarmonyPatch("Awake")]
			public static void Awake(BilgePump __instance)
			{
				bilgePumpWaterCost = __instance.waterCost;
				bilgePumpFoodCost = __instance.foodCost;
				__instance.waterCost = bilgePumpWaterCost * (1f - Configs.bilgePumpNeedsMult.Value);
				__instance.foodCost = bilgePumpFoodCost * (1f - Configs.bilgePumpNeedsMult.Value);
			}

			[HarmonyPostfix]
			[HarmonyPatch("OnActivate")]
			public static void OnActivate(BilgePump __instance)
			{
				__instance.waterCost = bilgePumpWaterCost * (1f - Configs.bilgePumpNeedsMult.Value);
				__instance.foodCost = bilgePumpFoodCost * (1f - Configs.bilgePumpNeedsMult.Value);
			}
		}

		[HarmonyPatch(typeof(ShipItemOar))]
		private class OarNeedsPatches
		{
			private static float addAmount;

			[HarmonyPrefix]
			[HarmonyPatch("ExtraLateUpdate")]
			public static void ReduceNeedsPrefix(bool ___isRowing)
			{
				if (___isRowing)
				{
					addAmount = Time.deltaTime * Configs.rowingNeedsMult.Value;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("ExtraLateUpdate")]
			public static void ReduceNeedsPostfix()
			{
				if (addAmount > 0f)
				{
					PlayerNeeds.water += addAmount * 0.4f;
					PlayerNeeds.food += addAmount * 0.6f;
					addAmount = 0f;
				}
			}
		}
	}
	internal class ReadingText : MonoBehaviour
	{
		internal TextMesh textMesh;

		internal ShipItem shipItem;

		internal Transform indicator1;

		internal Transform indicator2;

		private bool _isInSunlight;

		private float _sunlightTimer;

		internal InstrumentType instrumentType = InstrumentType.None;

		internal bool isCompassFlipped = false;

		private const float CHIPLOG_ANGLE_TO_KNOTS = 1f / 15f;

		private const float ANEMOMETER_ANGLE_TO_KNOTS = 5f / 36f;

		private static readonly Vector3 NOT_HELD_SIZE = new Vector3(0.0114f, 0.0127f, 0.0127f);

		private static readonly Vector3 HELD_SIZE = new Vector3(0.0044f, 0.0057f, 0.0057f);

		private void LateUpdate()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Expected O, but got Unknown
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d19: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b21: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e49: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e50: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b88: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c10: Unknown result type (might be due to invalid IL or missing references)
			if (!GameState.playing || GameState.currentlyLoading || GameState.loadingBoatLocalItems || (Object)(object)textMesh == (Object)null)
			{
				return;
			}
			if (BoatCamera.on)
			{
				((Component)textMesh).gameObject.SetActive(false);
				return;
			}
			Color targetColor = GetTargetColor();
			if (textMesh.color != targetColor)
			{
				textMesh.color = targetColor;
			}
			bool flag = (Object)(object)((PickupableItem)shipItem).held != (Object)null;
			Vector3 position = ((Component)Refs.observerMirror).transform.position;
			Vector3 position2 = ((Component)this).transform.position;
			float num = Vector3.Distance(position, position2);
			bool flag2 = !shipItem.sold || ((Component)this).gameObject.layer == 5 || (Object)(object)shipItem.currentActualBoat == (Object)null;
			bool flag3 = flag || flag2 || Vector3.Angle(-((Component)this).transform.forward, position - position2) > 85f || SpyglassPatches.HeldAndUp;
			if (instrumentType == InstrumentType.Compass)
			{
				if (!((Object)(object)indicator1 == (Object)null))
				{
					if ((!Configs.enableCompassDegreesText.Value && !Configs.enableCompassCardinalText.Value) || (flag && !Configs.enableCompassReadingHeld.Value) || flag2 || num > Configs.compassViewDist.Value || SpyglassPatches.HeldAndUp)
					{
						((Component)textMesh).gameObject.SetActive(false);
						return;
					}
					float num2 = (flag ? 0f : Vector3.SignedAngle(-((Component)this).transform.forward, position - position2, Vector3.up));
					((Component)textMesh).transform.localEulerAngles = new Vector3(0f, num2, 0f);
					((Component)textMesh).transform.localScale = (flag ? HELD_SIZE : NOT_HELD_SIZE);
					float num3 = (isCompassFlipped ? 180f : 360f);
					float reading = (180f - ((Component)indicator1).transform.localEulerAngles.y + num3) % 360f;
					textMesh.text = GetCompassReading(reading, Configs.enableCompassCardinalText.Value, Configs.enableCompassDegreesText.Value, Configs.compassCardinalPrecision.Value, Configs.compassDecimalPlaces.Value);
					((Component)textMesh).gameObject.SetActive(true);
				}
			}
			else if (instrumentType == InstrumentType.ChipLog)
			{
				if (!((Object)(object)indicator1 == (Object)null))
				{
					if (!Configs.enableChipLogText.Value || flag3 || num > Configs.chipLogViewDist.Value || !shipItem.GetPrivateField<bool>("thrown"))
					{
						((Component)textMesh).gameObject.SetActive(false);
						return;
					}
					float num4 = (360f - indicator1.localEulerAngles.z) % 360f * (1f / 15f);
					textMesh.text = num4.ToString("F" + Configs.chipLogDecimalPlaces.Value) + " kts";
					((Component)textMesh).gameObject.SetActive(true);
				}
			}
			else if (instrumentType == InstrumentType.Clock)
			{
				if ((!Configs.enableClockGlobalText.Value && !Configs.enableClockLocalText.Value) || flag3 || num > Configs.clockViewDist.Value)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				textMesh.text = GetClockReading();
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.Quadrant)
			{
				if (!Configs.enableQuadrantText.Value || !shipItem.GetPrivateField<bool>("inspecting") || shipItem.GetPrivateField<bool>("rotating"))
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				Transform privateField = ((object)(ShipItemQuadrant)shipItem).GetPrivateField<Transform>("dial");
				float x = privateField.localEulerAngles.x;
				textMesh.text = x.ToString("F" + Configs.quadrantDecimalPlaces.Value) + "°";
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.SunCompass)
			{
				if (!Configs.enableSunCompassText.Value || (Object)(object)((PickupableItem)shipItem).held == (Object)null || ((Component)this).gameObject.layer == 5)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				_sunlightTimer += Time.deltaTime;
				if (_sunlightTimer >= 5f)
				{
					_sunlightTimer = 0f;
					_isInSunlight = IsInSunlight();
				}
				if (!_isInSunlight)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				float z = FloatingOriginManager.instance.GetGlobeCoords(((Component)this).transform).z;
				textMesh.text = z.ToString("F" + Configs.sunCompassDecimalPlaces.Value) + "°";
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.Barometer)
			{
				if (!Configs.enableBarometerText.Value || flag3 || num > Configs.barometerViewDist.Value)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				float privateField2 = shipItem.GetPrivateField<float>("_pressure");
				float num5 = Mathf.Lerp(26f, 31.9f, privateField2);
				if (Configs.barometerUnits.Value == "hPa" || Configs.barometerUnits.Value == "mbar")
				{
					num5 *= 33.86389f;
				}
				else if (Configs.barometerUnits.Value == "atm")
				{
					num5 *= 0.03342f;
				}
				textMesh.text = num5.ToString("F" + Configs.barometerDecimalPlaces.Value) + Configs.barometerUnits.Value;
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.Thermometer)
			{
				if (!Configs.enableThermometerText.Value || flag3 || num > Configs.thermometerViewDist.Value)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				float privateField3 = shipItem.GetPrivateField<float>("_temperature");
				float num6 = Mathf.Lerp(10f, 115f, privateField3);
				if (Configs.thermometerUnits.Value == "°C")
				{
					num6 = (num6 - 32f) * 5f / 9f;
				}
				else if (Configs.thermometerUnits.Value == "K")
				{
					num6 = (num6 - 32f) * 5f / 9f + 273.15f;
				}
				textMesh.text = num6.ToString("F" + Configs.thermometerDecimalPlaces.Value) + Configs.thermometerUnits.Value;
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.Hygrometer)
			{
				if (!Configs.enableHygrometerText.Value || flag3 || num > Configs.hygrometerViewDist.Value)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				float privateField4 = shipItem.GetPrivateField<float>("_humidity");
				textMesh.text = (privateField4 * 100f).ToString("F" + Configs.hygrometerDecimalPlaces.Value) + "%";
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.Inclinometer)
			{
				if ((Object)(object)indicator1 == (Object)null)
				{
					return;
				}
				if (!Configs.enableInclinometerText.Value || flag3 || num > Configs.inclinometerViewDist.Value)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				float num7 = indicator1.localEulerAngles.z;
				if (num7 > 180f)
				{
					num7 = (Configs.negativeInclinometerAngles.Value ? (num7 - 360f) : (360f - num7));
				}
				textMesh.text = num7.ToString("F" + Configs.inclinometerDecimalPlaces.Value) + "°";
				((Component)textMesh).gameObject.SetActive(true);
			}
			else if (instrumentType == InstrumentType.WindCompass)
			{
				if (!((Object)(object)indicator1 == (Object)null))
				{
					if ((!Configs.enableWindCompassDegreesText.Value && !Configs.enableWindCompassCardinalText.Value && !Configs.enableWindCompassPointOfSailText.Value && !Configs.enableWindCompassPointOfSailDegrees.Value) || flag || flag2 || num > Configs.compassViewDist.Value || SpyglassPatches.HeldAndUp)
					{
						((Component)textMesh).gameObject.SetActive(false);
						return;
					}
					float num8 = (flag ? 0f : Vector3.SignedAngle(-((Component)this).transform.forward, position - position2, Vector3.up));
					((Component)textMesh).transform.localEulerAngles = new Vector3(0f, num8, 0f);
					((Component)textMesh).transform.localScale = (flag ? HELD_SIZE : NOT_HELD_SIZE);
					float reading2 = (indicator1.localEulerAngles.y + 180f + ((Component)this).transform.eulerAngles.y) % 360f;
					string compassReading = GetCompassReading(reading2, Configs.enableWindCompassCardinalText.Value, Configs.enableWindCompassDegreesText.Value, Configs.windCompassCardinalPrecision.Value, Configs.windCompassDecimalPlaces.Value);
					float num9 = (indicator1.eulerAngles.y + 180f) % 360f;
					float y = shipItem.currentActualBoat.parent.eulerAngles.y;
					float reading3 = (num9 - y + 540f) % 360f - 180f;
					string pointOfSailReading = GetPointOfSailReading(reading3, Configs.enableWindCompassPointOfSailText.Value, Configs.enableWindCompassPointOfSailDegrees.Value, Configs.windCompassPointOfSailDecimalPlaces.Value);
					textMesh.text = (compassReading + "\n" + pointOfSailReading).Trim();
					((Component)textMesh).gameObject.SetActive(true);
				}
			}
			else if (instrumentType == InstrumentType.Anemometer)
			{
				if (Configs.enableAnemometerText.Value && !((Object)(object)indicator1 == (Object)null) && !((Object)(object)indicator2 == (Object)null))
				{
					if (flag3 || num > Configs.anemometerViewDist.Value)
					{
						((Component)textMesh).gameObject.SetActive(false);
						return;
					}
					float num10 = (360f - indicator1.localEulerAngles.z) % 360f * (5f / 36f);
					float num11 = indicator2.localEulerAngles.z / 120f;
					textMesh.text = (num10 + num11 * 50f).ToString("F" + Configs.anemometerDecimalPlaces.Value) + " kts";
					((Component)textMesh).gameObject.SetActive(true);
				}
			}
			else if (instrumentType == InstrumentType.Weathervane && (Configs.enableWeathervaneDegreesText.Value || Configs.enableWeathervanePointOfSailText.Value) && !((Object)(object)indicator1 == (Object)null))
			{
				if (flag2 || num > Configs.weathervaneViewDist.Value || SpyglassPatches.HeldAndUp)
				{
					((Component)textMesh).gameObject.SetActive(false);
					return;
				}
				Transform parent = ((Component)textMesh).transform.parent;
				float num12 = Vector3.SignedAngle(-parent.forward, position - position2, Vector3.up);
				((Component)textMesh).transform.localEulerAngles = new Vector3(0f, num12, 0f);
				float num13 = (indicator1.eulerAngles.y + 180f) % 360f;
				float y2 = shipItem.currentActualBoat.parent.eulerAngles.y;
				float reading4 = (num13 - y2 + 540f) % 360f - 180f;
				textMesh.text = GetPointOfSailReading(reading4, Configs.enableWeathervanePointOfSailText.Value, Configs.enableWeathervaneDegreesText.Value, Configs.weathervaneDecimalPlaces.Value);
				((Component)textMesh).gameObject.SetActive(true);
			}
		}

		private static string GetPointOfSailReading(float reading, bool enableText, bool enableDegrees, int decimalPlaces)
		{
			string text = string.Empty;
			if (enableText)
			{
				text = ((!(reading > 0f)) ? "port " : "starboard ");
				float num = Mathf.Abs(reading);
				text = ((num <= 30f) ? "in irons" : ((num <= 50f) ? (text + "close-hauled") : ((num <= 80f) ? (text + "close reach") : ((num <= 120f) ? (text + "beam reach") : ((!(num <= 160f)) ? "running downwind" : (text + "broad reach"))))));
			}
			if (enableDegrees)
			{
				text = text + "\n" + reading.ToString("F" + decimalPlaces) + "°";
			}
			return text;
		}

		private static string GetCompassReading(float reading, bool enableText, bool enableDegrees, int cardinalPrecision, int decimalPlaces)
		{
			if (!enableText && !enableDegrees)
			{
				return string.Empty;
			}
			if (!enableText)
			{
				return reading.ToString("F" + decimalPlaces) + "°";
			}
			if (!enableDegrees)
			{
				return CompassRose.GetAbbreviatedDir(reading, cardinalPrecision);
			}
			return CompassRose.GetAbbreviatedDir(reading, cardinalPrecision) + "\n" + reading.ToString("F" + decimalPlaces) + "°";
		}

		private static string GetClockReading()
		{
			float globalTime = Sun.sun.globalTime;
			float localTime = Sun.sun.localTime;
			if (!Configs.enableClockLocalText.Value)
			{
				return GetTime(globalTime);
			}
			if (!Configs.enableClockGlobalText.Value)
			{
				return GetTime(localTime);
			}
			return GetTime(globalTime) + "\n\n\n\n" + GetTime(localTime);
		}

		private static string GetTime(float time)
		{
			int num = (int)time;
			double num2 = Math.Round(time % 1f * 60f) % 60.0;
			return $"{num:00}:{num2:00}";
		}

		private bool IsInSunlight()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			float localTime = Sun.sun.localTime;
			if ((Object)(object)((PickupableItem)shipItem).held == (Object)null || localTime < 11f || localTime > 13f)
			{
				return false;
			}
			Vector3 val = -((Component)Sun.sun).transform.forward;
			int num = -5;
			Vector3 val2 = ((Component)this).transform.position + val * 0.01f;
			bool flag = Physics.Raycast(val2, val, float.PositiveInfinity, num, (QueryTriggerInteraction)2);
			return !flag;
		}

		private Color GetTargetColor()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(instrumentType switch
			{
				InstrumentType.Compass => Configs.compassTextColor.Value, 
				InstrumentType.ChipLog => Configs.chipLogTextColor.Value, 
				InstrumentType.Clock => Configs.clockTextColor.Value, 
				InstrumentType.Quadrant => Configs.quadrantTextColor.Value, 
				InstrumentType.SunCompass => Configs.sunCompassTextColor.Value, 
				InstrumentType.Barometer => Configs.barometerTextColor.Value, 
				InstrumentType.Thermometer => Configs.thermometerTextColor.Value, 
				InstrumentType.Hygrometer => Configs.hygrometerTextColor.Value, 
				InstrumentType.Inclinometer => Configs.inclinometerTextColor.Value, 
				InstrumentType.WindCompass => Configs.windCompassTextColor.Value, 
				InstrumentType.Anemometer => Configs.anemometerTextColor.Value, 
				InstrumentType.Weathervane => Configs.weathervaneTextColor.Value, 
				_ => Configs.readingTextColor.Value, 
			});
		}
	}
	internal class Crate
	{
		public static string GetCrateInventory(ShipItemCrate crate)
		{
			CrateInventory privateField = crate.GetPrivateField<CrateInventory>("crateInventory");
			if ((Object)(object)privateField == (Object)null)
			{
				return string.Empty;
			}
			List<ShipItem> containedItems = privateField.containedItems;
			if (containedItems == null || containedItems.Count == 0)
			{
				return string.Empty;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (ShipItem item in containedItems)
			{
				string key = NormalizeKey(item);
				if (!dictionary.ContainsKey(key))
				{
					dictionary[key] = 1;
				}
				else
				{
					dictionary[key]++;
				}
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.AppendLine("crate");
			foreach (KeyValuePair<string, int> item2 in dictionary.OrderBy((KeyValuePair<string, int> p) => p.Key))
			{
				stringBuilder.AppendLine($"{item2.Key}: {item2.Value}");
			}
			return stringBuilder.ToString();
		}

		private static string NormalizeKey(ShipItem item)
		{
			string name = item.name;
			string text = ((GoPointerButton)item).description;
			int num = text.IndexOf('<');
			if (num >= 0)
			{
				text = text.Substring(0, num);
			}
			if (text.IndexOf('%') >= 0)
			{
				return name;
			}
			if (name.Equals("fishing hook") || name.Equals("knife") || name.Equals("hammer"))
			{
				return name;
			}
			return Utility.IsNullOrWhiteSpace(text) ? name : text;
		}
	}
	internal class KnifeWood : MonoBehaviour
	{
		private KnifeWoodCollider _knifeWoodCol;

		public void RegisterKnifeWoodCol(KnifeWoodCollider col)
		{
			_knifeWoodCol = col;
		}

		internal void CutContainer(ShipItem container)
		{
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			if ((container is ShipItemBottle && container.health > 0f) || (!(container is ShipItemBottle) && container.amount > 0f))
			{
				return;
			}
			ShipItemCrate val = (ShipItemCrate)(object)((container is ShipItemCrate) ? container : null);
			if (val == null || val.GetPrivateField<CrateInventory>("crateInventory").containedItems.Count <= 0)
			{
				string key = ((Component)container).gameObject.GetComponent<Good>()?.sizeDescription ?? container.name;
				int num = Knife.WoodPiecesPerContainer[key];
				float num2 = -0.01f * (float)num;
				for (int i = 0; i < num; i++)
				{
					GameObject val2 = Object.Instantiate<GameObject>(PrefabsDirectory.instance.directory[71]);
					val2.transform.position = ((Component)container).transform.position + ((Component)container).transform.right * num2;
					val2.transform.rotation = ((Component)container).transform.rotation * Quaternion.Euler(0f, 90f, 0f);
					num2 += 0.02f;
					ShipItemStoveFuel component = val2.GetComponent<ShipItemStoveFuel>();
					((ShipItem)component).sold = true;
					val2.GetComponent<SaveablePrefab>().RegisterToSave();
				}
				((Component)container).GetComponent<ShipItem>().DestroyItem();
				((MonoBehaviour)this).StartCoroutine(MakeLocalPosTracker());
			}
		}

		internal IEnumerator MakeLocalPosTracker()
		{
			yield return (object)new WaitForEndOfFrame();
			if ((Object)(object)CrateInventoryUI.instance.GetPrivateField<Transform>("localPosTracker") == (Object)null)
			{
				CrateInventoryUI.instance.SetPrivateField("localPosTracker", Object.Instantiate<GameObject>(new GameObject()).transform);
			}
		}
	}
	internal class KnifeWoodCollider : MonoBehaviour
	{
		public ShipItem CurrentWood { get; private set; }

		private void Awake()
		{
			((Component)((Component)this).transform.parent).GetComponent<KnifeWood>().RegisterKnifeWoodCol(this);
		}

		public void OnTriggerEnter(Collider other)
		{
			ShipItem component = ((Component)other).GetComponent<ShipItem>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			RR_Plugin.LogDebug("KnifeCollider: entering wood col: " + component.name);
			if (!(component is ShipItemBottle) || !(component.health <= 0f))
			{
				if (!(component is ShipItemCrate))
				{
					return;
				}
				ShipItemCrate component2 = ((Component)component).gameObject.GetComponent<ShipItemCrate>();
				if (component2 == null || !(component2.GetPrivateField<CrateInventory>("crateInventory")?.containedItems.Count <= 0))
				{
					return;
				}
			}
			CurrentWood = component;
		}

		public void OnTriggerExit(Collider other)
		{
			if ((Object)(object)((Component)other).GetComponent<ShipItem>() == (Object)(object)CurrentWood)
			{
				CurrentWood = null;
			}
		}
	}
	internal enum InstrumentType
	{
		None,
		Compass,
		ChipLog,
		Clock,
		Quadrant,
		SunCompass,
		Inclinometer,
		Barometer,
		Thermometer,
		Hygrometer,
		WindCompass,
		Anemometer,
		Weathervane
	}
	public class Knife
	{
		private static readonly Dictionary<string, int> _woodPiecesPerContainer = new Dictionary<string, int>
		{
			{ "small crate", 4 },
			{ "standard crate", 6 },
			{ "large crate", 8 },
			{ "very large crate", 10 },
			{ "standard barrel", 6 },
			{ "firewood", 4 },
			{ "fishing hooks", 4 },
			{ "lantern candles", 2 },
			{ "green tobacco", 2 },
			{ "blue tobacco", 2 },
			{ "black tobacco", 2 },
			{ "brown tobacco", 2 },
			{ "white tobacco", 2 },
			{ "coffee", 2 },
			{ "white tea", 2 },
			{ "black tea", 2 },
			{ "green tea", 2 },
			{ "empty crate", 6 },
			{ "sealing nails", 2 },
			{ "spoon lures", 2 },
			{ "swimbait lures", 2 },
			{ "topwater lures", 2 }
		};

		public static Dictionary<string, int> WoodPiecesPerContainer => _woodPiecesPerContainer;
	}
	internal class SwapSlot : MonoBehaviour
	{
		public static SwapSlot Instance { get; private set; }

		internal static GPButtonInventorySlot Slot { get; private set; }

		internal static GoPointer GoPntr { get; set; }

		private void Awake()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			Slot = new GPButtonInventorySlot();
		}

		public void SwapItems(PickupableItem item, GPButtonInventorySlot invSlot)
		{
			ShipItem component = ((Component)item).GetComponent<ShipItem>();
			if (!component.sold || !Object.op_Implicit((Object)(object)component) || ((PickupableItem)component).big)
			{
				return;
			}
			ShipItemBottle component2 = ((Component)item).GetComponent<ShipItemBottle>();
			if (!Object.op_Implicit((Object)(object)component2) || !(component2.GetCapacity() > 10f))
			{
				RR_Plugin.LogDebug("Inserting " + component.name + " into swap slot.");
				Slot.currentItem = component;
				item.held = null;
				((Component)component).GetComponent<Collider>().enabled = false;
				((Component)Slot.currentItem).gameObject.layer = 5;
				Transform[] componentsInChildren = ((Component)Slot.currentItem).GetComponentsInChildren<Transform>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Component)componentsInChildren[i]).gameObject.layer = 5;
				}
				ShipItem currentItem = invSlot.currentItem;
				RR_Plugin.LogDebug("Withdrawing " + currentItem.name + " from inventory slot.");
				GoPntr.PickUpItem((PickupableItem)(object)currentItem);
				((MonoBehaviour)this).StartCoroutine(GrabItem(currentItem));
				RR_Plugin.LogDebug("Moving " + Slot.currentItem.name + " from swap slot to inventory slot.");
				Debug.Log((object)"Inserting item.");
				Slot.currentItem.GetItemRigidbody().EnterInventorySlot(((Component)invSlot).transform);
				invSlot.currentItem = Slot.currentItem;
				UISoundPlayer.instance.PlayUISound((UISounds)4, 0.2f, 1.36f);
				Slot.currentItem = null;
				RR_Plugin.LogDebug("Items Swapped");
			}
		}

		private IEnumerator GrabItem(ShipItem item)
		{
			yield return (object)new WaitForEndOfFrame();
			GoPntr.SetPrivateField("heldItem", item);
			((Component)item).gameObject.layer = 2;
			GoPntr.GetPrivateField<PickupableItem>("heldItem").held = GoPntr;
			GoPntr.SetPrivateField("heldItemRot", Vector3.zero);
			GoPntr.SetPrivateField("timerAfterPickup", 0f);
			((PickupableItem)item).OnPickup();
			((Component)((Component)GoPntr).transform.parent).GetComponent<LookUI>().SetPrivateField("currentButton", ((Component)item).gameObject);
		}

		internal static bool IsItemHeld()
		{
			return (Object)(object)GoPntr.GetHeldItem() != (Object)null;
		}

		internal void WithdrawFromSwapSlot()
		{
			ShipItem currentItem = Slot.currentItem;
			RR_Plugin.LogDebug("Withdrawing " + currentItem.name + " from inventory slot.");
			GoPntr.PickUpItem((PickupableItem)(object)currentItem);
			((MonoBehaviour)this).StartCoroutine(GrabItem(currentItem));
		}

		internal void SwapSlotToOpenInvSlot()
		{
			GPButtonInventorySlot val = ((IEnumerable<GPButtonInventorySlot>)GPButtonInventorySlot.inventorySlots).FirstOrDefault((Func<GPButtonInventorySlot, bool>)((GPButtonInventorySlot s) => (Object)(object)s.currentItem == (Object)null));
			Slot.currentItem.GetItemRigidbody().EnterInventorySlot(((Component)val).transform);
			val.currentItem = Slot.currentItem;
			Slot.currentItem = null;
		}
	}
	internal class ViewMap
	{
		public static string[] MapNames = new string[5] { "ocean map", "Al'Ankh map", "Emerald Archipelago map", "Aestrin map", "Fire Fish Lagoon map" };

		private static int _mapSlotIndex = 4;

		public static bool GetMapSlotIndex()
		{
			GPButtonInventorySlot val = ((IEnumerable<GPButtonInventorySlot>)GPButtonInventorySlot.inventorySlots).FirstOrDefault((Func<GPButtonInventorySlot, bool>)((GPButtonInventorySlot s) => Object.op_Implicit((Object)(object)s.currentItem) && MapNames.Contains(s.currentItem.name)));
			if (!Object.op_Implicit((Object)(object)val))
			{
				return false;
			}
			_mapSlotIndex = val.slotIndex;
			return true;
		}

		public static void ToggleMap()
		{
			GoPointer goPntr = SwapSlot.GoPntr;
			PickupableItem val = ((goPntr != null) ? goPntr.GetHeldItem() : null);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			string text = ((val == null) ? null : ((Component)val).GetComponent<ShipItem>()?.name);
			if (Object.op_Implicit((Object)(object)val) && MapNames.Contains(text))
			{
				RR_Plugin.LogDebug("Stowing map: " + text);
				GPButtonInventorySlot val2 = GPButtonInventorySlot.inventorySlots[_mapSlotIndex];
				((GoPointerButton)val2).OnActivate();
				((GoPointerButton)val2).OnItemClick(val);
				goPntr.GetHeldItem().OnDrop();
				goPntr.DropItem();
			}
			else
			{
				if (!GetMapSlotIndex())
				{
					return;
				}
				RR_Plugin.LogDebug("Displaying map: " + GPButtonInventorySlot.inventorySlots[_mapSlotIndex].currentItem.name);
				if (!Object.op_Implicit((Object)(object)val) || (!val.big && Configs.enableInventorySwap.Value))
				{
					GPButtonInventorySlot val3 = GPButtonInventorySlot.inventorySlots[_mapSlotIndex];
					if (!Object.op_Implicit((Object)(object)val))
					{
						((GoPointerButton)val3).OnActivate(goPntr);
					}
					else
					{
						((GoPointerButton)val3).OnItemClick(val);
					}
					ShipItemFoldable component = ((Component)goPntr.GetHeldItem()).GetComponent<ShipItemFoldable>();
					if (((ShipItem)component).amount > 0f)
					{
						component.InvokePrivateMethod("Unfold");
					}
				}
			}
		}
	}
	internal class FishingHookPatches
	{
		[HarmonyPatch(typeof(ShipItem))]
		private class ShipItemFishingHookPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("OnLoad")]
			public static void OnLoadRemoveDescription(ShipItem __instance)
			{
				if (Configs.removeItemHints.Value && __instance.sold && __instance is ShipItemFishingHook)
				{
					((GoPointerButton)__instance).description = "";
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("EnterBoat")]
			public static void EnterBoatRemoveDescription(ShipItem __instance)
			{
				if (Configs.removeItemHints.Value && __instance.sold && __instance is ShipItemFishingHook)
				{
					((GoPointerButton)__instance).description = "";
				}
			}
		}
	}
	internal class InventoryPatches
	{
		[HarmonyPatch(typeof(LookUI))]
		private class LookUIPatches
		{
			[HarmonyPrefix]
			[HarmonyPatch("RegisterPointer")]
			public static void GetPointer(GoPointer goPointer)
			{
				SwapSlot.GoPntr = goPointer;
			}

			[HarmonyPostfix]
			[HarmonyPatch("LateUpdate")]
			public static void ToggleQuickMap()
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (Configs.enableQuickMap.Value && !GameState.wasInSettingsMenu && Input.GetKeyDown(Configs.quickMapKey.Value))
				{
					ViewMap.ToggleMap();
				}
			}
		}

		[HarmonyPatch(typeof(GPButtonInventorySlot))]
		private class GPButtonInventorySlotPatches
		{
			private static bool swapSlotMade;

			[HarmonyPrefix]
			[HarmonyPatch("Awake")]
			public static void Awake(GPButtonInventorySlot __instance)
			{
				if (!swapSlotMade)
				{
					swapSlotMade = true;
					Transform parent = ((Component)__instance).transform.parent;
					Transform val = Object.Instantiate<Transform>(parent.GetChild(0), parent);
					((Object)val).name = "inventory_slot_swap";
					Object.Destroy((Object)(object)((Component)val).GetComponent<MeshFilter>());
					Object.Destroy((Object)(object)((Component)val).GetComponent<MeshRenderer>());
					Object.Destroy((Object)(object)((Component)val).GetComponent<SphereCollider>());
					Object.Destroy((Object)(object)((Component)val).GetComponent<GPButtonInventorySlot>());
					Object.Destroy((Object)(object)((Component)val).GetComponent<Outline>());
					((Component)val).gameObject.AddComponent<SwapSlot>();
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch("OnItemClick")]
			public static void OnItemClickSwapItems(PickupableItem heldItem, ShipItem ___currentItem, GPButtonInventorySlot __instance)
			{
				if (Configs.enableInventorySwap.Value && Object.op_Implicit((Object)(object)___currentItem))
				{
					SwapSlot.Instance.SwapItems(heldItem, __instance);
				}
			}
		}

		[HarmonyPatch(typeof(CrateInventoryUI))]
		public class CrateInventoryUIPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("LateUpdate")]
			public static void AddItemDescription(CrateInventoryButton[] ___buttons)
			{
				if (Configs.enableCrateItemDescription.Value)
				{
					foreach (CrateInventoryButton val in ___buttons)
					{
						((GoPointerButton)val).description = ((GoPointerButton)(val.GetPrivateField<ShipItem>("currentItem")?)).description ?? "";
					}
				}
			}
		}
	}
	internal class KnifePatches
	{
		[HarmonyPatch(typeof(ShipItemKnife))]
		private class ShipItemKnifePatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("OnAltActivate")]
			public static void KnifeCutContainer(ShipItemKnife __instance, ref bool ___animating, ref float ___heldRotationOffset, ref float ___cutTimer)
			{
				if (Configs.enableWoodFromContainers.Value && ((ShipItem)__instance).sold)
				{
					ShipItem pointedAtItem = ((PickupableItem)__instance).held.GetPointedAtItem();
					Good component = ((Component)pointedAtItem).gameObject.GetComponent<Good>();
					if (Object.op_Implicit((Object)(object)pointedAtItem) && pointedAtItem.sold && (Knife.WoodPiecesPerContainer.ContainsKey(pointedAtItem.name) || ((Object)(object)component != (Object)null && Knife.WoodPiecesPerContainer.ContainsKey(component.sizeDescription))))
					{
						___animating = true;
						___heldRotationOffset = 0f;
						___cutTimer = 0.25f;
						KnifeWood component2 = ((Component)__instance).GetComponent<KnifeWood>();
						component2.CutContainer(((Component)pointedAtItem).GetComponent<ShipItem>());
					}
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("OnLoad")]
			public static void OnLoadPatch(ShipItemKnife __instance)
			{
				if (Configs.removeItemHints.Value && ((ShipItem)__instance).sold)
				{
					((GoPointerButton)__instance).description = "";
				}
				((Component)__instance).gameObject.AddComponent<KnifeWood>();
			}
		}

		[HarmonyPatch(typeof(LookUI))]
		private class LookUIPatches
		{
			[HarmonyPrefix]
			[HarmonyPatch("ShowLookText")]
			public static bool AddKnifeControlsText(LookUI __instance, GoPointerButton button, GoPointer ___pointer, TextMesh ___textLicon, TextMesh ___textRIcon, ref bool ___showingIcon, TextMesh ___controlsText, TextMesh ___extraText)
			{
				//IL_0039: Unknown result type (might be due to invalid IL or missing references)
				if (!Configs.enableWoodFromContainers.Value)
				{
					return true;
				}
				___extraText.text = button.lookText;
				((Component)__instance).transform.position = ((Component)button).gameObject.transform.position;
				((Component)__instance).transform.LookAt(((Component)Camera.main).transform);
				((Component)___textLicon).gameObject.SetActive(false);
				((Component)___textRIcon).gameObject.SetActive(false);
				___showingIcon = false;
				Good component = ((Component)button).gameObject.GetComponent<Good>();
				ShipItem component2 = ((Component)button).gameObject.GetComponent<ShipItem>();
				if (Object.op_Implicit((Object)(object)___pointer.GetHeldItem()) && Object.op_Implicit((Object)(object)((Component)___pointer.GetHeldItem()).GetComponent<ShipItemKnife>()) && (((Object)(object)component2 != (Object)null && Knife.WoodPiecesPerContainer.ContainsKey(component2.name)) || ((Object)(object)component != (Object)null && Knife.WoodPiecesPerContainer.ContainsKey(component.sizeDescription))))
				{
					((Component)___textRIcon).gameObject.SetActive(true);
					___showingIcon = true;
					___controlsText.text = "\ncut";
					return false;
				}
				return true;
			}
		}
	}
	internal class LogBookPatches
	{
		[HarmonyPatch(typeof(MissionListUI))]
		private class MissionListUIPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("ToggleMenu")]
			public static void OpenLastOpenBookmark(MissionListUI __instance, bool ___UIActive)
			{
				if (Configs.enableLogbookLastSection.Value && ___UIActive)
				{
					__instance.SwitchMode((MissionListMode)_currentPage);
				}
			}
		}

		[HarmonyPatch(typeof(GPButtonLogMode))]
		private class GPButtonLogModePatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("OnActivate")]
			public static void GetLastActivatedBookmark(MissionListMode ___mode)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected I4, but got Unknown
				if (Configs.enableLogbookLastSection.Value)
				{
					_currentPage = (int)___mode;
				}
			}
		}

		private static int _currentPage;
	}
	internal class QuadrantPatches
	{
		[HarmonyPatch(typeof(ShipItemQuadrant))]
		private class ShipItemQuadrantPatches
		{
			private static bool _rotating;

			[HarmonyPrefix]
			[HarmonyPatch("OnAltActivate")]
			public static bool ReverseLook(ShipItemQuadrant __instance, bool ___inspecting, Transform ___rotatingParent, ref Quaternion ___initialRot)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				if (Input.GetKey((KeyCode)101) && !___inspecting && !_rotating)
				{
					((MonoBehaviour)__instance).StartCoroutine(Rotate180(___rotatingParent));
					___initialRot *= Quaternion.Euler(Vector3.up * 180f);
					return false;
				}
				return true;
			}

			private static IEnumerator Rotate180(Transform rotatingParent)
			{
				_rotating = true;
				Quaternion startRotation = rotatingParent.rotation;
				Quaternion rotation180 = Quaternion.AngleAxis(180f, Vector3.up);
				Quaternion targetRotation = startRotation * rotation180;
				float elapsedTime = 0f;
				while (elapsedTime < 0.3f)
				{
					float t = elapsedTime / 0.3f;
					t = Mathf.SmoothStep(0f, 1f, t);
					rotatingParent.rotation = Quaternion.Slerp(startRotation, targetRotation, t);
					elapsedTime += Time.deltaTime;
					yield return null;
				}
				rotatingParent.rotation = targetRotation;
				_rotating = false;
			}
		}
	}
	internal class SpyglassPatches
	{
		[HarmonyPatch(typeof(ShipItemSpyglass))]
		private static class ShipItemSpyglassPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("OnAltActivate")]
			public static void DisableItemReadingsActivate(ShipItemSpyglass __instance, float ___heldRotationOffset)
			{
				if (((ShipItem)__instance).sold && ___heldRotationOffset == -22f)
				{
					HeldAndUp = true;
				}
				else
				{
					HeldAndUp = false;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("OnPickup")]
			public static void DisableItemReadingsOnPickup(ShipItemSpyglass __instance, float ___heldRotationOffset)
			{
				if (((ShipItem)__instance).sold && ___heldRotationOffset == 0f)
				{
					HeldAndUp = true;
				}
				else
				{
					HeldAndUp = false;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("OnEnterInventory")]
			public static void EnableItemReadingsInventory()
			{
				HeldAndUp = false;
			}

			[HarmonyPostfix]
			[HarmonyPatch("OnDrop")]
			public static void EnableItemReadingsDrop()
			{
				HeldAndUp = false;
			}
		}

		internal static bool HeldAndUp { get; private set; }
	}
	[BepInPlugin("com.raddude.radrefinements", "RadRefinements", "1.10.0")]
	public class RR_Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.raddude.radrefinements";

		public const string PLUGIN_NAME = "RadRefinements";

		public const string PLUGIN_VERSION = "1.10.0";

		private static ManualLogSource _logger;

		internal static RR_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;
			Configs.InitializeConfigs();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.raddude.radrefinements");
		}
	}
	public static class CompassRose
	{
		private static readonly string[] Directions4 = new string[5] { "North", "East", "South", "West", "North" };

		private static readonly string[] Directions8 = new string[9] { "North", "Northeast", "East", "Southeast", "South", "Southwest", "West", "Northwest", "North" };

		private static readonly string[] Directions16 = new string[17]
		{
			"North", "North-northeast", "Northeast", "East-northeast", "East", "East-southeast", "Southeast", "South-southeast", "South", "South-southwest",
			"Southwest", "West-southwest", "West", "West-northwest", "Northwest", "North-northwest", "North"
		};

		private static readonly string[] Directions32 = new string[33]
		{
			"North", "North by east", "North-northeast", "Northeast by north", "Northeast", "Northeast by east", "East-northeast", "East by north", "East", "East by south",
			"East-southeast", "Southeast by east", "Southeast", "Southeast by south", "South-southeast", "South by east", "South", "South by west", "South-southwest", "Southwest by south",
			"Southwest", "Southwest by west", "West-southwest", "West by south", "West", "West by north", "West-northwest", "Northwest by west", "Northwest", "Northwest by north",
			"North-northwest", "North by west", "North"
		};

		private static readonly Dictionary<string, string> Abbreviations = BuildAbbreviations();

		private static Dictionary<string, string> BuildAbbreviations()
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			AddAbbreviations(dictionary, Directions4);
			AddAbbreviations(dictionary, Directions8);
			AddAbbreviations(dictionary, Directions16);
			AddAbbreviations(dictionary, Directions32);
			return dictionary;
		}

		private static void AddAbbreviations(Dictionary<string, string> abbreviations, string[] directions)
		{
			foreach (string text in directions)
			{
				if (!abbreviations.ContainsKey(text))
				{
					abbreviations[text] = Abbreviate(text);
				}
			}
		}

		private static string Abbreviate(string direction)
		{
			return direction.ToLower().Replace("north", "N").Replace("east", "E")
				.Replace("south", "S")
				.Replace("west", "W")
				.Replace("-", "")
				.Replace(" by ", "b");
		}

		public static string GetCardinalDir(float degrees, int precision)
		{
			switch (precision)
			{
			case 4:
			{
				int num4 = (int)Math.Round((double)degrees / 90.0) % 4;
				return Directions4[num4];
			}
			case 8:
			{
				int num3 = (int)Math.Round((double)degrees / 45.0) % 8;
				return Directions8[num3];
			}
			case 16:
			{
				int num2 = (int)Math.Round((double)degrees / 22.5) % 16;
				return Directions16[num2];
			}
			default:
			{
				int num = (int)Math.Round((double)degrees / 11.25) % 32;
				return Directions32[num];
			}
			}
		}

		public static string GetAbbreviatedDir(float degrees, int precision)
		{
			string cardinalDir = GetCardinalDir(degrees, precision);
			string value;
			return Abbreviations.TryGetValue(cardinalDir, out value) ? value : Abbreviate(cardinalDir);
		}
	}
	internal class Configs
	{
		internal static ConfigEntry<bool> enableInventorySwap;

		internal static ConfigEntry<bool> enableQuickMap;

		internal static ConfigEntry<KeyCode> quickMapKey;

		internal static ConfigEntry<bool> enableCrateItemDescription;

		internal static ConfigEntry<Color> readingTextColor;

		internal static ConfigEntry<Color> compassTextColor;

		internal static ConfigEntry<Color> chipLogTextColor;

		internal static ConfigEntry<Color> clockTextColor;

		internal static ConfigEntry<Color> quadrantTextColor;

		internal static ConfigEntry<Color> sunCompassTextColor;

		internal static ConfigEntry<Color> barometerTextColor;

		internal static ConfigEntry<Color> thermometerTextColor;

		internal static ConfigEntry<Color> hygrometerTextColor;

		internal static ConfigEntry<Color> inclinometerTextColor;

		internal static ConfigEntry<Color> windCompassTextColor;

		internal static ConfigEntry<Color> anemometerTextColor;

		internal static ConfigEntry<Color> weathervaneTextColor;

		internal static ConfigEntry<bool> enableQuadrantText;

		internal static ConfigEntry<int> quadrantDecimalPlaces;

		internal static ConfigEntry<bool> enableCompassReadingHeld;

		internal static ConfigEntry<bool> enableCompassDegreesText;

		internal static ConfigEntry<bool> enableCompassCardinalText;

		internal static ConfigEntry<int> compassCardinalPrecision;

		internal static ConfigEntry<float> compassViewDist;

		internal static ConfigEntry<int> compassDecimalPlaces;

		internal static ConfigEntry<bool> enableSunCompassText;

		internal static ConfigEntry<int> sunCompassDecimalPlaces;

		internal static ConfigEntry<bool> enableClockGlobalText;

		internal static ConfigEntry<bool> enableClockLocalText;

		internal static ConfigEntry<float> clockViewDist;

		internal static ConfigEntry<bool> enableChipLogText;

		internal static ConfigEntry<float> chipLogViewDist;

		internal static ConfigEntry<int> chipLogDecimalPlaces;

		internal static ConfigEntry<bool> enableBarometerText;

		internal static ConfigEntry<float> barometerViewDist;

		internal static ConfigEntry<int> barometerDecimalPlaces;

		internal static ConfigEntry<bool> enableThermometerText;

		internal static ConfigEntry<float> thermometerViewDist;

		internal static ConfigEntry<int> thermometerDecimalPlaces;

		internal static ConfigEntry<bool> enableHygrometerText;

		internal static ConfigEntry<float> hygrometerViewDist;

		internal static ConfigEntry<int> hygrometerDecimalPlaces;

		internal static ConfigEntry<bool> enableInclinometerText;

		internal static ConfigEntry<float> inclinometerViewDist;

		internal static ConfigEntry<bool> negativeInclinometerAngles;

		internal static ConfigEntry<int> inclinometerDecimalPlaces;

		internal static ConfigEntry<bool> enableWindCompassDegreesText;

		internal static ConfigEntry<bool> enableWindCompassCardinalText;

		internal static ConfigEntry<int> windCompassCardinalPrecision;

		internal static ConfigEntry<int> windCompassDecimalPlaces;

		internal static ConfigEntry<bool> enableWindCompassPointOfSailText;

		internal static ConfigEntry<bool> enableWindCompassPointOfSailDegrees;

		internal static ConfigEntry<int> windCompassPointOfSailDecimalPlaces;

		internal static ConfigEntry<bool> enableAnemometerText;

		internal static ConfigEntry<float> anemometerViewDist;

		internal static ConfigEntry<int> anemometerDecimalPlaces;

		internal static ConfigEntry<bool> enableWeathervaneDegreesText;

		internal static ConfigEntry<bool> enableWeathervanePointOfSailText;

		internal static ConfigEntry<float> weathervaneViewDist;

		internal static ConfigEntry<int> weathervaneDecimalPlaces;

		internal static ConfigEntry<string> barometerUnits;

		internal static ConfigEntry<string> thermometerUnits;

		internal static ConfigEntry<bool> enableWoodFromContainers;

		internal static ConfigEntry<bool> enableCrateInvCountText;

		internal static ConfigEntry<KeyCode> crateInvCountTextKey;

		internal static ConfigEntry<bool> removeItemHints;

		internal static ConfigEntry<bool> enableElixirColors;

		internal static ConfigEntry<bool> enableLogbookLastSection;

		internal static ConfigEntry<bool> enableSingleClickSmoking;

		internal static ConfigEntry<bool> enableBlueTobacco;

		internal static ConfigEntry<int> bluePotencyMult;

		internal static ConfigEntry<bool> continualRow;

		internal static ConfigEntry<float> rowingNeedsMult;

		internal static ConfigEntry<float> runningNeedsMult;

		internal static ConfigEntry<float> fastSwimmingNeedsMult;

		internal static ConfigEntry<float> bilgePumpNeedsMult;

		internal static void InitializeConfigs()
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: 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_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Expected O, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Expected O, but got Unknown
			//IL_0438: Unknown result type (might be due to invalid IL or missing references)
			//IL_0442: Expected O, but got Unknown
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Expected O, but got Unknown
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fe: Expected O, but got Unknown
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Expected O, but got Unknown
			//IL_05c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Expected O, but got Unknown
			//IL_0631: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Expected O, but got Unknown
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Expected O, but got Unknown
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c1: Expected O, but got Unknown
			//IL_0715: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Expected O, but got Unknown
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0794: Expected O, but got Unknown
			//IL_07de: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e8: Expected O, but got Unknown
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0834: Expected O, but got Unknown
			//IL_0969: Unknown result type (might be due to invalid IL or missing references)
			//IL_0973: Expected O, but got Unknown
			//IL_09a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ab: Expected O, but got Unknown
			//IL_09f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fa: Expected O, but got Unknown
			//IL_0a3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a49: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)RR_Plugin.Instance).Config;
			enableInventorySwap = config.Bind<bool>("Inventory Settings", "Enable inventory swap", true, "Allows you to swap the item you are holding with the item in your selected inventory slot.");
			enableQuickMap = config.Bind<bool>("Inventory Settings", "Enable quick map", true, "On quick map key press, causes your character to hold the leftmost map that is in your inventory slots or to put it back in the inventory slot it came from.");
			quickMapKey = config.Bind<KeyCode>("Inventory Settings", "Quick map key", (KeyCode)109, "Key that retrieves or stows your map when pressed");
			enableCrateItemDescription = config.Bind<bool>("Inventory Settings", "Enable item description in crates", true, (ConfigDescription)null);
			readingTextColor = config.Bind<Color>("Item Text Settings", "Reading text color", new Color(0.859f, 0.839f, 0.788f, 0.533f), "Changing this sets all individual instrument colors. Adjust them individually afterward as you like.");
			compassTextColor = config.Bind<Color>("Item Text Colors", "Compass text color", readingTextColor.Value, (ConfigDescription)null);
			chipLogTextColor = config.Bind<Color>("Item Text Colors", "Chip log text color", readingTextColor.Value, (ConfigDescription)null);
			clockTextColor = config.Bind<Color>("Item Text Colors", "Clock text color", readingTextColor.Value, (ConfigDescription)null);
			quadrantTextColor = config.Bind<Color>("Item Text Colors", "Quadrant text color", readingTextColor.Value, (ConfigDescription)null);
			sunCompassTextColor = config.Bind<Color>("Item Text Colors", "Sun compass text color", readingTextColor.Value, (ConfigDescription)null);
			barometerTextColor = config.Bind<Color>("Item Text Colors", "Barometer text color", readingTextColor.Value, (ConfigDescription)null);
			thermometerTextColor = config.Bind<Color>("Item Text Colors", "Thermometer text color", readingTextColor.Value, (ConfigDescription)null);
			hygrometerTextColor = config.Bind<Color>("Item Text Colors", "Hygrometer text color", readingTextColor.Value, (ConfigDescription)null);
			inclinometerTextColor = config.Bind<Color>("Item Text Colors", "Inclinometer text color", readingTextColor.Value, (ConfigDescription)null);
			windCompassTextColor = config.Bind<Color>("Item Text Colors", "Wind compass text color", readingTextColor.Value, (ConfigDescription)null);
			anemometerTextColor = config.Bind<Color>("Item Text Colors", "Anemometer text color", readingTextColor.Value, (ConfigDescription)null);
			weathervaneTextColor = config.Bind<Color>("Item Text Colors", "Weathervane text color", readingTextColor.Value, (ConfigDescription)null);
			readingTextColor.SettingChanged += delegate
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: 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)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: 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_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: 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_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				Color value = readingTextColor.Value;
				compassTextColor.Value = value;
				chipLogTextColor.Value = value;
				clockTextColor.Value = value;
				quadrantTextColor.Value = value;
				sunCompassTextColor.Value = value;
				barometerTextColor.Value = value;
				thermometerTextColor.Value = value;
				hygrometerTextColor.Value = value;
				inclinometerTextColor.Value = value;
				windCompassTextColor.Value = value;
				anemometerTextColor.Value = value;
				weathervaneTextColor.Value = value;
			};
			enableQuadrantText = config.Bind<bool>("Enable Item Texts", "Quadrant reading text", true, (ConfigDescription)null);
			quadrantDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for quadrant", 2, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableCompassReadingHeld = config.Bind<bool>("Item Text Settings", "Compass reading text while held", false, (ConfigDescription)null);
			enableCompassDegreesText = config.Bind<bool>("Enable Item Texts", "Compass reading degrees text", true, (ConfigDescription)null);
			enableCompassCardinalText = config.Bind<bool>("Enable Item Texts", "Compass reading cardinal text", true, (ConfigDescription)null);
			compassCardinalPrecision = config.Bind<int>("Item Text Settings", "Number of compass ordinal directions", 16, new ConfigDescription("Number of ordinal directions given in the compass reading.", (AcceptableValueBase)(object)new AcceptableValueList<int>(new int[4] { 4, 8, 16, 32 }), Array.Empty<object>()));
			compassViewDist = config.Bind<float>("Item Text Settings", "Compass viewable distance", 3f, (ConfigDescription)null);
			compassDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for compass", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableSunCompassText = config.Bind<bool>("Enable Item Texts", "Sun compass reading text", true, (ConfigDescription)null);
			sunCompassDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for sun compass", 1, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableClockGlobalText = config.Bind<bool>("Enable Item Texts", "Clock global time text", true, (ConfigDescription)null);
			enableClockLocalText = config.Bind<bool>("Enable Item Texts", "Clock local time text", true, (ConfigDescription)null);
			clockViewDist = config.Bind<float>("Item Text Settings", "Clock viewable distance", 5f, (ConfigDescription)null);
			enableChipLogText = config.Bind<bool>("Enable Item Texts", "Chip log reading text", true, (ConfigDescription)null);
			chipLogViewDist = config.Bind<float>("Item Text Settings", "Chip log viewable distance", 5f, (ConfigDescription)null);
			chipLogDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for chip log", 1, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableBarometerText = config.Bind<bool>("Enable Item Texts", "Barometer reading text", true, (ConfigDescription)null);
			barometerViewDist = config.Bind<float>("Item Text Settings", "Barometer viewable distance", 5f, (ConfigDescription)null);
			barometerDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for barometer", 1, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableThermometerText = config.Bind<bool>("Enable Item Texts", "Thermometer reading text", true, (ConfigDescription)null);
			thermometerViewDist = config.Bind<float>("Item Text Settings", "Thermometer viewable distance", 5f, (ConfigDescription)null);
			thermometerDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for thermometer", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableHygrometerText = config.Bind<bool>("Enable Item Texts", "Hygrometer reading text", true, (ConfigDescription)null);
			hygrometerViewDist = config.Bind<float>("Item Text Settings", "Hygrometer viewable distance", 5f, (ConfigDescription)null);
			hygrometerDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for hygrometer", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableInclinometerText = config.Bind<bool>("Enable Item Texts", "Inclinometer reading text", true, (ConfigDescription)null);
			inclinometerViewDist = config.Bind<float>("Item Text Settings", "Inclinometer viewable distance", 5f, (ConfigDescription)null);
			negativeInclinometerAngles = config.Bind<bool>("Item Text Settings", "Inclinometer shows negative angles", false, (ConfigDescription)null);
			inclinometerDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for inclinometer", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableWindCompassDegreesText = config.Bind<bool>("Enable Item Texts", "Wind compass reading degrees text", true, (ConfigDescription)null);
			enableWindCompassCardinalText = config.Bind<bool>("Enable Item Texts", "Wind compass reading cardinal text", true, (ConfigDescription)null);
			windCompassCardinalPrecision = config.Bind<int>("Item Text Settings", "Number of wind compass ordinal directions", 16, new ConfigDescription("Number of ordinal directions given in the wind compass reading.", (AcceptableValueBase)(object)new AcceptableValueList<int>(new int[4] { 4, 8, 16, 32 }), Array.Empty<object>()));
			windCompassDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for wind compass", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableWindCompassPointOfSailText = config.Bind<bool>("Enable Item Texts", "Wind compass point of sail reading text", false, (ConfigDescription)null);
			enableWindCompassPointOfSailDegrees = config.Bind<bool>("Enable Item Texts", "Wind compass point of sail degrees reading text", false, (ConfigDescription)null);
			windCompassPointOfSailDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for wind compass point of sail", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableAnemometerText = config.Bind<bool>("Enable Item Texts", "Anemometer reading text", true, (ConfigDescription)null);
			anemometerViewDist = config.Bind<float>("Item Text Settings", "Anemometer viewable distance", 5f, (ConfigDescription)null);
			anemometerDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for anemometer", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			enableWeathervaneDegreesText = config.Bind<bool>("Enable Item Texts", "Weathervane degrees reading text", true, (ConfigDescription)null);
			enableWeathervanePointOfSailText = config.Bind<bool>("Enable Item Texts", "Weathervane point of sail reading text", true, (ConfigDescription)null);
			weathervaneViewDist = config.Bind<float>("Item Text Settings", "Weathervane viewable distance", 5f, (ConfigDescription)null);
			weathervaneDecimalPlaces = config.Bind<int>("Item Text Settings", "Number of decimal places for weathervane", 0, new ConfigDescription("Number of digits after the decimal.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 3), Array.Empty<object>()));
			barometerUnits = config.Bind<string>("Item Text Settings", "Barometer units", "inHg", new ConfigDescription("The units used in the barometer readings.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[4] { "inHg", "hPa", "mbar", "atm" }), Array.Empty<object>()));
			thermometerUnits = config.Bind<string>("Item Text Settings", "Thermometer units", "°F", new ConfigDescription("The units used in the thermometer readings.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "°F", "°C", "K" }), Array.Empty<object>()));
			enableWoodFromContainers = config.Bind<bool>("Other Settings", "Enable firewood from breaking containers", true, "Allows you to get firewood by breaking containers with a knife.");
			enableCrateInvCountText = config.Bind<bool>("Other Settings", "Enable crate total count text", true, "Enables the look text that shows the number of items in a crate.");
			crateInvCountTextKey = config.Bind<KeyCode>("Other Settings", "Crate inventory count text key", (KeyCode)101, "Crate inventory count text will show when holding this key.");
			removeItemHints = config.Bind<bool>("Other Settings", "Remove item hints", false, "Removes the hint text that appears when you look at a common items (e.g., knife, fishing hook).");
			enableElixirColors = config.Bind<bool>("Other Settings", "Enable elixir colors", true, "Makes the bottles for Energy Elixir blue and Snake Oil brown.");
			enableLogbookLastSection = config.Bind<bool>("Other Settings", "Logbook remembers last section", true, "Makes the logbook remember the last section you had open so when you reopen it, it opens to that section.");
			enableSingleClickSmoking = config.Bind<bool>("Other Settings", "Enable single click smoking", false, "Allows you to smoke a pipe with a single click instead of having to hold the button down.");
			enableBlueTobacco = config.Bind<bool>("Other Settings", "Increase blue tobacco potency", true, (ConfigDescription)null);
			bluePotencyMult = config.Bind<int>("Other Settings", "Blue tobacco potency multiplier", 6, "The potency multiplier of blue tobacco as compared to green tobacco.");
			continualRow = config.Bind<bool>("Other Settings", "Row continually", true, (ConfigDescription)null);
			rowingNeedsMult = config.Bind<float>("Other Settings", "Rowing needs reduction", 0f, new ConfigDescription("The multiplier for how much to reduce food and water consumption while rowing.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			runningNeedsMult = config.Bind<float>("Other Settings", "Running needs reduction", 0f, new ConfigDescription("The multiplier for how much to reduce water consumption while running.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			runningNeedsMult.SettingChanged += PlayerNeedsPatches.MovementNeedsPatches.UpdateMovementNeeds;
			fastSwimmingNeedsMult = config.Bind<float>("Other Settings", "Fast swimming needs reduction", 0f, new ConfigDescription("The multiplier for how much to reduce food and water consumption while swimming fast.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			fastSwimmingNeedsMult.SettingChanged += PlayerNeedsPatches.MovementNeedsPatches.UpdateMovementNeeds;
			bilgePumpNeedsMult = config.Bind<float>("Other Settings", "Bilge pump needs reduction", 0f, new ConfigDescription("The multiplier for how much to reduce the food and water consumption while using the bilge pump.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), 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);
		}

		public static void SetPrivateField<T>(string field, object value)
		{
			Traverse.Create(typeof(T)).Field(field).SetValue(value);
		}

		public static object InvokePrivateMethod(this object obj, string method, params object[] parameters)
		{
			return AccessTools.Method(obj.GetType(), method, (Type[])null, (Type[])null).Invoke(obj, parameters);
		}

		public static T InvokePrivateMethod<T>(this object obj, string method, params object[] parameters)
		{
			return (T)obj.InvokePrivateMethod(method, parameters);
		}

		public static object InvokePrivateMethod<T>(string method, params object[] parameters)
		{
			return AccessTools.Method(typeof(T), method, (Type[])null, (Type[])null).Invoke(null, parameters);
		}

		public static T InvokePrivateMethod<T, E>(string method, params object[] parameters)
		{
			return (T)InvokePrivateMethod<E>(method, parameters);
		}
	}
}
namespace RadRefinements.Patches
{
	internal class MapPatches
	{
		[HarmonyPatch(typeof(ShipItemFoldable))]
		private class ShipItemFoldablePatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("Fold")]
			public static void Postfix(ShipItemFoldable __instance)
			{
				((GoPointerButton)__instance).description = ((ShipItem)__instance).name;
			}

			[HarmonyPostfix]
			[HarmonyPatch("Unfold")]
			public static void RemoveName(ShipItemFoldable __instance)
			{
				((GoPointerButton)__instance).description = string.Empty;
			}
		}
	}
	internal class OarPatches
	{
		[HarmonyPatch(typeof(ShipItemOar), "OnAltHeld")]
		private class ShipItemOarPatches
		{
			public static void Postfix(ShipItemOar __instance, ref bool ___isHoldingButton, bool ___isOverWater, ref float ___rowProgress, ref bool ___isRowing)
			{
				//IL_006f: 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_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				if (!Configs.continualRow.Value)
				{
					return;
				}
				___isHoldingButton = true;
				if (Object.op_Implicit((Object)(object)((PickupableItem)__instance).held) && ___isOverWater && Object.op_Implicit((Object)(object)GameState.currentBoat))
				{
					if (___rowProgress <= 1f)
					{
						___isRowing = true;
						___rowProgress += Time.deltaTime;
						((Component)GameState.currentBoat.parent).GetComponent<Rigidbody>().AddForceAtPosition(__instance.waterPos.forward * (0f - __instance.rowForce) * Time.deltaTime, __instance.waterPos.position);
					}
					else
					{
						___isRowing = false;
						___rowProgress = 0f;
					}
				}
			}
		}
	}
	internal class CratePatches
	{
		[HarmonyPatch(typeof(ShipItemCrate))]
		private class ShipItemCratePatches
		{
			[HarmonyPostfix]
			[HarmonyPatch("UpdateLookText")]
			public static void AddNumItemsText(ShipItemCrate __instance, Good ___goodC, CrateInventory ___crateInventory)
			{
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				if (Configs.enableCrateInvCountText.Value && ((ShipItem)__instance).sold && !(((ShipItem)__instance).amount > 0f) && Object.op_Implicit((Object)(object)___crateInventory) && (!Object.op_Implicit((Object)(object)___goodC) || ___goodC.GetMissionIndex() <= -1))
				{
					string text = string.Empty;
					if (Input.GetKey(Configs.crateInvCountTextKey.Value))
					{
						text = Crate.GetCrateInventory(__instance);
					}
					((GoPointerButton)__instance).lookText = (Utility.IsNullOrWhiteSpace(text) ? $"{((GoPointerButton)__instance).lookText}\n{___crateInventory.containedItems.Count} items" : text);
				}
			}
		}
	}
	internal class ElixirPatches
	{
		[HarmonyPatch(typeof(ShipItem), "Awake")]
		private static class ShipItemPatch
		{
			private static readonly Color32 snakeOilColor = new Color32(byte.MaxValue, byte.MaxValue, (byte)0, byte.MaxValue);

			private static readonly Color32 energyElixirColor = new Color32((byte)0, byte.MaxValue, byte.MaxValue, byte.MaxValue);

			[HarmonyPostfix]
			public static void Postfix(ShipItem __instance)
			{
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				if (Configs.enableElixirColors.Value && __instance is ShipItemElixir)
				{
					MeshRenderer component = ((Component)__instance).GetComponent<MeshRenderer>();
					if (__instance.name == "snake oil")
					{
						((Renderer)component).materials[0].color = Color32.op_Implicit(snakeOilColor);
					}
					else if (__instance.name == "energy elixir")
					{
						((Renderer)component).materials[0].color = Color32.op_Implicit(energyElixirColor);
					}
				}
			}
		}
	}
}