Decompiled source of Auga v1.3.11

Project Auga/Auga.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using APIManager;
using Auga.Compat;
using Auga.Utilities;
using AugaUnity;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Preloader;
using BepInEx.Preloader.Patching;
using Fishlabs;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using fastJSON;

[assembly: AssemblyCopyright("Copyright © Randy Knapp 2021")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Auga")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Auga")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("bcc7dd31-d943-4684-800e-176a97dddb8f")]
[assembly: AssemblyFileVersion("1.3.11.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.11.0")]
[module: UnverifiableCode]
namespace Auga
{
	[PublicAPI]
	public static class API
	{
		public static string RedText = "#CD2121";

		public static string Red = "#AD1616";

		public static string Brown1 = "#EAE1D9";

		public static string Brown2 = "#D1C9C2";

		public static string Brown3 = "#A39689";

		public static string Brown4 = "#706457";

		public static string Brown5 = "#2E2620";

		public static string Brown6 = "#EAE1D9";

		public static string Brown7 = "#181410";

		public static string Blue = "#216388";

		public static string LightBlue = "#1AACEF";

		public static string Gold = "#B98A12";

		public static string BrightGold = "#EAA800";

		public static string BrightestGold = "#FFBF1B";

		public static string GoldDark = "#755608";

		public static string Green = "#1B9B37";

		[UsedImplicitly]
		public static bool IsLoaded()
		{
			return true;
		}

		[UsedImplicitly]
		public static Font GetBoldFont()
		{
			return Auga.Assets.SourceSansProBold;
		}

		[UsedImplicitly]
		public static Font GetSemiBoldFont()
		{
			return Auga.Assets.SourceSansProSemiBold;
		}

		[UsedImplicitly]
		public static Font GetRegularFont()
		{
			return Auga.Assets.SourceSansProRegular;
		}

		[UsedImplicitly]
		public static Sprite GetItemBackgroundSprite()
		{
			return Auga.Assets.ItemBackgroundSprite;
		}

		[UsedImplicitly]
		public static GameObject Panel_Create(Transform parent, Vector2 size, string name, bool withCornerDecoration)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.PanelBase, parent);
			if ((Object)(object)Auga.Assets.PanelBase == (Object)null)
			{
				Auga.LogError("Auga.Assets.PanelBase is null");
				Thread.Sleep(25000);
			}
			((Object)val).name = name;
			if (!withCornerDecoration)
			{
				foreach (Transform item in val.transform.Find("Background"))
				{
					Transform val2 = item;
					Object.Destroy((Object)(object)((Component)val2).gameObject);
				}
			}
			RectTransform val3 = (RectTransform)val.transform;
			Vector2 val4 = default(Vector2);
			((Vector2)(ref val4))..ctor(0.5f, 0.5f);
			val3.anchorMax = val4;
			Vector2 pivot = (val3.anchorMin = val4);
			val3.pivot = pivot;
			val3.anchoredPosition = Vector2.zero;
			val3.SetSizeWithCurrentAnchors((Axis)0, size.x);
			val3.SetSizeWithCurrentAnchors((Axis)1, size.y);
			return val;
		}

		[UsedImplicitly]
		public static Button SmallButton_Create(Transform parent, string name, string labelText)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.ButtonSmall, parent);
			((Object)val).name = name;
			TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.text = Localization.instance.Localize(labelText);
			}
			return (Button)(object)val.GetComponent<ColorButtonText>();
		}

		[UsedImplicitly]
		public static Button MediumButton_Create(Transform parent, string name, string labelText)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.ButtonMedium, parent);
			((Object)val).name = name;
			TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.text = Localization.instance.Localize(labelText);
			}
			return (Button)(object)val.GetComponent<ColorButtonText>();
		}

		[UsedImplicitly]
		public static Button FancyButton_Create(Transform parent, string name, string labelText)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.ButtonFancy, parent);
			((Object)val).name = name;
			TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.text = Localization.instance.Localize(labelText);
			}
			return (Button)(object)val.GetComponent<ColorButtonText>();
		}

		[UsedImplicitly]
		public static Button SettingsButton_Create(Transform parent, string name, string labelText)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.ButtonSettings, parent);
			((Object)val).name = name;
			TMP_Text componentInChildren = val.GetComponentInChildren<TMP_Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.text = Localization.instance.Localize(labelText);
			}
			return (Button)(object)val.GetComponent<ColorButtonText>();
		}

		[UsedImplicitly]
		public static Button DiamondButton_Create(Transform parent, string name, [CanBeNull] Sprite icon)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.DiamondButton, parent);
			((Object)val).name = name;
			Image componentInChildren = val.GetComponentInChildren<Image>();
			if ((Object)(object)icon == (Object)null)
			{
				((Behaviour)componentInChildren).enabled = false;
			}
			else
			{
				componentInChildren.sprite = icon;
			}
			return val.GetComponent<Button>();
		}

		[UsedImplicitly]
		public static GameObject Divider_CreateSmall(Transform parent, string name, float width = -1f)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.DividerSmall, parent);
			((Object)val).name = name;
			if (width >= 0f)
			{
				val.RectTransform().SetSizeWithCurrentAnchors((Axis)0, width);
			}
			return val;
		}

		[UsedImplicitly]
		public static Tuple<GameObject, GameObject> Divider_CreateMedium(Transform parent, string name, float width = -1f)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.DividerMedium, parent);
			((Object)val).name = name;
			if (width >= 0f)
			{
				val.RectTransform().SetSizeWithCurrentAnchors((Axis)0, width);
			}
			return new Tuple<GameObject, GameObject>(val, ((Component)val.transform.Find("Content")).gameObject);
		}

		[UsedImplicitly]
		public static Tuple<GameObject, GameObject> Divider_CreateLarge(Transform parent, string name, float width = -1f)
		{
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.DividerLarge, parent);
			((Object)val).name = name;
			if (width >= 0f)
			{
				val.RectTransform().SetSizeWithCurrentAnchors((Axis)0, width);
			}
			return new Tuple<GameObject, GameObject>(val, ((Component)val.transform.Find("Content")).gameObject);
		}

		[UsedImplicitly]
		public static void Button_SetTextColors(Button button, Color normal, Color highlighted, Color pressed, Color selected, Color disabled, Color baseTextColor)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			ColorButtonTextValues component = ((Component)button).GetComponent<ColorButtonTextValues>();
			if ((Object)(object)component != (Object)null)
			{
				((ColorBlock)(ref component.TextColors)).normalColor = normal;
				((ColorBlock)(ref component.TextColors)).highlightedColor = highlighted;
				((ColorBlock)(ref component.TextColors)).pressedColor = pressed;
				((ColorBlock)(ref component.TextColors)).selectedColor = selected;
				((ColorBlock)(ref component.TextColors)).disabledColor = disabled;
			}
			TMP_Text componentInChildren = ((Component)button).GetComponentInChildren<TMP_Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Graphic)componentInChildren).color = baseTextColor;
			}
		}

		[UsedImplicitly]
		public static void Button_OverrideTextColor(Button button, Color color)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			ColorButtonTextValues component = ((Component)button).GetComponent<ColorButtonTextValues>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
			TMP_Text componentInChildren = ((Component)button).GetComponentInChildren<TMP_Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((Graphic)componentInChildren).color = color;
			}
		}

		[UsedImplicitly]
		public static void Tooltip_MakeSimpleTooltip(GameObject obj)
		{
			UITooltip val = obj.GetComponent<UITooltip>();
			if ((Object)(object)val == (Object)null)
			{
				val = obj.AddComponent<UITooltip>();
			}
			val.m_tooltipPrefab = Auga.Assets.SimpleTooltip;
		}

		[UsedImplicitly]
		public static void Tooltip_MakeItemTooltip(GameObject obj, ItemData item)
		{
			UITooltip val = obj.GetComponent<UITooltip>();
			if ((Object)(object)val == (Object)null)
			{
				val = obj.AddComponent<UITooltip>();
			}
			val.m_tooltipPrefab = Auga.Assets.InventoryTooltip;
			ItemTooltip val2 = obj.GetComponent<ItemTooltip>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = obj.AddComponent<ItemTooltip>();
			}
			val2.Item = item;
		}

		[UsedImplicitly]
		public static void Tooltip_MakeFoodTooltip(GameObject obj, Food food)
		{
			UITooltip val = obj.GetComponent<UITooltip>();
			if ((Object)(object)val == (Object)null)
			{
				val = obj.AddComponent<UITooltip>();
			}
			val.m_tooltipPrefab = Auga.Assets.InventoryTooltip;
			FoodTooltip val2 = obj.GetComponent<FoodTooltip>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = obj.AddComponent<FoodTooltip>();
			}
			val2.Food = food;
		}

		[UsedImplicitly]
		public static void Tooltip_MakeStatusEffectTooltip(GameObject obj, StatusEffect statusEffect)
		{
			UITooltip val = obj.GetComponent<UITooltip>();
			if ((Object)(object)val == (Object)null)
			{
				val = obj.AddComponent<UITooltip>();
			}
			val.m_tooltipPrefab = Auga.Assets.InventoryTooltip;
			StatusTooltip val2 = obj.GetComponent<StatusTooltip>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = obj.AddComponent<StatusTooltip>();
			}
			val2.StatusEffect = statusEffect;
		}

		[UsedImplicitly]
		public static void Tooltip_MakeSkillTooltip(GameObject obj, Skill skill)
		{
			UITooltip val = obj.GetComponent<UITooltip>();
			if ((Object)(object)val == (Object)null)
			{
				val = obj.AddComponent<UITooltip>();
			}
			val.m_tooltipPrefab = Auga.Assets.InventoryTooltip;
			SkillTooltip val2 = obj.GetComponent<SkillTooltip>();
			if ((Object)(object)val2 == (Object)null)
			{
				val2 = obj.AddComponent<SkillTooltip>();
			}
			val2.Skill = skill;
		}

		[UsedImplicitly]
		public static bool PlayerPanel_HasTab(string tabID)
		{
			return (Object)(object)WorkbenchPanelController.instance != (Object)null && WorkbenchPanelController.instance.HasPlayerPanelTab(tabID);
		}

		[UsedImplicitly]
		public static PlayerPanelTabData PlayerPanel_AddTab(string tabID, Sprite tabIcon, string tabTitleText, Action<int> onTabSelected)
		{
			if ((Object)(object)WorkbenchPanelController.instance != (Object)null)
			{
				PlayerPanelTabData playerPanelTabData = new PlayerPanelTabData();
				TabButton val = default(TabButton);
				WorkbenchPanelController.instance.AddPlayerPanelTab(tabID, tabIcon, tabTitleText, onTabSelected, ref playerPanelTabData.TabTitle, ref val, ref playerPanelTabData.ContentGO);
				playerPanelTabData.Index = WorkbenchPanelController.instance.DefaultTabController.TabButtons.Count - 1;
				playerPanelTabData.TabButtonGO = ((Component)val).gameObject;
				return playerPanelTabData;
			}
			return null;
		}

		[UsedImplicitly]
		public static bool PlayerPanel_IsTabActive(GameObject tabButton)
		{
			return (Object)(object)WorkbenchPanelController.instance != (Object)null && WorkbenchPanelController.instance.IsTabActive(tabButton);
		}

		[UsedImplicitly]
		public static Button PlayerPanel_GetTabButton(int index)
		{
			if ((Object)(object)WorkbenchPanelController.instance != (Object)null && index >= 0 && index < WorkbenchPanelController.instance.DefaultTabController.TabButtons.Count)
			{
				return WorkbenchPanelController.instance.DefaultTabController.TabButtons[index].Button;
			}
			return null;
		}

		[UsedImplicitly]
		public static bool Workbench_HasWorkbenchTab(string tabID)
		{
			return (Object)(object)WorkbenchPanelController.instance != (Object)null && WorkbenchPanelController.instance.HasWorkbenchTab(tabID);
		}

		[UsedImplicitly]
		public static WorkbenchTabData Workbench_AddWorkbenchTab(string tabID, Sprite tabIcon, string tabTitleText, Action<int> onTabSelected)
		{
			if ((Object)(object)WorkbenchPanelController.instance != (Object)null)
			{
				WorkbenchTabData workbenchTabData = new WorkbenchTabData();
				TabButton val = default(TabButton);
				CraftingRequirementsPanel val2 = default(CraftingRequirementsPanel);
				ComplexTooltip val3 = default(ComplexTooltip);
				WorkbenchPanelController.instance.AddWorkbenchTab(tabID, tabIcon, tabTitleText, onTabSelected, false, ref workbenchTabData.TabTitle, ref val, ref val2, ref val3);
				workbenchTabData.Index = WorkbenchPanelController.instance.WorkbenchTabController.TabButtons.Count - 1;
				workbenchTabData.TabButtonGO = ((Component)val).gameObject;
				workbenchTabData.RequirementsPanelGO = ((Component)val2).gameObject;
				workbenchTabData.ItemInfoGO = ((Component)val3).gameObject;
				return workbenchTabData;
			}
			return null;
		}

		[UsedImplicitly]
		public static WorkbenchTabData Workbench_AddVanillaWorkbenchTab(string tabID, Sprite tabIcon, string tabTitleText, Action<int> onTabSelected)
		{
			if ((Object)(object)WorkbenchPanelController.instance != (Object)null)
			{
				WorkbenchTabData workbenchTabData = new WorkbenchTabData();
				TabButton val = default(TabButton);
				CraftingRequirementsPanel val2 = default(CraftingRequirementsPanel);
				ComplexTooltip val3 = default(ComplexTooltip);
				WorkbenchPanelController.instance.AddWorkbenchTab(tabID, tabIcon, tabTitleText, onTabSelected, true, ref workbenchTabData.TabTitle, ref val, ref val2, ref val3);
				workbenchTabData.Index = WorkbenchPanelController.instance.WorkbenchTabController.TabButtons.Count - 1;
				workbenchTabData.TabButtonGO = ((Component)val).gameObject;
				workbenchTabData.RequirementsPanelGO = ((Component)val2).gameObject;
				workbenchTabData.ItemInfoGO = ((Component)val3).gameObject;
				return workbenchTabData;
			}
			return null;
		}

		[UsedImplicitly]
		public static bool Workbench_IsTabActive(GameObject tabButton)
		{
			return (Object)(object)WorkbenchPanelController.instance != (Object)null && WorkbenchPanelController.instance.IsTabActive(tabButton);
		}

		[UsedImplicitly]
		public static Button Workbench_GetCraftingTabButton()
		{
			WorkbenchPanelController instance = WorkbenchPanelController.instance;
			return (instance != null) ? ((Component)instance.WorkbenchTabController.TabButtons[0]).GetComponent<Button>() : null;
		}

		[UsedImplicitly]
		public static Button Workbench_GetUpgradeTabButton()
		{
			WorkbenchPanelController instance = WorkbenchPanelController.instance;
			return (instance != null) ? ((Component)instance.WorkbenchTabController.TabButtons[1]).GetComponent<Button>() : null;
		}

		[UsedImplicitly]
		public static GameObject Workbench_CreateNewResultsPanel()
		{
			WorkbenchPanelController instance = WorkbenchPanelController.instance;
			return (instance != null) ? instance.CraftingPanel.CreateResultsPanel() : null;
		}

		private static bool TextBoxCheck(GameObject tooltipTextBoxGO, out TooltipTextBox tooltipTextBox)
		{
			tooltipTextBox = tooltipTextBoxGO.GetComponent<TooltipTextBox>();
			if ((Object)(object)tooltipTextBox == (Object)null)
			{
				Auga.LogError("Must call TooltipTextBox interface method with a game object with a TooltipTextBox component on it.");
				return false;
			}
			return true;
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, Text t, object s, bool localize = true)
		{
			TooltipTextBox_AddLine(tooltipTextBoxGO, t, s, localize, overwrite: false);
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, Text t, object s, bool localize, bool overwrite)
		{
			if (TextBoxCheck(tooltipTextBoxGO, out var tooltipTextBox))
			{
				tooltipTextBox.AddLine((object)t, s, localize, overwrite);
			}
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, object a, bool localize = true)
		{
			TooltipTextBox_AddLine(tooltipTextBoxGO, a, localize, overwrite: false);
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, object a, bool localize, bool overwrite)
		{
			if (TextBoxCheck(tooltipTextBoxGO, out var tooltipTextBox))
			{
				tooltipTextBox.AddLine(a, localize, overwrite);
			}
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, object a, object b, bool localize = true)
		{
			TooltipTextBox_AddLine(tooltipTextBoxGO, a, b, localize, overwrite: false);
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, object a, object b, bool localize, bool overwrite)
		{
			if (TextBoxCheck(tooltipTextBoxGO, out var tooltipTextBox))
			{
				tooltipTextBox.AddLine(a, b, localize, overwrite);
			}
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, object a, object b, object parenthetical, bool localize = true)
		{
			TooltipTextBox_AddLine(tooltipTextBoxGO, a, b, parenthetical, localize, overwrite: false);
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddLine(GameObject tooltipTextBoxGO, object a, object b, object parenthetical, bool localize, bool overwrite)
		{
			if (TextBoxCheck(tooltipTextBoxGO, out var tooltipTextBox))
			{
				tooltipTextBox.AddLine(a, b, parenthetical, localize, overwrite);
			}
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddUpgradeLine(GameObject tooltipTextBoxGO, object label, object value1, object value2, string color2, bool localize = true)
		{
			TooltipTextBox_AddUpgradeLine(tooltipTextBoxGO, label, value1, value2, color2, localize, overwrite: false);
		}

		[UsedImplicitly]
		public static void TooltipTextBox_AddUpgradeLine(GameObject tooltipTextBoxGO, object label, object value1, object value2, string color2, bool localize, bool overwrite)
		{
			if (TextBoxCheck(tooltipTextBoxGO, out var tooltipTextBox))
			{
				tooltipTextBox.AddUpgradeLine(label, value1, value2, color2, localize, overwrite);
			}
		}

		private static bool ComplexTooltipCheck(GameObject complexTooltipGO, out ComplexTooltip complexTooltip)
		{
			complexTooltip = complexTooltipGO.GetComponent<ComplexTooltip>();
			if ((Object)(object)complexTooltip == (Object)null)
			{
				Auga.LogError("Must call ComplexTooltip interface method with a game object with a ComplexTooltip component on it.");
				return false;
			}
			return true;
		}

		[UsedImplicitly]
		public static void ComplexTooltip_AddItemTooltipCreatedListener(Action<GameObject, ItemData> listener)
		{
			ComplexTooltip.OnComplexTooltipGeneratedForItem += delegate(ComplexTooltip complexTooltip, ItemData item)
			{
				listener(((Component)complexTooltip).gameObject, item);
			};
		}

		[UsedImplicitly]
		public static void ComplexTooltip_AddFoodTooltipCreatedListener(Action<GameObject, Food> listener)
		{
			ComplexTooltip.OnComplexTooltipGeneratedForFood += delegate(ComplexTooltip complexTooltip, Food item)
			{
				listener(((Component)complexTooltip).gameObject, item);
			};
		}

		[UsedImplicitly]
		public static void ComplexTooltip_AddStatusEffectTooltipCreatedListener(Action<GameObject, StatusEffect> listener)
		{
			ComplexTooltip.OnComplexTooltipGeneratedForStatusEffect += delegate(ComplexTooltip complexTooltip, StatusEffect item)
			{
				listener(((Component)complexTooltip).gameObject, item);
			};
		}

		[UsedImplicitly]
		public static void ComplexTooltip_AddSkillTooltipCreatedListener(Action<GameObject, Skill> listener)
		{
			ComplexTooltip.OnComplexTooltipGeneratedForSkill += delegate(ComplexTooltip complexTooltip, Skill item)
			{
				listener(((Component)complexTooltip).gameObject, item);
			};
		}

		[UsedImplicitly]
		public static void ComplexTooltip_AddItemStatPreprocessor(Func<ItemData, string, string, Tuple<string, string>> itemStatPreprocessor)
		{
			ComplexTooltip.AddItemStatPreprocessor(itemStatPreprocessor);
		}

		[UsedImplicitly]
		public static void ComplexTooltip_ClearTextBoxes(GameObject complexTooltipGO)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.ClearTextBoxes();
			}
		}

		[UsedImplicitly]
		public static GameObject ComplexTooltip_AddTwoColumnTextBox(GameObject complexTooltipGO)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return null;
			}
			return ((Component)complexTooltip.AddTextBox(complexTooltip.TwoColumnTextBoxPrefab, (RectTransform)null)).gameObject;
		}

		[UsedImplicitly]
		public static GameObject ComplexTooltip_AddCenteredTextBox(GameObject complexTooltipGO)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return null;
			}
			return ((Component)complexTooltip.AddTextBox(complexTooltip.CenteredTextBoxPrefab, (RectTransform)null)).gameObject;
		}

		[UsedImplicitly]
		public static GameObject ComplexTooltip_AddUpgradeLabels(GameObject complexTooltipGO)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return null;
			}
			return ((Component)complexTooltip.AddTextBox(complexTooltip.UpgradeLabelsPrefab, (RectTransform)null)).gameObject;
		}

		[UsedImplicitly]
		public static GameObject ComplexTooltip_AddUpgradeTwoColumnTextBox(GameObject complexTooltipGO)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return null;
			}
			return ((Component)complexTooltip.AddTextBox(complexTooltip.UpgradeTwoColumnTextBoxPrefab, (RectTransform)null)).gameObject;
		}

		[UsedImplicitly]
		public static GameObject ComplexTooltip_AddCheckBoxTextBox(GameObject complexTooltipGO)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return null;
			}
			return ((Component)complexTooltip.AddTextBox(complexTooltip.CheckBoxTextBoxPrefab, (RectTransform)null)).gameObject;
		}

		[UsedImplicitly]
		public static GameObject ComplexTooltip_AddDivider(GameObject complexTooltipGO)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return null;
			}
			return complexTooltip.AddDivider((RectTransform)null);
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetTopic(GameObject complexTooltipGO, string topic)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetTopic(topic);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetSubtitle(GameObject complexTooltipGO, string topic)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetSubtitle(topic);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetDescription(GameObject complexTooltipGO, string desc)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetDescription(desc);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetIcon(GameObject complexTooltipGO, Sprite icon)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetIcon(icon);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_EnableDescription(GameObject complexTooltipGO, bool enabled)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.EnableDescription(enabled);
			}
		}

		[UsedImplicitly]
		public static string ComplexTooltip_GenerateItemSubtext(GameObject complexTooltipGO, ItemData item)
		{
			if (!ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				return string.Empty;
			}
			return complexTooltip.GenerateItemSubtext(item);
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetItem(GameObject complexTooltipGO, ItemData item, int quality = -1, int variant = -1)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetItem(item, quality, variant);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetItemNoTextBoxes(GameObject complexTooltipGO, ItemData item, int quality = -1, int variant = -1)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetItemNoTextBoxes(item, quality, variant);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetFood(GameObject complexTooltipGO, Food food)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetFood(food);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetStatusEffect(GameObject complexTooltipGO, StatusEffect statusEffect)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetStatusEffect(statusEffect);
			}
		}

		[UsedImplicitly]
		public static void ComplexTooltip_SetSkill(GameObject complexTooltipGO, Skill skill)
		{
			if (ComplexTooltipCheck(complexTooltipGO, out var complexTooltip))
			{
				complexTooltip.SetSkill(skill);
			}
		}

		private static bool RequirementsPanelCheck(GameObject requirementsPanelGO, out CraftingRequirementsPanel requirementsPanel)
		{
			requirementsPanel = requirementsPanelGO.GetComponent<CraftingRequirementsPanel>();
			if ((Object)(object)requirementsPanel == (Object)null)
			{
				Auga.LogError("Must call RequirementsPanel interface method with a game object with a CraftingRequirementsPanel component on it.");
				return false;
			}
			return true;
		}

		[UsedImplicitly]
		public static Image RequirementsPanel_GetIcon(GameObject requirementsPanelGO)
		{
			CraftingRequirementsPanel requirementsPanel;
			return (!RequirementsPanelCheck(requirementsPanelGO, out requirementsPanel)) ? null : requirementsPanel.Icon;
		}

		[UsedImplicitly]
		public static GameObject[] RequirementsPanel_RequirementList(GameObject requirementsPanelGO)
		{
			CraftingRequirementsPanel requirementsPanel;
			return (!RequirementsPanelCheck(requirementsPanelGO, out requirementsPanel)) ? null : requirementsPanel.RequirementList;
		}

		[UsedImplicitly]
		public static void RequirementsPanel_SetWires(GameObject requirementsPanelGO, RequirementWireState[] wireStates, bool canCraft)
		{
			if (RequirementsPanelCheck(requirementsPanelGO, out var requirementsPanel))
			{
				List<WireState> list = wireStates.Select((RequirementWireState wireState) => (WireState)wireState).ToList();
				requirementsPanel.WireFrame.Set((IReadOnlyList<WireState>)list, canCraft);
			}
		}

		[UsedImplicitly]
		public static TMP_Text CustomVariantPanel_Enable(string buttonLabel, Action<bool> onShow)
		{
			if ((Object)(object)WorkbenchPanelController.instance == (Object)null)
			{
				return null;
			}
			return WorkbenchPanelController.instance.CraftingPanel.EnableCustomVariantDialog(buttonLabel, onShow);
		}

		[UsedImplicitly]
		public static void CustomVariantPanel_SetButtonLabel(string buttonLabel)
		{
			if (!((Object)(object)WorkbenchPanelController.instance == (Object)null))
			{
				WorkbenchPanelController.instance.CraftingPanel.SetCustomVariantButtonLabel(buttonLabel);
			}
		}

		[UsedImplicitly]
		public static void CustomVariantPanel_Disable()
		{
			WorkbenchPanelController instance = WorkbenchPanelController.instance;
			if (instance != null)
			{
				instance.CraftingPanel.DisableCustomVariantDialog();
			}
		}
	}
	public enum RequirementWireState
	{
		Absent,
		Have,
		DontHave
	}
	public class PlayerPanelTabData
	{
		public int Index;

		public TMP_Text TabTitle;

		public GameObject TabButtonGO;

		public GameObject ContentGO;
	}
	public class WorkbenchTabData
	{
		public int Index;

		public TMP_Text TabTitle;

		public GameObject TabButtonGO;

		public GameObject RequirementsPanelGO;

		public GameObject ItemInfoGO;
	}
	public class AugaAssets
	{
		public GameObject AugaLogo;

		public GameObject InventoryScreen;

		public GameObject Hud;

		public Texture2D Cursor;

		public GameObject MenuPrefab;

		public GameObject TextViewerPrefab;

		public GameObject MainMenuPrefab;

		public GameObject BuildHudElement;

		public GameObject SettingsPrefab;

		public GameObject MessageHud;

		public GameObject TextInput;

		public GameObject AugaBarber;

		public GameObject AugaChat;

		public GameObject DamageText;

		public GameObject EnemyHud;

		public GameObject StoreGui;

		public GameObject WorldListElement;

		public GameObject ServerListElement;

		public GameObject PasswordDialog;

		public GameObject ConnectingDialog;

		public GameObject PanelBase;

		public GameObject ButtonSmall;

		public GameObject ButtonMedium;

		public GameObject ButtonFancy;

		public GameObject ButtonToggle;

		public GameObject ButtonSettings;

		public GameObject DiamondButton;

		public Font SourceSansProBold;

		public Font SourceSansProSemiBold;

		public Font SourceSansProRegular;

		public Sprite ItemBackgroundSprite;

		public GameObject InventoryTooltip;

		public GameObject SimpleTooltip;

		public GameObject DividerSmall;

		public GameObject DividerMedium;

		public GameObject DividerLarge;

		public GameObject ConfirmDialog;

		public Sprite RecyclingPanelIcon;

		public GameObject BuildHud;

		public GameObject LeftWristMountUI;
	}
	public class AugaColors
	{
		public string BrightestGold = "#FFBF1B";

		public string Topic = "#EAA800";

		public string Emphasis = "#1AACEF";

		public Color Healing = new Color(0.5f, 1f, 0.5f, 0.7f);

		public Color PlayerDamage = new Color(1f, 0f, 0f, 1f);

		public Color PlayerNoDamage = new Color(0.5f, 0.5f, 0.5f, 1f);

		public Color NormalDamage = new Color(1f, 1f, 1f, 1f);

		public Color ResistDamage = new Color(0.6f, 0.6f, 0.6f, 1f);

		public Color WeakDamage = new Color(1f, 1f, 0f, 1f);

		public Color ImmuneDamage = new Color(0.6f, 0.6f, 0.6f, 1f);

		public Color TooHard = new Color(0.8f, 0.7f, 0.7f, 1f);
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("randyknapp.mods.auga", "Project Auga", "1.3.11")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Auga : BaseUnityPlugin
	{
		public enum StatBarTextDisplayMode
		{
			JustValue,
			ValueAndMax,
			ValueMaxPercent,
			JustPercent
		}

		public enum StatBarTextPosition
		{
			Off = -1,
			Above,
			Below,
			Center,
			Start,
			End
		}

		public const string PluginID = "randyknapp.mods.auga";

		public const string Version = "1.3.11";

		private static ConfigEntry<bool> _loggingEnabled;

		private static ConfigEntry<LogLevel> _logLevel;

		public static ConfigEntry<bool> UseAugaTrash;

		public static ConfigEntry<bool> HealthBarShow;

		public static ConfigEntry<int> HealthBarFixedSize;

		public static ConfigEntry<StatBarTextDisplayMode> HealthBarTextDisplay;

		public static ConfigEntry<StatBarTextPosition> HealthBarTextPosition;

		public static ConfigEntry<bool> HealthBarShowTicks;

		public static ConfigEntry<bool> StaminaBarShow;

		public static ConfigEntry<int> StaminaBarFixedSize;

		public static ConfigEntry<StatBarTextDisplayMode> StaminaBarTextDisplay;

		public static ConfigEntry<StatBarTextPosition> StaminaBarTextPosition;

		public static ConfigEntry<bool> StaminaBarShowTicks;

		public static ConfigEntry<bool> EitrBarShow;

		public static ConfigEntry<int> EitrBarFixedSize;

		public static ConfigEntry<StatBarTextDisplayMode> EitrBarTextDisplay;

		public static ConfigEntry<StatBarTextPosition> EitrBarTextPosition;

		public static ConfigEntry<bool> EitrBarShowTicks;

		public static ConfigEntry<bool> AugaChatShow;

		public static readonly AugaAssets Assets = new AugaAssets();

		public static readonly AugaColors Colors = new AugaColors();

		public static bool HasBetterTrader;

		public static bool HasMultiCraft;

		public static bool HasSimpleRecycling;

		public static bool HasChatter;

		public static bool HasSearsCatalog;

		public static bool HasJewelcrafting;

		private static Auga _instance;

		private Harmony _harmony;

		private static Type _multiCraftUiType;

		private static Type _recyclingContainerButtonHolderType;

		private static Type _recyclingStationButtonHolderType;

		private static WorkbenchTabData _recyclingTabData;

		public static Auga instance => _instance;

		public void Awake()
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Expected O, but got Unknown
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Expected O, but got Unknown
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Expected O, but got Unknown
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Expected O, but got Unknown
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Expected O, but got Unknown
			//IL_096f: Unknown result type (might be due to invalid IL or missing references)
			//IL_097d: Expected O, but got Unknown
			//IL_0996: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a4: Expected O, but got Unknown
			//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a65: Expected O, but got Unknown
			//IL_0529: Unknown result type (might be due to invalid IL or missing references)
			//IL_0537: Expected O, but got Unknown
			//IL_0a8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Expected O, but got Unknown
			//IL_0ac1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acf: Expected O, but got Unknown
			//IL_0af6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b04: Expected O, but got Unknown
			//IL_05ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Expected O, but got Unknown
			//IL_062f: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Expected O, but got Unknown
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Expected O, but got Unknown
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_073f: Expected O, but got Unknown
			_instance = this;
			if (int.TryParse(Assembly.GetExecutingAssembly().GetName().Version.ToString().Split(new char[1] { '.' })[3], out var result) && result > 0)
			{
				Debug.LogWarning((object)"==============================================================================");
				Debug.LogWarning((object)"You are using a PTB version of this mod. It will not work in prior versions.");
				Debug.LogWarning((object)$"Project Auga - Version {Assembly.GetExecutingAssembly().GetName().Version}");
				Debug.LogWarning((object)("Valheim - Version " + Version.GetVersionString(false)));
				if ((Version.CurrentVersion.m_minor != 217 || Version.CurrentVersion.m_patch < 27) && Version.CurrentVersion.m_minor <= 217)
				{
					Debug.LogError((object)">>>>>>>>> GAME VERSION MISMATCH - EXITING <<<<<<<<");
					Debug.LogWarning((object)"==============================================================================");
					Thread.Sleep(10000);
					Object.Destroy((Object)(object)this);
					return;
				}
				Debug.LogWarning((object)"GAME VERSION CHECK - PASSED");
				Debug.LogWarning((object)"==============================================================================");
			}
			LoadDependencies();
			Patcher.Patch();
			LoadTranslations();
			LoadConfig();
			LoadAssets();
			ApplyCursor();
			HasBetterTrader = Chainloader.PluginInfos.ContainsKey("Menthus.bepinex.plugins.BetterTrader");
			HasMultiCraft = Chainloader.PluginInfos.TryGetValue("maximods.valheim.multicraft", out var value);
			HasSimpleRecycling = Chainloader.PluginInfos.TryGetValue("com.github.abearcodes.valheim.simplerecycling", out var value2);
			HasChatter = Chainloader.PluginInfos.TryGetValue("redseiko.valheim.chatter", out var value3);
			HasSearsCatalog = Chainloader.PluginInfos.TryGetValue("redseiko.valheim.searscatalog", out var value4);
			HasJewelcrafting = Chainloader.PluginInfos.TryGetValue("org.bepinex.plugins.jewelcrafting", out var value5);
			_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "randyknapp.mods.auga");
			if (HasChatter)
			{
				Chatter.ChatterType = Assembly.LoadFile(value3.Location);
				Chatter.ToggleCell = Chatter.ChatterType.GetType("Chatter.ToggleCell");
				MethodInfo methodInfo = AccessTools.Method(Chatter.ToggleCell, "CreateChildCell", (Type[])null, (Type[])null);
				MethodInfo methodInfo2 = AccessTools.Method(Chatter.ToggleCell, "CreateChildLabel", (Type[])null, (Type[])null);
				MethodInfo methodInfo3 = AccessTools.Method(Chatter.ToggleCell, "OnToggleValueChanged", (Type[])null, (Type[])null);
				if (Chatter.ToggleCell != null)
				{
					_harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Chatter), "CreateChildCell_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					_harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Chatter), "CreateChildLabel_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
					_harmony.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Chatter), "OnToggleValueChanged_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			if (HasSearsCatalog)
			{
				SearsCatalog.SearsCatalogType = Assembly.LoadFile(value4.Location);
				SearsCatalog.HudPatch = SearsCatalog.SearsCatalogType.GetType("SearsCatalog.HudPatch");
				MethodInfo methodInfo4 = AccessTools.Method(typeof(Hud), "Awake", (Type[])null, (Type[])null);
				if (SearsCatalog.HudPatch != null)
				{
					_harmony.Patch((MethodBase)methodInfo4, (HarmonyMethod)null, new HarmonyMethod(typeof(SearsCatalog), "AwakePostfix_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			if (HasJewelcrafting)
			{
				Jewelcrafting.ModAssembly = Assembly.LoadFile(value5.Location);
				Jewelcrafting.Synergy = Jewelcrafting.ModAssembly.GetType("Jewelcrafting.Synergy");
				Jewelcrafting.SocketsBackground = Jewelcrafting.ModAssembly.GetType("Jewelcrafting.SocketsBackground");
				Jewelcrafting.FusionBoxSetup = Jewelcrafting.ModAssembly.GetType("Jewelcrafting.FusionBoxSetup");
				Jewelcrafting.AddSealButton = Jewelcrafting.FusionBoxSetup.GetNestedType("AddSealButton");
				Jewelcrafting.AddSynergyIcon = Jewelcrafting.Synergy.GetNestedType("AddSynergyIcon", BindingFlags.Static | BindingFlags.NonPublic);
				Jewelcrafting.DisplaySynergyView = Jewelcrafting.Synergy.GetNestedType("DisplaySynergyView");
				Jewelcrafting.GemCursor = Jewelcrafting.ModAssembly.GetType("Jewelcrafting.GemCursor");
				Jewelcrafting.CacheVanillaCursor = Jewelcrafting.GemCursor.GetNestedType("CacheVanillaCursor", BindingFlags.Static | BindingFlags.NonPublic);
				Jewelcrafting.GemStones = Jewelcrafting.ModAssembly.GetType("Jewelcrafting.GemStones");
				Jewelcrafting.OpenFakeSocketsContainer = Jewelcrafting.GemStones.GetNestedType("OpenFakeSocketsContainer");
				Jewelcrafting.CloseFakeSocketsContainer = Jewelcrafting.GemStones.GetNestedType("CloseFakeSocketsContainer", BindingFlags.Static | BindingFlags.NonPublic);
				bool flag = false;
				if (Jewelcrafting.DisplaySynergyView != null)
				{
					MethodInfo methodInfo5 = AccessTools.Method(Jewelcrafting.DisplaySynergyView, "Awake", (Type[])null, (Type[])null);
					MethodInfo methodInfo6 = AccessTools.Method(typeof(InventoryGui), "Awake", (Type[])null, (Type[])null);
					_harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Jewelcrafting), "DisplaySynergyView_Awake_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
					_harmony.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(typeof(Jewelcrafting), "IvnentoryGui_Awake_Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					flag = true;
				}
				if (Jewelcrafting.SocketsBackground != null)
				{
					MethodInfo methodInfo7 = AccessTools.Method(typeof(Hud), "Awake", (Type[])null, (Type[])null);
					_harmony.Patch((MethodBase)methodInfo7, new HarmonyMethod(typeof(Jewelcrafting), "Hud_Awake_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					flag = true;
				}
				if (Jewelcrafting.AddSealButton != null)
				{
					MethodInfo method = Jewelcrafting.AddSealButton.GetMethod("Postfix", BindingFlags.Static | BindingFlags.NonPublic);
					if (method == null)
					{
						flag = true;
						Debug.LogWarning((object)$"sealPostfixMethod ==  null: {method == null}");
					}
					_harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Jewelcrafting), "FusionBoxSetup_AddSealButton_Postfix_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					flag = true;
				}
				if (Jewelcrafting.CacheVanillaCursor != null)
				{
					MethodInfo method2 = Jewelcrafting.CacheVanillaCursor.GetMethod("Postfix", BindingFlags.Static | BindingFlags.NonPublic);
					if (method2 == null)
					{
						flag = true;
						Debug.LogWarning((object)$"cursorPostfixMethod ==  null: {method2 == null}");
					}
					_harmony.Patch((MethodBase)method2, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Jewelcrafting), "GemCursor_CacheVanillaCursor_Postfix_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					flag = true;
				}
				if (Jewelcrafting.OpenFakeSocketsContainer != null)
				{
					MethodInfo method3 = Jewelcrafting.OpenFakeSocketsContainer.GetMethod("Open", BindingFlags.Static | BindingFlags.Public);
					if (method3 == null)
					{
						flag = true;
						Debug.LogWarning((object)$"openSocketsMethod ==  null: {method3 == null}");
					}
					_harmony.Patch((MethodBase)method3, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Jewelcrafting), "GemStones_OpenFakeSocketsContainer_Open_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					flag = true;
				}
				if (Jewelcrafting.CloseFakeSocketsContainer != null)
				{
					MethodInfo method4 = Jewelcrafting.CloseFakeSocketsContainer.GetMethod("Prefix", BindingFlags.Static | BindingFlags.NonPublic);
					if (method4 == null)
					{
						flag = true;
						Debug.LogWarning((object)$"closeSocketsMethod ==  null: {method4 == null}");
					}
					_harmony.Patch((MethodBase)method4, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Jewelcrafting), "GemStones_CloseFakeSocketsContainer_Prefix_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
				}
				else
				{
					flag = true;
				}
				if (flag)
				{
					Debug.LogWarning((object)$"Jewelcrafting.DisplaySynergyView ==  null: {Jewelcrafting.DisplaySynergyView == null}");
					Debug.LogWarning((object)$"Jewelcrafting.Synergy ==  null: {Jewelcrafting.Synergy == null}");
					Debug.LogWarning((object)$"Jewelcrafting.SocketsBackground ==  null: {Jewelcrafting.SocketsBackground == null}");
					Debug.LogWarning((object)$"Jewelcrafting.DisplaySynergyView ==  null: {Jewelcrafting.DisplaySynergyView == null}");
					Debug.LogWarning((object)$"Jewelcrafting.AddSynergyIcon ==  null: {Jewelcrafting.AddSynergyIcon == null}");
					Debug.LogWarning((object)$"Jewelcrafting.FusionBoxSetup ==  null: {Jewelcrafting.FusionBoxSetup == null}");
					Debug.LogWarning((object)$"Jewelcrafting.AddSealButton ==  null: {Jewelcrafting.AddSealButton == null}");
					Debug.LogWarning((object)$"Jewelcrafting.GemCursor ==  null: {Jewelcrafting.GemCursor == null}");
					Debug.LogWarning((object)$"Jewelcrafting.CacheVanillaCursor ==  null: {Jewelcrafting.CacheVanillaCursor == null}");
					Debug.LogWarning((object)$"Jewelcrafting.GemStones ==  null: {Jewelcrafting.GemStones == null}");
					Debug.LogWarning((object)$"Jewelcrafting.OpenFakeSocketsContainer ==  null: {Jewelcrafting.OpenFakeSocketsContainer == null}");
					Debug.LogWarning((object)$"Jewelcrafting.CloseFakeSocketsContainer ==  null: {Jewelcrafting.CloseFakeSocketsContainer == null}");
					Debug.LogError((object)"Jewelcrafting Compatibility Failed - Contact Vapok with the above information");
					Thread.Sleep(15000);
				}
			}
			if (HasMultiCraft)
			{
				Assembly assembly = Assembly.LoadFile(value.Location);
				_multiCraftUiType = assembly.GetType("MultiCraft.MultiCraft_UI");
				Type type = assembly.GetType("MultiCraft.MultiCraft_Logic");
				MethodInfo methodInfo8 = AccessTools.Method(_multiCraftUiType, "CreateSpaceFromCraftButton", (Type[])null, (Type[])null);
				MethodInfo methodInfo9 = AccessTools.Method(type, "IsCrafting", (Type[])null, (Type[])null);
				if (methodInfo8 != null)
				{
					_harmony.Patch((MethodBase)methodInfo8, new HarmonyMethod(typeof(Auga), "MultiCraft_UI_CreateSpaceFromCraftButton_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					_harmony.Patch((MethodBase)methodInfo9, new HarmonyMethod(typeof(Auga), "MultiCraft_Logic_IsCrafting_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			if (HasSimpleRecycling)
			{
				Assembly assembly2 = Assembly.LoadFile(value2.Location);
				_recyclingContainerButtonHolderType = assembly2.GetType("ABearCodes.Valheim.SimpleRecycling.UI.ContainerRecyclingButtonHolder");
				_recyclingStationButtonHolderType = assembly2.GetType("ABearCodes.Valheim.SimpleRecycling.UI.StationRecyclingTabHolder");
				MethodInfo methodInfo10 = AccessTools.Method(_recyclingContainerButtonHolderType, "SetupButton", (Type[])null, (Type[])null);
				MethodInfo methodInfo11 = AccessTools.Method(_recyclingStationButtonHolderType, "SetupTabButton", (Type[])null, (Type[])null);
				MethodInfo methodInfo12 = AccessTools.Method(_recyclingStationButtonHolderType, "SetActive", (Type[])null, (Type[])null);
				MethodInfo methodInfo13 = AccessTools.Method(_recyclingStationButtonHolderType, "InRecycleTab", (Type[])null, (Type[])null);
				if (methodInfo10 != null)
				{
					_harmony.Patch((MethodBase)methodInfo10, new HarmonyMethod(typeof(Auga), "SimpleRecycling_ContainerRecyclingButtonHolder_SetupButton_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				if (methodInfo11 != null)
				{
					_harmony.Patch((MethodBase)methodInfo11, new HarmonyMethod(typeof(Auga), "SimpleRecycling_StationRecyclingTabHolder_SetupTabButton_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				if (methodInfo12 != null)
				{
					_harmony.Patch((MethodBase)methodInfo12, new HarmonyMethod(typeof(Auga), "SimpleRecycling_StationRecyclingTabHolder_SetActive_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
				if (methodInfo13 != null)
				{
					_harmony.Patch((MethodBase)methodInfo13, new HarmonyMethod(typeof(Auga), "SimpleRecycling_StationRecyclingTabHolder_InRecycleTab_Patch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
		}

		public static bool MultiCraft_UI_CreateSpaceFromCraftButton_Patch(InventoryGui instance)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			object multiCraftUiInstance = AccessTools.Method(_multiCraftUiType, "get_instance", (Type[])null, (Type[])null).Invoke(null, BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty, null, new object[0], CultureInfo.InvariantCulture);
			Transform val = ((Component)instance.m_craftButton).transform.parent.Find("plus");
			MethodInfo plusButtonMethod = AccessTools.Method(_multiCraftUiType, "OnPlusButtonPressed", (Type[])null, (Type[])null);
			((UnityEvent)((Component)val).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				plusButtonMethod.Invoke(multiCraftUiInstance, new object[0]);
			});
			Transform val2 = ((Component)instance.m_craftButton).transform.parent.Find("minus");
			MethodInfo minusButtonMethod = AccessTools.Method(_multiCraftUiType, "OnMinusButtonPressed", (Type[])null, (Type[])null);
			((UnityEvent)((Component)val2).GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				minusButtonMethod.Invoke(multiCraftUiInstance, new object[0]);
			});
			return false;
		}

		public static bool MultiCraft_Logic_IsCrafting_Patch(ref bool __result)
		{
			__result = InventoryGui.instance.m_craftTimer >= 0f;
			return false;
		}

		public static bool SimpleRecycling_ContainerRecyclingButtonHolder_SetupButton_Patch()
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			GameObject gameObject = ((Component)((Transform)InventoryGui.instance.m_container).Find("RecycleAll")).gameObject;
			MethodInfo onRecycleAllPressedMethod = AccessTools.Method(_recyclingContainerButtonHolderType, "OnRecycleAllPressed", (Type[])null, (Type[])null);
			MethodInfo methodInfo = AccessTools.Method(_recyclingContainerButtonHolderType, "SetButtonState", (Type[])null, (Type[])null);
			FieldRef<object, Button> val = AccessTools.FieldRefAccess<Button>(_recyclingContainerButtonHolderType, "_recycleAllButton");
			FieldRef<object, Text> val2 = AccessTools.FieldRefAccess<Text>(_recyclingContainerButtonHolderType, "_textComponent");
			FieldRef<object, Image> val3 = AccessTools.FieldRefAccess<Image>(_recyclingContainerButtonHolderType, "_imageComponent");
			Component component = ((Component)_instance).gameObject.GetComponent("ContainerRecyclingButtonHolder");
			Button component2 = gameObject.GetComponent<Button>();
			val.Invoke((object)component) = component2;
			((UnityEventBase)component2.onClick).RemoveAllListeners();
			((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
			{
				onRecycleAllPressedMethod.Invoke(component, new object[0]);
			});
			val2.Invoke((object)component) = ((Component)component2).GetComponentInChildren<Text>();
			val3.Invoke((object)component) = ((Component)component2).GetComponentInChildren<Image>();
			methodInfo.Invoke(component, new object[1] { false });
			return false;
		}

		public static bool SimpleRecycling_StationRecyclingTabHolder_SetupTabButton_Patch()
		{
			FieldRef<object, Button> val = AccessTools.FieldRefAccess<Button>(_recyclingStationButtonHolderType, "_recyclingTabButtonComponent");
			FieldRef<object, GameObject> val2 = AccessTools.FieldRefAccess<GameObject>(_recyclingStationButtonHolderType, "_recyclingTabButtonGameObject");
			MethodInfo updateCraftingPanelMethod = AccessTools.Method(_recyclingStationButtonHolderType, "UpdateCraftingPanel", (Type[])null, (Type[])null);
			Component component = ((Component)_instance).gameObject.GetComponent("StationRecyclingTabHolder");
			_recyclingTabData = API.Workbench_AddVanillaWorkbenchTab("RECYCLE", Assets.RecyclingPanelIcon, "Recycle", delegate
			{
				updateCraftingPanelMethod.Invoke(component, new object[0]);
			});
			val.Invoke((object)component) = _recyclingTabData.TabButtonGO.GetComponent<Button>();
			val2.Invoke((object)component) = _recyclingTabData.TabButtonGO;
			return false;
		}

		public static bool SimpleRecycling_StationRecyclingTabHolder_SetActive_Patch()
		{
			return false;
		}

		public static bool SimpleRecycling_StationRecyclingTabHolder_InRecycleTab_Patch(ref bool __result)
		{
			__result = (Object)(object)WorkbenchPanelController.instance != (Object)null && WorkbenchPanelController.instance.IsTabActiveById("RECYCLE");
			return false;
		}

		public void OnDestroy()
		{
			_instance = null;
		}

		private void LoadDependencies()
		{
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			LoadEmbeddedAssembly(callingAssembly, "fastJSON.dll");
			LoadEmbeddedAssembly(callingAssembly, "Unity.Auga.dll");
		}

		private static void LoadEmbeddedAssembly(Assembly assembly, string assemblyName)
		{
			Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(assembly.GetName().Name + "." + assemblyName);
			if (manifestResourceStream == null)
			{
				LogError("Could not load embedded assembly (" + assemblyName + ")!");
				return;
			}
			using (manifestResourceStream)
			{
				byte[] array = new byte[manifestResourceStream.Length];
				manifestResourceStream.Read(array, 0, array.Length);
				Assembly.Load(array);
			}
		}

		private static void LoadTranslations()
		{
			string text = LoadJsonText("translations.json");
			if (string.IsNullOrEmpty(text))
			{
				return;
			}
			IDictionary<string, object> dictionary = (IDictionary<string, object>)JSON.Parse(text);
			foreach (KeyValuePair<string, object> item in dictionary)
			{
				if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value.ToString()))
				{
					Localization.instance.AddWord(item.Key, item.Value.ToString());
				}
			}
		}

		private void LoadConfig()
		{
			_loggingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Logging", "LoggingEnabled", false, "Enable logging");
			_logLevel = ((BaseUnityPlugin)this).Config.Bind<LogLevel>("Logging", "LogLevel", (LogLevel)16, "Only log messages of the selected level or higher");
			UseAugaTrash = ((BaseUnityPlugin)this).Config.Bind<bool>("Options", "UseAugaTrash", false, "Enable Auga's built in trash button. Click on the button while holding an item or part of a stack with the mouse.");
			HealthBarShow = ((BaseUnityPlugin)this).Config.Bind<bool>("StatBars", "HealthBarShow", true, "If false, hides the health bar completely.");
			HealthBarFixedSize = ((BaseUnityPlugin)this).Config.Bind<int>("StatBars", "HealthBarFixedSize", 0, "If greater than 0, forces the health bar to be that many pixels long, regardless of the player's max health.");
			HealthBarTextDisplay = ((BaseUnityPlugin)this).Config.Bind<StatBarTextDisplayMode>("StatBars", "HealthBarTextDisplay", StatBarTextDisplayMode.JustValue, "Changes how the label of the health bar is displayed.");
			HealthBarTextPosition = ((BaseUnityPlugin)this).Config.Bind<StatBarTextPosition>("StatBars", "HealthBarTextPosition", StatBarTextPosition.Center, "Changes where the label of the health bar is displayed.");
			HealthBarShowTicks = ((BaseUnityPlugin)this).Config.Bind<bool>("StatBars", "HealthBarShowTicks", true, "Show a faint line on the bar every 25 units");
			StaminaBarShow = ((BaseUnityPlugin)this).Config.Bind<bool>("StatBars", "StaminaBarShow", true, "If false, hides the stamina bar completely.");
			StaminaBarFixedSize = ((BaseUnityPlugin)this).Config.Bind<int>("StatBars", "StaminaBarFixedSize", 0, "If greater than 0, forces the stamina bar to be that many pixels long, regardless of the player's max stamina.");
			StaminaBarTextDisplay = ((BaseUnityPlugin)this).Config.Bind<StatBarTextDisplayMode>("StatBars", "StaminaBarTextDisplay", StatBarTextDisplayMode.JustValue, "Changes how the label of the stamina bar is displayed.");
			StaminaBarTextPosition = ((BaseUnityPlugin)this).Config.Bind<StatBarTextPosition>("StatBars", "StaminaBarTextPosition", StatBarTextPosition.Center, "Changes where the label of the stamina bar is displayed.");
			StaminaBarShowTicks = ((BaseUnityPlugin)this).Config.Bind<bool>("StatBars", "StaminaBarShowTicks", true, "Show a faint line on the bar every 25 units");
			EitrBarShow = ((BaseUnityPlugin)this).Config.Bind<bool>("StatBars", "EitrBarShow", true, "If false, hides the eitr bar completely.");
			EitrBarFixedSize = ((BaseUnityPlugin)this).Config.Bind<int>("StatBars", "EitrBarFixedSize", 0, "If greater than 0, forces the eitr bar to be that many pixels long, regardless of the player's max eitr. Eitr bar still hides if max eitr is zero.");
			EitrBarTextDisplay = ((BaseUnityPlugin)this).Config.Bind<StatBarTextDisplayMode>("StatBars", "EitrBarTextDisplay", StatBarTextDisplayMode.JustValue, "Changes how the label of the eitr bar is displayed.");
			EitrBarTextPosition = ((BaseUnityPlugin)this).Config.Bind<StatBarTextPosition>("StatBars", "EitrBarTextPosition", StatBarTextPosition.Center, "Changes where the label of the eitr bar is displayed.");
			EitrBarShowTicks = ((BaseUnityPlugin)this).Config.Bind<bool>("StatBars", "Eitr", true, "Show a faint line on the bar every 25 units");
			AugaChatShow = ((BaseUnityPlugin)this).Config.Bind<bool>("AugaChat", "Show Auga Chat. Disable to use other mods. (Requires Restart)", true, "If false, disables the Auga Chat window display");
		}

		private static void LoadAssets()
		{
			AssetBundle val = LoadAssetBundle("augaassets");
			Assets.AugaLogo = val.LoadAsset<GameObject>("AugaLogo");
			Assets.InventoryScreen = val.LoadAsset<GameObject>("Inventory_screen");
			Assets.Cursor = val.LoadAsset<Texture2D>("Cursor2");
			Assets.MenuPrefab = val.LoadAsset<GameObject>("AugaMenu");
			Assets.TextViewerPrefab = val.LoadAsset<GameObject>("AugaTextViewer");
			Assets.Hud = val.LoadAsset<GameObject>("HUD");
			Assets.MainMenuPrefab = val.LoadAsset<GameObject>("MainMenu");
			Assets.BuildHudElement = val.LoadAsset<GameObject>("BuildHudElement");
			Assets.SettingsPrefab = val.LoadAsset<GameObject>("AugaSettings");
			Assets.MessageHud = val.LoadAsset<GameObject>("AugaMessageHud");
			Assets.TextInput = val.LoadAsset<GameObject>("AugaTextInput");
			Assets.AugaBarber = val.LoadAsset<GameObject>("AugaBarber");
			Assets.AugaChat = val.LoadAsset<GameObject>("AugaChat");
			Assets.DamageText = val.LoadAsset<GameObject>("AugaDamageText");
			Assets.EnemyHud = val.LoadAsset<GameObject>("AugaEnemyHud");
			Assets.StoreGui = val.LoadAsset<GameObject>("AugaStoreScreen");
			Assets.WorldListElement = val.LoadAsset<GameObject>("WorldListElement");
			Assets.ServerListElement = val.LoadAsset<GameObject>("ServerListElement");
			Assets.PasswordDialog = val.LoadAsset<GameObject>("AugaPassword");
			Assets.ConnectingDialog = val.LoadAsset<GameObject>("AugaConnecting");
			Assets.PanelBase = val.LoadAsset<GameObject>("AugaPanelBase");
			Assets.ButtonSmall = val.LoadAsset<GameObject>("ButtonSmall");
			Assets.ButtonMedium = val.LoadAsset<GameObject>("ButtonMedium");
			Assets.ButtonFancy = val.LoadAsset<GameObject>("ButtonFancy");
			Assets.ButtonToggle = val.LoadAsset<GameObject>("ButtonToggle");
			Assets.ButtonSettings = val.LoadAsset<GameObject>("ButtonSettings");
			Assets.DiamondButton = val.LoadAsset<GameObject>("DiamondButton");
			Assets.SourceSansProBold = val.LoadAsset<Font>("SourceSansPro-Bold");
			Assets.SourceSansProSemiBold = val.LoadAsset<Font>("SourceSansPro-SemiBold");
			Assets.SourceSansProRegular = val.LoadAsset<Font>("SourceSansPro-Regular");
			Assets.ItemBackgroundSprite = val.LoadAsset<Sprite>("Container_Square_A");
			Assets.InventoryTooltip = val.LoadAsset<GameObject>("InventoryTooltip");
			Assets.SimpleTooltip = val.LoadAsset<GameObject>("SimpleTooltip");
			Assets.DividerSmall = val.LoadAsset<GameObject>("DividerSmall");
			Assets.DividerMedium = val.LoadAsset<GameObject>("DividerMedium");
			Assets.DividerLarge = val.LoadAsset<GameObject>("DividerLarge");
			Assets.ConfirmDialog = val.LoadAsset<GameObject>("ConfirmDialog");
			Assets.RecyclingPanelIcon = val.LoadAsset<Sprite>("RecyclingPanel");
			Assets.LeftWristMountUI = val.LoadAsset<GameObject>("LeftWristMountUI");
			Assets.BuildHud = val.LoadAsset<GameObject>("BuildHud");
		}

		private static void ApplyCursor()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Cursor.SetCursor(Assets.Cursor, new Vector2(6f, 5f), (CursorMode)0);
		}

		public static AssetBundle LoadAssetBundle(string filename)
		{
			string assetPath = GetAssetPath(filename);
			if (!string.IsNullOrEmpty(assetPath))
			{
				return AssetBundle.LoadFromFile(assetPath);
			}
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			return AssetBundle.LoadFromStream(callingAssembly.GetManifestResourceStream(callingAssembly.GetName().Name + "." + filename));
		}

		public static string LoadJsonText(string filename)
		{
			string assetPath = GetAssetPath(filename);
			return (!string.IsNullOrEmpty(assetPath)) ? File.ReadAllText(assetPath) : null;
		}

		public static string GetAssetPath(string assetName)
		{
			string text = Path.Combine(Paths.PluginPath, "Auga", assetName);
			if (!File.Exists(text))
			{
				Assembly assembly = typeof(Auga).Assembly;
				text = Path.Combine(Path.GetDirectoryName(assembly.Location) ?? string.Empty, assetName);
				if (!File.Exists(text))
				{
					LogError("Could not find asset (" + assetName + ")");
					return null;
				}
			}
			return text;
		}

		public static void Log(string message)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			if (_loggingEnabled.Value && (int)_logLevel.Value <= 16)
			{
				((BaseUnityPlugin)_instance).Logger.LogInfo((object)message);
			}
		}

		public static void LogWarning(string message)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if (_loggingEnabled.Value && (int)_logLevel.Value <= 4)
			{
				((BaseUnityPlugin)_instance).Logger.LogWarning((object)message);
			}
		}

		public static void LogError(string message)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			if (_loggingEnabled.Value && (int)_logLevel.Value <= 2)
			{
				((BaseUnityPlugin)_instance).Logger.LogError((object)message);
			}
		}

		[UsedImplicitly]
		public void Update()
		{
			UpdateStatBars();
		}

		public static void UpdateStatBars()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Hud.instance != (Object)null))
			{
				return;
			}
			Transform val = ((Component)Hud.instance).transform.Find("hudroot/HealthBar");
			Transform val2 = ((Component)Hud.instance).transform.Find("hudroot/StaminaBar");
			Transform val3 = ((Component)Hud.instance).transform.Find("hudroot/EitrBar");
			if ((Object)(object)val != (Object)null)
			{
				AugaHealthBar component = ((Component)val).GetComponent<AugaHealthBar>();
				if (component != null)
				{
					component.Hide = !HealthBarShow.Value;
					component.FixedLength = HealthBarFixedSize.Value;
					component.TextDisplay = (TextDisplayMode)HealthBarTextDisplay.Value;
					component.DisplayTextPosition = (TextPosition)HealthBarTextPosition.Value;
					component.ShowTicks = HealthBarShowTicks.Value;
				}
			}
			if ((Object)(object)val2 != (Object)null)
			{
				AugaHealthBar component2 = ((Component)val2).GetComponent<AugaHealthBar>();
				if (component2 != null)
				{
					component2.Hide = !StaminaBarShow.Value;
					component2.FixedLength = StaminaBarFixedSize.Value;
					component2.TextDisplay = (TextDisplayMode)StaminaBarTextDisplay.Value;
					component2.DisplayTextPosition = (TextPosition)StaminaBarTextPosition.Value;
					component2.ShowTicks = StaminaBarShowTicks.Value;
				}
			}
			if ((Object)(object)val3 != (Object)null)
			{
				AugaHealthBar component3 = ((Component)val3).GetComponent<AugaHealthBar>();
				if (component3 != null)
				{
					component3.Hide = !EitrBarShow.Value;
					component3.FixedLength = EitrBarFixedSize.Value;
					component3.TextDisplay = (TextDisplayMode)EitrBarTextDisplay.Value;
					component3.DisplayTextPosition = (TextPosition)EitrBarTextPosition.Value;
					component3.ShowTicks = EitrBarShowTicks.Value;
				}
			}
		}
	}
	[HarmonyPatch(typeof(Terminal), "InitTerminal")]
	public static class Terminal_InitTerminal_Patch
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static ConsoleEvent <>9__0_0;

			internal void <Postfix>b__0_0(ConsoleEventArgs args)
			{
				FieldInfo field = typeof(Player).GetField("m_knownBiome", BindingFlags.Instance | BindingFlags.NonPublic);
				field.SetValue(Player.m_localPlayer, new HashSet<Biome>());
			}
		}

		public static void Postfix()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				ConsoleEvent val = delegate
				{
					FieldInfo field = typeof(Player).GetField("m_knownBiome", BindingFlags.Instance | BindingFlags.NonPublic);
					field.SetValue(Player.m_localPlayer, new HashSet<Biome>());
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			new ConsoleCommand("resetbiomes", "", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
		}
	}
	public class MovableHudElement : MonoBehaviour
	{
		public ConfigEntry<TextAnchor> Anchor;

		public ConfigEntry<Vector2> Position;

		public ConfigEntry<float> Scale;

		public void Init(TextAnchor defaultAnchor, float defaultPositionX, float defaultPositionY)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Init(((Object)((Component)this).gameObject).name, defaultAnchor, defaultPositionX, defaultPositionY);
		}

		public void Init(string nameOverride, TextAnchor defaultAnchor, float defaultPositionX, float defaultPositionY)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Anchor = ((BaseUnityPlugin)Auga.instance).Config.Bind<TextAnchor>(nameOverride, nameOverride + "Anchor", defaultAnchor, "Anchor for " + nameOverride);
			Position = ((BaseUnityPlugin)Auga.instance).Config.Bind<Vector2>(nameOverride, nameOverride + "Position", new Vector2(defaultPositionX, defaultPositionY), "Position for " + nameOverride);
			Scale = ((BaseUnityPlugin)Auga.instance).Config.Bind<float>(nameOverride, nameOverride + "Scale", 1f, "Uniform scale for " + nameOverride);
		}

		public void Update()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected I4, but got Unknown
			//IL_0083: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: 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_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			if (Anchor != null && Position != null && Scale != null)
			{
				RectTransform val = (RectTransform)((Component)this).transform;
				TextAnchor value = Anchor.Value;
				TextAnchor val2 = value;
				Vector2 val3 = default(Vector2);
				switch ((int)val2)
				{
				case 0:
				{
					((Vector2)(ref val3))..ctor(0f, 1f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 1:
				{
					((Vector2)(ref val3))..ctor(0.5f, 1f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 2:
				{
					((Vector2)(ref val3))..ctor(1f, 1f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 3:
				{
					((Vector2)(ref val3))..ctor(0f, 0.5f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 4:
				{
					((Vector2)(ref val3))..ctor(0.5f, 0.5f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 5:
				{
					((Vector2)(ref val3))..ctor(1f, 0.5f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 6:
				{
					((Vector2)(ref val3))..ctor(0f, 0f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 7:
				{
					((Vector2)(ref val3))..ctor(0.5f, 0f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				case 8:
				{
					((Vector2)(ref val3))..ctor(1f, 0f);
					val.anchorMax = val3;
					Vector2 pivot = (val.anchorMin = val3);
					val.pivot = pivot;
					break;
				}
				}
				val.anchoredPosition = Position.Value;
				((Transform)val).localScale = new Vector3(Scale.Value, Scale.Value);
			}
		}
	}
	[HarmonyPatch(typeof(Game), "SpawnPlayer")]
	public static class AugaLog_Hooks
	{
		public static void Postfix(Game __instance)
		{
			if (Player.m_localPlayer.m_firstSpawn)
			{
				AugaMessageLog.instance.AddArrivalLog(Player.m_localPlayer);
			}
		}
	}
	[HarmonyPatch(typeof(Player), "OnDeath")]
	public static class Player_OnDeath_Patch
	{
		public static void Postfix(Player __instance)
		{
			LastHitTracker lastHitTracker = ((Component)(object)__instance).RequireComponent<LastHitTracker>();
			HitData val = (((Object)(object)lastHitTracker != (Object)null) ? lastHitTracker.LastHit : null);
			AugaMessageLog.instance.AddDeathLog(__instance, val);
		}
	}
	[HarmonyPatch(typeof(TombStone), "UpdateDespawn")]
	public static class TombStone_UpdateDespawn_Patch
	{
		public static bool Prefix(TombStone __instance)
		{
			if (__instance.m_nview.IsValid() && __instance.IsOwner() && !__instance.m_container.IsInUse() && __instance.m_container.GetInventory().NrOfItems() <= 0)
			{
				AugaMessageLog.instance.AddTombstoneLog(Player.m_localPlayer);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "AddKnownItem")]
	public static class Player_AddKnownItem_Patch
	{
		public static bool Prefix(Player __instance, ItemData item)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			if (__instance.m_knownMaterial.Contains(item.m_shared.m_name))
			{
				return true;
			}
			if ((int)item.m_shared.m_itemType == 1)
			{
				AugaMessageLog.instance.AddNewMaterialLog(item);
			}
			else if ((int)item.m_shared.m_itemType == 13)
			{
				AugaMessageLog.instance.AddNewTrophyLog(item);
			}
			else
			{
				AugaMessageLog.instance.AddNewItemLog(item);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "UpdateKnownRecipesList")]
	public static class Player_UpdateKnownRecipesList_Patch
	{
		public static bool Prefix(Player __instance)
		{
			List<Recipe> list = new List<Recipe>();
			foreach (Recipe recipe in ObjectDB.instance.m_recipes)
			{
				if (recipe.m_enabled && !__instance.m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name) && __instance.HaveRequirements(recipe, true, 0))
				{
					list.Add(recipe);
				}
			}
			if (list.Count > 0)
			{
				AugaMessageLog.instance.AddNewRecipesLog((IReadOnlyList<Recipe>)list);
			}
			List<PieceTable> list2 = new List<PieceTable>();
			List<Piece> list3 = new List<Piece>();
			((Humanoid)__instance).m_inventory.GetAllPieceTables(list2);
			foreach (PieceTable item in list2)
			{
				foreach (GameObject piece in item.m_pieces)
				{
					Piece component = piece.GetComponent<Piece>();
					if (component.m_enabled && !__instance.m_knownRecipes.Contains(component.m_name) && __instance.HaveRequirements(component, (RequirementMode)1))
					{
						list3.Add(component);
					}
				}
			}
			if (list3.Count > 0)
			{
				AugaMessageLog.instance.AddNewPieceLog(list3);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "AddKnownStation")]
	public static class Player_AddKnownStation_Patch
	{
		public static bool Prefix(Player __instance, CraftingStation station)
		{
			if (!__instance.m_knownStations.ContainsKey(station.m_name))
			{
				AugaMessageLog.instance.AddNewStationLog(station);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "AddKnownBiome")]
	public static class Player_AddKnownBiome_Patch
	{
		public static bool Prefix(Player __instance, Biome biome)
		{
			//IL_0007: 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)
			if (!__instance.m_knownBiome.Contains(biome))
			{
				AugaMessageLog.instance.AddNewBiomeLog(biome);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(TeleportWorld), "Teleport")]
	public static class TeleportWorld_Teleport_Patch
	{
		public static void Postfix(TeleportWorld __instance, Player player)
		{
			if (__instance.TargetFound() && ((Humanoid)player).IsTeleportable())
			{
				AugaMessageLog.instance.AddTeleportLog(__instance.GetText(), player);
			}
		}
	}
	[HarmonyPatch(typeof(InventoryGui), "DoCrafting")]
	public static class InventoryGui_DoCrafting_Patch
	{
		public static bool Prefix(InventoryGui __instance, Player player)
		{
			if ((Object)(object)__instance.m_craftRecipe == (Object)null)
			{
				return true;
			}
			ItemData craftUpgradeItem = __instance.m_craftUpgradeItem;
			int num = ((craftUpgradeItem == null) ? 1 : (craftUpgradeItem.m_quality + 1));
			if (num > __instance.m_craftRecipe.m_item.m_itemData.m_shared.m_maxQuality || (!player.HaveRequirements(__instance.m_craftRecipe, false, num) && !player.NoCostCheat()) || (__instance.m_craftUpgradeItem != null && !((Humanoid)player).GetInventory().ContainsItem(__instance.m_craftUpgradeItem)) || (__instance.m_craftUpgradeItem == null && !((Humanoid)player).GetInventory().HaveEmptySlot()))
			{
				return true;
			}
			if (__instance.m_craftRecipe.m_item.m_itemData.m_shared.m_dlc.Length > 0 && !DLCMan.instance.IsDLCInstalled(__instance.m_craftRecipe.m_item.m_itemData.m_shared.m_dlc))
			{
				return true;
			}
			if (__instance.m_craftUpgradeItem != null)
			{
				AugaMessageLog.instance.AddUpgradeItemLog(__instance.m_craftUpgradeItem, num);
			}
			else
			{
				AugaMessageLog.instance.AddCraftItemLog(__instance.m_craftRecipe);
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Player), "RaiseSkill")]
	public static class Player_RaiseSkill_Patch
	{
		public static SkillType Skill;

		public static int LevelBefore;

		public static bool Prefix(Player __instance, SkillType skill)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			Skill = skill;
			LevelBefore = Mathf.FloorToInt(__instance.m_skills.GetSkill(skill)?.m_level ?? 0f);
			return true;
		}

		public static void Postfix(Player __instance, SkillType skill)
		{
			//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)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (Skill == skill)
			{
				int num = Mathf.FloorToInt(__instance.m_skills.GetSkill(skill)?.m_level ?? 0f);
				if (LevelBefore != num)
				{
					AugaMessageLog.instance.AddSkillUpLog(skill, num);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Character), "ShowPickupMessage")]
	public static class Character_ShowPickupMessage_Patch
	{
		public static void Postfix(ItemData item, int amount)
		{
			if (item != null && amount > 0)
			{
				AugaMessageLog.instance.AddItemPickupLog(item, amount);
			}
		}
	}
	[HarmonyPatch]
	public static class Chat_Setup
	{
		[HarmonyPatch(typeof(Chat), "Awake")]
		public static class Chat_Awake_Patch
		{
			public static bool Prefix(Chat __instance)
			{
				if (Auga.HasChatter)
				{
					return true;
				}
				if (!Auga.AugaChatShow.Value)
				{
					return true;
				}
				return !SetupHelper.IndirectTwoObjectReplace(((Component)__instance).transform, Auga.Assets.AugaChat, "Chat", "Chat_box", "AugaChat");
			}

			public static void Postfix(Chat __instance)
			{
				if (!Auga.HasChatter && Auga.AugaChatShow.Value && (Object)(object)((Terminal)__instance).m_input != (Object)null)
				{
					((Component)((Component)((Terminal)__instance).m_input).transform.parent).gameObject.AddComponent<MovableHudElement>().Init((TextAnchor)8, 0f, 67f);
				}
			}
		}

		[HarmonyPatch(typeof(Chat), "SetNpcText")]
		public static class Chat_SetNpcText_Patch
		{
			public static void Postfix(Chat __instance)
			{
				if (!Auga.HasChatter && Auga.AugaChatShow.Value)
				{
					NpcText val = __instance.m_npcTexts.LastOrDefault();
					if (val != null)
					{
						string text = ((TMP_Text)val.m_textField).text;
						text = text.Replace("<color=orange>", "<color=" + Auga.Colors.Topic + ">");
						text = text.Replace("<color=yellow>", "<color=" + Auga.Colors.Emphasis + ">");
						((TMP_Text)val.m_textField).text = text;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(ZNet), "Awake")]
	public static class ZNet_Awake_Patch
	{
		[UsedImplicitly]
		public static void Postfix(ZNet __instance)
		{
			Transform parent = ((Transform)__instance.m_passwordDialog).parent;
			Object.Destroy((Object)(object)((Component)__instance.m_passwordDialog).gameObject);
			GameObject val = Object.Instantiate<GameObject>(Auga.Assets.PasswordDialog, parent, false);
			val.gameObject.SetActive(false);
			__instance.m_passwordDialog = val.GetComponent<RectTransform>();
			Object.Destroy((Object)(object)((Component)__instance.m_connectingDialog).gameObject);
			GameObject val2 = Object.Instantiate<GameObject>(Auga.Assets.ConnectingDialog, parent, false);
			val2.gameObject.SetActive(false);
			__instance.m_connectingDialog = val2.GetComponent<RectTransform>();
		}
	}
	[HarmonyPatch]
	public static class DamageText_Setup
	{
		[HarmonyPatch(typeof(DamageText), "Awake")]
		public static class DamageText_Awake_Patch
		{
			public static bool Prefix(TextInput __instance)
			{
				return !SetupHelper.DirectObjectReplace(((Component)__instance).transform, Auga.Assets.DamageText, "DamageText");
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(DamageText), "AddInworldText")]
		public static void AddInworldText_Postfix(DamageText __instance, TextType type, float dmg, bool mySelf)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected I4, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: 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)
			WorldTextInstance val = __instance.m_worldTexts.LastOrDefault();
			if (val != null)
			{
				Color color;
				if ((int)type == 4)
				{
					color = Auga.Colors.Healing;
				}
				else if (mySelf)
				{
					color = ((dmg != 0f) ? Auga.Colors.PlayerDamage : Auga.Colors.PlayerNoDamage);
				}
				else
				{
					color = (Color)((int)type switch
					{
						0 => Auga.Colors.NormalDamage, 
						1 => Auga.Colors.ResistDamage, 
						2 => Auga.Colors.WeakDamage, 
						3 => Auga.Colors.ImmuneDamage, 
						5 => Auga.Colors.TooHard, 
						_ => Color.white, 
					});
				}
				((Graphic)val.m_textField).color = color;
			}
		}
	}
	[Flags]
	public enum ReplaceFlags
	{
		None = 0,
		Instantiate = 1,
		DestroyOriginal = 2
	}
	public static class AugaExtensions
	{
		public static RectTransform RectTransform(this Component c)
		{
			Transform transform = c.transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public static RectTransform RectTransform(this GameObject go)
		{
			Transform transform = go.transform;
			return (RectTransform)(object)((transform is RectTransform) ? transform : null);
		}

		public static void HideElement(this Component c)
		{
			if ((Object)(object)c != (Object)null)
			{
				c.gameObject.SetActive(false);
			}
		}

		public static void HideElementByType<T>(this Component parent) where T : Component
		{
			if (!((Object)(object)parent == (Object)null))
			{
				T componentInChildren = parent.GetComponentInChildren<T>();
				((Component)(object)componentInChildren).HideElement();
			}
		}

		public static void HideElementByName(this GameObject parent, string name)
		{
			((Component)(object)parent.transform).HideElementByName(name);
		}

		public static void HideElementByName(this Component parent, string name)
		{
			if (!((Object)(object)parent == (Object)null))
			{
				Transform c = parent.transform.Find(name);
				((Component)(object)c).HideElement();
			}
		}

		public static Transform Replace(this Transform c, string findPath, Transform other, string otherFindPath = null, ReplaceFlags flags = ReplaceFlags.Instantiate | ReplaceFlags.DestroyOriginal)
		{
			Transform val = c.Find(findPath);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			otherFindPath = otherFindPath ?? findPath;
			Transform val2 = other.Find(otherFindPath);
			if ((Object)(object)val2 == (Object)null)
			{
				return null;
			}
			Transform parent = val.parent;
			int siblingIndex = val.GetSiblingIndex();
			val.SetParent((Transform)null);
			if ((flags & ReplaceFlags.DestroyOriginal) != 0)
			{
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			if ((flags & ReplaceFlags.Instantiate) != 0)
			{
				val2 = Object.Instantiate<Transform>(val2, parent);
				((Object)val2).name = ((Object)val2).name.Replace("(Clone)", "").Replace("(clone)", "");
			}
			else
			{
				val2.SetParent(parent);
			}
			val2.SetSiblingIndex(siblingIndex);
			return val2;
		}

		public static Transform Replace(this Component c, string findPath, GameObject other, string otherFindPath = null, ReplaceFlags flags = ReplaceFlags.Instantiate | ReplaceFlags.DestroyOriginal)
		{
			return c.transform.Replace(findPath, other.transform, otherFindPath, flags);
		}

		public static Transform Replace(this Transform c, string findPath, GameObject other, string otherFindPath = null, ReplaceFlags flags = ReplaceFlags.Instantiate | ReplaceFlags.DestroyOriginal)
		{
			return c.Replace(findPath, other.transform, otherFindPath, flags);
		}

		public static Transform Replace(this GameObject go, string findPath, Transform other, string otherFindPath = null, ReplaceFlags flags = ReplaceFlags.Instantiate | ReplaceFlags.DestroyOriginal)
		{
			return go.transform.Replace(findPath, other, otherFindPath, flags);
		}

		public static Transform Replace(this GameObject go, string findPath, GameObject other, string otherFindPath = null, ReplaceFlags flags = ReplaceFlags.Instantiate | ReplaceFlags.DestroyOriginal)
		{
			return go.transform.Replace(findPath, other.transform, otherFindPath, flags);
		}

		public static Transform CopyOver(this GameObject go, string findPath, GameObject other, int siblingIndex)
		{
			Transform val = other.transform.Find(findPath);
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			val = Object.Instantiate<Transform>(val, go.transform);
			((Object)val).name = ((Object)val).name.Replace("(Clone)", "").Replace("(clone)", "");
			val.SetSiblingIndex(siblingIndex);
			return val;
		}

		public static T RequireComponent<T>(this Component c) where T : Component
		{
			T val = c.GetComponent<T>();
			if ((Object)(object)val == (Object)null)
			{
				val = c.gameObject.AddComponent<T>();
			}
			return val;
		}

		public static T RequireComponent<T>(this GameObject go) where T : Component
		{
			T val = go.GetComponent<T>();
			if ((Object)(object)val == (Object)null)
			{
				val = go.AddComponent<T>();
			}
			return val;
		}
	}
	[HarmonyPatch(typeof(GuiBar), "SetBar")]
	public static class GuiBar_Patch
	{
		public static bool Prefix(GuiBar __instance, float i)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.m_barImage != (Object)null && (int)__instance.m_barImage.type == 3)
			{
				__instance.m_barImage.fillAmount = i;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Hud))]
	public static class Hud_Setup
	{
		[HarmonyPatch("Awake")]
		[HarmonyPriority(800)]
		[HarmonyPostfix]
		public static void Hud_Awake_Postfix(Hud __instance)
		{
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Expected O, but got Unknown
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Expected O, but got Unknown
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Expected O, but got Unknown
			//IL_07dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e3: Expected O, but got Unknown
			//IL_0860: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Expected O, but got Unknown
			//IL_0b15: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cbe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cc8: Expected O, but got Unknown
			//IL_0cec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf6: Expected O, but got Unknown
			//IL_099f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a53: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a6e: Unknown result type (might be due to invalid IL or missing references)
			Transform val = (Auga.HasJewelcrafting ? ((Component)__instance).transform.Find("hudroot/HotKeyBar") : ((Component)(object)__instance).Replace("hudroot/HotKeyBar", Auga.Assets.Hud, "hudroot/HotKeyBar"));
			((Component)val).gameObject.AddComponent<MovableHudElement>().Init((TextAnchor)0, 55f, -44f);
			Transform val2 = ((Component)(object)__instance).Replace("hudroot/StatusEffects", Auga.Assets.Hud);
			Transform c = val2.Find("StatusEffectsExt/SE_Template");
			Transform val3 = val2.Find("StatusEffectsExt");
			Transform val4 = val2.Find("StatusEffectsInt");
			((Component)val4).gameObject.AddComponent<MovableHudElement>().Init("Status Effect List", (TextAnchor)2, -40f, 0f);
			((Component)val3).gameObject.AddComponent<MovableHudElement>().Init("Abilities and Other Statuses", (TextAnchor)2, -160f, 0f);
			__instance.m_statusEffectTemplate = ((Component)(object)c).RectTransform();
			__instance.m_statusEffectListRoot = ((Component)(object)val3).RectTransform();
			__instance.m_saveIcon = ((Component)((Component)(object)__instance).Replace("hudroot/SaveIcon", Auga.Assets.Hud)).gameObject;
			__instance.m_saveIconImage = __instance.m_saveIcon.GetComponent<Image>();
			__instance.m_badConnectionIcon = ((Component)((Component)(object)__instance).Replace("hudroot/BadConnectionIcon", Auga.Assets.Hud)).gameObject;
			DreamTexts dreamTexts = __instance.m_sleepingProgress.GetComponent<SleepText>().m_dreamTexts;
			Transform val5 = ((Component)(object)__instance).Replace("LoadingBlack", Auga.Assets.Hud);
			__instance.m_loadingScreen = ((Component)val5).GetComponent<CanvasGroup>();
			__instance.m_loadingProgress = ((Component)val5.Find("Loading")).gameObject;
			__instance.m_sleepingProgress = ((Component)val5.Find("Sleeping")).gameObject;
			__instance.m_teleportingProgress = ((Component)val5.Find("Teleporting")).gameObject;
			__instance.m_loadingImage = ((Component)val5.Find("Loading/Image")).GetComponent<Image>();
			__instance.m_loadingTip = ((Component)val5.Find("Loading/Tip")).GetComponent<TMP_Text>();
			__instance.m_sleepingProgress.GetComponent<SleepText>().m_dreamTexts = dreamTexts;
			__instance.m_eventBar = ((Component)((Component)(object)__instance).Replace("hudroot/EventBar", Auga.Assets.Hud)).gameObject;
			__instance.m_eventName = __instance.m_eventBar.GetComponentInChildren<TMP_Text>();
			__instance.m_eventBar.gameObject.AddComponent<MovableHudElement>().Init((TextAnchor)1, 0f, -90f);
			__instance.m_damageScreen = ((Component)((Component)(object)__instance).Replace("hudroot/Damaged", Auga.Assets.Hud)).GetComponent<Image>();
			Transform val6 = ((Component)(object)__instance).Replace("hudroot/crosshair", Auga.Assets.Hud);
			__instance.m_crosshair = ((Component)val6.Find("crosshair")).GetComponent<Image>();
			__instance.m_crosshairBow = ((Component)val6.Find("crosshair_bow")).GetComponent<Image>();
			__instance.m_hoverName = ((Component)val6.Find("Dummy/HoverName")).GetComponent<TextMeshProUGUI>();
			__instance.m_pieceHealthRoot = (RectTransform)val6.Find("PieceHealthRoot");
			__instance.m_pieceHealthBar = ((Component)val6.Find("PieceHealthRoot/PieceHealthBar")).GetComponent<GuiBar>();
			__instance.m_targetedAlert = ((Component)val6.Find("Sneak/Alert")).gameObject;
			__instance.m_targeted = ((Component)val6.Find("Sneak/Detected")).gameObject;
			__instance.m_hidden = ((Component)val6.Find("Sneak/Hidden")).gameObject;
			__instance.m_stealthBar = ((Component)val6.Find("Sneak/StealthBar")).GetComponent<GuiBar>();
			((Component)__instance.m_pieceHealthBar).gameObject.AddComponent<MovableHudElement>().Init("BuildPieceHealthBar", (TextAnchor)4, 130f, 0f);
			((Component)__instance.m_targetedAlert.transform.parent).gameObject.AddComponent<MovableHudElement>().Init("Stealth", (TextAnchor)4, 0f, 0f);
			Material material = ((Graphic)__instance.m_gpIcon).material;
			__instance.m_gpRoot = (RectTransform)((Component)(object)__instance).Replace("hudroot/GuardianPower", Auga.Assets.Hud);
			__instance.m_gpName = ((Component)((Transform)__instance.m_gpRoot).Find("Name")).GetComponent<TMP_Text>();
			__instance.m_gpIcon = ((Component)((Transform)__instance.m_gpRoot).Find("Icon")).GetComponent<Image>();
			((Graphic)__instance.m_gpIcon).material = material;
			__instance.m_gpCooldown = ((Component)((Transform)__instance.m_gpRoot).Find("GPTimeText")).GetComponent<TMP_Text>();
			((Component)__instance.m_gpRoot).gameObject.AddComponent<MovableHudElement>().Init((TextAnchor)6, 60f, 70f);
			foreach (Transform item in (Transform)__instance.m_healthPanel)
			{
				Transform val7 = item;
				Object.Destroy((Object)(object)((Component)val7).gameObject);
			}
			Object.Destroy((Object)(object)((Component)__instance.m_staminaBar2Root).gameObject);
			Object.Destroy((Object)(object)((Component)__instance.m_eitrBarRoot).gameObject);
			Transform val8 = ((Component)__instance).transform.Find("hudroot");
			Transform val9 = ((Component)val8).gameObject.CopyOver("hudroot/FoodPanel0", Auga.Assets.Hud, 5);
			Transform val10 = ((Component)val8).gameObject.CopyOver("hudroot/FoodPanel1", Auga.Assets.Hud, 6);
			Transform val11 = ((Component)val8).gameObject.CopyOver("hudroot/FoodPanel2", Auga.Assets.Hud, 7);
			Transform val12 = ((Component)val8).gameObject.CopyOver("hudroot/HealthBar", Auga.Assets.Hud, 8);
			Transform val13 = ((Component)val8).gameObject.CopyOver("hudroot/StaminaBar", Auga.Assets.Hud, 9);
			Transform val14 = ((Component)val8).gameObject.CopyOver("hudroot/EitrBar", Auga.Assets.Hud, 10);
			((Component)val9).gameObject.AddComp