Decompiled source of VBQOL v1.2.2

VBQOL.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using ServerSync;
using Steamworks;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: <ec74b817-87f0-424a-8b7d-4dddd7805b72>RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[<325e5d2a-1e76-4ea7-9145-f16cff94a4a8>Embedded]
	internal sealed class <325e5d2a-1e76-4ea7-9145-f16cff94a4a8>EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[<325e5d2a-1e76-4ea7-9145-f16cff94a4a8>Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	internal sealed class <ec74b817-87f0-424a-8b7d-4dddd7805b72>RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public <ec74b817-87f0-424a-8b7d-4dddd7805b72>RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace VBQOL
{
	public class VB_WardPatch
	{
		[HarmonyPatch(typeof(Pickable), "Interact")]
		internal static class PickableInteract_Patch
		{
			private static bool Prefix(Pickable __instance, ref bool repeat)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Pickable), "GetHoverText")]
		internal static class PickableHover_Patch
		{
			private static string Postfix(string __result, Pickable __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return Localization.instance.Localize(__instance.GetHoverName() + "\n$piece_noaccess");
				}
				return __result;
			}
		}

		[HarmonyPatch(typeof(ItemDrop), "Interact")]
		internal static class ItemDropInteract_Patch
		{
			private static bool Prefix(ItemDrop __instance, ref bool repeat)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ItemDrop), "GetHoverText")]
		internal static class ItemDropHover_Patch
		{
			private static string Postfix(string __result, ItemDrop __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return Localization.instance.Localize(__instance.GetHoverName() + "\n$piece_noaccess");
				}
				return __result;
			}
		}

		[HarmonyPatch(typeof(Beehive), "Interact")]
		internal static class BeehiveInteract_Patch
		{
			private static bool Prefix(Beehive __instance, ref bool repeat)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Beehive), "GetHoverText")]
		internal static class BeehiveHover_Patch
		{
			private static string Postfix(string __result, Beehive __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return Localization.instance.Localize(__instance.GetHoverName() + "\n$piece_noaccess");
				}
				return __result;
			}
		}

		[HarmonyPatch(typeof(ShipControlls), "Interact")]
		internal static class ShipControllsInteract_Patch
		{
			private static bool Prefix(ShipControlls __instance, ref bool repeat)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ShipControlls), "GetHoverText")]
		internal static class ShipControllsHover_Patch
		{
			private static string Postfix(string __result, ShipControlls __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return Localization.instance.Localize(__instance.GetHoverName() + "\n$piece_noaccess");
				}
				return __result;
			}
		}

		[HarmonyPatch(typeof(Sign), "Interact")]
		internal static class SignInteract_Patch
		{
			private static bool Prefix(Sign __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Sign), "GetHoverText")]
		internal static class SignHover_Patch
		{
			private static string Postfix(string __result, Sign __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return Localization.instance.Localize(__instance.GetHoverName() + "\n$piece_noaccess");
				}
				return "\"" + __instance.GetText() + "\"\n" + Localization.instance.Localize(__instance.m_name + "\n[<color=#FFFF00><b>$KEY_Use</b></color>] $piece_use");
			}
		}

		[HarmonyPatch(typeof(Container), "Interact")]
		internal static class ContainerInteract_Patch
		{
			private static bool Prefix(Container __instance, bool hold)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(Container), "GetHoverText")]
		internal static class ContainerHover_Patch
		{
			private static string Postfix(string __result, Container __instance)
			{
				if (PrivateArea.m_allAreas.Any((PrivateArea x) => x.IsEnabled() && x.IsInside(((Component)__instance).transform.position, 0f) && !PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)))
				{
					return Localization.instance.Localize(__instance.GetHoverName() + "\n$piece_noaccess");
				}
				return __result;
			}
		}
	}
	public class VB_AshLandsFix
	{
		public static float maxTtl = 30f;

		[HarmonyPatch(typeof(SEMan), "Update")]
		[HarmonyPostfix]
		public static void PatchUpdate(SEMan __instance)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Invalid comparison between Unknown and I4
			StatusEffect val = __instance.GetStatusEffects().Find((StatusEffect x) => ((Object)x).name == "Wet");
			if (Object.op_Implicit((Object)(object)val) && (int)WorldGenerator.instance.GetBiome(((Component)__instance.m_character).transform.position) == 32 && val.m_ttl > maxTtl)
			{
				val.m_ttl -= maxTtl / 5f;
			}
		}
	}
	public class VB_CraftingStationLevelRange
	{
		[HarmonyPatch(typeof(CraftingStation), "UpdateKnownStationsInRange")]
		private static class UpdateKnownStationsInRange_Patch
		{
			private static void Postfix(Player player)
			{
				foreach (CraftingStation item in (List<CraftingStation>)AccessTools.Field(typeof(CraftingStation), "m_allStations").GetValue(null))
				{
					if (item.m_name == "$piece_stonecutter")
					{
						ChangeChildStationRange(item);
					}
				}
			}
		}

		private static int stationAmountIncrease = 4;

		private static int stationDefaultRange = 20;

		private static double stationSearchRange = 50.0;

		public static (bool, CraftingStation) IsParentWorkbenchInRange(CraftingStation station, string workbenchType, float searchRange)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			CraftingStation val = CraftingStation.FindClosestStationInRange(workbenchType, ((Component)station).transform.position, searchRange);
			if ((Object)(object)val == (Object)null)
			{
				return (false, val);
			}
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(((Component)val).transform.position.x, ((Component)val).transform.position.z);
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(((Component)station).transform.position.x, ((Component)station).transform.position.z);
			if (Vector2.Distance(val2, val3) <= val.m_rangeBuild)
			{
				return (true, val);
			}
			return (false, val);
		}

		public static void ChangeStationRange(CraftingStation station, float newRange)
		{
			if (station.m_rangeBuild != newRange)
			{
				CraftingStation component = ((Component)((Component)station).GetComponent<ZNetView>()).GetComponent<CraftingStation>();
				component.m_rangeBuild = newRange;
				component.m_areaMarker.GetComponent<CircleProjector>().m_radius = newRange;
				component.m_areaMarker.GetComponent<CircleProjector>().m_nrOfSegments = (int)Math.Ceiling(Math.Max(5f, 4f * newRange));
				VBQOL.Logger.LogInfo((object)$"{station.m_name} ({((Object)station).GetInstanceID()}) новый радиус {newRange} ");
			}
		}

		public static void ChangeChildStationRange(CraftingStation station)
		{
			var (flag, val) = IsParentWorkbenchInRange(station, "$piece_workbench", (float)stationSearchRange);
			if (!flag)
			{
				ChangeStationRange(station, stationDefaultRange);
			}
			if (flag && val.GetLevel(true) > 1)
			{
				float newRange = (float)stationDefaultRange + (float)stationAmountIncrease * (float)(val.GetLevel(true) - 1);
				ChangeStationRange(station, newRange);
			}
			else if (flag && val.GetLevel(true) == 1)
			{
				ChangeStationRange(station, stationDefaultRange);
			}
		}
	}
	public class VB_FramePerSecondPlus
	{
		[HarmonyPatch(typeof(ClutterSystem), "Awake")]
		private static class ClutterSystem_Awake_Patch
		{
			private static void Prefix(ClutterSystem __instance)
			{
				__instance.m_grassPatchSize = 15f;
			}
		}

		[HarmonyPatch(typeof(Smoke), "CustomUpdate")]
		private class SlowUpdaterFix
		{
			private static bool Prefix(Smoke __instance, float deltaTime)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				__instance.m_time += deltaTime;
				float num = 1f - Mathf.Clamp01(__instance.m_time / __instance.m_ttl);
				__instance.m_body.mass = num * num;
				Vector3 velocity = __instance.m_body.velocity;
				Vector3 val = __instance.m_vel - velocity;
				__instance.m_body.AddForce(val * __instance.m_force * deltaTime, (ForceMode)2);
				if (__instance.m_fadeTimer >= 0f)
				{
					__instance.m_fadeTimer += deltaTime;
					if (__instance.m_fadeTimer >= __instance.m_fadetime)
					{
						Object.Destroy((Object)(object)((Component)__instance).gameObject);
					}
				}
				if (__instance.m_time <= 1f || __instance.m_fadeTimer > 0f)
				{
					Color color = __instance.m_propertyBlock.GetColor(Smoke.m_colorProp);
					color.a = __instance.m_alpha;
					__instance.m_propertyBlock.SetColor(Smoke.m_colorProp, color);
					((Renderer)__instance.m_mr).SetPropertyBlock(__instance.m_propertyBlock);
				}
				return false;
			}
		}
	}
	public class VB_AddAllFuel
	{
		[HarmonyPatch(typeof(Fireplace))]
		public static class FireplacePatch
		{
			[HarmonyPrefix]
			[HarmonyPatch("Interact")]
			public static bool FireplaceInteractPrefix(ref Fireplace __instance, Humanoid user, bool hold, bool alt, ref bool __result)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				bool flag = !Input.GetKey(AFModifierKeyConfig.Value);
				__result = false;
				if (hold)
				{
					return false;
				}
				if (!__instance.m_nview.HasOwner())
				{
					__instance.m_nview.ClaimOwnership();
				}
				string name = __instance.m_fuelItem.m_itemData.m_shared.m_name;
				ZLog.Log((object)("Found fuel " + name));
				float num = Mathf.CeilToInt(__instance.m_nview.GetZDO().GetFloat("fuel", 0f));
				if (num > __instance.m_maxFuel - 1f)
				{
					((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_cantaddmore", new string[1] { name }), 0, (Sprite)null);
					return false;
				}
				ZLog.Log((object)("Checking Inventory for fuel " + name));
				Inventory inventory = user.GetInventory();
				ItemData val = ((inventory != null) ? inventory.GetItem(name, -1, false) : null);
				if (val == null)
				{
					if (flag)
					{
						return true;
					}
					((Character)user).Message((MessageType)2, "$msg_outof " + name, 0, (Sprite)null);
					return false;
				}
				((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_fireadding", new string[1] { name }), 0, (Sprite)null);
				int val2 = (int)(__instance.m_maxFuel - num);
				int num2 = 1;
				if (!flag)
				{
					num2 = Math.Min(val.m_stack, val2);
				}
				user.GetInventory().RemoveItem(val, num2);
				for (int i = 0; i < num2; i++)
				{
					__instance.m_nview.InvokeRPC("RPC_AddFuel", Array.Empty<object>());
				}
				__result = true;
				return false;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Fireplace), "GetHoverText")]
			public static string AddFuel_FirePlaceGetHoverText_Patch(string __result, Fireplace __instance)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				string text = __result;
				KeyCode value = AFModifierKeyConfig.Value;
				string text2 = ((object)(KeyCode)(ref value)).ToString();
				string text3 = ((object)(KeyCode)(ref AFModifierKeyUseConfig)).ToString();
				if ((Object)(object)__instance == (Object)null)
				{
					return text;
				}
				if (!__instance.IsBurning())
				{
					return text;
				}
				if (__instance.m_wet)
				{
					return text;
				}
				return text + "\n[<color=yellow><b>" + text2 + "+" + text3 + "</b></color>] " + AFTextConfig.Value;
			}

			public static void RPC_AddFuelAmount(Fireplace instance, ZNetView m_nview, float count)
			{
				//IL_005b: 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)
				if (m_nview.IsOwner())
				{
					float @float = m_nview.GetZDO().GetFloat("fuel", 0f);
					float num = Mathf.Clamp(@float + count, 0f, instance.m_maxFuel);
					m_nview.GetZDO().Set("fuel", num);
					instance.m_fuelAddedEffects.Create(((Component)instance).transform.position, ((Component)instance).transform.rotation, (Transform)null, 1f, -1);
					ZLog.Log((object)$"Added fuel * {count}");
					Traverse.Create((object)instance).Method("UpdateState", Array.Empty<object>()).GetValue();
				}
			}
		}

		[HarmonyPatch(typeof(Smelter))]
		public static class SmelterPatch
		{
			[HarmonyPrefix]
			[HarmonyPatch("OnAddOre")]
			public static bool SmelterOnAddOrePrefix(ref Smelter __instance, ref Switch sw, ref Humanoid user, ItemData item, ref bool __result)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				bool flag = !Input.GetKey(AFModifierKeyConfig.Value);
				int value = Traverse.Create((object)__instance).Method("GetQueueSize", Array.Empty<object>()).GetValue<int>();
				if (value >= __instance.m_maxOre)
				{
					((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null);
					return false;
				}
				if (item == null)
				{
					item = FindCookableItem(__instance, user.GetInventory(), flag);
				}
				if (item == null)
				{
					if (flag)
					{
						return true;
					}
					((Character)user).Message((MessageType)2, "$msg_noprocessableitems", 0, (Sprite)null);
					return false;
				}
				if (!Traverse.Create((object)__instance).Method("IsItemAllowed", new object[1] { ((Object)item.m_dropPrefab).name }).GetValue<bool>())
				{
					((Character)user).Message((MessageType)2, "$msg_wontwork", 0, (Sprite)null);
					return false;
				}
				((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null);
				int val = __instance.m_maxOre - value;
				int num = 1;
				if (!flag)
				{
					num = Math.Min(item.m_stack, val);
				}
				user.GetInventory().RemoveItem(item, num);
				for (int i = 0; i < num; i++)
				{
					__instance.m_nview.InvokeRPC("RPC_AddOre", new object[1] { ((Object)item.m_dropPrefab).name });
				}
				__result = true;
				return false;
			}

			[HarmonyPrefix]
			[HarmonyPatch("OnAddFuel")]
			public static bool Prefix(ref Smelter __instance, ref bool __result, Switch sw, Humanoid user, ItemData item)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				bool flag = !Input.GetKey(AFModifierKeyConfig.Value);
				string name = __instance.m_fuelItem.m_itemData.m_shared.m_name;
				if (item != null && item.m_shared.m_name != name)
				{
					((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null);
					return false;
				}
				float value = Traverse.Create((object)__instance).Method("GetFuel", Array.Empty<object>()).GetValue<float>();
				if (value > (float)(__instance.m_maxFuel - 1))
				{
					((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null);
					return false;
				}
				item = user.GetInventory().GetItem(name, -1, false);
				if (item == null)
				{
					if (flag)
					{
						return true;
					}
					((Character)user).Message((MessageType)2, "$msg_donthaveany " + name, 0, (Sprite)null);
					return false;
				}
				((Character)user).Message((MessageType)2, "$msg_added " + name, 0, (Sprite)null);
				int val = (int)((float)__instance.m_maxFuel - value);
				int num = 1;
				if (!flag)
				{
					num = Math.Min(item.m_stack, val);
				}
				user.GetInventory().RemoveItem(item, num);
				for (int i = 0; i < num; i++)
				{
					__instance.m_nview.InvokeRPC("RPC_AddFuel", Array.Empty<object>());
				}
				__result = true;
				return false;
			}

			[HarmonyPatch(typeof(Smelter), "OnHoverAddFuel")]
			[HarmonyPostfix]
			public static string AddFuel_OnHoverAddFuel_Patch(string __result, Smelter __instance)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				string text = __result;
				KeyCode value = AFModifierKeyConfig.Value;
				string text2 = ((object)(KeyCode)(ref value)).ToString();
				string text3 = ((object)(KeyCode)(ref AFModifierKeyUseConfig)).ToString();
				if ((Object)(object)__instance == (Object)null)
				{
					return text;
				}
				return text + "\n[<color=yellow><b>" + text2 + "+" + text3 + "</b></color>] " + AFTextConfig.Value;
			}

			[HarmonyPatch(typeof(Smelter), "OnHoverAddOre")]
			[HarmonyPostfix]
			public static string AddFuel_OnHoverAddOre_Patch(string __result, Smelter __instance)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				string text = __result;
				KeyCode value = AFModifierKeyConfig.Value;
				string text2 = ((object)(KeyCode)(ref value)).ToString();
				string text3 = ((object)(KeyCode)(ref AFModifierKeyUseConfig)).ToString();
				if ((Object)(object)__instance == (Object)null)
				{
					return text;
				}
				return text + "\n[<color=yellow><b>" + text2 + "+" + text3 + "</b></color>] " + AFTextConfig.Value;
			}

			public static void RPC_AddOre(Smelter instance, ZNetView m_nview, string name, int count)
			{
				//IL_00aa: 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)
				if (m_nview.IsOwner() && Traverse.Create((object)instance).Method("IsItemAllowed", new object[1] { name }).GetValue<bool>())
				{
					int value = Traverse.Create((object)instance).Method("GetQueueSize", Array.Empty<object>()).GetValue<int>();
					for (int i = 0; i < count; i++)
					{
						m_nview.GetZDO().Set($"item{value + i}", name);
					}
					m_nview.GetZDO().Set("queued", value + count);
					instance.m_oreAddedEffects.Create(((Component)instance).transform.position, ((Component)instance).transform.rotation, (Transform)null, 1f, -1);
					ZLog.Log((object)$"Added ore {name} * {count}");
				}
			}

			public static void RPC_AddFuel(Smelter instance, ZNetView m_nview, float count)
			{
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				if (m_nview.IsOwner())
				{
					float value = Traverse.Create((object)instance).Method("GetFuel", Array.Empty<object>()).GetValue<float>();
					m_nview.GetZDO().Set("fuel", value + count);
					instance.m_fuelAddedEffects.Create(((Component)instance).transform.position, ((Component)instance).transform.rotation, ((Component)instance).transform, 1f, -1);
					ZLog.Log((object)$"Added fuel * {count}");
				}
			}
		}

		public static ConfigEntry<KeyCode> AFModifierKeyConfig;

		public static KeyCode AFModifierKeyUseConfig = (KeyCode)101;

		public static ConfigEntry<string> AFTextConfig;

		public static ItemData FindCookableItem(Smelter __instance, Inventory inventory, bool isAddOne)
		{
			IEnumerable<string> enumerable = null;
			enumerable = __instance.m_conversion.Select((ItemConversion n) => n.m_from.m_itemData.m_shared.m_name);
			if (enumerable == null)
			{
				return null;
			}
			foreach (string item in enumerable)
			{
				ItemData val = ((inventory != null) ? inventory.GetItem(item, -1, false) : null);
				if (val != null)
				{
					return val;
				}
			}
			return null;
		}
	}
	[HarmonyPatch]
	public class VB_DayCycle
	{
		[HarmonyPatch(typeof(EnvMan), "Awake")]
		private static class EnvMan_Awake_Patch
		{
			public static void Postfix(ref long ___m_dayLengthSec)
			{
				vanillaDayLengthSec = ___m_dayLengthSec;
				___m_dayLengthSec = (long)Mathf.Round((float)vanillaDayLengthSec / 0.5f);
			}
		}

		public static long vanillaDayLengthSec;
	}
	public class VB_Swampkey
	{
		[HarmonyPatch(typeof(Door), "Interact")]
		public static class SingleDoorPatch
		{
			private static void Postfix(Door __instance, ref bool __result, Humanoid character)
			{
				Player localPlayer = Player.m_localPlayer;
				if (!__result || !((Object)(object)character == (Object)(object)localPlayer))
				{
					return;
				}
				ItemDrop keyItem = __instance.m_keyItem;
				if ((Object)(object)keyItem != (Object)null && keyItem.m_itemData.m_shared.m_name == "$item_cryptkey")
				{
					Inventory inventory = character.GetInventory();
					if (inventory != null && inventory.ContainsItemByName("$item_cryptkey") && Random.value * 100f <= 33f)
					{
						inventory.RemoveItem("$item_cryptkey", 1, -1, true);
						((Character)character).Message((MessageType)1, Localization.instance.Localize("<color=yellow>Болотный ключ сломался</color>"), 0, (Sprite)null);
					}
				}
			}
		}
	}
	[HarmonyPatch]
	public static class VB_Timeout_Patch
	{
		public static CodeMatcher GetPosition(this CodeMatcher codeMatcher, out int position)
		{
			position = codeMatcher.Pos;
			return codeMatcher;
		}

		public static CodeMatcher AddLabel(this CodeMatcher codeMatcher, out Label label)
		{
			label = default(Label);
			codeMatcher.AddLabels((IEnumerable<Label>)new Label[1] { label });
			return codeMatcher;
		}

		public static CodeMatcher GetLabels(this CodeMatcher codeMatcher, out List<Label> label)
		{
			label = codeMatcher.Labels;
			return codeMatcher;
		}

		public static CodeMatcher GetOperand(this CodeMatcher codeMatcher, out object operand)
		{
			operand = codeMatcher.Operand;
			return codeMatcher;
		}

		internal static CodeMatcher Print(this CodeMatcher codeMatcher, int before, int after)
		{
			for (int i = -before; i <= after; i++)
			{
				int num = i;
				int num2 = codeMatcher.Pos + num;
				if (num2 > 0)
				{
					if (num2 >= codeMatcher.Length)
					{
						break;
					}
					try
					{
						CodeInstruction val = codeMatcher.InstructionAt(num);
						VBQOL.Logger.LogDebug((object)($"[{num}] " + (object)val));
					}
					catch (Exception ex)
					{
						VBQOL.Logger.LogDebug((object)ex.Message);
					}
				}
			}
			return codeMatcher;
		}

		public static bool IsVirtCall(this CodeInstruction i, string declaringType, string name)
		{
			return i.opcode == OpCodes.Callvirt && i.operand is MethodInfo methodInfo && methodInfo.DeclaringType?.Name == declaringType && methodInfo.Name == name;
		}
	}
	public class VB_SlopeDamagePatch
	{
		[HarmonyPatch(typeof(Attack), "DoMeleeAttack")]
		public class PatchAttackDoMeleeAttack
		{
			public static void Prefix(ref Attack __instance, ref float ___m_maxYAngle, ref float ___m_attackOffset, ref float ___m_attackHeight)
			{
				Humanoid character = __instance.m_character;
				Player val = (Player)(object)((character is Player) ? character : null);
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Player.m_localPlayer))
				{
					___m_maxYAngle = 180f;
					___m_attackOffset = 0f;
					___m_attackHeight = 1f;
				}
			}
		}
	}
	public class VB_ClearLogPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(ConsoleLogListener), "LogEvent")]
		private static bool ConsoleLogListenerLog(object sender, LogEventArgs eventArgs)
		{
			string text = eventArgs.Data.ToString();
			return !text.StartsWith("Failed to find expected binary shader data") && !text.Contains("Fetching PlatformPrefs 'GuiScale' before loading defaults") && !text.Contains("Missing audio clip in music respawn") && !text.Contains("Set button") && !text.Contains("Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).");
		}
	}
	public class VB_FeedFromHandPatch
	{
		[HarmonyPatch(typeof(Humanoid), "UseItem")]
		public static class Humanoid_UseItem_Prefix_Patch
		{
			public static bool Prefix(Humanoid __instance, ItemData item)
			{
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: Unknown result type (might be due to invalid IL or missing references)
				GameObject hoverObject = __instance.GetHoverObject();
				if ((Object)(object)hoverObject == (Object)null)
				{
					return true;
				}
				if (!Object.op_Implicit((Object)(object)hoverObject.GetComponent<MonsterAI>()) && !Object.op_Implicit((Object)(object)hoverObject.GetComponent<Character>()) && !Object.op_Implicit((Object)(object)hoverObject.GetComponent<Tameable>()) && !Object.op_Implicit((Object)(object)hoverObject.GetComponent<Humanoid>()))
				{
					return true;
				}
				MonsterAI component = hoverObject.GetComponent<MonsterAI>();
				Character component2 = hoverObject.GetComponent<Character>();
				Tameable component3 = hoverObject.GetComponent<Tameable>();
				Humanoid component4 = hoverObject.GetComponent<Humanoid>();
				if (component2.IsTamed() && component.CanConsume(item))
				{
					string hoverName = component2.GetHoverName();
					if (component2.GetHealth() < component2.GetMaxHealth())
					{
						component2.Heal(50f, true);
						component3.ResetFeedingTimer();
						component3.Interact(component4, false, false);
						__instance.DoInteractAnimation(hoverObject.transform.position);
						((Character)__instance).Message((MessageType)2, hoverName + " $hud_tamelove", 0, (Sprite)null);
						Inventory inventory = __instance.GetInventory();
						inventory.RemoveOneItem(item);
						bool flag = false;
					}
					if (component3.IsHungry())
					{
						component2.Heal(50f, true);
						component3.ResetFeedingTimer();
						component3.Interact(component4, false, false);
						__instance.DoInteractAnimation(hoverObject.transform.position);
						((Character)__instance).Message((MessageType)2, hoverName + " $hud_tamelove", 0, (Sprite)null);
						Inventory inventory2 = __instance.GetInventory();
						inventory2.RemoveOneItem(item);
						return false;
					}
					((Character)__instance).Message((MessageType)2, hoverName + " $msg_nomore", 0, (Sprite)null);
					return false;
				}
				return true;
			}
		}
	}
	public class VB_SnakeCameraPatch
	{
		internal class SneakConfig
		{
			public enum CrouchPosition
			{
				Disabled,
				Crouching,
				CrouchStanding,
				CrouchWalking
			}

			public static CrouchPosition LowerCameraWhen = CrouchPosition.Crouching;

			public static float CameraHeightReduction = 0.5f;

			internal const float CameraMin = 0f;

			internal const float CameraMax = 1f;

			public static bool ChangeCollisionCrouchHeight = true;

			public static float CrouchHeightMultiplier = 0.8f;

			internal const float HeightMultMin = 0.75f;

			internal const float HeightMultMax = 1f;
		}

		[HarmonyPatch]
		internal class CameraPatches
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(GameCamera), "GetCameraBaseOffset")]
			private static void GetCameraBaseOffset(Player player, ref Vector3 __result)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				if (!((Object)(object)player != (Object)(object)Player.m_localPlayer) && SneakConfig.LowerCameraWhen != 0 && !(__result != ((Component)((Character)player).m_eye).transform.position - ((Component)player).transform.position) && ((Character)player).IsCrouching() && ((Character)player).IsOnGround())
				{
					bool flag = ((Character)player).IsSneaking();
					if (SneakConfig.LowerCameraWhen == SneakConfig.CrouchPosition.Crouching || (SneakConfig.LowerCameraWhen == SneakConfig.CrouchPosition.CrouchWalking && flag) || (SneakConfig.LowerCameraWhen == SneakConfig.CrouchPosition.CrouchStanding && !flag))
					{
						__result += Vector3.up * (0f - Mathf.Clamp(SneakConfig.CameraHeightReduction, 0f, 1f));
					}
				}
			}
		}

		private static float? standingSize;

		private static float? crouchedSize;

		[HarmonyPatch(typeof(Player), "FixedUpdate")]
		[HarmonyPostfix]
		private static void FixedUpdate(Player __instance)
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || !SneakConfig.ChangeCollisionCrouchHeight)
			{
				return;
			}
			CapsuleCollider collider = ((Character)__instance).GetCollider();
			if (Object.op_Implicit((Object)(object)collider))
			{
				if (!standingSize.HasValue)
				{
					standingSize = collider.height;
					CalculateCrouchedSize();
				}
				bool flag = ((Character)__instance).IsCrouching() && ((Character)__instance).IsOnGround();
				collider.height = (flag ? crouchedSize.Value : standingSize.Value);
				collider.center = new Vector3(0f, collider.height / 2f, 0f);
			}
		}

		internal static void CalculateCrouchedSize()
		{
			if (standingSize.HasValue)
			{
				_ = SneakConfig.CrouchHeightMultiplier;
				if (0 == 0)
				{
					crouchedSize = standingSize.Value * Mathf.Clamp(SneakConfig.CrouchHeightMultiplier, 0.75f, 1f);
				}
			}
		}
	}
	public class VB_BlastFurnaceTalesAll
	{
		[HarmonyPatch(typeof(Smelter), "Awake")]
		[HarmonyPostfix]
		private static void BlastFurnacePatch(ref Smelter __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0060: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_00a0: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected O, but got Unknown
			if (__instance.m_name != "$piece_blastfurnace")
			{
				return;
			}
			foreach (ItemConversion item in new List<ItemConversion>
			{
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("CopperOre").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("Copper").GetComponent<ItemDrop>()
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("CopperScrap").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("Copper").GetComponent<ItemDrop>()
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("TinOre").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("Tin").GetComponent<ItemDrop>()
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("IronOre").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("Iron").GetComponent<ItemDrop>()
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("IronScrap").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("Iron").GetComponent<ItemDrop>()
				},
				new ItemConversion
				{
					m_from = ObjectDB.instance.GetItemPrefab("SilverOre").GetComponent<ItemDrop>(),
					m_to = ObjectDB.instance.GetItemPrefab("Silver").GetComponent<ItemDrop>()
				}
			})
			{
				__instance.m_conversion.Add(item);
			}
		}
	}
	public class VB_BetterLaders
	{
		[HarmonyPatch(typeof(AutoJumpLedge), "OnTriggerStay")]
		public static class Ladder_Patch
		{
			private static bool Prefix(AutoJumpLedge __instance, Collider collider)
			{
				//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_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: 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_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: 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_011d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: 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_00be: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
				Character component = ((Component)collider).GetComponent<Character>();
				if (Object.op_Implicit((Object)(object)component) && (Object)(object)component == (Object)(object)Player.m_localPlayer)
				{
					Vector3 position = ((Component)component).transform.position;
					Quaternion rotation = ((Component)__instance).gameObject.transform.rotation;
					float y = ((Quaternion)(ref rotation)).eulerAngles.y;
					rotation = ((Component)component).transform.rotation;
					float y2 = ((Quaternion)(ref rotation)).eulerAngles.y;
					float num = Math.Abs(Mathf.DeltaAngle(y, y2));
					if (num <= 12f)
					{
						if (!component.m_running)
						{
							((Component)component).transform.position = new Vector3(position.x, position.y + 0.06f, position.z) + ((Component)component).transform.forward * 0.08f;
						}
						else
						{
							((Component)component).transform.position = new Vector3(position.x, position.y + 0.08f, position.z) + ((Component)component).transform.forward * 0.08f;
						}
					}
				}
				return !((Object)(object)component == (Object)(object)Player.m_localPlayer);
			}
		}
	}
	public class VB_Pickable_UpdateRespawn_Patch
	{
		[HarmonyPatch(typeof(Pickable), "UpdateRespawn")]
		public static class Patch_Pickable_UpdateRespawn
		{
			private static Exception Finalizer(Pickable __instance, Exception __exception)
			{
				if ((Object)(object)__instance != (Object)null && __exception != null)
				{
					VBQOL.Logger.LogDebug((object)"Исправлен таймер расстения:");
					VBQOL.Logger.LogDebug((object)__exception);
					DateTime time = ZNet.instance.GetTime();
					__instance.m_nview.GetZDO().Set(ZDOVars.s_pickedTime, time.Ticks);
				}
				return null;
			}
		}
	}
	public class VB_ToolTierPatch
	{
		[HarmonyPatch]
		internal class Change_ToolTierPatch
		{
			[HarmonyPatch(typeof(ZNetScene), "Awake")]
			[HarmonyPostfix]
			public static void Patch(ZNetScene __instance)
			{
				__instance.GetPrefab("Beech1").GetComponent<TreeBase>().m_minToolTier = 0;
				__instance.GetPrefab("beech_log").GetComponent<TreeLog>().m_minToolTier = 0;
				__instance.GetPrefab("beech_log_half").GetComponent<TreeLog>().m_minToolTier = 0;
				__instance.GetPrefab("Beech_Stub").GetComponent<Destructible>().m_minToolTier = 0;
				__instance.GetPrefab("FirTree").GetComponent<TreeBase>().m_minToolTier = 0;
				__instance.GetPrefab("FirTree_log").GetComponent<TreeLog>().m_minToolTier = 0;
				__instance.GetPrefab("FirTree_log_half").GetComponent<TreeLog>().m_minToolTier = 0;
				__instance.GetPrefab("FirTree_Stub").GetComponent<Destructible>().m_minToolTier = 0;
				__instance.GetPrefab("Pinetree_01").GetComponent<TreeBase>().m_minToolTier = 1;
				__instance.GetPrefab("PineTree_log").GetComponent<TreeLog>().m_minToolTier = 1;
				__instance.GetPrefab("PineTree_log_half").GetComponent<TreeLog>().m_minToolTier = 1;
				__instance.GetPrefab("Pinetree_01_Stub").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("SwampTree1").GetComponent<TreeBase>().m_minToolTier = 2;
				__instance.GetPrefab("SwampTree1_log").GetComponent<TreeLog>().m_minToolTier = 2;
				__instance.GetPrefab("SwampTree1_Stub").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("Birch1").GetComponent<TreeBase>().m_minToolTier = 2;
				__instance.GetPrefab("Birch2").GetComponent<TreeBase>().m_minToolTier = 2;
				__instance.GetPrefab("Birch_log").GetComponent<TreeLog>().m_minToolTier = 2;
				__instance.GetPrefab("Birch_log_half").GetComponent<TreeLog>().m_minToolTier = 2;
				__instance.GetPrefab("BirchStub").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("Birch1_aut").GetComponent<TreeBase>().m_minToolTier = 2;
				__instance.GetPrefab("Birch2_aut").GetComponent<TreeBase>().m_minToolTier = 2;
				__instance.GetPrefab("caverock_ice_stalagtite").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("caverock_ice_stalagtite_falling").GetComponent<TreeLog>().m_minToolTier = 2;
				__instance.GetPrefab("caverock_ice_stalagmite").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("caverock_ice_stalagmite_broken").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("caverock_ice_pillar_wall").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("Oak1").GetComponent<TreeBase>().m_minToolTier = 3;
				__instance.GetPrefab("Oak_log").GetComponent<TreeLog>().m_minToolTier = 3;
				__instance.GetPrefab("Oak_log_half").GetComponent<TreeLog>().m_minToolTier = 3;
				__instance.GetPrefab("OakStub").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("YggaShoot1").GetComponent<TreeBase>().m_minToolTier = 4;
				__instance.GetPrefab("YggaShoot2").GetComponent<TreeBase>().m_minToolTier = 4;
				__instance.GetPrefab("YggaShoot3").GetComponent<TreeBase>().m_minToolTier = 4;
				__instance.GetPrefab("yggashoot_log").GetComponent<TreeLog>().m_minToolTier = 4;
				__instance.GetPrefab("yggashoot_log_half").GetComponent<TreeLog>().m_minToolTier = 4;
				__instance.GetPrefab("ShootStump").GetComponent<Destructible>().m_minToolTier = 4;
				__instance.GetPrefab("Leviathan").GetComponent<MineRock>().m_minToolTier = 1;
				__instance.GetPrefab("mudpile").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("mudpile2").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("mudpile_beacon").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("mudpile_old").GetComponent<MineRock>().m_minToolTier = 1;
				__instance.GetPrefab("mudpile_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("mudpile2_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("MineRock_Meteorite").GetComponent<MineRock>().m_minToolTier = 3;
				__instance.GetPrefab("Rock_3").GetComponent<Destructible>().m_minToolTier = 0;
				__instance.GetPrefab("Rock_3_frac").GetComponent<MineRock5>().m_minToolTier = 0;
				__instance.GetPrefab("rock4_coast").GetComponent<Destructible>().m_minToolTier = 0;
				__instance.GetPrefab("rock4_coast_frac").GetComponent<MineRock5>().m_minToolTier = 0;
				__instance.GetPrefab("rock4_forest").GetComponent<Destructible>().m_minToolTier = 0;
				__instance.GetPrefab("rock4_forest_frac").GetComponent<MineRock5>().m_minToolTier = 0;
				__instance.GetPrefab("rock4_copper").GetComponent<Destructible>().m_minToolTier = 0;
				__instance.GetPrefab("rock4_copper_frac").GetComponent<MineRock5>().m_minToolTier = 0;
				__instance.GetPrefab("rock1_mountain").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("rock1_mountain_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("rock2_mountain").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("rock2_mountain_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("rock3_mountain").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("rock3_mountain_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("rock2_heath").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("rock2_heath_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("rock4_heath").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("rock4_heath_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("HeathRockPillar").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("HeathRockPillar_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("RockThumb").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("RockThumb_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("RockFinger").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("RockFinger_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("RockFingerBroken").GetComponent<Destructible>().m_minToolTier = 1;
				__instance.GetPrefab("RockFingerBroken_frac").GetComponent<MineRock5>().m_minToolTier = 1;
				__instance.GetPrefab("rock_mistlands1").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("rock_mistlands1_frac").GetComponent<MineRock5>().m_minToolTier = 2;
				__instance.GetPrefab("cliff_mistlands1").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("cliff_mistlands1_frac").GetComponent<MineRock5>().m_minToolTier = 2;
				__instance.GetPrefab("cliff_mistlands2").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("cliff_mistlands2_frac").GetComponent<MineRock5>().m_minToolTier = 2;
				__instance.GetPrefab("cliff_mistlands1_creep").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("cliff_mistlands1_creep_frac").GetComponent<MineRock5>().m_minToolTier = 2;
				__instance.GetPrefab("silvervein").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("silvervein_frac").GetComponent<MineRock5>().m_minToolTier = 2;
				__instance.GetPrefab("rock3_silver").GetComponent<Destructible>().m_minToolTier = 2;
				__instance.GetPrefab("rock3_silver_frac").GetComponent<MineRock5>().m_minToolTier = 2;
				__instance.GetPrefab("giant_brain").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_brain_frac").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("giant_ribs").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_ribs_frac").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("giant_skull").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_skull_frac").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("giant_helmet1").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_helmet1_destruction").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("giant_helmet2").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_helmet2_destruction").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("giant_sword1").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_sword1_destruction").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("giant_sword2").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("giant_sword2_destruction").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("ice_rock1").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("ice_rock1_frac").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("rock3_ice").GetComponent<Destructible>().m_minToolTier = 3;
				__instance.GetPrefab("rock3_ice_frac").GetComponent<MineRock5>().m_minToolTier = 3;
				__instance.GetPrefab("ice1").GetComponent<Destructible>().m_minToolTier = 3;
			}
		}
	}
	[HarmonyPatch(typeof(InventoryGui))]
	public class VB_RecycleInventoryGui
	{
		[HarmonyPatch(typeof(Humanoid))]
		private class HumanoidPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("EquipItem")]
			private static void EquipItem(Humanoid __instance, ItemData item, bool triggerEquipEffects = true)
			{
				if (((Character)__instance).IsPlayer())
				{
					InventoryGui instance = InventoryGui.instance;
					if (instance != null)
					{
						instance.UpdateCraftingPanel(false);
					}
				}
			}

			[HarmonyPatch("UnequipItem")]
			[HarmonyPostfix]
			private static void UnequipItem(Humanoid __instance, ItemData item, bool triggerEquipEffects = true)
			{
				if (((Character)__instance).IsPlayer())
				{
					InventoryGui instance = InventoryGui.instance;
					if (instance != null)
					{
						instance.UpdateCraftingPanel(false);
					}
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui))]
		public class InventoryGuiPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("Update")]
			internal static void PostfixUpdate(InventoryGui __instance)
			{
				VBQOL.self?.RebuildRecycleTab();
			}

			[HarmonyPatch("OnTabCraftPressed")]
			[HarmonyPrefix]
			internal static bool PrefixOnTabCraftPressed(InventoryGui __instance)
			{
				((Selectable)VBQOL.self.recycleButton).interactable = true;
				return true;
			}

			[HarmonyPrefix]
			[HarmonyPatch("OnTabUpgradePressed")]
			internal static bool PrefixOnTabUpgradePressed(InventoryGui __instance)
			{
				((Selectable)VBQOL.self.recycleButton).interactable = true;
				return true;
			}

			[HarmonyPatch("SetupRequirement")]
			[HarmonyPostfix]
			internal static void PostfixSetupRequirement(Transform elementRoot, Requirement req, int quality)
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				if (VBQOL.self.InTabDeconstruct())
				{
					TMP_Text component = ((Component)((Component)elementRoot).transform.Find("res_amount")).GetComponent<TMP_Text>();
					component.text = VBQOL.GetModifiedAmount(quality, req).ToString();
					((Graphic)component).color = Color.green;
				}
			}

			[HarmonyPatch("UpdateCraftingPanel")]
			[HarmonyPrefix]
			internal static bool PrefixUpdateCraftingPanel(InventoryGui __instance, bool focusView = false)
			{
				if ((Object)(object)VBQOL.self != (Object)null)
				{
					Player localPlayer = Player.m_localPlayer;
					if (Object.op_Implicit((Object)(object)localPlayer.GetCurrentCraftingStation()) && (((Object)((Component)localPlayer.GetCurrentCraftingStation()).gameObject).name.Contains("cauldron") || ((Object)((Component)localPlayer.GetCurrentCraftingStation()).gameObject).name.Contains("artisanstation")))
					{
						VBQOL.self.recycleObject.SetActive(false);
						((Selectable)VBQOL.self.recycleButton).interactable = true;
						return true;
					}
					if (!Object.op_Implicit((Object)(object)localPlayer.GetCurrentCraftingStation()) && !localPlayer.NoCostCheat())
					{
						((Selectable)__instance.m_tabCraft).interactable = false;
						((Selectable)__instance.m_tabUpgrade).interactable = true;
						((Component)__instance.m_tabUpgrade).gameObject.SetActive(false);
						VBQOL.self.recycleObject.SetActive(false);
						((Selectable)VBQOL.self.recycleButton).interactable = true;
					}
					else
					{
						((Component)__instance.m_tabUpgrade).gameObject.SetActive(true);
						VBQOL.self.recycleObject.SetActive(true);
					}
					List<Recipe> list = new List<Recipe>();
					localPlayer.GetAvailableRecipes(ref list);
					__instance.UpdateRecipeList(list);
					if (__instance.m_availableRecipes.Count <= 0)
					{
						__instance.SetRecipe(-1, focusView);
						return false;
					}
					if ((Object)(object)__instance.m_selectedRecipe.Key != (Object)null)
					{
						int selectedRecipeIndex = __instance.GetSelectedRecipeIndex(false);
						__instance.SetRecipe(selectedRecipeIndex, focusView);
						return false;
					}
					__instance.SetRecipe(0, focusView);
					return false;
				}
				return true;
			}

			[HarmonyPostfix]
			[HarmonyPatch("UpdateRecipeList")]
			internal static void PostfixUpdateRecipeList(InventoryGui __instance, List<Recipe> recipes)
			{
				if (!VBQOL.self.InTabDeconstruct())
				{
					return;
				}
				Player localPlayer = Player.m_localPlayer;
				Inventory inventory = ((Humanoid)localPlayer).GetInventory();
				__instance.m_availableRecipes.Clear();
				foreach (GameObject recipe in __instance.m_recipeList)
				{
					Object.Destroy((Object)(object)recipe);
				}
				__instance.m_recipeList.Clear();
				List<KeyValuePair<Recipe, ItemData>> list = new List<KeyValuePair<Recipe, ItemData>>();
				for (int i = 0; i < recipes.Count; i++)
				{
					Recipe val = recipes[i];
					if (val.m_item.m_itemData.m_shared.m_maxQuality < 1)
					{
						continue;
					}
					__instance.m_tempItemList.Clear();
					if (val.m_item.m_itemData.m_shared.m_maxStackSize == 1)
					{
						inventory.GetAllItems(val.m_item.m_itemData.m_shared.m_name, __instance.m_tempItemList);
					}
					else
					{
						for (int j = 0; j < inventory.m_inventory.Count; j++)
						{
							if (inventory.m_inventory[j].m_shared.m_name.Equals(val.m_item.m_itemData.m_shared.m_name) && inventory.m_inventory[j].m_stack >= val.m_amount)
							{
								__instance.m_tempItemList.Add(inventory.m_inventory[j]);
								break;
							}
						}
					}
					foreach (ItemData tempItem in __instance.m_tempItemList)
					{
						if (tempItem.m_quality >= 1)
						{
							list.Add(new KeyValuePair<Recipe, ItemData>(val, tempItem));
						}
					}
				}
				IEnumerable<int> equipped = from item in inventory.GetEquippedItems()
					select ((object)item).GetHashCode();
				list.RemoveAll((KeyValuePair<Recipe, ItemData> m) => equipped.Contains(((object)m.Value).GetHashCode()));
				List<ItemData> list2 = new List<ItemData>();
				inventory.GetBoundItems(list2);
				IEnumerable<int> hotbarItemsHashes = list2.Select((ItemData item) => ((object)item).GetHashCode());
				list.RemoveAll((KeyValuePair<Recipe, ItemData> m) => hotbarItemsHashes.Contains(((object)m.Value).GetHashCode()));
				foreach (KeyValuePair<Recipe, ItemData> item in list)
				{
					__instance.AddRecipeToList(localPlayer, item.Key, item.Value, true);
				}
				float num = (float)__instance.m_recipeList.Count * __instance.m_recipeListSpace;
				num = Mathf.Max(__instance.m_recipeListBaseSize, num);
				__instance.m_recipeListRoot.SetSizeWithCurrentAnchors((Axis)1, num);
			}

			[HarmonyPrefix]
			[HarmonyPatch("UpdateRecipe")]
			internal static bool PrefixUpdateRecipe(InventoryGui __instance, Player player, float dt)
			{
				//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
				if (VBQOL.self.InTabDeconstruct())
				{
					CraftingStation currentCraftingStation = player.GetCurrentCraftingStation();
					if (Object.op_Implicit((Object)(object)currentCraftingStation))
					{
						__instance.m_craftingStationName.text = Localization.instance.Localize(currentCraftingStation.m_name);
						((Component)__instance.m_craftingStationIcon).gameObject.SetActive(true);
						__instance.m_craftingStationIcon.sprite = currentCraftingStation.m_icon;
						int level = currentCraftingStation.GetLevel(true);
						__instance.m_craftingStationLevel.text = level.ToString();
						((Component)__instance.m_craftingStationLevelRoot).gameObject.SetActive(true);
					}
					else
					{
						__instance.m_craftingStationName.text = Localization.instance.Localize("$hud_crafting");
						((Component)__instance.m_craftingStationIcon).gameObject.SetActive(false);
						((Component)__instance.m_craftingStationLevelRoot).gameObject.SetActive(false);
					}
					if (Object.op_Implicit((Object)(object)__instance.m_selectedRecipe.Key))
					{
						((Behaviour)__instance.m_recipeIcon).enabled = true;
						((Behaviour)__instance.m_recipeName).enabled = true;
						ItemData value = __instance.m_selectedRecipe.Value;
						if (value.m_quality == 1)
						{
							((Behaviour)__instance.m_recipeDecription).enabled = false;
						}
						else
						{
							((Behaviour)__instance.m_recipeDecription).enabled = true;
						}
						int num = ((value == null) ? 1 : ((value.m_quality >= 1) ? (value.m_quality - 1) : 0));
						bool flag = num <= __instance.m_selectedRecipe.Key.m_item.m_itemData.m_shared.m_maxQuality;
						int num2 = value?.m_variant ?? __instance.m_selectedVariant;
						__instance.m_recipeIcon.sprite = __instance.m_selectedRecipe.Key.m_item.m_itemData.m_shared.m_icons[num2];
						string text = Localization.instance.Localize(__instance.m_selectedRecipe.Key.m_item.m_itemData.m_shared.m_name);
						if (__instance.m_selectedRecipe.Key.m_amount > 1)
						{
							text = text + " x" + __instance.m_selectedRecipe.Key.m_amount;
						}
						__instance.m_recipeName.text = text;
						__instance.m_recipeDecription.text = Localization.instance.Localize(ItemData.GetTooltip(__instance.m_selectedRecipe.Key.m_item.m_itemData, num, true, (float)Game.m_worldLevel));
						if (value != null)
						{
							((Component)__instance.m_itemCraftType).gameObject.SetActive(true);
							string text2 = Localization.instance.Localize(value.m_shared.m_name);
							__instance.m_itemCraftType.text = "Предмет будет разобран";
						}
						else
						{
							((Component)__instance.m_itemCraftType).gameObject.SetActive(false);
						}
						((Component)__instance.m_variantButton).gameObject.SetActive(__instance.m_selectedRecipe.Key.m_item.m_itemData.m_shared.m_variants > 1 && __instance.m_selectedRecipe.Value == null);
						__instance.SetupRequirementList(num + 1, player, flag);
						int num3 = 0;
						CraftingStation requiredStation = __instance.m_selectedRecipe.Key.GetRequiredStation(num);
						if ((Object)(object)requiredStation != (Object)null && flag)
						{
							((Component)__instance.m_minStationLevelIcon).gameObject.SetActive(true);
							__instance.m_minStationLevelText.text = num3.ToString();
							if ((Object)(object)currentCraftingStation == (Object)null || currentCraftingStation.GetLevel(true) < num3)
							{
								((Graphic)__instance.m_minStationLevelText).color = ((Mathf.Sin(Time.time * 10f) > 0f) ? Color.red : __instance.m_minStationLevelBasecolor);
							}
							else
							{
								((Graphic)__instance.m_minStationLevelText).color = __instance.m_minStationLevelBasecolor;
							}
						}
						else
						{
							((Component)__instance.m_minStationLevelIcon).gameObject.SetActive(false);
						}
						bool flag2 = true;
						bool flag3 = VBQOL.HaveEmptySlotsForRecipe(((Humanoid)player).GetInventory(), __instance.m_selectedRecipe.Key, num + 1);
						bool flag4 = !Object.op_Implicit((Object)(object)requiredStation) || (Object.op_Implicit((Object)(object)currentCraftingStation) && currentCraftingStation.CheckUsable(player, false));
						((Selectable)__instance.m_craftButton).interactable = ((flag2 && flag4) || player.NoCostCheat()) && flag3 && flag;
						TMP_Text componentInChildren = ((Component)__instance.m_craftButton).GetComponentInChildren<TMP_Text>();
						componentInChildren.text = "Разбор";
						UITooltip component = ((Component)__instance.m_craftButton).GetComponent<UITooltip>();
						if (!flag3)
						{
							component.m_text = Localization.instance.Localize("$inventory_full");
						}
						else if (!flag4)
						{
							component.m_text = Localization.instance.Localize("$msg_missingstation");
						}
						else
						{
							component.m_text = "";
						}
					}
					else
					{
						((Behaviour)__instance.m_recipeIcon).enabled = false;
						((Behaviour)__instance.m_recipeName).enabled = false;
						((Behaviour)__instance.m_recipeDecription).enabled = false;
						((Component)__instance.m_qualityPanel).gameObject.SetActive(false);
						((Component)__instance.m_minStationLevelIcon).gameObject.SetActive(false);
						((Component)__instance.m_craftButton).GetComponent<UITooltip>().m_text = "";
						((Component)__instance.m_variantButton).gameObject.SetActive(false);
						((Component)__instance.m_itemCraftType).gameObject.SetActive(false);
						for (int i = 0; i < __instance.m_recipeRequirementList.Length; i++)
						{
							InventoryGui.HideRequirement(__instance.m_recipeRequirementList[i].transform);
						}
						((Selectable)__instance.m_craftButton).interactable = false;
					}
					if (__instance.m_craftTimer < 0f)
					{
						((Component)__instance.m_craftProgressPanel).gameObject.SetActive(false);
						((Component)__instance.m_craftButton).gameObject.SetActive(true);
						return false;
					}
					((Component)__instance.m_craftButton).gameObject.SetActive(false);
					((Component)__instance.m_craftProgressPanel).gameObject.SetActive(true);
					__instance.m_craftProgressBar.SetMaxValue(__instance.m_craftDuration);
					__instance.m_craftProgressBar.SetValue(__instance.m_craftTimer);
					__instance.m_craftTimer += dt;
					if (__instance.m_craftTimer >= __instance.m_craftDuration)
					{
						if (VBQOL.self.InTabDeconstruct())
						{
							VBQOL.DoRecycle(player, __instance);
						}
						else
						{
							__instance.DoCrafting(player);
						}
						__instance.m_craftTimer = -1f;
					}
					return false;
				}
				return true;
			}
		}
	}
	[HarmonyPatch]
	public class VB_FirePlaceUtilites
	{
		public static KeyCode configPOKey;

		public static ConfigEntry<bool> extinguishItemsConfig;

		public static ConfigEntry<string> extinguishStringConfig;

		public static ConfigEntry<string> igniteStringConfig;

		public static ConfigEntry<KeyCode> keyPOCodeStringConfig;

		public static Fireplace GetAndCheckFireplace(Player player, bool checkIfBurning)
		{
			GameObject hoverObject = ((Humanoid)player).GetHoverObject();
			Fireplace val = (((Object)(object)hoverObject != (Object)null) ? hoverObject.GetComponentInParent<Fireplace>() : null);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			Fireplace component = ((Component)((Component)val).GetComponent<ZNetView>()).GetComponent<Fireplace>();
			if ((Object)(object)component == (Object)null)
			{
				return null;
			}
			if (checkIfBurning)
			{
				if (!component.IsBurning())
				{
					return null;
				}
				if (component.m_wet)
				{
					return null;
				}
			}
			return component;
		}

		[HarmonyPatch(typeof(Fireplace), "UpdateFireplace")]
		[HarmonyPostfix]
		public static void FireplaceUpdateFireplace_Patch(Fireplace __instance)
		{
			ZDO zDO = __instance.m_nview.GetZDO();
			float @float = zDO.GetFloat("fuel", 0f);
			if (!zDO.GetBool("enabledFire", false))
			{
				if (@float <= 0f)
				{
					return;
				}
				zDO.Set("enabledFire", true);
				zDO.Set("fuel", zDO.GetFloat("hiddenFuelAmount", 0f) + @float);
			}
			if (zDO.GetFloat("hiddenFuelAmount", 0f) != @float)
			{
				float num = @float;
				zDO.Set("hiddenFuelAmount", num);
			}
			if (zDO.GetFloat("fuel", 0f) > __instance.m_maxFuel)
			{
				zDO.Set("fuel", __instance.m_maxFuel);
			}
		}

		[HarmonyPatch(typeof(Fireplace), "GetHoverText")]
		[HarmonyPostfix]
		public static string FireplaceGetHoverText_Patch(string __result, Fireplace __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			string text = __result;
			KeyCode value = keyPOCodeStringConfig.Value;
			string text2 = ((object)(KeyCode)(ref value)).ToString();
			if ((Object)(object)__instance == (Object)null)
			{
				return text;
			}
			ZDO zDO = __instance.m_nview.GetZDO();
			float @float = zDO.GetFloat("hiddenFuelAmount", 0f);
			if (extinguishItemsConfig.Value && !__instance.IsBurning() && @float > 0f)
			{
				int num = (int)__instance.m_maxFuel;
				text = text.Replace($"0/{num}", $"{(int)Mathf.Ceil(@float)}/{num}") + "\n[<color=yellow><b>" + text2 + "</b></color>] " + igniteStringConfig.Value;
			}
			if (!__instance.IsBurning())
			{
				return text;
			}
			if (__instance.m_wet)
			{
				return text;
			}
			if (extinguishItemsConfig.Value)
			{
				text = text + "\n[<color=yellow><b>" + text2 + "</b></color>] " + extinguishStringConfig.Value;
			}
			return text;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Update")]
		public static void PlayerUpdate_Patch(Player __instance)
		{
			//IL_0013: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)__instance) || !Input.GetKeyUp(configPOKey) || !extinguishItemsConfig.Value)
			{
				return;
			}
			Fireplace andCheckFireplace = GetAndCheckFireplace(__instance, checkIfBurning: false);
			if (!((Object)(object)andCheckFireplace == (Object)null))
			{
				ZDO zDO = andCheckFireplace.m_nview.GetZDO();
				bool flag = !zDO.GetBool("enabledFire", false);
				zDO.Set("enabledFire", flag);
				if (!flag)
				{
					andCheckFireplace.m_fuelAddedEffects.Create(((Component)andCheckFireplace).transform.position, ((Component)andCheckFireplace).transform.rotation, (Transform)null, 1f, -1);
					zDO.Set("fuel", 0f);
				}
				if (flag)
				{
					andCheckFireplace.m_fuelAddedEffects.Create(((Component)andCheckFireplace).transform.position, ((Component)andCheckFireplace).transform.rotation, (Transform)null, 1f, -1);
					zDO.Set("fuel", zDO.GetFloat("hiddenFuelAmount", 0f));
				}
			}
		}
	}
	public class VB_BuildDamage
	{
		public static class RPC_HealthChanged_Patch
		{
			public static bool Prefix(long peer, Piece ___m_piece, WearNTear __instance)
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				foreach (PrivateArea allArea in PrivateArea.m_allAreas)
				{
					if (allArea.IsEnabled() && allArea.IsInside(((Component)__instance).transform.position, 0f))
					{
						if (___m_piece == null)
						{
							return true;
						}
						if (uncreatedDamageMultConfig.Value == 0f && ___m_piece.GetCreator() == 0)
						{
							return false;
						}
						if (nonCreatorDamageMultConfig.Value == 0f && ___m_piece.GetCreator() != 0L && peer != ___m_piece.GetCreator())
						{
							return false;
						}
						if (creatorDamageMultConfig.Value == 0f && ___m_piece.GetCreator() != 0L && peer == ___m_piece.GetCreator())
						{
							return false;
						}
					}
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(WearNTear), "RPC_Damage")]
		public static class RPC_Damage_Patch
		{
			public static void Prefix(ref HitData hit, Piece ___m_piece, WearNTear __instance)
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: 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)
				foreach (PrivateArea allArea in PrivateArea.m_allAreas)
				{
					if (allArea.IsEnabled() && allArea.IsInside(((Component)__instance).transform.position, 0f))
					{
						if (!enableModBDConfig.Value)
						{
							break;
						}
						float num = 1f;
						_ = hit.m_attacker;
						num = (((ZDOID)(ref hit.m_attacker)).IsNone() ? naturalDamageMultConfig.Value : ((___m_piece != null && ___m_piece.GetCreator() == 0) ? uncreatedDamageMultConfig.Value : ((!(hit.m_attacker == ((Character)Player.m_localPlayer).GetZDOID()) || !((Object)(object)___m_piece != (Object)null) || !___m_piece.IsCreator()) ? nonCreatorDamageMultConfig.Value : creatorDamageMultConfig.Value)));
						MultiplyDamage(ref hit, num);
					}
				}
			}

			private static void MultiplyDamage(ref HitData hit, float value)
			{
				value = Math.Max(0f, value);
				hit.m_damage.m_damage *= value;
				hit.m_damage.m_blunt *= value;
				hit.m_damage.m_slash *= value;
				hit.m_damage.m_pierce *= value;
				hit.m_damage.m_chop *= value;
				hit.m_damage.m_pickaxe *= value;
				hit.m_damage.m_fire *= value;
				hit.m_damage.m_frost *= value;
				hit.m_damage.m_lightning *= value;
				hit.m_damage.m_poison *= value;
				hit.m_damage.m_spirit *= value;
			}
		}

		[HarmonyPatch(typeof(WearNTear), "ApplyDamage")]
		public static class ApplyDamage_Patch
		{
			public static void Prefix(ref float damage, WearNTear __instance)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				foreach (PrivateArea allArea in PrivateArea.m_allAreas)
				{
					if (allArea.IsEnabled() && allArea.IsInside(((Component)__instance).transform.position, 0f))
					{
						if (!enableModBDConfig.Value || Environment.StackTrace.Contains("RPC_Damage"))
						{
							break;
						}
						damage *= naturalDamageMultConfig.Value;
					}
				}
			}
		}

		public static ConfigEntry<bool> enableModBDConfig;

		public static ConfigEntry<float> creatorDamageMultConfig;

		public static ConfigEntry<float> nonCreatorDamageMultConfig;

		public static ConfigEntry<float> uncreatedDamageMultConfig;

		public static ConfigEntry<float> naturalDamageMultConfig;
	}
	[HarmonyPatch(typeof(MessageHud))]
	public static class VB_BetterPickupNotifications
	{
		private class PickupMessage : MsgData
		{
			public float Timer;
		}

		private class PickupDisplay
		{
			public GameObject RootGO;

			private Image IconComp;

			private TMP_Text TextComp;

			private int Index;

			public PickupDisplay(int index)
			{
				Index = index;
				CreateUI();
			}

			private void CreateUI()
			{
				//IL_0087: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//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_00fe: 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_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: Unknown result type (might be due to invalid IL or missing references)
				//IL_014c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				RootGO = Object.Instantiate<GameObject>(((Component)((Component)MessageHud.instance.m_messageText).gameObject.transform.parent).gameObject, ((Component)MessageHud.instance.m_messageText).gameObject.transform.parent.parent);
				RootGO.transform.SetAsFirstSibling();
				IconComp = RootGO.GetComponentInChildren<Image>();
				TextComp = RootGO.GetComponentInChildren<TMP_Text>();
				Transform transform = RootGO.transform;
				Vector3 position = transform.position;
				Vector3 up = Vector3.up;
				Rect rect = ((Graphic)IconComp).rectTransform.rect;
				transform.position = position + up * (0f - ((Rect)(ref rect)).height * MessageVerticalSpacingModifier.Value) * (float)(Index + 1);
				Transform transform2 = ((Component)TextComp).gameObject.transform;
				Vector3 position2 = transform2.position;
				Vector3 up2 = Vector3.up;
				rect = ((Graphic)IconComp).rectTransform.rect;
				Vector3 val = up2 * (0f - ((Rect)(ref rect)).height) * MessageTextVerticalModifier.Value;
				Vector3 right = Vector3.right;
				rect = ((Graphic)IconComp).rectTransform.rect;
				transform2.position = position2 + (val + right * ((Rect)(ref rect)).width * MessageTextHorizontalSpacingModifier.Value);
			}

			public void Display(PickupMessage msg)
			{
				try
				{
					((Graphic)TextComp).canvasRenderer.SetAlpha(1f);
					((Graphic)TextComp).CrossFadeAlpha(1f, 0f, true);
					if (((MsgData)msg).m_amount > 1)
					{
						TextComp.text = ((MsgData)msg).m_text + " x" + ((MsgData)msg).m_amount;
					}
					else
					{
						TextComp.text = ((MsgData)msg).m_text;
					}
					IconComp.sprite = ((MsgData)msg).m_icon;
					((Graphic)IconComp).canvasRenderer.SetAlpha(1f);
					((Graphic)IconComp).CrossFadeAlpha(1f, 0f, true);
				}
				catch
				{
					if (msg != null && (Object)(object)((MsgData)msg).m_icon != (Object)null)
					{
						CreateUI();
						Display(msg);
					}
				}
			}

			public void FadeAway()
			{
				((Graphic)TextComp).CrossFadeAlpha(0f, MessageFadeTime.Value, true);
				((Graphic)IconComp).CrossFadeAlpha(0f, MessageFadeTime.Value, true);
			}
		}

		public static ConfigEntry<float> MessageLifetime;

		public static ConfigEntry<float> MessageFadeTime;

		public static ConfigEntry<float> MessageBumpTime;

		public static ConfigEntry<bool> ResetMessageTimerOnDupePickup;

		public static ConfigEntry<float> MessageVerticalSpacingModifier;

		public static ConfigEntry<float> MessageTextHorizontalSpacingModifier;

		public static ConfigEntry<float> MessageTextVerticalModifier;

		private static List<PickupMessage> PickupMessages;

		private static List<PickupDisplay> PickupDisplays;

		[HarmonyPatch("ShowMessage")]
		[HarmonyPrefix]
		public static bool ShowMessagePrefix(MessageHud __instance, MessageType type, string text, int amount, Sprite icon)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			if (Hud.IsUserHidden())
			{
				return false;
			}
			text = Localization.instance.Localize(text);
			if ((int)type == 2 || string.IsNullOrWhiteSpace(text) || amount < 1 || (Object)(object)icon == (Object)null)
			{
				return true;
			}
			int i;
			for (i = 0; i < PickupMessages.Count && (PickupMessages[i] == null || !(((MsgData)PickupMessages[i]).m_text == text)); i++)
			{
			}
			if (i == PickupMessages.Count)
			{
				i = PickupMessages.IndexOf(null);
				if (i < 0)
				{
					i = PickupMessages.Count;
					PickupMessages.Add(null);
					PickupDisplays.Add(new PickupDisplay(i));
				}
				PickupMessages[i] = new PickupMessage
				{
					m_text = text,
					m_amount = amount,
					m_icon = icon,
					Timer = MessageLifetime.Value
				};
				PickupDisplays[i].Display(PickupMessages[i]);
			}
			else
			{
				PickupMessage pickupMessage = PickupMessages[i];
				((MsgData)pickupMessage).m_amount = ((MsgData)pickupMessage).m_amount + amount;
				if (ResetMessageTimerOnDupePickup.Value)
				{
					PickupMessages[i].Timer = MessageLifetime.Value;
				}
				else
				{
					PickupMessages[i].Timer += MessageBumpTime.Value;
					if (PickupMessages[i].Timer > MessageLifetime.Value)
					{
						PickupMessages[i].Timer = MessageLifetime.Value;
					}
					PickupDisplays[i].Display(PickupMessages[i]);
				}
			}
			return false;
		}

		[HarmonyPatch("UpdateMessage")]
		[HarmonyPrefix]
		public static bool UpdateMessagePrefix(MessageHud __instance, float dt)
		{
			for (int i = 0; i < PickupMessages.Count; i++)
			{
				if (PickupMessages[i] != null)
				{
					PickupMessages[i].Timer -= dt;
					if (PickupMessages[i].Timer <= 0f)
					{
						PickupMessages[i] = null;
						PickupDisplays[i].FadeAway();
					}
				}
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		public static void AwakePostfix()
		{
			PickupMessages = new List<PickupMessage>();
			PickupDisplays = new List<PickupDisplay>();
		}

		[HarmonyPatch("OnDestroy")]
		[HarmonyPostfix]
		public static void OnDestroyPostfix()
		{
			PickupMessages = null;
			PickupDisplays = null;
		}
	}
	public static class VB_CustomSlotManager
	{
		public static readonly Dictionary<Humanoid, Dictionary<string, ItemData>> customSlotItemData = new Dictionary<Humanoid, Dictionary<string, ItemData>>();

		public static string GetCustomSlotName(ItemData item)
		{
			return item.m_dropPrefab.GetComponent<VB_CustomSlotItem>().m_slotName;
		}

		public static bool IsCustomSlotItem(ItemData item)
		{
			return item != null && Object.op_Implicit((Object)(object)item.m_dropPrefab) && Object.op_Implicit((Object)(object)item.m_dropPrefab.GetComponent<VB_CustomSlotItem>());
		}

		public static ItemData GetPrefabItemData(Humanoid humanoid, string slotName)
		{
			if (!DoesSlotExist(humanoid, slotName))
			{
				return null;
			}
			return customSlotItemData[humanoid][slotName].m_dropPrefab.GetComponent<ItemDrop>().m_itemData;
		}

		public static ItemData GetSlotItem(Humanoid humanoid, string slotName)
		{
			if (DoesSlotExist(humanoid, slotName))
			{
				return customSlotItemData[humanoid][slotName];
			}
			return null;
		}

		public static void SetSlotItem(Humanoid humanoid, string slotName, ItemData item)
		{
			customSlotItemData[humanoid][slotName] = item;
		}

		public static bool DoesSlotExist(Humanoid humanoid, string slotName)
		{
			return customSlotItemData[humanoid] != null && customSlotItemData[humanoid].ContainsKey(slotName);
		}

		public static bool IsSlotOccupied(Humanoid humanoid, string slotName)
		{
			return customSlotItemData[humanoid] != null && customSlotItemData[humanoid].ContainsKey(slotName) && customSlotItemData[humanoid][slotName] != null;
		}

		public static void ApplyCustomSlotItem(GameObject prefab, string slotName)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)prefab.GetComponent<VB_CustomSlotItem>()))
			{
				prefab.AddComponent<VB_CustomSlotItem>();
			}
			prefab.GetComponent<VB_CustomSlotItem>().m_slotName = slotName;
			prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_itemType = (ItemType)0;
		}
	}
	internal class VB_CustomSlotItem : MonoBehaviour
	{
		[HarmonyPatch]
		public class Patches
		{
			[HarmonyPatch]
			public class PatchSlot
			{
				[HarmonyPostfix]
				[HarmonyPatch(typeof(ZNetScene), "Awake")]
				private static void PrefabPostfix(ref ZNetScene __instance)
				{
					VB_CustomSlotManager.ApplyCustomSlotItem(__instance.GetPrefab("Wishbone"), "wishbone");
					VB_CustomSlotManager.ApplyCustomSlotItem(__instance.GetPrefab("Demister"), "wisplight");
				}
			}

			[HarmonyPatch(typeof(ItemData), "IsEquipable")]
			[HarmonyPostfix]
			private static void IsEquipablePostfix(ref bool __result, ref ItemData __instance)
			{
				__result = __result || VB_CustomSlotManager.IsCustomSlotItem(__instance);
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Humanoid), "Awake")]
			private static void HumanoidEntryPostfix(ref Humanoid __instance)
			{
				VB_CustomSlotManager.customSlotItemData[__instance] = new Dictionary<string, ItemData>();
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Player), "Load")]
			private static void InventoryLoadPostfix(ref Player __instance)
			{
				foreach (ItemData equippedItem in ((Humanoid)__instance).m_inventory.GetEquippedItems())
				{
					if (VB_CustomSlotManager.IsCustomSlotItem(equippedItem))
					{
						string customSlotName = VB_CustomSlotManager.GetCustomSlotName(equippedItem);
						VB_CustomSlotManager.SetSlotItem((Humanoid)(object)__instance, customSlotName, equippedItem);
					}
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Humanoid), "EquipItem")]
			private static void EquipItemPostfix(ref bool __result, ref Humanoid __instance, ItemData item, bool triggerEquipEffects = true)
			{
				if (__result && VB_CustomSlotManager.IsCustomSlotItem(item))
				{
					string customSlotName = VB_CustomSlotManager.GetCustomSlotName(item);
					if (VB_CustomSlotManager.IsSlotOccupied(__instance, customSlotName))
					{
						__instance.UnequipItem(VB_CustomSlotManager.GetSlotItem(__instance, customSlotName), triggerEquipEffects);
					}
					VB_CustomSlotManager.SetSlotItem(__instance, customSlotName, item);
					if (__instance.IsItemEquiped(item))
					{
						item.m_equipped = true;
					}
					__instance.SetupEquipment();
					if (triggerEquipEffects)
					{
						__instance.TriggerEquipEffect(item);
					}
					__result = true;
				}
			}

			[HarmonyPatch(typeof(Humanoid), "UnequipItem")]
			[HarmonyPostfix]
			private static void UnequipItemPostfix(ref Humanoid __instance, ItemData item, bool triggerEquipEffects = true)
			{
				if (VB_CustomSlotManager.IsCustomSlotItem(item))
				{
					string customSlotName = VB_CustomSlotManager.GetCustomSlotName(item);
					if (item == VB_CustomSlotManager.GetSlotItem(__instance, customSlotName))
					{
						VB_CustomSlotManager.SetSlotItem(__instance, customSlotName, null);
					}
					__instance.UpdateEquipmentStatusEffects();
				}
			}

			[HarmonyPatch(typeof(Humanoid), "IsItemEquiped")]
			[HarmonyPostfix]
			private static void IsItemEquipedPostfix(ref bool __result, ref Humanoid __instance, ItemData item)
			{
				if (VB_CustomSlotManager.IsCustomSlotItem(item))
				{
					string customSlotName = VB_CustomSlotManager.GetCustomSlotName(item);
					bool flag = VB_CustomSlotManager.DoesSlotExist(__instance, customSlotName) && VB_CustomSlotManager.GetSlotItem(__instance, customSlotName) == item;
					__result |= flag;
				}
			}

			[HarmonyPatch(typeof(Humanoid), "GetEquipmentWeight")]
			[HarmonyPostfix]
			private static void GetEquipmentWeightPostfix(ref float __result, ref Humanoid __instance)
			{
				foreach (string key in VB_CustomSlotManager.customSlotItemData[__instance].Keys)
				{
					if (VB_CustomSlotManager.IsSlotOccupied(__instance, key))
					{
						__result += VB_CustomSlotManager.GetSlotItem(__instance, key).m_shared.m_weight;
					}
				}
			}

			[HarmonyPatch(typeof(Humanoid), "UnequipAllItems")]
			[HarmonyPostfix]
			private static void UnequipAllItemsPostfix(ref Humanoid __instance)
			{
				foreach (string item in VB_CustomSlotManager.customSlotItemData[__instance].Keys.ToList())
				{
					if (VB_CustomSlotManager.IsSlotOccupied(__instance, item))
					{
						__instance.UnequipItem(VB_CustomSlotManager.GetSlotItem(__instance, item), false);
					}
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(Humanoid), "GetSetCount")]
			private static void GetSetCountPostfix(ref int __result, ref Humanoid __instance, string setName)
			{
				foreach (string item in VB_CustomSlotManager.customSlotItemData[__instance].Keys.ToList())
				{
					if (VB_CustomSlotManager.IsSlotOccupied(__instance, item) && VB_CustomSlotManager.GetSlotItem(__instance, item).m_shared.m_setName == setName)
					{
						__result++;
					}
				}
			}

			public static HashSet<StatusEffect> GetStatusEffectsFromCustomSlotItems(Humanoid __instance)
			{
				HashSet<StatusEffect> hashSet = new HashSet<StatusEffect>();
				foreach (string key in VB_CustomSlotManager.customSlotItemData[__instance].Keys)
				{
					if (VB_CustomSlotManager.IsSlotOccupied(__instance, key))
					{
						if (Object.op_Implicit((Object)(object)VB_CustomSlotManager.GetSlotItem(__instance, key).m_shared.m_equipStatusEffect))
						{
							StatusEffect equipStatusEffect = VB_CustomSlotManager.GetSlotItem(__instance, key).m_shared.m_equipStatusEffect;
							hashSet.Add(equipStatusEffect);
						}
						if (__instance.HaveSetEffect(VB_CustomSlotManager.GetSlotItem(__instance, key)))
						{
							StatusEffect setStatusEffect = VB_CustomSlotManager.GetSlotItem(__instance, key).m_shared.m_setStatusEffect;
							hashSet.Add(setStatusEffect);
						}
					}
				}
				return hashSet;
			}

			[HarmonyPatch(typeof(Humanoid), "UpdateEquipmentStatusEffects")]
			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> UpdateEquipmentStatusEffectsTranspiler(IEnumerable<CodeInstruction> instructions)
			{
				List<CodeInstruction> codes = instructions.ToList();
				if (codes[0].opcode != OpCodes.Newobj || codes[1].opcode != OpCodes.Stloc_0)
				{
					throw new Exception("CustomSlotItemLib Transpiler injection point NOT found!! Game has most likely updated and broken this mod!");
				}
				yield return codes[0];
				yield return codes[1];
				yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
				yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
				yield return CodeInstruction.Call(typeof(Patches), "GetStatusEffectsFromCustomSlotItems", (Type[])null, (Type[])null);
				yield return CodeInstruction.Call(typeof(HashSet<StatusEffect>), "UnionWith", (Type[])null, (Type[])null);
				for (int i = 2; i < codes.Count; i++)
				{
					yield return codes[i];
				}
			}
		}

		public string m_slotName;
	}
	[BepInPlugin("VitByr.VBQOL", "VBQOL", "0.2.2")]
	internal class VBQOL : BaseUnityPlugin
	{
		public enum TabPositions
		{
			Left,
			Middle,
			Right
		}

		[HarmonyPatch]
		public static class Patches
		{
			[HarmonyPrefix]
			[HarmonyPatch(typeof(Character), "IsSwimming")]
			public static bool IsSwimming_Prefix(Humanoid __instance, float ___m_swimTimer, ref bool __result)
			{
				if (___m_swimTimer >= 0.5f)
				{
					return true;
				}
				StackTrace stackTrace = new StackTrace();
				string text = "";
				for (int i = 2; i < stackTrace.FrameCount && i < 10; i++)
				{
					text = text + GeneralExtensions.FullDescription(stackTrace.GetFrame(i).GetMethod()) + "_";
				}
				if (!((Character)__instance).IsPlayer() || (!text.Contains("UpdateEquipment") && !text.Contains("EquipItem")))
				{
					return true;
				}
				if ((__instance.GetRightItem() != null && !EiW_Custom.Value.Split(',').Contains(((Object)__instance.GetRightItem().m_dropPrefab).name)) || (__instance.GetLeftItem() != null && !EiW_Custom.Value.Split(',').Contains(((Object)__instance.GetLeftItem().m_dropPrefab).name)))
				{
					__instance.HideHandItems();
				}
				return false;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(Humanoid), "EquipItem")]
			private static void EquipItem_Prefix()
			{
			}

			[HarmonyPatch(typeof(Humanoid), "UpdateEquipment")]
			[HarmonyPrefix]
			private static void UpdateEquipment_Prefix()
			{
			}
		}

		[CompilerGenerated]
		[Embedded]
		internal sealed class EmbeddedAttribute : Attribute
		{
		}

		[CompilerGenerated]
		[Embedded]
		[AttributeUsage(AttributeTargets.Module)]
		internal sealed class RefSafetyRulesAttribute : Attribute
		{
			public readonly int Version;

			public RefSafetyRulesAttribute(int A_1)
			{
				Version = A_1;
			}
		}

		[HarmonyPatch(typeof(ZNet), "Start")]
		private static class FejdStartup_Start_Patch
		{
			[UsedImplicitly]
			private static void Postfix()
			{
				if (IsServer)
				{
					Application.targetFrameRate = ((BaseUnityPlugin)self).Config.Bind<int>("01 - General", "Target_FPS", Application.targetFrameRate, "Целевой FPS").Value;
				}
			}
		}

		[HarmonyPatch]
		private static class PatchMethods
		{
			[HarmonyTargetMethods]
			private static IEnumerable<MethodBase> Target()
			{
				yield return AccessTools.Method(typeof(ZSteamSocket), "Send", new Type[1] { typeof(ZPackage) }, (Type[])null);
				yield return AccessTools.Method(typeof(ZSteamSocket), "Flush", (Type[])null, (Type[])null);
				yield return AccessTools.Method(typeof(ZSteamSocket), "Update", (Type[])null, (Type[])null);
			}

			[HarmonyTranspiler]
			private static IEnumerable<CodeInstruction> FixingIssue(IEnumerable<CodeInstruction> code)
			{
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Expected O, but got Unknown
				List<CodeInstruction> list = new List<CodeInstruction>(code);
				MethodInfo methodInfo = AccessTools.Method(typeof(VBQOL), IsServer ? "Replacement_Server" : "Replacement_Client", (Type[])null, (Type[])null);
				MethodInfo targetMethod = AccessTools.Method(typeof(ZSteamSocket), "SendQueuedPackages", (Type[])null, (Type[])null);
				int num = list.FindIndex((CodeInstruction ins) => ins.opcode == OpCodes.Call && ins.operand == targetMethod);
				if (num == -1)
				{
					Logger.LogError((object)"VBQOL: Не удалось найти callvirt to ZSteamSocket.SendQueuedPackages");
					return list;
				}
				list[num] = new CodeInstruction(OpCodes.Call, (object)methodInfo);
				return list;
			}
		}

		private const string ModName = "VBQOL";

		private const string ModVersion = "0.2.2";

		private const string ModGUID = "VitByr.VBQOL";

		private Harmony harmony = new Harmony("VitByr.VBQOL");

		internal static VBQOL self;

		private static ConfigEntry<string> EiW_Custom;

		internal ConfigEntry<int> nomorecrashes;

		internal GameObject recycleObject;

		internal Button recycleButton;

		internal float width;

		private Vector3 craftingPos;

		internal ConfigEntry<TabPositions> tabPosition;

		internal ConfigEntry<float> resourceMultiplier;

		internal ConfigEntry<bool> preserveOriginalItem;

		internal ConfigEntry<string> recyclebuttontext;

		private static string ConfigFileName = "VitByr.VBQOL.cfg";

		private static string ConfigFileFullPath = Paths.ConfigPath + Path.DirectorySeparatorChar + ConfigFileName;

		private DateTime LastConfigChange;

		private static ConfigEntry<bool> serverConfigLocked = null;

		public Action OnConfigurationChanged;

		public static readonly ManualLogSource Logger = Logger.CreateLogSource("VBQOL");

		public readonly ConfigSync configSync = new ConfigSync("VBQOL")
		{
			DisplayName = "VBQOL",
			CurrentVersion = "0.2.2",
			MinimumRequiredVersion = "0.2.2"
		};

		private static ConfigEntry<float> Timeout { get; set; }

		private static bool IsServer => (int)SystemInfo.graphicsDeviceType == 4;

		internal bool InTabDeconstruct()
		{
			return !((Selectable)recycleButton).interactable;
		}

		private void Awake()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			self = this;
			Harmony.CreateAndPatchAll(typeof(VB_ClearLogPatch), (string)null);
			serverConfigLocked = config("01 - Awake", "Lock Configuration", value: true, new ConfigDescription("Вкл/ Выкл синхронизацию с сервером.", (AcceptableValueBase)null, Array.Empty<object>()));
			configSync.AddLockingConfigEntry<bool>(serverConfigLocked);
			nomorecrashes = config("01 - General", "Target_FPS", Application.targetFrameRate, "Целевой FPS", synchronizedSetting: false);
			Timeout = config("01 - General", "Timeout", 90f, "Время ожидания в секундах");
			VB_AddAllFuel.AFModifierKeyConfig = config<KeyCode>("02 - AddAllFuel", "AFModifierKey", (KeyCode)304, "Клавиша для добавления сразу стака в печь/ плавильню.", synchronizedSetting: false);
			VB_AddAllFuel.AFTextConfig = config("02 - AddAllFuel", "AF_Extinguish_Text", "Добавить стак", "Текст отображаемый при наведении печь/костер", synchronizedSetting: false);
			VB_BuildDamage.enableModBDConfig = config("03 - BuildDamage", "BD_Enable_Section", value: true, "Включите или отключите этот раздел");
			VB_BuildDamage.creatorDamageMultConfig = config("03 - BuildDamage", "BD_CreatorDamageMult", 0.75f, "Множитель урона от создателя постройки");
			VB_BuildDamage.nonCreatorDamageMultConfig = config("03 - BuildDamage", "BD_NonCreatorDamageMult", 0.05f, "Множитель урона от не создателя постройки");
			VB_BuildDamage.uncreatedDamageMultConfig = config("03 - BuildDamage", "BD_UncreatedDamageMult", 0.75f, "Множитель урона постройкам не созданным игроком");
			VB_BuildDamage.naturalDamageMultConfig = config("03 - BuildDamage", "BD_NaturalDamageMult", 0.75f, "Множитель урона от погоды и монстров.");
			VB_BetterPickupNotifications.MessageLifetime = config("04 - BetterPickupNotifications", "BPN_MessageLifetime", 4f, "Как долго уведомление отображается в HUD, прежде чем исчезнуть", synchronizedSetting: false);
			VB_BetterPickupNotifications.MessageFadeTime = config("04 - BetterPickupNotifications", "BPN_MessageFadeTime", 2f, "Как долго исчезают уведомления", synchronizedSetting: false);
			VB_BetterPickupNotifications.MessageBumpTime = config("04 - BetterPickupNotifications", "BPN_MessageBumpTime", 2f, "Сколько времени добавлять к сроку действия уведомления при получении дублирующегося элемента", synchronizedSetting: false);
			VB_BetterPickupNotifications.ResetMessageTimerOnDupePickup = config("04 - BetterPickupNotifications", "BPN_ResetMessageTimerOnDupePickup", value: false, "Сбрасывает таймер уведомления на максимальное время жизни при получении дублирующегося предмета", synchronizedSetting: false);
			VB_BetterPickupNotifications.MessageVerticalSpacingModifier = config("04 - BetterPickupNotifications", "BPN_MessageVerticalSpacingModifier", 1.25f, "Вертикальное разделение между сообщениями");
			VB_BetterPickupNotifications.MessageTextHorizontalSpacingModifier = config("04 - BetterPickupNotifications", "BPN_MessageTextHorizontalSpacingModifier", 2f, "Горизонтальный интервал между иконкой и текста уведомлений", synchronizedSetting: false);
			VB_BetterPickupNotifications.MessageTextVerticalModifier = config("04 - BetterPickupNotifications", "BPN_MessageTextVerticalModifier", 1f, "Вертикальное выравнивание текста уведомлений", synchronizedSetting: false);
			EiW_Custom = config("05 - EquipInWater", "EiW_Custom", "KnifeFlint,KnifeCopper,KnifeChitin,KnifeSilver,KnifeBlackMetal,KnifeButcher,KnifeSkollAndHati,SpearFlint,SpearBronze,SpearElderbark,SpearWolfFang,SpearChitin,SpearCarapace,PickaxeAntler,PickaxeBronze,PickaxeIron,PickaxeBlackMetal,Hammer,Hoe,FistFenrirClaw", "Разрешить использовать оружие/инструмент в воде");
			VB_FirePlaceUtilites.extinguishItemsConfig = config("06 - EnableFire", "EF_Enable", value: true, "Вкл/Выкл секцию");
			VB_FirePlaceUtilites.extinguishStringConfig = config("06 - EnableFire", "EF_Extinguish_Fire_Text", "Тушить огонь", "Текст отображаемый при наведении курсора на огонь", synchronizedSetting: false);
			VB_FirePlaceUtilites.igniteStringConfig = config("06 - EnableFire", "EF_Ignite_Fire_Text", "Разжечь огонь", "Текст, отображаемый при наведении курсора на огонь, если тот потушен", synchronizedSetting: false);
			VB_FirePlaceUtilites.keyPOCodeStringConfig = config<KeyCode>("06 - EnableFire", "EF_Put_Out_Fire_Key", (KeyCode)308, "Клавиша чтобы потушить огонь.", synchronizedSetting: false);
			Type typeFromHandle = typeof(KeyCode);
			KeyCode value = VB_FirePlaceUtilites.keyPOCodeStringConfig.Value;
			VB_FirePlaceUtilites.configPOKey = (KeyCode)Enum.Parse(typeFromHandle, ((object)(KeyCode)(ref value)).ToString());
			tabPosition = config("07 - Recycle", "R_TabPosition", TabPositions.Left, "Положение вкладки Разобрать в меню крафта. (Требуется перезапуск)", synchronizedSetting: false);
			resourceMultiplier = config("07 - Recycle", "R_ResourceMultiplier", 0.35f, "Количество ресурсов, возвращаемых в результате разбора (от 0 до 1, где 1 возвращает 100% ресурсов, а 0 - 0%)");
			preserveOriginalItem = config("07 - Recycle", "R_PreserveOriginalItem", value: true, "Сохранять ли данные оригинального предмета при понижении уровня. Полезно для модов, добавляющих дополнительные свойства к предметам, например EpicLoot.\nОтключите, если возникли проблемы.");
			recyclebuttontext = config("07 - Recycle", "R_RecycleButtonText", "Разобрать", "Текст кнопки в меню крафта", synchronizedSetting: false);
			QualitySettings.softParticles = false;
			QualitySettings.particleRaycastBudget = 1024;
			QualitySettings.softVegetation = false;
			QualitySettings.streamingMipmapsMemoryBudget = 4096f;
			SetupWatcher();
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_AddAllFuel), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_Swampkey), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_BlastFurnaceTalesAll), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_FeedFromHandPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_Pickable_UpdateRespawn_Patch), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_SlopeDamagePatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_SnakeCameraPatch), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_Timeout_Patch), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_CraftingStationLevelRange), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_AshLandsFix), (string)null);
			Harmony.CreateAndPatchAll(typeof(VB_WardPatch), (string)null);
		}

		public static int GetModifiedAmount(int quality, Requirement requirement)
		{
			return (int)Math.Round(self.resourceMultiplier.Value * (float)requirement.GetAmount(quality), 0);
		}

		public static bool HaveEmptySlotsForRecipe(Inventory inventory, Recipe recipe, int quality)
		{
			int emptySlots = inventory.GetEmptySlots();
			int num = 0;
			Requirement[] resources = recipe.m_resources;
			foreach (Requirement requirement in resources)
			{
				if (GetModifiedAmount(quality, requirement) > 0)
				{
					num++;
				}
			}
			if (emptySlo