Decompiled source of Skill Cap Mod v2.0.11

ValheimSkillCapMod.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ValheimSkillCapMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValheimSkillCapMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("19F0E6BA-DE2B-4504-9801-0F9360E3D9EB")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MyBepInExPlugin;

public class OverlayMap : MonoBehaviour
{
	private const float MinZoom = 0.005f;

	private const float MaxZoom = 1f;

	private const float FogRebuildInterval = 30f;

	private const float FogRebuildIntervalFallback = 2f;

	private const float FogApplyInterval = 0.5f;

	private const float PinSize = 24f;

	private static ConfigEntry<KeyCode> _toggleKey;

	private static ConfigEntry<float> _zoom;

	private static ConfigEntry<float> _alpha;

	private static ConfigEntry<float> _feather;

	private GameObject _root;

	private RawImage _mapImage;

	private Image _playerMarker;

	private RenderTexture _composite;

	private RawImage _fogMask;

	private Texture2D _fogMaskTexture;

	private Color32[] _fogPixels;

	private float _nextFogRebuild;

	private float _nextFogApply;

	private readonly List<Vector2Int> _fogDirtyTexels = new List<Vector2Int>();

	private Material _fogBundleMat;

	private static AssetBundle s_fogBundle;

	private RectTransform _pinLayer;

	private readonly List<Image> _pinPool = new List<Image>();

	private bool _built;

	private bool _visible;

	private static readonly FieldInfo PinsField = AccessTools.Field(typeof(Minimap), "m_pins");

	private static readonly FieldInfo SmallMarkerField = AccessTools.Field(typeof(Minimap), "m_smallMarker");

	private static readonly FieldInfo ExploredField = AccessTools.Field(typeof(Minimap), "m_explored");

	private static readonly FieldInfo ExploredOthersField = AccessTools.Field(typeof(Minimap), "m_exploredOthers");

	private static bool s_exploreAttempted;

	private static bool s_explorePatched;

	public static OverlayMap Instance { get; private set; }

	public static KeyCode ToggleKey => (KeyCode)((_toggleKey == null) ? 121 : ((int)_toggleKey.Value));

	public static float Zoom => (_zoom != null) ? _zoom.Value : 0.05f;

	public static float Alpha => (_alpha != null) ? _alpha.Value : 0.5f;

	public static float Feather => (_feather != null) ? _feather.Value : 3f;

	public static void BindConfig(ConfigFile config)
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		_toggleKey = config.Bind<KeyCode>("OverlayMap", "Toggle key", (KeyCode)121, "Key that shows/hides the overlay map");
		_zoom = config.Bind<float>("OverlayMap", "Zoom", 0.05f, new ConfigDescription("Fraction of the world map shown vertically (smaller = closer)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.005f, 1f), Array.Empty<object>()));
		_alpha = config.Bind<float>("OverlayMap", "Opacity", 0.5f, new ConfigDescription("Overlay opacity", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		_feather = config.Bind<float>("OverlayMap", "Fog feather", 2f, new ConfigDescription("Fog edge softness in map texels (needs the overlaymapfog bundle)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 8f), Array.Empty<object>()));
		_alpha.SettingChanged += delegate
		{
			if ((Object)(object)Instance != (Object)null && Instance._built)
			{
				Instance.ApplyAlpha();
			}
		};
		_feather.SettingChanged += delegate
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance._fogBundleMat != (Object)null)
			{
				Instance._fogBundleMat.SetFloat("_Feather", Feather);
			}
		};
	}

	public static void Create()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)Instance != (Object)null))
		{
			new GameObject("OverlayMapOverlay").AddComponent<OverlayMap>();
		}
	}

	private void Awake()
	{
		Instance = this;
	}

	private void OnDestroy()
	{
		if ((Object)(object)Instance == (Object)(object)this)
		{
			Instance = null;
		}
		if ((Object)(object)_fogMaskTexture != (Object)null)
		{
			Object.Destroy((Object)(object)_fogMaskTexture);
		}
		if ((Object)(object)_fogBundleMat != (Object)null)
		{
			Object.Destroy((Object)(object)_fogBundleMat);
		}
		if ((Object)(object)_composite != (Object)null)
		{
			_composite.Release();
		}
	}

	public static void ToggleVisible()
	{
		if ((Object)(object)Instance != (Object)null)
		{
			Instance.SetVisible(!Instance._visible);
		}
	}

	public static void SetZoom(float zoom)
	{
		if (_zoom != null)
		{
			_zoom.Value = Mathf.Clamp(zoom, 0.005f, 1f);
		}
	}

	public static void SetAlpha(float alpha)
	{
		if (_alpha != null)
		{
			_alpha.Value = Mathf.Clamp01(alpha);
		}
	}

	private void SetVisible(bool visible)
	{
		_visible = visible;
		if (_built)
		{
			_root.SetActive(visible);
		}
	}

	private void Update()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)Player.m_localPlayer == (Object)null || IsTextInputActive())
		{
			return;
		}
		if (Input.GetKeyDown(ToggleKey))
		{
			SetVisible(!_visible);
		}
		if (_visible)
		{
			if (Input.GetKeyDown((KeyCode)270) || Input.GetKeyDown((KeyCode)61))
			{
				SetZoom(Zoom / 1.3f);
			}
			if (Input.GetKeyDown((KeyCode)269) || Input.GetKeyDown((KeyCode)45))
			{
				SetZoom(Zoom * 1.3f);
			}
		}
	}

	private void LateUpdate()
	{
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0291: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: 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)
		if (!_visible || (!_built && !TryBuild()))
		{
			return;
		}
		Player localPlayer = Player.m_localPlayer;
		Minimap instance = Minimap.instance;
		bool flag = (Object)(object)localPlayer != (Object)null && (Object)(object)instance != (Object)null && !Minimap.IsOpen();
		_root.SetActive(flag);
		if (!flag)
		{
			return;
		}
		if (Time.unscaledTime >= _nextFogRebuild)
		{
			_nextFogRebuild = Time.unscaledTime + (s_explorePatched ? 30f : 2f);
			RebuildFogMask(instance);
			_fogDirtyTexels.Clear();
		}
		else if (_fogDirtyTexels.Count > 0 && Time.unscaledTime >= _nextFogApply)
		{
			_nextFogApply = Time.unscaledTime + 0.5f;
			foreach (Vector2Int fogDirtyTexel in _fogDirtyTexels)
			{
				Vector2Int current = fogDirtyTexel;
				_fogMaskTexture.SetPixel(((Vector2Int)(ref current)).x, ((Vector2Int)(ref current)).y, Color.white);
			}
			_fogDirtyTexels.Clear();
			_fogMaskTexture.Apply(false);
		}
		WorldToMapUV(((Component)localPlayer).transform.position, instance, out var mx, out var my);
		float zoom = Zoom;
		float num = Zoom * ((float)Screen.width / (float)Screen.height);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(mx - num * 0.5f, my - zoom * 0.5f, num, zoom);
		EnsureComposite();
		Material material = ((Graphic)instance.m_mapImageSmall).material;
		if ((Object)(object)material != (Object)null)
		{
			RenderTexture active = RenderTexture.active;
			RenderTexture.active = _composite;
			GL.PushMatrix();
			GL.LoadOrtho();
			DrawViewQuad(material, val);
			if ((Object)(object)_fogBundleMat != (Object)null)
			{
				DrawViewQuad(_fogBundleMat, val);
			}
			GL.PopMatrix();
			RenderTexture.active = active;
		}
		_fogMask.uvRect = val;
		if ((Object)(object)_playerMarker != (Object)null)
		{
			((Transform)((Graphic)_playerMarker).rectTransform).localEulerAngles = new Vector3(0f, 0f, 0f - ((Component)localPlayer).transform.eulerAngles.y);
		}
		SyncPins(instance, val);
	}

	private void SyncPins(Minimap map, Rect view)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		List<PinData> list = ((PinsField != null) ? (PinsField.GetValue(map) as List<PinData>) : null);
		int num = 0;
		if (list != null)
		{
			Rect rect = _pinLayer.rect;
			float width = ((Rect)(ref rect)).width;
			rect = _pinLayer.rect;
			float height = ((Rect)(ref rect)).height;
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 1f, Mathf.Clamp01(Alpha + 0.3f));
			foreach (PinData item in list)
			{
				if (item != null && !((Object)(object)item.m_icon == (Object)null))
				{
					WorldToMapUV(item.m_pos, map, out var mx, out var my);
					float num2 = (mx - ((Rect)(ref view)).x) / ((Rect)(ref view)).width;
					float num3 = (my - ((Rect)(ref view)).y) / ((Rect)(ref view)).height;
					if (!(num2 < -0.02f) && !(num2 > 1.02f) && !(num3 < -0.02f) && !(num3 > 1.02f))
					{
						Image pinImage = GetPinImage(num++);
						pinImage.sprite = item.m_icon;
						((Graphic)pinImage).color = color;
						((Graphic)pinImage).rectTransform.anchoredPosition = new Vector2(num2 * width, num3 * height);
					}
				}
			}
		}
		for (int i = num; i < _pinPool.Count; i++)
		{
			if (((Component)_pinPool[i]).gameObject.activeSelf)
			{
				((Component)_pinPool[i]).gameObject.SetActive(false);
			}
		}
	}

	private Image GetPinImage(int index)
	{
		//IL_0009: 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_0043: 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)
		while (_pinPool.Count <= index)
		{
			Image val = new GameObject("Pin").AddComponent<Image>();
			((Component)val).transform.SetParent((Transform)(object)_pinLayer, false);
			((Graphic)val).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)val).rectTransform;
			rectTransform.anchorMin = Vector2.zero;
			rectTransform.anchorMax = Vector2.zero;
			rectTransform.sizeDelta = new Vector2(24f, 24f);
			_pinPool.Add(val);
		}
		Image val2 = _pinPool[index];
		if (!((Component)val2).gameObject.activeSelf)
		{
			((Component)val2).gameObject.SetActive(true);
		}
		return val2;
	}

	private static bool IsTextInputActive()
	{
		return Console.IsVisible() || TextInput.IsVisible() || Minimap.InTextInput() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus());
	}

	private static void WorldToMapUV(Vector3 p, Minimap map, out float mx, out float my)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		float num = (float)map.m_textureSize / 2f;
		mx = (p.x / map.m_pixelSize + num) / (float)map.m_textureSize;
		my = (p.z / map.m_pixelSize + num) / (float)map.m_textureSize;
	}

	private void RebuildFogMask(Minimap map)
	{
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		bool[] array = ((ExploredField != null) ? (ExploredField.GetValue(map) as bool[]) : null);
		bool[] array2 = ((ExploredOthersField != null) ? (ExploredOthersField.GetValue(map) as bool[]) : null);
		if (array == null || (Object)(object)_fogMaskTexture == (Object)null)
		{
			return;
		}
		int num = map.m_textureSize * map.m_textureSize;
		if (array.Length >= num)
		{
			if (_fogPixels == null)
			{
				_fogPixels = (Color32[])(object)new Color32[num];
			}
			Color32 val = default(Color32);
			((Color32)(ref val))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)0, (byte)0, (byte)0, (byte)0);
			for (int i = 0; i < num; i++)
			{
				bool flag = array[i] || (array2 != null && array2[i]);
				_fogPixels[i] = (flag ? val : val2);
			}
			_fogMaskTexture.SetPixels32(_fogPixels);
			_fogMaskTexture.Apply(false);
		}
	}

	public static void TryPatchExploreMethods()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		if (s_exploreAttempted)
		{
			return;
		}
		s_exploreAttempted = true;
		try
		{
			Harmony val = new Harmony("skillcapmod.overlaymap.fog");
			HarmonyMethod val2 = new HarmonyMethod(AccessTools.Method(typeof(OverlayMap), "ExploredTexelPostfix", (Type[])null, (Type[])null));
			MethodInfo methodInfo = AccessTools.Method(typeof(Minimap), "Explore", new Type[2]
			{
				typeof(int),
				typeof(int)
			}, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Minimap), "ExploreOthers", new Type[2]
			{
				typeof(int),
				typeof(int)
			}, (Type[])null);
			if (methodInfo != null)
			{
				val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			if (methodInfo2 != null)
			{
				val.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
			s_explorePatched = methodInfo != null;
		}
		catch (Exception ex)
		{
			Main.logger.LogWarning((object)("OverlayMap: Explore patch failed, using periodic fog rebuild: " + ex.Message));
		}
	}

	private static void ExploredTexelPostfix(int __0, int __1, bool __result)
	{
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		if (__result)
		{
			OverlayMap instance = Instance;
			if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance._fogMaskTexture == (Object)null))
			{
				instance._fogDirtyTexels.Add(new Vector2Int(__0, __1));
			}
		}
	}

	private static Shader TryLoadFogBundleShader()
	{
		try
		{
			if ((Object)(object)s_fogBundle == (Object)null)
			{
				string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "", "overlaymapfog");
				if (!File.Exists(text))
				{
					return null;
				}
				s_fogBundle = AssetBundle.LoadFromFile(text);
			}
			if ((Object)(object)s_fogBundle == (Object)null)
			{
				return null;
			}
			Shader[] array = s_fogBundle.LoadAllAssets<Shader>();
			if (array == null || array.Length == 0)
			{
				return null;
			}
			if (!array[0].isSupported)
			{
				Main.logger.LogWarning((object)"OverlayMap: fog bundle shader not supported on this platform");
				return null;
			}
			return array[0];
		}
		catch (Exception ex)
		{
			Main.logger.LogWarning((object)("OverlayMap: fog bundle load failed: " + ex.Message));
			return null;
		}
	}

	private void EnsureComposite()
	{
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Expected O, but got Unknown
		if (!((Object)(object)_composite != (Object)null) || ((Texture)_composite).width != Screen.width || ((Texture)_composite).height != Screen.height)
		{
			if ((Object)(object)_composite != (Object)null)
			{
				_composite.Release();
			}
			_composite = new RenderTexture(Screen.width, Screen.height, 0);
			if ((Object)(object)_mapImage != (Object)null)
			{
				_mapImage.texture = (Texture)(object)_composite;
			}
		}
	}

	private static void DrawViewQuad(Material material, Rect view)
	{
		material.SetPass(0);
		GL.Begin(7);
		GL.TexCoord2(((Rect)(ref view)).xMin, ((Rect)(ref view)).yMin);
		GL.Vertex3(0f, 0f, 0f);
		GL.TexCoord2(((Rect)(ref view)).xMax, ((Rect)(ref view)).yMin);
		GL.Vertex3(1f, 0f, 0f);
		GL.TexCoord2(((Rect)(ref view)).xMax, ((Rect)(ref view)).yMax);
		GL.Vertex3(1f, 1f, 0f);
		GL.TexCoord2(((Rect)(ref view)).xMin, ((Rect)(ref view)).yMax);
		GL.Vertex3(0f, 1f, 0f);
		GL.End();
	}

	private static void Stretch(RectTransform rect)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		rect.anchorMin = Vector2.zero;
		rect.anchorMax = Vector2.one;
		rect.offsetMin = Vector2.zero;
		rect.offsetMax = Vector2.zero;
	}

	private bool TryBuild()
	{
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Expected O, but got Unknown
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Expected O, but got Unknown
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Expected O, but got Unknown
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Expected O, but got Unknown
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0329: Unknown result type (might be due to invalid IL or missing references)
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		Minimap instance = Minimap.instance;
		if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_mapImageSmall == (Object)null || (Object)(object)((Graphic)instance.m_mapImageSmall).material == (Object)null)
		{
			return false;
		}
		Canvas val = ((Component)this).gameObject.AddComponent<Canvas>();
		val.renderMode = (RenderMode)0;
		val.sortingOrder = 100;
		EnsureComposite();
		_root = new GameObject("MapRoot", new Type[1] { typeof(RectTransform) });
		_root.transform.SetParent(((Component)this).transform, false);
		Stretch((RectTransform)_root.transform);
		_fogMask = new GameObject("ExploredMask").AddComponent<RawImage>();
		((Component)_fogMask).transform.SetParent(_root.transform, false);
		((Graphic)_fogMask).raycastTarget = false;
		Stretch(((Graphic)_fogMask).rectTransform);
		_fogMaskTexture = new Texture2D(instance.m_textureSize, instance.m_textureSize, (TextureFormat)4, false);
		((Texture)_fogMaskTexture).wrapMode = (TextureWrapMode)1;
		_fogMask.texture = (Texture)(object)_fogMaskTexture;
		Shader val2 = TryLoadFogBundleShader();
		if ((Object)(object)val2 != (Object)null)
		{
			_fogBundleMat = new Material(val2);
			_fogBundleMat.mainTexture = (Texture)(object)_fogMaskTexture;
			_fogBundleMat.SetFloat("_Feather", Feather);
			((Behaviour)_fogMask).enabled = false;
		}
		else
		{
			Mask val3 = ((Component)_fogMask).gameObject.AddComponent<Mask>();
			val3.showMaskGraphic = false;
		}
		_mapImage = new GameObject("MapImage").AddComponent<RawImage>();
		((Component)_mapImage).transform.SetParent(((Component)_fogMask).transform, false);
		_mapImage.texture = (Texture)(object)_composite;
		((Graphic)_mapImage).raycastTarget = false;
		Stretch(((Graphic)_mapImage).rectTransform);
		_pinLayer = (RectTransform)new GameObject("Pins", new Type[1] { typeof(RectTransform) }).transform;
		((Transform)_pinLayer).SetParent(_root.transform, false);
		Stretch(_pinLayer);
		RectTransform val4 = (RectTransform)((SmallMarkerField != null) ? /*isinst with value type is only supported in some contexts*/: null);
		Image val5 = (((Object)(object)val4 != (Object)null) ? ((Component)val4).GetComponent<Image>() : null);
		if ((Object)(object)val5 != (Object)null && (Object)(object)val5.sprite != (Object)null)
		{
			_playerMarker = new GameObject("PlayerMarker").AddComponent<Image>();
			((Component)_playerMarker).transform.SetParent(_root.transform, false);
			_playerMarker.sprite = val5.sprite;
			((Graphic)_playerMarker).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)_playerMarker).rectTransform;
			rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			rectTransform.sizeDelta = (Vector2)((val4.sizeDelta.x >= 1f) ? val4.sizeDelta : new Vector2(32f, 32f));
			rectTransform.anchoredPosition = Vector2.zero;
		}
		_built = true;
		ApplyAlpha();
		SetVisible(_visible);
		return true;
	}

	private void ApplyAlpha()
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		((Graphic)_mapImage).color = new Color(1f, 1f, 1f, Alpha);
		if ((Object)(object)_playerMarker != (Object)null)
		{
			((Graphic)_playerMarker).color = new Color(1f, 1f, 1f, Mathf.Clamp01(Alpha + 0.4f));
		}
	}
}
[HarmonyPatch]
public static class OverlayMapPatches
{
	[HarmonyPostfix]
	[HarmonyPatch(typeof(Minimap), "Awake")]
	private static void MinimapAwakePostfix()
	{
		OverlayMap.TryPatchExploreMethods();
		OverlayMap.Create();
	}
}
public class OverlayMapCommand : ConsoleCommand
{
	public override string Name => "dmap";

	public override string Help => "Toggle the overlay map";

	public override void Run(string[] args)
	{
		OverlayMap.ToggleVisible();
	}
}
public class OverlayMapZoomCommand : ConsoleCommand
{
	public override string Name => "dmap_zoom";

	public override string Help => "dmap_zoom [0.005-1]: fraction of the world map shown vertically (smaller = closer)";

	public override void Run(string[] args)
	{
		if (OverlayMapCommandUtils.TryParseFloatArg(args, out var value))
		{
			OverlayMap.SetZoom(value);
		}
		Main.logger.LogInfo((object)$"OverlayMap zoom: {OverlayMap.Zoom}");
	}
}
public class OverlayMapAlphaCommand : ConsoleCommand
{
	public override string Name => "dmap_alpha";

	public override string Help => "dmap_alpha [0-1]: overlay opacity";

	public override void Run(string[] args)
	{
		if (OverlayMapCommandUtils.TryParseFloatArg(args, out var value))
		{
			OverlayMap.SetAlpha(value);
		}
		Main.logger.LogInfo((object)$"OverlayMap alpha: {OverlayMap.Alpha}");
	}
}
internal static class OverlayMapCommandUtils
{
	public static bool TryParseFloatArg(string[] args, out float value)
	{
		value = 0f;
		bool result = false;
		foreach (string s in args)
		{
			if (float.TryParse(s, NumberStyles.Float, CultureInfo.InvariantCulture, out var result2))
			{
				value = result2;
				result = true;
			}
		}
		return result;
	}
}
[BepInPlugin("Lelouis.Valheim.SkillCapMod", "Skill_Cap_Mod", "2.0.11")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch]
	private static class ChangeRaiseSkillMethod
	{
		public static Player vagonUser;

		public static bool hasDoubleJumped = false;

		public static bool grantInvuln = false;

		public static int invulnTimer = 0;

		public static bool timerGoesDown = false;

		public static float moveTimer;

		public static bool canBeInvisible;

		public static HashSet<string> autoPickables = new HashSet<string> { "Pickable_Dandelion(Clone)", "RaspberryBush(Clone)", "Pickable_Mushroom(Clone)", "BlueberryBush(Clone)", "Pickable_Thistle(Clone)", "Pickable_Mushroom_yellow(Clone)", "CloudberryBush(Clone)", "Pickable_Fiddlehead(Clone)", "Pickable_SmokePuff(Clone)", "LingonberryBush(Clone)" };

		private static Dictionary<int, StatusEffect> statusEffectDic = BuildStatusEffectDic();

		public const string RPCNAME_RPC_ApplyEffectsToOtherPlayers = "Lelouis";

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Skills), "RaiseSkill")]
		public static bool RaiseSkill(Skills __instance, SkillType skillType, float factor = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((int)skillType == 0)
			{
				return false;
			}
			float skillLevel = __instance.GetSkillLevel(skillType);
			float num = skillLevel;
			float num2 = num;
			if (num2 >= 10f && num2 < 20f)
			{
				if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_eikthyr"))
				{
					return false;
				}
			}
			else
			{
				float num3 = num2;
				if (num3 >= 20f && num3 < 30f)
				{
					if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_gdking"))
					{
						return false;
					}
				}
				else
				{
					float num4 = num2;
					if (num4 >= 30f && num4 < 40f)
					{
						if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_bonemass"))
						{
							return false;
						}
					}
					else
					{
						float num5 = num2;
						if (num5 >= 40f && num5 < 50f)
						{
							if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_dragon"))
							{
								return false;
							}
						}
						else
						{
							float num6 = num2;
							if (num6 >= 50f && num6 < 60f)
							{
								if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_goblinking"))
								{
									return false;
								}
							}
							else
							{
								float num7 = num2;
								if (num7 >= 60f && num7 < 75f)
								{
									if (!ZoneSystem.instance.GetGlobalKeys().Contains("defeated_queen"))
									{
										return false;
									}
								}
								else
								{
									float num8 = num2;
									if (num8 >= 75f && num8 < 100f && !ZoneSystem.instance.GetGlobalKeys().Contains("defeated_fader"))
									{
										return false;
									}
								}
							}
						}
					}
				}
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Skills), "OnDeath")]
		public static bool DoNotLowerSkills()
		{
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Vagon), "Update")]
		public static void RaiseCarrierSpeed(Vagon __instance)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			if (!(((Object)((Component)__instance).gameObject).name == "TurboCart(Clone)"))
			{
				return;
			}
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_attachedObject", BindingFlags.Instance | BindingFlags.NonPublic);
			GameObject val = (GameObject)field.GetValue(__instance);
			if ((Object)(object)val != (Object)null)
			{
				if ((Object)(object)vagonUser != (Object)(object)val.GetComponent<Player>())
				{
					vagonUser = val.GetComponent<Player>();
					((Character)vagonUser).m_runSpeed = 21f;
					((Character)vagonUser).m_walkSpeed = 12f;
				}
			}
			else if ((Object)(object)vagonUser != (Object)null)
			{
				((Character)vagonUser).m_runSpeed = 7f;
				((Character)vagonUser).m_walkSpeed = 4f;
				vagonUser = null;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(InventoryGui), "DoCrafting")]
		public static void AddBonusItem()
		{
			SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan();
			InventoryGui.instance.m_craftBonusChance = 0.25f;
			if (sEMan.GetStatusEffects().Count <= 0)
			{
				return;
			}
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (((Object)statusEffect).name == "SetEffect_ChefHat")
				{
					InventoryGui.instance.m_craftBonusChance = 0.5f;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CookingStation), "OnInteract")]
		public static void AddBonusItemCooking()
		{
			SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan();
			InventoryGui.instance.m_craftBonusChance = 0.25f;
			if (sEMan.GetStatusEffects().Count <= 0)
			{
				return;
			}
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (((Object)statusEffect).name == "SetEffect_ChefHat")
				{
					InventoryGui.instance.m_craftBonusChance = 0.5f;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "Awake")]
		public static void ChangeBossHP(Humanoid __instance)
		{
			if (((Object)__instance).name == "Eikthyr(Clone)")
			{
				((Character)__instance).m_health = 1000f;
			}
			if (((Object)__instance).name == "gd_king(Clone)")
			{
				((Character)__instance).m_health = 5000f;
			}
			if (((Object)__instance).name == "Bonemass(Clone)")
			{
				((Character)__instance).m_health = 10000f;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "Jump")]
		public static void DoubleJump(Character __instance)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			if (!hasDoubleJumped && !__instance.IsOnGround() && __instance.IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && __instance.GetSkillFactor((SkillType)100) >= 0.5f && ((Component)__instance).GetComponent<Player>().GetStamina() > 10f)
			{
				hasDoubleJumped = true;
				__instance.ForceJump(new Vector3(0f, 10f, 0f), true);
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_maxAirAltitude", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(__instance, __instance.GetHeight());
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "UpdateTeleport")]
		public static void InvulnAfterTP(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			if (((Character)__instance).IsTeleporting())
			{
				grantInvuln = true;
				invulnTimer = 300;
			}
			else if (grantInvuln && !((Character)__instance).IsTeleporting())
			{
				grantInvuln = false;
				timerGoesDown = true;
				__instance.SetGodMode(true);
				logger.LogInfo((object)"god mode = true");
			}
			if (timerGoesDown)
			{
				invulnTimer--;
				if (invulnTimer == 0)
				{
					timerGoesDown = false;
					__instance.SetGodMode(false);
					logger.LogInfo((object)"god mode = false");
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "ApplyDamage")]
		public static bool TrueGodMode(Character __instance)
		{
			if (__instance.InGodMode())
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "UpdateGroundContact")]
		public static void ResetDoubleJump(Character __instance)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && __instance.GetSkillFactor((SkillType)100) >= 0.3f)
			{
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_maxAirAltitude", BindingFlags.Instance | BindingFlags.NonPublic);
				float num = Mathf.Max(0f, (float)field.GetValue(__instance) - ((Component)__instance).transform.position.y);
				if (num < 8f)
				{
					SEMan sEMan = __instance.GetSEMan();
					sEMan.AddStatusEffect(newHaldorAssetBundle.LoadAsset<StatusEffect>("SetEffect_SlowFall"), false, 0, 0f, (short)(-1));
				}
			}
			if (__instance.IsPlayer() && __instance.IsOnGround() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				hasDoubleJumped = false;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "UpdateGroundContact")]
		public static void RemoveSlowFall(Character __instance)
		{
			if (!__instance.IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = __instance.GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			if (statusEffects.Count <= 0)
			{
				return;
			}
			bool flag = false;
			StatusEffect val = ScriptableObject.CreateInstance<StatusEffect>();
			foreach (StatusEffect item in statusEffects)
			{
				if (item.m_name == "SlowFall")
				{
					flag = true;
					val = item;
				}
			}
			if (flag)
			{
				sEMan.RemoveStatusEffect(val, false);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Character), "UpdateWalking")]
		public static void IncreaseSneakSpeed(Character __instance)
		{
			if (__instance.IsPlayer() && __instance.IsOnGround() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && !__instance.IsEncumbered() && __instance.GetSkillFactor((SkillType)101) >= 0.2f)
			{
				__instance.m_crouchSpeed = 4.5f;
			}
			else if (__instance.IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				__instance.m_crouchSpeed = 2f;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "BlockAttack")]
		public static void ActivateMagicShield(Humanoid __instance)
		{
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer) || !((Character)__instance).HaveEitr(10f) || !((Character)__instance).IsBlocking())
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			float num = 4f;
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (statusEffect.m_name == "Extended Buffing Range")
				{
					num = 8f;
				}
				if (statusEffect.m_name == "Magic Shield")
				{
					((Character)__instance).UseEitr(10f);
					if (ZNet.instance.GetServerPeer() != null)
					{
						logger.LogInfo((object)("local player ID is " + Player.m_localPlayer.GetPlayerID()));
						logger.LogInfo((object)("buff range is " + num));
						ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_ApplyEffectsToOtherPlayers", new object[3]
						{
							Player.m_localPlayer.GetPlayerID(),
							1,
							num
						});
					}
					else
					{
						logger.LogInfo((object)"no server found, using peer to peer RPC logic instead");
						logger.LogInfo((object)("local player ID is " + Player.m_localPlayer.GetPlayerID()));
						logger.LogInfo((object)("buff range is " + num));
						ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_ApplyEffectsToOtherPlayers", new object[3]
						{
							Player.m_localPlayer.GetPlayerID(),
							1,
							num
						});
					}
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "CustomFixedUpdate")]
		public static void Dive(Humanoid __instance)
		{
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			((Character)__instance).m_swimDepth = 2f;
			if (((Character)__instance).IsSwimming() && ((Character)__instance).IsBlocking() && ((Character)__instance).GetStaminaPercentage() > 0.01f && ((Character)__instance).GetSkillFactor((SkillType)103) >= 0.2f)
			{
				((Character)__instance).m_swimDepth = 10f;
				((Character)__instance).UseStamina(Mathf.Lerp(0.4f, 0.1f, ((Character)__instance).GetSkillFactor((SkillType)103)));
			}
			if (!((Character)__instance).IsSwimming())
			{
				return;
			}
			Inventory inventory = __instance.GetInventory();
			if (!inventory.ContainsItemByName("Empty Bucket"))
			{
				return;
			}
			List<ItemData> allItems = inventory.GetAllItems();
			List<ItemData> list = new List<ItemData>();
			foreach (ItemData item2 in allItems)
			{
				if (item2.m_shared.m_name == "Empty Bucket")
				{
					list.Add(item2);
				}
			}
			foreach (ItemData item3 in list)
			{
				CustomItem item = ItemManager.Instance.GetItem("WaterBucket");
				inventory.AddItem(item.ItemDrop.m_itemData.m_dropPrefab, item3.m_stack);
				inventory.RemoveItem("Empty Bucket", item3.m_stack, -1, true);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "GetStealthFactor")]
		public static void SetInvisible(Player __instance)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (((Character)__instance).GetSkillFactor((SkillType)101) >= 0.5f && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && ((Character)__instance).IsCrouching() && canBeInvisible)
			{
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_stealthFactor", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(__instance, 0f);
			}
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				goto IL_00a3;
			}
			if (!((Character)__instance).InDodge())
			{
				Vector3 velocity = ((Character)__instance).GetVelocity();
				if (!(((Vector3)(ref velocity)).magnitude > 0.01f))
				{
					goto IL_00a3;
				}
			}
			moveTimer = 180f;
			canBeInvisible = false;
			goto IL_00b5;
			IL_00b5:
			if (moveTimer <= 0f)
			{
				canBeInvisible = true;
			}
			return;
			IL_00a3:
			moveTimer -= 1f;
			goto IL_00b5;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "HideHandItems")]
		public static bool AttackWhileSwimming(Humanoid __instance)
		{
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Invalid comparison between Unknown and I4
			if (((Character)__instance).IsPlayer() && (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				int num = 0;
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_leftItem", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field.GetValue(__instance) == null)
				{
					num++;
				}
				type = ((object)__instance).GetType();
				field = type.GetField("m_rightItem", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field.GetValue(__instance) == null)
				{
					num++;
				}
				if (num == 2)
				{
					return false;
				}
				if (__instance.RightItem != null && (int)__instance.RightItem.m_shared.m_skillType == 2 && ((Character)__instance).GetSkillFactor((SkillType)103) >= 0.3f)
				{
					if (__instance.LeftItem != null)
					{
						__instance.UnequipItem(__instance.LeftItem, true);
					}
					return false;
				}
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(TombStone), "Start")]
		public static void ChangeCorpseRunWeight(TombStone __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			SE_Stats val = (SE_Stats)__instance.m_lootStatusEffect;
			val.m_addMaxCarryWeight = 700f;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "OnDeath")]
		public static void IncreaseWorldExp(Character __instance)
		{
			if (!__instance.IsBoss())
			{
				return;
			}
			if (ZNet.instance.GetServerPeer() != null)
			{
				logger.LogInfo((object)ZNet.instance.GetServerPeer());
				logger.LogInfo((object)ZNet.instance.GetServerPeer().m_uid);
				logger.LogInfo((object)ZNet.instance.GetServerPeer().m_playerID);
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_ChangeWorldExpModifier", new object[1] { ZNet.instance.GetServerPeer().m_uid });
			}
			else
			{
				logger.LogInfo((object)"No server instance found. Adding bonus as singleplayer.");
				if ((Object)(object)Player.m_localPlayer != (Object)null)
				{
					ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_ChangeWorldExpModifier", new object[1] { Player.m_localPlayer.GetPlayerID() });
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Game), "UpdateWorldRates")]
		public static void ForceSetWorldExpRate()
		{
			Game.m_skillGainRate = worldExpModifier.Value;
		}

		[HarmonyPatch(typeof(Trader), "Start")]
		[HarmonyPrefix]
		public static void SwapHaldor(Trader __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Expected O, but got Unknown
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Expected O, but got Unknown
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Expected O, but got Unknown
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039c: Expected O, but got Unknown
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Expected O, but got Unknown
			//IL_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Expected O, but got Unknown
			if (((Object)((Component)__instance).gameObject).name == "Haldor(Clone)")
			{
				TradeItem val = new TradeItem();
				val.m_price = 100;
				val.m_stack = 1;
				val.m_prefab = ItemManager.Instance.GetItem("newSurtlingCore").ItemDrop;
				val.m_requiredGlobalKey = GlobalKey.KilledEikthyr;
				val.m_tooltip = "It throbs with inner heat.";
				__instance.m_items.Add(val);
				TradeItem val2 = new TradeItem();
				val2.m_price = 50;
				val2.m_stack = 20;
				val2.m_prefab = ItemManager.Instance.GetItem("newMossyBait").ItemDrop;
				val2.m_requiredGlobalKey = GlobalKey.KilledEikthyr;
				val2.m_tooltip = "Dead trolls in the forest attract a fish or two, speed up the process with this bait!";
				__instance.m_items.Add(val2);
				TradeItem val3 = new TradeItem();
				val3.m_price = 100;
				val3.m_stack = 20;
				val3.m_prefab = ItemManager.Instance.GetItem("newStickyBait").ItemDrop;
				val3.m_requiredGlobalKey = GlobalKey.KilledElder;
				val3.m_tooltip = "It might smell foul, but the fish drawn to this bait are used to so much worse.";
				__instance.m_items.Add(val3);
				TradeItem val4 = new TradeItem();
				val4.m_price = 150;
				val4.m_stack = 20;
				val4.m_prefab = ItemManager.Instance.GetItem("newStingyBait").ItemDrop;
				val4.m_requiredGlobalKey = GlobalKey.KilledModer;
				val4.m_tooltip = "You're not immune to deathsquito bites, and the fish here aren't immune to this snack.";
				__instance.m_items.Add(val4);
				TradeItem val5 = new TradeItem();
				val5.m_price = 200;
				val5.m_stack = 20;
				val5.m_prefab = ItemManager.Instance.GetItem("newHeavyBait").ItemDrop;
				val5.m_requiredGlobalKey = GlobalKey.KilledTroll;
				val5.m_tooltip = "This bait sinks deep, deep enough to lure the fish swimming along the very bottom of the sea.";
				__instance.m_items.Add(val5);
				TradeItem val6 = new TradeItem();
				val6.m_price = 250;
				val6.m_stack = 20;
				val6.m_prefab = ItemManager.Instance.GetItem("newMistyBait").ItemDrop;
				val6.m_requiredGlobalKey = GlobalKey.KilledYagluth;
				val6.m_tooltip = "A bait to guide fish to you through shrouded waters.";
				__instance.m_items.Add(val6);
				TradeItem val7 = new TradeItem();
				val7.m_price = 300;
				val7.m_stack = 20;
				val7.m_prefab = ItemManager.Instance.GetItem("newHotBait").ItemDrop;
				val7.m_requiredGlobalKey = GlobalKey.KilledYagluth;
				val7.m_tooltip = "Some fish already like it where the waters are warm, and this bait brings the temperature close to boiling.";
				__instance.m_items.Add(val7);
				TradeItem val8 = new TradeItem();
				val8.m_price = 350;
				val8.m_stack = 20;
				val8.m_prefab = ItemManager.Instance.GetItem("newFrostyBait").ItemDrop;
				val8.m_requiredGlobalKey = GlobalKey.KilledYagluth;
				val8.m_tooltip = "It's not very nutritious, so the only fish that'll take this bait are the ones that are used to just eating ice.";
				__instance.m_items.Add(val8);
				TradeItem val9 = new TradeItem();
				val9.m_price = 400;
				val9.m_stack = 20;
				val9.m_prefab = ItemManager.Instance.GetItem("newColdBait").ItemDrop;
				val9.m_requiredGlobalKey = GlobalKey.KilledBonemass;
				val9.m_tooltip = "This bait doesn't look like much but its a treat to fish that live where it's cold and dark.";
				__instance.m_items.Add(val9);
				TradeItem val10 = new TradeItem();
				val10.m_prefab = ItemManager.Instance.GetItem("newFishingRod").ItemDrop;
				val10.m_price = 350;
				val10.m_stack = 1;
				val10.m_tooltip = "Standard issue dvergr fishing rod.";
				__instance.m_items[4] = val10;
				TradeItem val11 = new TradeItem();
				val11.m_price = 100;
				val11.m_stack = 3;
				val11.m_prefab = ItemManager.Instance.GetItem("newHoops").ItemDrop;
				val11.m_tooltip = "These metal rings are perfectly round, suitable for holding a barrel (or bucket) together. Just add wood!";
				__instance.m_items[8] = val11;
				TradeItem val12 = new TradeItem();
				val12.m_price = 620;
				val12.m_stack = 1;
				val12.m_prefab = ItemManager.Instance.GetItem("MiningHat").ItemDrop;
				val12.m_tooltip = "I am a dwarf and I'm digging a hole! Diggy diggy hole! Diggy diggy hole!";
				__instance.m_items[1] = val12;
				TradeItem val13 = new TradeItem();
				val13.m_price = 200;
				val13.m_stack = 1;
				val13.m_prefab = ItemManager.Instance.GetItem("newAxeEarly").ItemDrop;
				val13.m_requiredGlobalKey = GlobalKey.KilledEikthyr;
				val13.m_tooltip = "The metal glints oddly in the sunlight. Somehow, you know that it can never be complete on its own...";
				__instance.m_items.Add(val13);
				TradeItem val14 = new TradeItem();
				val14.m_price = 200;
				val14.m_stack = 1;
				val14.m_prefab = ItemManager.Instance.GetItem("newAxeCurious").ItemDrop;
				val14.m_requiredGlobalKey = GlobalKey.KilledEikthyr;
				val14.m_tooltip = "What battles has this weapon borne witness to? You cannot see its past, only shape its future...";
				__instance.m_items.Add(val14);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Tameable), "Interact")]
		public static void GiveMilk(Tameable __instance)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance.m_saddleItem != (Object)null) || !(__instance.m_saddleItem.m_itemData.m_shared.m_name == "$item_saddlelox"))
			{
				return;
			}
			Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 4f, -1, (QueryTriggerInteraction)1);
			if (array.Length == 0 || array == null)
			{
				return;
			}
			List<Player> list = new List<Player>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
				{
					list.Add(((Component)val).GetComponentInParent<Player>());
				}
			}
			foreach (Player item2 in list)
			{
				Inventory inventory = ((Humanoid)item2).GetInventory();
				if (!inventory.ContainsItemByName("Empty Bucket"))
				{
					continue;
				}
				List<ItemData> allItems = inventory.GetAllItems();
				List<ItemData> list2 = new List<ItemData>();
				foreach (ItemData item3 in allItems)
				{
					if (item3.m_shared.m_name == "Empty Bucket")
					{
						list2.Add(item3);
					}
				}
				foreach (ItemData item4 in list2)
				{
					CustomItem item = ItemManager.Instance.GetItem("MilkBucket");
					inventory.AddItem(item.ItemDrop.m_itemData.m_dropPrefab, item4.m_stack);
					inventory.RemoveItem("Empty Bucket", item4.m_stack, -1, true);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "UpdateCover")]
		public static void HasWaxedCape(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			if (statusEffects == null || statusEffects.Count <= 0)
			{
				return;
			}
			foreach (StatusEffect item in statusEffects)
			{
				if (item.m_name == "Waterproof" || item.m_name == "WaterproofSlowFall" || item.m_name == "WaterproofWindRun")
				{
					Type type = ((object)__instance).GetType();
					FieldInfo field = type.GetField("m_underRoof", BindingFlags.Instance | BindingFlags.NonPublic);
					field.SetValue(__instance, true);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Update")]
		public static void AutoPickBerries(Player __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			_ = ((Component)__instance).transform.position;
			if (((Character)__instance).GetSEMan() == null)
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			__instance.m_autoPickupRange = 2f;
			if (sEMan.GetStatusEffects().Count <= 0)
			{
				return;
			}
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (!(((Object)statusEffect).name == "SetEffect_GathererGloves"))
				{
					continue;
				}
				__instance.m_autoPickupRange = 4f;
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 4f, -1, (QueryTriggerInteraction)1);
				if (array.Length == 0 || array == null)
				{
					continue;
				}
				Collider[] array2 = array;
				foreach (Collider val in array2)
				{
					if ((Object)(object)((Component)val).GetComponentInParent<Pickable>() != (Object)null)
					{
						Pickable componentInParent = ((Component)val).GetComponentInParent<Pickable>();
						if (autoPickables.Contains(((Object)componentInParent).name))
						{
							componentInParent.Interact((Humanoid)(object)__instance, false, false);
						}
					}
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Aoe), "OnHit")]
		public static bool RemoveDuplicateHEaling(Aoe __instance)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.m_name == "Healing AoE")
			{
				Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 4f, -1, (QueryTriggerInteraction)1);
				if (array.Length != 0 && array != null)
				{
					List<Player> list = new List<Player>();
					Collider[] array2 = array;
					foreach (Collider val in array2)
					{
						if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
						{
							list.Add(((Component)val).GetComponentInParent<Player>());
						}
					}
					foreach (Player item in list)
					{
						SEMan sEMan = ((Character)item).GetSEMan();
						List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
						foreach (StatusEffect item2 in statusEffects)
						{
							if (item2.m_name == "Healing")
							{
								return false;
							}
						}
					}
				}
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "DoAreaAttack")]
		public static void ApplyAoEBuffs(Attack __instance)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			logger.LogInfo((object)"Area attack being done");
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_character", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field.GetValue(__instance).GetType() == typeof(Player)))
			{
				return;
			}
			Player val = (Player)field.GetValue(__instance);
			if (!((Object)(object)val == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)val).GetSEMan();
			float num = 4f;
			foreach (StatusEffect statusEffect in sEMan.GetStatusEffects())
			{
				if (statusEffect.m_name == "Extended Buffing Range")
				{
					num = 8f;
				}
			}
			if (__instance.GetWeapon().m_shared.m_name == "Odin's Tankard")
			{
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_RemoveEffectsFromOtherPlayers", new object[3]
				{
					val.GetPlayerID(),
					1,
					num
				});
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_ApplyEffectsToOtherPlayers", new object[3]
				{
					val.GetPlayerID(),
					1,
					num
				});
				((Character)val).RaiseSkill((SkillType)9, 1f);
			}
			if (__instance.GetWeapon().m_shared.m_name == "French Horn")
			{
				ZRoutedRpc.instance.InvokeRoutedRPC(0L, "RPC_ApplyEffectsToOtherPlayers", new object[3]
				{
					val.GetPlayerID(),
					5,
					num
				});
				((Character)val).RaiseSkill((SkillType)9, 1f);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Start")]
		public static void RemovePieceDuplicates()
		{
			if (PieceManager.Instance.GetPiece("Smelter") != null)
			{
				PieceManager.Instance.RemovePiece("Smelter");
			}
			if (PieceManager.Instance.GetPiece("cartCopy") != null)
			{
				PieceManager.Instance.RemovePiece("cartCopy");
			}
			if (PieceManager.Instance.GetPiece("roofCopy") != null)
			{
				PieceManager.Instance.RemovePiece("roofCopy");
			}
			if (PieceManager.Instance.GetPiece("woodDoorCopy") != null)
			{
				PieceManager.Instance.RemovePiece("woodDoorCopy");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Game), "Start")]
		public static void Remove5PlayersLimit(Game __instance)
		{
			__instance.m_difficultyScaleMaxPlayers = 99;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Pickable), "Awake")]
		public static void AddFarmingToDandelion(Pickable __instance)
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			if (((Object)((Component)__instance).gameObject).name == "Pickable_Dandelion(Clone)" || ((Object)((Component)__instance).gameObject).name == "Pickable_SmokePuff(Clone)" || ((Object)((Component)__instance).gameObject).name == "Pickable_Thistle(Clone)")
			{
				__instance.m_pickRaiseSkill = (SkillType)106;
			}
			if (((Object)((Component)__instance).gameObject).name == "Pickable_MeatPile(Clone)")
			{
				DropData item = new DropData
				{
					m_item = ZNetScene.instance.GetPrefab("RottenMeat"),
					m_weight = 0.8f,
					m_stackMin = 1,
					m_stackMax = 1
				};
				DropTable extraDrops = ((Component)__instance).GetComponent<Pickable>().m_extraDrops;
				extraDrops.m_dropMax = 4;
				extraDrops.m_drops.Add(item);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Dodge")]
		public static void RefillTorch(Player __instance)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			SE_Stats val = null;
			if (statusEffects.Count > 0)
			{
				foreach (StatusEffect item in statusEffects)
				{
					if (item.m_name == "Auto Replant Trees")
					{
						val = (SE_Stats)item;
					}
				}
			}
			if ((Object)(object)val != (Object)null)
			{
				sEMan.RemoveStatusEffect((StatusEffect)(object)val, false);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Humanoid), "UpdateEquipment")]
		public static void RefillTorch(Humanoid __instance)
		{
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			if (__instance.RightItem != null && __instance.RightItem.m_shared.m_useDurability && __instance.RightItem.m_shared.m_name == "Refillable Torch" && __instance.RightItem.m_durability <= 1f)
			{
				Inventory inventory = __instance.GetInventory();
				if (inventory.ContainsItemByName("$item_resin"))
				{
					inventory.RemoveItem("$item_resin", 1, -1, true);
					__instance.RightItem.m_durability = 20f;
				}
			}
			if (__instance.LeftItem != null && __instance.LeftItem.m_shared.m_useDurability && __instance.LeftItem.m_shared.m_name == "Refillable Torch" && __instance.LeftItem.m_durability <= 10f)
			{
				Inventory inventory2 = __instance.GetInventory();
				if (inventory2.ContainsItemByName("$item_resin"))
				{
					inventory2.RemoveItem("$item_resin", 1, -1, true);
					__instance.LeftItem.m_durability = 20f;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Humanoid), "UpdateEquipment")]
		public static void ChangeReloadSpeed(Humanoid __instance)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Invalid comparison between Unknown and I4
			if (!((Character)__instance).IsPlayer() || !((Object)(object)__instance == (Object)(object)Player.m_localPlayer))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			foreach (StatusEffect item in statusEffects)
			{
				if (item.m_name == "Improved Realoding Speed" && __instance.LeftItem != null && (int)__instance.LeftItem.m_shared.m_skillType == 14)
				{
					__instance.LeftItem.m_shared.m_attack.m_reloadTime = 1.75f;
					return;
				}
			}
			if (__instance.LeftItem != null && (int)__instance.LeftItem.m_shared.m_skillType == 14)
			{
				__instance.LeftItem.m_shared.m_attack.m_reloadTime = 3.5f;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ZNet), "SetPublicReferencePosition")]
		public static bool ForcePublic(ZNet __instance)
		{
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_publicReferencePosition", BindingFlags.Instance | BindingFlags.NonPublic);
			field.SetValue(__instance, true);
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "ProjectileAttackTriggered")]
		public static void ShootSecondProjectile(Attack __instance)
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_ammoItem", BindingFlags.Instance | BindingFlags.NonPublic);
			if (field.GetValue(__instance) == null || !(field.GetValue(__instance).GetType() == typeof(ItemData)))
			{
				return;
			}
			ItemData val = (ItemData)field.GetValue(__instance);
			if ((int)__instance.m_attackType != 2 || (int)val.m_shared.m_skillType != 8)
			{
				return;
			}
			type = ((object)__instance).GetType();
			field = type.GetField("m_character", BindingFlags.Instance | BindingFlags.NonPublic);
			if (!(field.GetValue(__instance).GetType() == typeof(Player)))
			{
				return;
			}
			Player val2 = (Player)field.GetValue(__instance);
			if ((Object)(object)val2 == (Object)(object)Player.m_localPlayer)
			{
				Random random = new Random();
				if (((Character)val2).GetSkillFactor((SkillType)8) >= 0.5f && random.Next(10) < 1)
				{
					MethodInfo method = typeof(Attack).GetMethod("FireProjectileBurst", BindingFlags.Instance | BindingFlags.NonPublic);
					method.Invoke(__instance, Array.Empty<object>());
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Projectile), "SpawnOnHit")]
		public static bool SpearRaycast(Projectile __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			if ((int)__instance.m_type == 64)
			{
				ItemDrop component = Object.Instantiate<GameObject>(__instance.m_spawnItem.m_dropPrefab, ((Component)__instance).transform.position + ((Component)__instance).transform.TransformDirection(__instance.m_spawnOffset), Quaternion.identity).GetComponent<ItemDrop>();
				component.m_itemData = __instance.m_spawnItem.Clone();
				if (component.m_itemData.m_quality > 1)
				{
					component.SetQuality(component.m_itemData.m_quality);
				}
				bool flag = true;
				component.m_itemData.m_stack = 1;
				if (component.m_onDrop != null)
				{
					component.m_onDrop(component);
				}
				Type type = ((object)__instance).GetType();
				FieldInfo field = type.GetField("m_owner", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field.GetValue(__instance).GetType() == typeof(Player))
				{
					object? value = field.GetValue(__instance);
					Player val = (Player)((value is Player) ? value : null);
					if ((Object)(object)val == (Object)(object)Player.m_localPlayer && ((Character)val).GetSkillFactor((SkillType)5) >= 0.3f)
					{
						LineRenderer val2 = ((Component)component).gameObject.AddComponent<LineRenderer>();
						val2.positionCount = 2;
						Vector3 val3 = default(Vector3);
						((Vector3)(ref val3))..ctor(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y + 5f, ((Component)__instance).transform.position.z);
						Vector3 val4 = default(Vector3);
						((Vector3)(ref val4))..ctor(((Component)__instance).transform.position.x, ((Component)__instance).transform.position.y - 100f, ((Component)__instance).transform.position.z);
						Vector3[] positions = (Vector3[])(object)new Vector3[2] { val3, val4 };
						val2.SetPositions(positions);
						val2.SetPositions(positions);
						Material material = ((Component)PieceManager.Instance.GetPiece("SuperchargedSmelter").PiecePrefab.transform.Find("_enabled/smoke (1)")).GetComponent<Renderer>().material;
						((Renderer)val2).material.shader = material.shader;
						((Renderer)val2).material.color = new Color(1f, 1f, 1f, 0.25f);
						val2.widthMultiplier = 0.5f;
					}
				}
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "CheckRun")]
		public static void ActivateSecondWind(Player __instance)
		{
			if (!((Object)(object)__instance == (Object)(object)Player.m_localPlayer) || !(((Character)__instance).GetSkillFactor((SkillType)102) >= 0.4f) || ((Character)__instance).HaveStamina(0f))
			{
				return;
			}
			SEMan sEMan = ((Character)__instance).GetSEMan();
			List<StatusEffect> statusEffects = sEMan.GetStatusEffects();
			if (statusEffects != null && statusEffects.Count > 0)
			{
				foreach (StatusEffect item in statusEffects)
				{
					if (item.m_name == newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_SecondWind").m_name)
					{
						return;
					}
				}
			}
			sEMan.AddStatusEffect(newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_SecondWind"), false, 0, 0f, (short)(-1));
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DropOnDestroyed), "OnDestroyed")]
		public static void ReplantTree(DropOnDestroyed __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 2f, -1, (QueryTriggerInteraction)1);
			List<Player> list = new List<Player>();
			Collider[] array2 = array;
			foreach (Collider val in array2)
			{
				if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
				{
					list.Add(((Component)val).GetComponentInParent<Player>());
				}
			}
			bool flag = false;
			Player val2 = null;
			Inventory val3 = null;
			bool flag2 = false;
			foreach (Player item in list)
			{
				foreach (StatusEffect statusEffect in ((Character)item).GetSEMan().GetStatusEffects())
				{
					if (statusEffect.m_name == "Auto Replant Trees")
					{
						flag2 = true;
					}
				}
				if (((Character)item).GetSkillFactor((SkillType)13) >= 0.3f && flag2)
				{
					flag = true;
					val2 = item;
					val3 = ((Humanoid)item).GetInventory();
					break;
				}
			}
			if (!flag)
			{
				return;
			}
			switch (((Object)__instance).name)
			{
			case "Beech_Stub(Clone)":
				if (val3.ContainsItemByName("$item_beechseeds"))
				{
					val3.RemoveItem("$item_beechseeds", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("Beech_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "BirchStub(Clone)":
				if (val3.ContainsItemByName("$item_birchseeds"))
				{
					val3.RemoveItem("$item_birchseeds", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("Birch_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "OakStub(Clone)":
				if (val3.ContainsItemByName("$item_oakseeds"))
				{
					val3.RemoveItem("$item_oakseeds", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("Oak_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "FirTree_Stub(Clone)":
				if (val3.ContainsItemByName("$item_fircone"))
				{
					val3.RemoveItem("$item_fircone", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("FirTree_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			case "Pinetree_01_Stub(Clone)":
				if (val3.ContainsItemByName("$item_pinecone"))
				{
					val3.RemoveItem("$item_pinecone", 1, -1, true);
					Object.Instantiate<GameObject>(PrefabManager.Instance.GetPrefab("PineTree_Sapling"), ((Component)__instance).transform.position, Quaternion.identity);
					((Character)val2).RaiseSkill((SkillType)106, 1f);
				}
				break;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Beehive), "RPC_Extract")]
		public static void GenerateWax(Beehive __instance)
		{
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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)
			CustomItem item = ItemManager.Instance.GetItem("wax");
			ItemDrop itemDrop = item.ItemDrop;
			Random random = new Random();
			MethodInfo method = typeof(Beehive).GetMethod("GetHoneyLevel", BindingFlags.Instance | BindingFlags.NonPublic);
			int num = (int)method.Invoke(__instance, Array.Empty<object>());
			if (num <= 0)
			{
				return;
			}
			for (int i = 0; i < num; i++)
			{
				if (random.Next(10) == 0)
				{
					__instance.m_spawnEffect.Create(__instance.m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1, default(ZDOID));
					Vector3 position = __instance.m_spawnPoint.position;
					ItemDrop component = ((Component)Object.Instantiate<ItemDrop>(itemDrop, position, Quaternion.identity)).GetComponent<ItemDrop>();
					if ((Object)(object)component != (Object)null)
					{
						component.SetStack(Game.instance.ScaleDrops(item.ItemDrop.m_itemData, 1));
					}
				}
			}
		}

		private static Dictionary<int, StatusEffect> BuildStatusEffectDic()
		{
			try
			{
				return new Dictionary<int, StatusEffect>
				{
					{
						1,
						newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_AttackBuff")
					},
					{ 2, attackBuff },
					{
						3,
						ItemManager.Instance.GetItem("WoodCopy1").ItemDrop.m_itemData.m_shared.m_attackStatusEffect
					},
					{
						4,
						(StatusEffect)(object)newHaldorAssetBundle.LoadAsset<SE_Stats>("StatusEffect_MagicShieldActivatedEffect")
					},
					{
						5,
						newHaldorAssetBundle.LoadAsset<StatusEffect>("StatusEffect_StaminaBoost")
					}
				};
			}
			catch (Exception ex)
			{
				logger.LogWarning((object)("statusEffectDic unavailable (assets not loaded): " + ex.Message));
				return new Dictionary<int, StatusEffect>();
			}
		}

		private static void RPC_ApplyEffectsToOtherPlayers(long sender, long receiver, int effects, float range)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			logger.LogInfo((object)("sender is " + sender));
			logger.LogInfo((object)("receiver is " + receiver));
			logger.LogInfo((object)("effects are " + effects));
			logger.LogInfo((object)("range is " + range));
			float num = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)Player.GetPlayer(receiver)).transform.position);
			logger.LogInfo((object)("local player position is " + ((object)((Component)Player.m_localPlayer).transform.position/*cast due to .constrained prefix*/).ToString()));
			logger.LogInfo((object)("casting player position is " + ((object)((Component)Player.GetPlayer(receiver)).transform.position/*cast due to .constrained prefix*/).ToString()));
			logger.LogInfo((object)("distance with player casting the effect is " + num));
			if (num < range)
			{
				switch (effects)
				{
				case 1:
					logger.LogInfo((object)("player is " + Player.m_localPlayer.GetPlayerID()));
					logger.LogInfo((object)("Trying to add " + statusEffectDic[3].m_name));
					logger.LogInfo((object)("Trying to add " + statusEffectDic[4].m_name));
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(statusEffectDic[3], false, 0, 0f, (short)(-1));
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(statusEffectDic[4], false, 0, 0f, (short)(-1));
					logger.LogInfo((object)"effects were added!");
					break;
				case 2:
					logger.LogInfo((object)("player is " + Player.m_localPlayer.GetPlayerID()));
					logger.LogInfo((object)("Trying to add " + statusEffectDic[1].m_name));
					logger.LogInfo((object)("Trying to add " + statusEffectDic[2].m_name));
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(statusEffectDic[1], false, 0, 0f, (short)(-1));
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(statusEffectDic[2], false, 0, 0f, (short)(-1));
					break;
				case 3:
					logger.LogInfo((object)("player is " + Player.m_localPlayer.GetPlayerID()));
					logger.LogInfo((object)("Trying to add " + statusEffectDic[5].m_name));
					((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(statusEffectDic[5], false, 0, 0f, (short)(-1));
					break;
				default:
					logger.LogInfo((object)"could not apply effect(s), list was empty");
					break;
				}
			}
		}

		private static void RPC_RemoveEffectsFromOtherPlayers(long sender, long receiver, int effects, float range)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			List<Player> list = new List<Player>();
			Collider[] array = Physics.OverlapSphere(((Component)Player.GetPlayer(sender)).transform.position, range, -1, (QueryTriggerInteraction)1);
			if (array.Length != 0)
			{
				logger.LogInfo((object)"found collision(s), attempting to get players in range");
				Collider[] array2 = array;
				foreach (Collider val in array2)
				{
					if ((Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
					{
						list.Add(((Component)val).GetComponentInParent<Player>());
					}
				}
			}
			else
			{
				logger.LogInfo((object)"no players found within range");
			}
			foreach (Player item in list)
			{
				switch (effects)
				{
				case 1:
					logger.LogInfo((object)("player is " + Player.m_localPlayer.GetPlayerID()));
					logger.LogInfo((object)("Trying to remove " + statusEffectDic[3].m_name));
					logger.LogInfo((object)("Trying to remove " + statusEffectDic[4].m_name));
					((Character)item).GetSEMan().RemoveStatusEffect(statusEffectDic[3], false);
					((Character)item).GetSEMan().RemoveStatusEffect(statusEffectDic[4], false);
					break;
				case 2:
					logger.LogInfo((object)("player is " + Player.m_localPlayer.GetPlayerID()));
					logger.LogInfo((object)("Trying to remove " + statusEffectDic[1].m_name));
					logger.LogInfo((object)("Trying to remove " + statusEffectDic[2].m_name));
					((Character)item).GetSEMan().RemoveStatusEffect(statusEffectDic[1], false);
					((Character)item).GetSEMan().RemoveStatusEffect(statusEffectDic[2], false);
					break;
				case 3:
					logger.LogInfo((object)("player is " + Player.m_localPlayer.GetPlayerID()));
					logger.LogInfo((object)("Trying to remove " + statusEffectDic[5].m_name));
					((Character)item).GetSEMan().RemoveStatusEffect(statusEffectDic[5], false);
					break;
				default:
					logger.LogInfo((object)"could not remove effect(s), list was empty");
					break;
				}
			}
		}

		private static void RPC_ChangeWorldExpModifier(long sender, long target)
		{
			logger.LogInfo((object)Main.worldExpModifier.Value);
			ConfigEntry<float> worldExpModifier = Main.worldExpModifier;
			worldExpModifier.Value += 0.2f;
			logger.LogInfo((object)Main.worldExpModifier.Value);
		}

		public static bool IsInTheMainScene()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			return ((Scene)(ref activeScene)).name.Equals("main");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Player), "Load")]
		public static void PatchRPCsPlayer(Player __instance)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			if (!IsInTheMainScene())
			{
				ManualLogSource logger = Main.logger;
				Scene activeScene = SceneManager.GetActiveScene();
				logger.LogInfo((object)(((Scene)(ref activeScene)).name ?? ""));
				Main.logger.LogInfo((object)"Not in main scene, skipping");
				return;
			}
			Type type = ((object)__instance).GetType();
			FieldInfo field = type.GetField("m_nview", BindingFlags.Instance | BindingFlags.NonPublic);
			object? value = field.GetValue(__instance);
			ZNetView val = (ZNetView)((value is ZNetView) ? value : null);
			Main.logger.LogInfo((object)"got field value");
			try
			{
				if (ZRoutedRpc.instance != null)
				{
					Main.logger.LogInfo((object)"registering rpc");
					ZRoutedRpc.instance.Register<long, int, float>("RPC_ApplyEffectsToOtherPlayers", (Action<long, long, int, float>)RPC_ApplyEffectsToOtherPlayers);
					ZRoutedRpc.instance.Register<long, int, float>("RPC_RemoveEffectsFromOtherPlayers", (Action<long, long, int, float>)RPC_RemoveEffectsFromOtherPlayers);
					ZRoutedRpc.instance.Register<long>("RPC_ChangeWorldExpModifier", (Action<long, long>)RPC_ChangeWorldExpModifier);
				}
				else
				{
					Main.logger.LogInfo((object)"could not register rpc");
				}
			}
			catch (Exception ex)
			{
				Debug.Log((object)("Client RPC already registered: " + ex.Message));
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(ZoneSystem), "Load")]
		public static void PatchRPCsServer()
		{
			if (ZNet.instance.IsServer())
			{
				try
				{
					ZRoutedRpc.instance.Register<long, int, float>("RPC_ApplyEffectsToOtherPlayers", (Action<long, long, int, float>)RPC_ApplyEffectsToOtherPlayers);
					ZRoutedRpc.instance.Register<long, int, float>("RPC_RemoveEffectsFromOtherPlayers", (Action<long, long, int, float>)RPC_RemoveEffectsFromOtherPlayers);
					ZRoutedRpc.instance.Register<long>("RPC_ChangeWorldExpModifier", (Action<long, long>)RPC_ChangeWorldExpModifier);
				}
				catch (Exception ex)
				{
					Debug.Log((object)("Server RPC already registered: " + ex.Message));
					logger.LogInfo((object)"The RPC has already been registered!\nThis can happen if you are hosting without a dedicated server");
				}
			}
		}
	}

	private const string pluginGUID = "Lelouis.Valheim.SkillCapMod";

	private const string pluginName = "Skill_Cap_Mod";

	private const string pluginVersion = "2.0.11";

	private readonly Harmony HarmonyInstance = new Harmony("Lelouis.Valheim.SkillCapMod");

	public static ManualLogSource logger = Logger.CreateLogSource("Skill_Cap_Mod");

	public AssetBundle waxAsset;

	public GameObject waxPrefab;

	public AssetBundle capesBundle;

	public GameObject capeDeer;

	public GameObject capeTroll;

	public GameObject capeWolfWaterproof;

	public GameObject capeLoxWaterproof;

	public GameObject capeLinenWaterproof;

	public GameObject capeFeatherWaterproof;

	public GameObject capeAsksvinWaterproof;

	public GameObject capeAshWaterproof;

	public static AssetBundle newHaldorAssetBundle;

	public GameObject newHaldor;

	public static StatusEffect attackBuff;

	public AssetBundle foodsAssetBundle;

	public static ConfigEntry<float> worldExpModifier;

	public Shader standardSurface2;

	public Shader CustomParticleUnlit;

	public Shader CustomCreature;

	public Shader CustomGrass;

	public Shader CustomPlayer;

	public void Awake()
	{
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		HarmonyInstance.PatchAll(executingAssembly);
		OverlayMap.BindConfig(((BaseUnityPlugin)this).Config);
		CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OverlayMapCommand());
		CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OverlayMapZoomCommand());
		CommandManager.Instance.AddConsoleCommand((ConsoleCommand)(object)new OverlayMapAlphaCommand());
		try
		{
			LoadAssets();
			AddRecipes();
			PrefabManager.OnVanillaPrefabsAvailable += CreateWax;
			PrefabManager.OnVanillaPrefabsAvailable += CreateCapes;
			PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems;
			PrefabManager.OnVanillaPrefabsAvailable += FixShaders;
			PrefabManager.OnVanillaPrefabsAvailable += CreateNewHaldor;
		}
		catch (Exception ex)
		{
			logger.LogWarning((object)("Skill-Cap assets unavailable (bundles missing next to the DLL?). Running without custom items/pieces. First error: " + ex.Message));
		}
	}

	private void LoadAssets()
	{
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Expected O, but got Unknown
		string location = Assembly.GetExecutingAssembly().Location;
		location = location.Substring(0, location.Length - 22);
		location = location.Replace('\\', '/');
		string text = location;
		string text2 = location;
		string text3 = location;
		string text4 = location;
		string text5 = location;
		ConfigurationManagerAttributes val = new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		};
		AcceptableValueRange<float> val2 = new AcceptableValueRange<float>(0f, 1000f);
		worldExpModifier = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "FloatValue1", 1f, new ConfigDescription("Server side float", (AcceptableValueBase)(object)val2, new object[1] { val }));
		waxAsset = AssetUtils.LoadAssetBundle(text += "wax");
		waxPrefab = waxAsset.LoadAsset<GameObject>("wax");
		capesBundle = AssetUtils.LoadAssetBundle(text2 += "capes");
		capeDeer = capesBundle.LoadAsset<GameObject>("capeDeer");
		capeTroll = capesBundle.LoadAsset<GameObject>("capeTroll");
		capeWolfWaterproof = capesBundle.LoadAsset<GameObject>("capeWolfWaterproof");
		capeLoxWaterproof = capesBundle.LoadAsset<GameObject>("capeLoxWaterproof");
		capeLinenWaterproof = capesBundle.LoadAsset<GameObject>("capeLinenWaterproof");
		capeFeatherWaterproof = capesBundle.LoadAsset<GameObject>("capeFeatherWaterproof");
		capeAsksvinWaterproof = capesBundle.LoadAsset<GameObject>("capeAsksvinWaterproof");
		capeAshWaterproof = capesBundle.LoadAsset<GameObject>("capeAshWaterproof");
		newHaldorAssetBundle = AssetUtils.LoadAssetBundle(text3 += "newhaldor");
		newHaldor = newHaldorAssetBundle.LoadAsset<GameObject>("newhaldor");
		foodsAssetBundle = AssetUtils.LoadAssetBundle(text4 += "foods");
	}

	private void CreateCorrectShaders()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Expected O, but got Unknown
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Expected O, but got Unknown
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Expected O, but got Unknown
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Expected O, but got Unknown
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Expected O, but got Unknown
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Expected O, but got Unknown
		PieceConfig val = new PieceConfig();
		val.Name = "Standard Surface 2";
		CustomPiece val2 = new CustomPiece("piece_cauldroncopy", "piece_cauldron", val);
		standardSurface2 = ((Renderer)((Component)val2.PiecePrefab.transform.Find("HaveFire/Waterplane")).GetComponent<MeshRenderer>()).material.shader;
		ItemConfig val3 = new ItemConfig();
		val3.Name = "foobar";
		CustomItem val4 = new CustomItem("MeadBaseHealthMediumcopy", "MeadBaseHealthMedium", val3);
		CustomParticleUnlit = ((Component)val4.ItemDrop.m_itemData.m_shared.m_consumeStatusEffect.m_startEffects.m_effectPrefabs[0].m_prefab.transform.Find("trails")).GetComponent<Renderer>().materials[0].shader;
		ItemConfig val5 = new ItemConfig();
		val5.Name = "creatureshader";
		CustomItem val6 = new CustomItem("CreatureShader", "CapeDeerHide", val5);
		CustomCreature = ((Renderer)((Component)((Component)val6.ItemDrop).transform.Find("attach_skin/cape2")).GetComponent<SkinnedMeshRenderer>()).material.shader;
		PieceConfig val7 = new PieceConfig();
		val7.Name = "grass";
		CustomPiece val8 = new CustomPiece("piece_barleycopy", "sapling_barley", val7);
		CustomGrass = ((Renderer)((Component)val8.PiecePrefab.transform.Find("healthy/barley_sapling")).GetComponent<MeshRenderer>()).material.shader;
		ItemConfig val9 = new ItemConfig();
		val9.Name = "player";
		CustomItem val10 = new CustomItem("PlayerShader", "ArmorTrollLeatherChest", val9);
		CustomPlayer = ((Renderer)((Component)((Component)val10.ItemDrop).transform.Find("attach_skin/shorts")).GetComponent<SkinnedMeshRenderer>()).materials[0].shader;
	}

	private void AddClonedItems()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Expected O, but got Unknown
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Expected O, but got Unknown
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Expected O, but got Unknown
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Expected O, but got Unknown
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Expected O, but got Unknown
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Expected O, but got Unknown
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Expected O, but got Unknown
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Expected O, but got Unknown
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Expected O, but got Unknown
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Expected O, but got Unknown
		//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Expected O, but got Unknown
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Expected O, but got Unknown
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Expected O, but got Unknown
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Expected O, but got Unknown
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0296: Expected O, but got Unknown
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c3: Expected O, but got Unknown
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Expected O, but got Unknown
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Expected O, but got Unknown
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0423: Expected O, but got Unknown
		//IL_048a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: Expected O, but got Unknown
		//IL_0a0a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a11: Expected O, but got Unknown
		//IL_0a7b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a85: Expected O, but got Unknown
		//IL_0dad: Unknown result type (might be due to invalid IL or missing references)
		//IL_0db4: Expected O, but got Unknown
		//IL_0dea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0df1: Expected O, but got Unknown
		//IL_0e26: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e2d: Expected O, but got Unknown
		//IL_0e72: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e79: Expected O, but got Unknown
		//IL_119d: Unknown result type (might be due to invalid IL or missing references)
		//IL_11af: Unknown result type (might be due to invalid IL or missing references)
		//IL_11b6: Expected O, but got Unknown
		//IL_11fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_1202: Expected O, but got Unknown
		//IL_1526: Unknown result type (might be due to invalid IL or missing references)
		//IL_1538: Unknown result type (might be due to invalid IL or missing references)
		//IL_153f: Expected O, but got Unknown
		//IL_1584: Unknown result type (might be due to invalid IL or missing references)
		//IL_158b: Expected O, but got Unknown
		//IL_192d: Unknown result type (might be due to invalid IL or missing references)
		//IL_193f: Unknown result type (might be due to invalid IL or missing references)
		//IL_1946: Expected O, but got Unknown
		//IL_198b: Unknown result type (might be due to invalid IL or missing references)
		//IL_1992: Expected O, but got Unknown
		//IL_1d34: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d46: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d4d: Expected O, but got Unknown
		//IL_1d92: Unknown result type (might be due to invalid IL or missing references)
		//IL_1d99: Expected O, but got Unknown
		//IL_21b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_21c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_21cc: Expected O, but got Unknown
		//IL_2211: Unknown result type (might be due to invalid IL or missing references)
		//IL_2218: Expected O, but got Unknown
		//IL_2632: Unknown result type (might be due to invalid IL or missing references)
		//IL_2644: Unknown result type (might be due to invalid IL or missing references)
		//IL_264b: Expected O, but got Unknown
		//IL_2690: Unknown result type (might be due to invalid IL or missing references)
		//IL_2697: Expected O, but got Unknown
		//IL_2a33: Unknown result type (might be due to invalid IL or missing references)
		//IL_2a45: Unknown result type (might be due to invalid IL or missing references)
		//IL_2a4c: Expected O, but got Unknown
		//IL_2a91: Unknown result type (might be due to invalid IL or missing references)
		//IL_2a98: Expected O, but got Unknown
		//IL_2e34: Unknown result type (might be due to invalid IL or missing references)
		//IL_2e46: Unknown result type (might be due to invalid IL or missing references)
		//IL_2e4d: Expected O, but got Unknown
		//IL_2eca: Unknown result type (might be due to invalid IL or missing references)
		//IL_2ed1: Expected O, but got Unknown
		//IL_2f45: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f4c: Expected O, but got Unknown
		//IL_2f98: Unknown result type (might be due to invalid IL or missing references)
		//IL_2f9f: Expected O, but got Unknown
		//IL_2fcc: Unknown result type (might be due to invalid IL or missing references)
		//IL_2fd3: Expected O, but got Unknown
		//IL_3041: Unknown result type (might be due to invalid IL or missing references)
		//IL_3048: Expected O, but got Unknown
		//IL_30bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_30c3: Expected O, but got Unknown
		//IL_310f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3116: Expected O, but got Unknown
		//IL_3143: Unknown result type (might be due to invalid IL or missing references)
		//IL_314a: Expected O, but got Unknown
		//IL_3196: Unknown result type (might be due to invalid IL or missing references)
		//IL_319d: Expected O, but got Unknown
		//IL_31f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_31f8: Expected O, but got Unknown
		//IL_326f: Unknown result type (might be due to invalid IL or missing references)
		//IL_3276: Expected O, but got Unknown
		//IL_329f: Unknown result type (might be due to invalid IL or missing references)
		//IL_32f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_337a: Unknown result type (might be due to invalid IL or missing references)
		//IL_3381: Expected O, but got Unknown
		//IL_33fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_3401: Expected O, but got Unknown
		//IL_3457: Unknown result type (might be due to invalid IL or missing references)
		//IL_345e: Expected O, but got Unknown
		//IL_34d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_34de: Expected O, but got Unknown
		//IL_3506: Unknown result type (might be due to invalid IL or missing references)
		//IL_350d: Expected O, but got Unknown
		//IL_3572: Unknown result type (might be due to invalid IL or missing references)
		//IL_3579: Expected O, but got Unknown
		//IL_35ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_360b: Unknown result type (might be due to invalid IL or missing references)
		//IL_3698: Unknown result type (might be due to invalid IL or missing references)
		//IL_369f: Expected O, but got Unknown
		//IL_36c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_36cc: Expected O, but got Unknown
		//IL_36fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_3705: Expected O, but got Unknown
		//IL_37b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_37ba: Expected O, but got Unknown
		//IL_38bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_38c4: Expected O, but got Unknown
		//IL_3954: Unknown result type (might be due to invalid IL or missing references)
		//IL_395b: Expected O, but got Unknown
		//IL_39b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_39c0: Expected O, but got Unknown
		//IL_3a41: Unknown result type (might be due to invalid IL or missing references)
		//IL_3a48: Expected O, but got Unknown
		//IL_3aa6: Unknown result type (might be due to invalid IL or missing references)
		//IL_3aad: Expected O, but got Unknown
		//IL_3b2e: Unknown result type (might be due to invalid IL or missing references)
		//IL_3b35: Expected O, but got Unknown
		//IL_3bae: Unknown result type (might be due to invalid IL or missing references)
		//IL_3bb5: Expected O, but got Unknown
		//IL_3c35: Unknown result type (might be due to invalid IL or missing references)
		//IL_3c3c: Expected O, but got Unknown
		//IL_3cb5: Unknown result type (might be due to invalid IL or missing references)
		//IL_3cbc: Expected O, but got Unknown
		//IL_3d3c: Unknown result type (might be due to invalid IL or missing references)
		//IL_3d43: Expected O, but got Unknown
		//IL_3dbc: Unknown result type (might be due to invalid IL or missing references)
		//IL_3dc3: Expected O, but got Unknown
		//IL_3e2b: Unknown result type (might be due to invalid IL or missing references)
		//IL_3e32: Expected O, but got Unknown
		//IL_3ebd: Unknown result type (might be due to invalid IL or missing references)
		//IL_3ec4: Expected O, but got Unknown
		//IL_3f0e: Unknown result type (might be due to invalid IL or missing references)
		//IL_3f15: Expected O, but got Unknown
		//IL_3fa0: Unknown result type (might be due to invalid IL or missing references)
		//IL_3fa7: Expected O, but got Unknown
		//IL_4009: Unknown result type (might be due to invalid IL or missing references)
		//IL_4010: Expected O, but got Unknown
		//IL_401d: Unknown result type (might be due to invalid IL or missing references)
		//IL_4024: Expected O, but got Unknown
		//IL_408c: Unknown result type (might be due to invalid IL or missing references)
		//IL_4093: Expected O, but got Unknown
		//IL_410c: Unknown result type (might be due to invalid IL or missing references)
		//IL_4113: Expected O, but got Unknown
		//IL_415d: Unknown result type (might be due to invalid IL or missing references)
		//IL_4164: Expected O, but got Unknown
		//IL_4171: Unknown result type (might be due to invalid IL or missing references)
		//IL_4178: Expected O, but got Unknown
		//IL_41c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_41c9: Expected O, but got Unknown
		//IL_41db: Unknown result type (might be due to invalid IL or missing references)
		//IL_41ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_41f4: Expected O, but got Unknown
		//IL_425c: Unknown result type (might be due to invalid IL or missing references)
		//IL_4263: Expected O, but got Unknown
		//IL_4275: Unknown result type (might be due to invalid IL or missing references)
		//IL_4287: Unknown result type (might be due to invalid IL or missing references)
		//IL_428e: Expected O, but got Unknown
		//IL_42d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_42df: Expected O, but got Unknown
		//IL_4342: Unknown result type (might be due to invalid IL or missing references)
		//IL_436b: Unknown result type (might be due to invalid IL or missing references)
		//IL_4372: Expected O, but got Unknown
		//IL_4407: Unknown result type (might be due to invalid IL or missing references)
		//IL_440e: Expected O, but got Unknown
		//IL_4420: Unknown result type (might be due to invalid IL or missing references)
		//IL_4449: Unknown result type (might be due to invalid IL or missing references)
		//IL_4450: Expected O, but got Unknown
		//IL_44c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_44ce: Expected O, but got Unknown
		//IL_4547: Unknown result type (might be due to invalid IL or missing references)
		//IL_454e: Expected O, but got Unknown
		//IL_45c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_45cd: Expected O, but got Unknown
		//IL_45df: Unknown result type (might be due to invalid IL or missing references)
		//IL_4608: Unknown result type (might be due to invalid IL or missing references)
		//IL_460f: Expected O, but got Unknown
		//IL_4678: Unknown result type (might