Decompiled source of DetailedLevels v1.5.3

DetailedLevels.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DetailedLevels.Features;
using DetailedLevels.Tools;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using ServerSync;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DetailedLevels")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DetailedLevels")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f302fe77-1481-495a-84b9-5ba829a4cf2b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DetailedLevels
{
	internal class ConfigurationFile
	{
		private static ConfigEntry<bool> _serverConfigLocked = null;

		public static ConfigEntry<bool> debug;

		public static ConfigEntry<KeyCode> hotKey;

		public static ConfigEntry<int> numberOfDecimals;

		public static ConfigEntry<int> skillUpMessageAfterMultipleLevel;

		public static ConfigEntry<int> skillUpBigMessageAfterMultipleLevel;

		public static ConfigEntry<Color> colorSkillBackground;

		public static ConfigEntry<bool> saveSkillBuffs;

		public static ConfigEntry<float> deathSkillLoss;

		public static ConfigEntry<string> deathPenaltyText;

		public static ConfigEntry<string> reloadAfterDyingText;

		public static ConfigEntry<string> numberOfDecimalsText;

		public static ConfigEntry<string> skillUpMessageText;

		public static ConfigEntry<string> skillUpBigMessageText;

		public static ConfigEntry<string> skillUpValueText;

		public static ConfigEntry<string> statsText;

		public static ConfigEntry<string> statsProgressionText;

		public static ConfigEntry<string> statsTravellingText;

		public static ConfigEntry<string> statsOthersText;

		private static ConfigFile configFile;

		private static readonly string ConfigFileName = "Turbero.DetailedLevels.cfg";

		private static readonly string ConfigFileFullPath;

		private static readonly ConfigSync ConfigSync;

		internal static void LoadConfig(BaseUnityPlugin plugin)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			configFile = plugin.Config;
			_serverConfigLocked = config("1 - General", "Lock Configuration", value: true, "If on, the configuration is locked and can be changed by server admins only.");
			ConfigSync.AddLockingConfigEntry<bool>(_serverConfigLocked);
			debug = config("1 - General", "DebugMode", value: false, "Enabling/Disabling the debugging in the console (default = false)", synchronizedSetting: false);
			hotKey = config<KeyCode>("1 - General", "HotKey", (KeyCode)285, "Hot Key to show the skills tab without opening the inventory first (default = F4)", synchronizedSetting: false);
			numberOfDecimals = config("2 - Levels Data", "NumberOfDecimals", 2, "Number of decimals to show in your levels information (default = 2, min = 0, max = 15)", synchronizedSetting: false);
			skillUpMessageAfterMultipleLevel = config("2 - Levels Data", "SkillUpMessageAfterMultipleLevel", 5, "Shows skill up message after the new level is multiple of the indicated level (0 = disabled, default = 5)", synchronizedSetting: false);
			skillUpBigMessageAfterMultipleLevel = config("2 - Levels Data", "SkillUpBigMessageAfterMultipleLevel", 10, "Shows skill up big message after the new level is multiple of the indicated level (0 = disabled, default = 20)", synchronizedSetting: false);
			colorSkillBackground = config<Color>("2 - Levels Data", "ColorSkillBackground", Color.cyan, "Choose the color background for selected skills in the skills dialog: red, green, blue, white, black, yellow, cyan, magenta, gray or grey (default = cyan)", synchronizedSetting: false);
			saveSkillBuffs = config("2 - Levels Data", "SaveSkillBuffs", value: false, "Enable/disable the option to reload tracked skills after dying (default = false)", synchronizedSetting: false);
			deathSkillLoss = config("3 - Config", "DeathSkillLoss", 5f, "Amount of skill loss when dying (value between 0 and 100, default = 5 as vanilla)");
			deathPenaltyText = config("4 - Language", "DeathPenaltyText", "Death Penalty", "Translation for <Death Penalty> text");
			reloadAfterDyingText = config("4 - Language", "ReloadAfterDyingText", "Reload after dying", "Translation for <Reload after dying> text");
			numberOfDecimalsText = config("4 - Language", "NumberOfDecimalsText", "Number of decimals", "Translation for <Number of decimals> text");
			skillUpMessageText = config("4 - Language", "SkillUpMessageText", "Skill up message", "Translation for <Skill up message> text");
			skillUpBigMessageText = config("4 - Language", "SkillUpBigMessageText", "Skill up big message", "Translation for <Skill up big message> text");
			skillUpValueText = config("4 - Language", "SkillUpValueText", "Each {0} levels", "Translation for <Each X levels> text");
			statsText = config("4 - Language", "StatsText", "Stats", "Translation for <Stats> text");
			statsProgressionText = config("4 - Language", "StatsProgressionText", "Progression", "Translation for <Progression> text (restart game after change)");
			statsTravellingText = config("4 - Language", "StatsTravellingText", "Travelling", "Translation for <Travelling> text (restart game after change)");
			statsOthersText = config("4 - Language", "StatsOthersText", "Others", "Translation for <Others> text (restart game after change)");
			deathSkillLoss.SettingChanged += SettingsChanged;
			SetupWatcher();
		}

		private static void SetupWatcher()
		{
			FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName);
			fileSystemWatcher.Changed += ReadConfigValues;
			fileSystemWatcher.Created += ReadConfigValues;
			fileSystemWatcher.Renamed += ReadConfigValues;
			fileSystemWatcher.IncludeSubdirectories = true;
			fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
			fileSystemWatcher.EnableRaisingEvents = true;
		}

		private static void ReadConfigValues(object sender, FileSystemEventArgs e)
		{
			if (!File.Exists(ConfigFileFullPath))
			{
				return;
			}
			try
			{
				Logger.Log("Attempting to reload configuration...");
				configFile.Reload();
				SettingsChanged(null, null);
			}
			catch
			{
				Logger.LogError("There was an issue loading " + ConfigFileName);
			}
		}

		private static void SettingsChanged(object sender, EventArgs e)
		{
			if (0f <= deathSkillLoss.Value && deathSkillLoss.Value <= 100f)
			{
				((Character)Player.m_localPlayer).GetSkills().m_DeathLowerFactor = deathSkillLoss.Value / 100f;
				Logger.Log("m_DeathLowerFactor: " + ((Character)Player.m_localPlayer).GetSkills().m_DeathLowerFactor);
				PlayerSkillupOptionsPatch.updateSkillLossPercentage();
			}
			PlayerSkillupOptionsPatch.updateOptionsTexts();
			PlayerSkillupOptionsPatch.reloadTexts();
			PlayerColorBuffs.refreshAllBlueColors(Player.m_localPlayer);
			SkillTypeCraftStationDescriptionsPatch.updated = false;
		}

		private static ConfigEntry<T> config<T>(string group, string name, T value, string description, bool synchronizedSetting = true)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			return config(group, name, value, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting);
		}

		private static ConfigEntry<T> config<T>(string group, string name, T value, ConfigDescription description, bool synchronizedSetting = true)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags);
			ConfigEntry<T> val2 = configFile.Bind<T>(group, name, value, val);
			SyncedConfigEntry<T> syncedConfigEntry = ConfigSync.AddConfigEntry<T>(val2);
			syncedConfigEntry.SynchronizedConfig = synchronizedSetting;
			return val2;
		}

		static ConfigurationFile()
		{
			string configPath = Paths.ConfigPath;
			char directorySeparatorChar = Path.DirectorySeparatorChar;
			ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName;
			ConfigSync = new ConfigSync("Turbero.DetailedLevels")
			{
				DisplayName = "Detailed Levels",
				CurrentVersion = "1.5.3",
				MinimumRequiredVersion = "1.5.3"
			};
		}
	}
	[BepInPlugin("Turbero.DetailedLevels", "Detailed Levels", "1.5.3")]
	public class DetailedLevels : BaseUnityPlugin
	{
		public const string GUID = "Turbero.DetailedLevels";

		public const string NAME = "Detailed Levels";

		public const string VERSION = "1.5.3";

		private readonly Harmony harmony = new Harmony("Turbero.DetailedLevels");

		private void Awake()
		{
			ConfigurationFile.LoadConfig((BaseUnityPlugin)(object)this);
			harmony.PatchAll();
		}

		private void onDestroy()
		{
			harmony.UnpatchSelf();
		}

		private void Update()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !Object.op_Implicit((Object)(object)InventoryGui.instance))
			{
				return;
			}
			if (Input.GetKeyDown((KeyCode)27) || Input.GetKeyDown((KeyCode)9) || ((Character)Player.m_localPlayer).IsDead())
			{
				hideCustomPanelAndSkillsDialog();
			}
			if (Input.GetKeyDown(ConfigurationFile.hotKey.Value) && Time.timeScale > 0f)
			{
				if (((Component)InventoryGui.instance.m_skillsDialog).gameObject.activeSelf)
				{
					hideCustomPanelAndSkillsDialog();
					InventoryGui.instance.Hide();
				}
				else
				{
					InventoryGui.instance.Show((Container)null, 1);
					WaitForSecondsAsync(0.15f);
				}
			}
		}

		private static void hideCustomPanelAndSkillsDialog()
		{
			if (!((Object)(object)InventoryGui.instance.m_skillsDialog == (Object)null))
			{
				((Component)InventoryGui.instance.m_skillsDialog).gameObject.SetActive(false);
				if (!((Object)(object)((Component)InventoryGui.instance.m_skillsDialog).transform.Find("SkillsFrame/CustomSkillOptionsPanel") == (Object)null))
				{
					((Component)((Component)InventoryGui.instance.m_skillsDialog).transform.Find("SkillsFrame/CustomSkillOptionsPanel")).gameObject.SetActive(false);
				}
			}
		}

		private static async Task WaitForSecondsAsync(float seconds)
		{
			await Task.Delay((int)(Math.Max(0f, seconds) * 1000f));
			InventoryGui.instance.m_skillsDialog.Setup(Player.m_localPlayer);
			((Component)InventoryGui.instance.m_skillsDialog).gameObject.SetActive(true);
		}
	}
	[HarmonyPatch(typeof(Localization), "SetLanguage")]
	public class Localization_SetLanguage_Patch
	{
		private static void Postfix(string language)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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)
			Logger.Log("Language changed to: " + language);
			foreach (SkillType key in PlayerUtils.skillStatusEffects.Keys)
			{
				int valueSafe = GeneralExtensions.GetValueSafe<SkillType, int>(PlayerUtils.skillStatusEffects, key);
				Player_RaiseSkill_Patch.updateSkillTypeBuff(Player.m_localPlayer, key, valueSafe, forceUpdate: true);
			}
		}
	}
	public static class Logger
	{
		public static ManualLogSource logger = Logger.CreateLogSource("Detailed Levels");

		internal static void Log(object s)
		{
			if (ConfigurationFile.debug.Value)
			{
				logger.LogInfo((object)s?.ToString());
			}
		}

		internal static void LogInfo(object s)
		{
			logger.LogInfo((object)s?.ToString());
		}

		internal static void LogWarning(object s)
		{
			string text = "Detailed Levels 1.5.3: " + ((s != null) ? s.ToString() : "null");
			Debug.LogWarning((object)text);
		}

		internal static void LogError(object s)
		{
			string text = "Detailed Levels 1.5.3: " + ((s != null) ? s.ToString() : "null");
			Debug.LogError((object)text);
		}
	}
}
namespace DetailedLevels.Tools
{
	public class CustomSkillOptionsPanel
	{
		private GameObject panel;

		private TextMeshProUGUI titleText;

		private TMP_Text buttonText;

		public CustomSkillOptionsPanel(Transform copyForCloseButton)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			Transform transform = ((Component)((Component)InventoryGui.instance.m_skillsDialog).transform.Find("SkillsFrame")).transform;
			panel = new GameObject("CustomSkillOptionsPanel", new Type[1] { typeof(RectTransform) });
			panel.SetActive(false);
			panel.transform.SetParent(transform, false);
			RectTransform component = panel.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(512f, 512f);
			component.anchoredPosition = new Vector2(0f, 0f);
			Image component2 = ((Component)transform.Find("bkg")).GetComponent<Image>();
			Image val = Object.Instantiate<Image>(component2, panel.transform);
			((Object)val).name = "bkg_customskills";
			GameObject gameObject = ((Component)transform.Find("topic")).gameObject;
			GameObject val2 = Object.Instantiate<GameObject>(gameObject, panel.transform);
			((Object)val2).name = "Title";
			titleText = val2.GetComponent<TextMeshProUGUI>();
			((TMP_Text)titleText).text = Localization.instance.Localize("$button_ps_start");
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchoredPosition = new Vector2(0f, -30f);
			Transform val3 = ((Component)InventoryGui.instance.m_skillsDialog).transform.Find("SkillsFrame/Closebutton");
			GameObject val4 = Object.Instantiate<GameObject>(((Component)val3).gameObject, copyForCloseButton);
			((Object)val4).name = "DLOptionsCloseButton";
			val4.transform.SetParent(panel.transform, false);
			RectTransform component4 = val4.GetComponent<RectTransform>();
			component4.anchoredPosition = new Vector2(0f, 40f);
			buttonText = val4.GetComponentInChildren<TMP_Text>();
			Button component5 = val4.GetComponent<Button>();
			component5.onClick = new ButtonClickedEvent();
			((UnityEvent)component5.onClick).AddListener((UnityAction)delegate
			{
				panel.SetActive(false);
				InventoryGui.instance.m_skillsDialog.Setup(Player.m_localPlayer);
			});
			reloadTexts();
		}

		public GameObject getPanel()
		{
			return panel;
		}

		public void reloadTexts()
		{
			((TMP_Text)titleText).text = Localization.instance.Localize("$button_ps_start");
			buttonText.text = Localization.instance.Localize("$menu_close");
		}
	}
	public class CustomSlider
	{
		private readonly GameObject sliderObject;

		private readonly Slider slider;

		private readonly TextMeshProUGUI sliderValue;

		public TextMeshProUGUI sliderLabelDescription;

		public CustomSlider(string name, int maxValue, Vector2 sizeDelta, Vector2 position, int posXIcon, string spriteName, int posXDescription, string description, int posXValue, int initValue, string valueDesc)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0336: Expected O, but got Unknown
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Expected O, but got Unknown
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Expected O, but got Unknown
			//IL_04c8: Unknown result type (might be due to invalid IL or missing references)
			sliderObject = new GameObject(name, new Type[1] { typeof(RectTransform) });
			RectTransform component = sliderObject.GetComponent<RectTransform>();
			component.sizeDelta = sizeDelta;
			component.anchoredPosition = position;
			slider = sliderObject.AddComponent<Slider>();
			((Object)slider).name = name;
			slider.minValue = 0f;
			slider.maxValue = maxValue;
			slider.value = initValue;
			typeof(Slider).GetField("m_WholeNumbers", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(slider, true);
			GameObject val = new GameObject("Background", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(sliderObject.transform, false);
			RectTransform component2 = val.GetComponent<RectTransform>();
			component2.anchorMin = new Vector2(0f, 0f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.sizeDelta = new Vector2(0f, 0f);
			((Graphic)val.GetComponent<Image>()).color = Color.gray;
			GameObject val2 = new GameObject("Fill Area", new Type[1] { typeof(RectTransform) });
			val2.transform.SetParent(sliderObject.transform, false);
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 0.25f);
			component3.anchorMax = new Vector2(1f, 0.75f);
			component3.sizeDelta = new Vector2(0f, 0f);
			GameObject val3 = new GameObject("Fill", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val3.transform.SetParent(val2.transform, false);
			RectTransform component4 = val3.GetComponent<RectTransform>();
			component4.anchorMin = new Vector2(0f, 0f);
			component4.anchorMax = new Vector2(1f, 1f);
			component4.sizeDelta = new Vector2(0f, 0f);
			((Graphic)val3.GetComponent<Image>()).color = Color.green;
			slider.fillRect = component4;
			GameObject val4 = new GameObject("Handle", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.transform.SetParent(sliderObject.transform, false);
			RectTransform component5 = val4.GetComponent<RectTransform>();
			component5.sizeDelta = new Vector2(10f, 10f);
			((Graphic)val4.GetComponent<Image>()).color = Color.white;
			((Selectable)slider).targetGraphic = (Graphic)(object)val4.GetComponent<Image>();
			slider.handleRect = component5;
			if (spriteName != null)
			{
				GameObject val5 = new GameObject("Icon");
				Image val6 = val5.AddComponent<Image>();
				val6.sprite = PlayerUtils.getSprite(spriteName);
				RectTransform component6 = val5.GetComponent<RectTransform>();
				((Transform)component6).SetParent(sliderObject.transform, false);
				component6.sizeDelta = new Vector2(25f, 25f);
				component6.anchoredPosition = new Vector2((float)posXIcon, 0f);
			}
			if (description != null)
			{
				GameObject val7 = new GameObject("SliderLabel", new Type[2]
				{
					typeof(RectTransform),
					typeof(TextMeshProUGUI)
				});
				val7.transform.SetParent(sliderObject.transform, false);
				RectTransform component7 = val7.GetComponent<RectTransform>();
				component7.anchoredPosition = new Vector2((float)posXDescription, 0f);
				sliderLabelDescription = val7.GetComponent<TextMeshProUGUI>();
				((TMP_Text)sliderLabelDescription).text = description;
				((TMP_Text)sliderLabelDescription).fontSize = 18f;
				((TMP_Text)sliderLabelDescription).alignment = (TextAlignmentOptions)516;
				((TMP_Text)sliderLabelDescription).font = PlayerUtils.getFontAsset("Valheim-AveriaSansLibre");
			}
			if (initValue >= 0)
			{
				GameObject val8 = new GameObject("SliderValue", new Type[2]
				{
					typeof(RectTransform),
					typeof(TextMeshProUGUI)
				});
				val8.transform.SetParent(sliderObject.transform, false);
				RectTransform component8 = val8.GetComponent<RectTransform>();
				component8.anchoredPosition = new Vector2((float)posXValue, 0f);
				sliderValue = val8.GetComponent<TextMeshProUGUI>();
				((TMP_Text)sliderValue).fontSize = 18f;
				((TMP_Text)sliderValue).font = PlayerUtils.getFontAsset("Valheim-AveriaSansLibre");
				((TMP_Text)sliderValue).alignment = (TextAlignmentOptions)513;
				((TMP_Text)sliderValue).text = valueDesc;
			}
		}

		public GameObject getGameObject()
		{
			return sliderObject;
		}

		public void OnValueChanged(UnityAction<float> call)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			slider.onValueChanged = new SliderEvent();
			((UnityEvent<float>)(object)slider.onValueChanged).AddListener(call);
		}

		public void updateValue(string value)
		{
			((TMP_Text)sliderValue).text = value;
		}

		public float getValue()
		{
			return slider.value;
		}
	}
	public class CustomStatsPanel
	{
		private readonly GameObject panel;

		private readonly TextMeshProUGUI statsTopicText;

		private readonly CustomStatsPanelScroll scrollPanel;

		public CustomStatsPanel()
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b49: Expected O, but got Unknown
			//IL_0b58: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b62: Expected O, but got Unknown
			GameObject trophiesPanel = InventoryGui.instance.m_trophiesPanel;
			if (!((Object)(object)trophiesPanel == (Object)null))
			{
				SkillsDialog skillsDialog = InventoryGui.instance.m_skillsDialog;
				panel = Object.Instantiate<GameObject>(trophiesPanel, ((Component)skillsDialog).transform);
				((Object)panel).name = "PlayerStatsFrame";
				panel.SetActive(false);
				RectTransform component = panel.GetComponent<RectTransform>();
				component.anchoredPosition = new Vector2(0f, 0f);
				((Object)panel.transform.Find("TrophiesFrame")).name = "MainFrame";
				Transform val = ((Component)skillsDialog).transform.Find("PlayerStatsFrame/MainFrame/topic");
				statsTopicText = ((Component)val).GetComponent<TextMeshProUGUI>();
				((TMP_Text)statsTopicText).text = ConfigurationFile.statsText.Value;
				((Object)((Component)skillsDialog).transform.Find("PlayerStatsFrame/MainFrame/Trophies")).name = "Stats";
				((Object)((Component)skillsDialog).transform.Find("PlayerStatsFrame/MainFrame/Stats/TrophyListScroll")).name = "StatsListScroll";
				((Object)((Component)skillsDialog).transform.Find("PlayerStatsFrame/MainFrame/Stats/TrophyList")).name = "StatList";
				Dictionary<PlayerStatType, float> playerDictionaryStats = getPlayerDictionaryStats();
				scrollPanel = new CustomStatsPanelScroll(((Component)skillsDialog).transform.Find("PlayerStatsFrame/MainFrame/Stats/StatList"));
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)26,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)26)
					},
					{
						(PlayerStatType)4,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)4)
					}
				});
				scrollPanel.AddHeaderToScrollList("$menu_combat");
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)0,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)0)
					},
					{
						(PlayerStatType)10,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)10)
					},
					{
						(PlayerStatType)11,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)11)
					},
					{
						(PlayerStatType)51,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)51)
					},
					{
						(PlayerStatType)50,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)50)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)5,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)5)
					},
					{
						(PlayerStatType)6,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)6)
					},
					{
						(PlayerStatType)7,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)7)
					},
					{
						(PlayerStatType)8,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)8)
					},
					{
						(PlayerStatType)9,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)9)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)52,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)52)
					},
					{
						(PlayerStatType)53,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)53)
					},
					{
						(PlayerStatType)54,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)54)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)15,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)15)
					},
					{
						(PlayerStatType)83,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)83)
					},
					{
						(PlayerStatType)84,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)84)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)56,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)56)
					},
					{
						(PlayerStatType)57,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)57)
					},
					{
						(PlayerStatType)58,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)58)
					},
					{
						(PlayerStatType)59,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)59)
					},
					{
						(PlayerStatType)60,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)60)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)61,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)61)
					},
					{
						(PlayerStatType)62,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)62)
					},
					{
						(PlayerStatType)63,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)63)
					},
					{
						(PlayerStatType)64,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)64)
					},
					{
						(PlayerStatType)65,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)65)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)66,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)66)
					},
					{
						(PlayerStatType)67,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)67)
					},
					{
						(PlayerStatType)68,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)68)
					},
					{
						(PlayerStatType)69,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)69)
					},
					{
						(PlayerStatType)70,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)70)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)71,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)71)
					},
					{
						(PlayerStatType)72,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)72)
					},
					{
						(PlayerStatType)73,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)73)
					}
				});
				scrollPanel.AddHeaderToScrollList(ConfigurationFile.statsProgressionText.Value);
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)85,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)85)
					},
					{
						(PlayerStatType)86,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)86)
					},
					{
						(PlayerStatType)87,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)87)
					},
					{
						(PlayerStatType)96,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)96)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)88,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)88)
					},
					{
						(PlayerStatType)97,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)97)
					},
					{
						(PlayerStatType)89,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)89)
					},
					{
						(PlayerStatType)98,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)98)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)90,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)90)
					},
					{
						(PlayerStatType)99,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)99)
					},
					{
						(PlayerStatType)91,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)91)
					},
					{
						(PlayerStatType)100,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)100)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)92,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)92)
					},
					{
						(PlayerStatType)101,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)101)
					},
					{
						(PlayerStatType)93,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)93)
					},
					{
						(PlayerStatType)102,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)102)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)94,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)94)
					},
					{
						(PlayerStatType)103,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)103)
					},
					{
						(PlayerStatType)95,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)95)
					},
					{
						(PlayerStatType)104,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)104)
					}
				});
				scrollPanel.AddHeaderToScrollList(ConfigurationFile.statsTravellingText.Value);
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)16,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)16), 2)
					},
					{
						(PlayerStatType)17,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)17), 2)
					},
					{
						(PlayerStatType)18,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)18), 2)
					},
					{
						(PlayerStatType)19,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)19), 2)
					},
					{
						(PlayerStatType)20,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)20), 2)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)21,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)21), 2)
					},
					{
						(PlayerStatType)22,
						(float)Math.Round(GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)22), 2)
					},
					{
						(PlayerStatType)23,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)23)
					},
					{
						(PlayerStatType)3,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)3)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)45,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)45)
					},
					{
						(PlayerStatType)46,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)46)
					},
					{
						(PlayerStatType)47,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)47)
					}
				});
				scrollPanel.AddHeaderToScrollList("$menu_resources");
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)35,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)35)
					},
					{
						(PlayerStatType)36,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)36)
					},
					{
						(PlayerStatType)27,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)27)
					},
					{
						(PlayerStatType)28,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)28)
					},
					{
						(PlayerStatType)29,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)29)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)30,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)30)
					},
					{
						(PlayerStatType)31,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)31)
					},
					{
						(PlayerStatType)32,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)32)
					},
					{
						(PlayerStatType)33,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)33)
					},
					{
						(PlayerStatType)34,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)34)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)37,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)37)
					},
					{
						(PlayerStatType)38,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)38)
					},
					{
						(PlayerStatType)39,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)39)
					},
					{
						(PlayerStatType)40,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)40)
					},
					{
						(PlayerStatType)41,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)41)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)42,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)42)
					},
					{
						(PlayerStatType)43,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)43)
					},
					{
						(PlayerStatType)44,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)44)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)12,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)12)
					},
					{
						(PlayerStatType)48,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)48)
					},
					{
						(PlayerStatType)49,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)49)
					},
					{
						(PlayerStatType)76,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)76)
					},
					{
						(PlayerStatType)77,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)77)
					}
				});
				scrollPanel.AddHeaderToScrollList("$hud_building");
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)2,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)2)
					},
					{
						(PlayerStatType)1,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)1)
					},
					{
						(PlayerStatType)13,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)13)
					},
					{
						(PlayerStatType)14,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)14)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)25,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)25)
					},
					{
						(PlayerStatType)24,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)24)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)74,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)74)
					},
					{
						(PlayerStatType)75,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)75)
					},
					{
						(PlayerStatType)82,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)82)
					}
				});
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)78,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)78)
					},
					{
						(PlayerStatType)79,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)79)
					},
					{
						(PlayerStatType)80,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)80)
					},
					{
						(PlayerStatType)81,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)81)
					}
				});
				scrollPanel.AddHeaderToScrollList(ConfigurationFile.statsOthersText.Value);
				scrollPanel.AddRowToScrollList(new Dictionary<PlayerStatType, float>
				{
					{
						(PlayerStatType)55,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)55)
					},
					{
						(PlayerStatType)105,
						GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, (PlayerStatType)105)
					}
				});
				Transform val2 = ((Component)skillsDialog).transform.Find("PlayerStatsFrame/MainFrame/Closebutton");
				Button component2 = ((Component)val2).GetComponent<Button>();
				component2.onClick = new ButtonClickedEvent();
				((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
				{
					Logger.Log("statsCloseButtonButton clicked.");
					panel.SetActive(false);
				});
			}
		}

		private static Dictionary<PlayerStatType, float> getPlayerDictionaryStats()
		{
			//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)
			PlayerProfile val = (PlayerProfile)(typeof(Game).GetField("m_playerProfile", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(Game.instance));
			return ((int)val != 0) ? val.m_playerStats.m_stats : null;
		}

		public GameObject getPanel()
		{
			return panel;
		}

		public void reloadTexts()
		{
			//IL_0043: 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)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)statsTopicText).text = ConfigurationFile.statsText.Value;
			Dictionary<PlayerStatType, float> playerDictionaryStats = getPlayerDictionaryStats();
			foreach (KeyValuePair<PlayerStatType, TextMeshProUGUI> statsText in scrollPanel.statsTexts)
			{
				TextMeshProUGUI value = statsText.Value;
				PlayerStatType key = statsText.Key;
				((TMP_Text)value).text = ((object)(PlayerStatType)(ref key)).ToString() + ": " + GeneralExtensions.GetValueSafe<PlayerStatType, float>(playerDictionaryStats, statsText.Key);
			}
			scrollPanel.reloadHeaderTitles();
		}
	}
	public class CustomStatsPanelScroll
	{
		private readonly GameObject content;

		public readonly Dictionary<PlayerStatType, TextMeshProUGUI> statsTexts = new Dictionary<PlayerStatType, TextMeshProUGUI>();

		private readonly Dictionary<string, TextMeshProUGUI> titleTranslations = new Dictionary<string, TextMeshProUGUI>();

		public CustomStatsPanelScroll(Transform parent)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0080: 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_00ac: 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_00d8: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Expected O, but got Unknown
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Expected O, but got Unknown
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Expected O, but got Unknown
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			InventoryGui instance = InventoryGui.instance;
			GameObject val = new GameObject("CustomStatsPanelScroll", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(((Component)parent).transform, false);
			Object.Destroy((Object)(object)val.GetComponent<Image>());
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.5f, 0.5f);
			component.anchorMax = new Vector2(0.5f, 0.5f);
			component.pivot = new Vector2(0.5f, 0.5f);
			component.anchoredPosition = new Vector2(0f, 0f);
			component.sizeDelta = new Vector2(1260f, 650f);
			Image component2 = val.GetComponent<Image>();
			((Graphic)component2).color = new Color(0f, 0f, 0f, 0.6f);
			GameObject val2 = new GameObject("ScrollView", new Type[3]
			{
				typeof(RectTransform),
				typeof(ScrollRect),
				typeof(Image)
			});
			val2.transform.SetParent(val.transform, false);
			Object.Destroy((Object)(object)val2.GetComponent<Image>());
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 0f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.offsetMin = new Vector2(0f, 0f);
			component3.offsetMax = new Vector2(0f, 0f);
			((Graphic)val2.GetComponent<Image>()).color = new Color(1f, 1f, 1f, 0.05f);
			ScrollRect component4 = val2.GetComponent<ScrollRect>();
			component4.horizontal = false;
			component4.scrollSensitivity = 2000f;
			component4.movementType = (MovementType)2;
			GameObject val3 = new GameObject("Viewport", new Type[3]
			{
				typeof(RectTransform),
				typeof(Mask),
				typeof(Image)
			});
			val3.transform.SetParent(val2.transform, false);
			RectTransform component5 = val3.GetComponent<RectTransform>();
			component5.anchorMin = Vector2.zero;
			component5.anchorMax = Vector2.one;
			component5.offsetMin = Vector2.zero;
			component5.offsetMax = Vector2.zero;
			((Graphic)val3.GetComponent<Image>()).color = new Color(1f, 1f, 1f, 0.05f);
			val3.GetComponent<Mask>().showMaskGraphic = false;
			component4.viewport = component5;
			content = new GameObject("Content", new Type[3]
			{
				typeof(RectTransform),
				typeof(VerticalLayoutGroup),
				typeof(ContentSizeFitter)
			});
			content.transform.SetParent(val3.transform, false);
			RectTransform component6 = content.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0f, 1f);
			component6.anchorMax = new Vector2(1f, 1f);
			component6.pivot = new Vector2(0.5f, 1f);
			component6.anchoredPosition = Vector2.zero;
			component6.sizeDelta = new Vector2(0f, 0f);
			VerticalLayoutGroup component7 = content.GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component7).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)component7).childForceExpandWidth = true;
			((LayoutGroup)component7).childAlignment = (TextAnchor)0;
			((HorizontalOrVerticalLayoutGroup)component7).spacing = 25f;
			((LayoutGroup)component7).padding = new RectOffset(0, 0, 20, 20);
			ContentSizeFitter component8 = content.GetComponent<ContentSizeFitter>();
			component8.verticalFit = (FitMode)2;
			component4.content = component6;
			GameObject gameObject = ((Component)instance.m_recipeListScroll).gameObject;
			GameObject val4 = Object.Instantiate<GameObject>(gameObject, val.transform);
			((Object)val4).name = "Scrollbar";
			RectTransform component9 = val4.GetComponent<RectTransform>();
			component9.anchorMin = new Vector2(1f, 0f);
			component9.anchorMax = new Vector2(1f, 1f);
			component9.pivot = new Vector2(1f, 1f);
			component9.sizeDelta = new Vector2(11f, 0f);
			component9.anchoredPosition = Vector2.zero;
			Scrollbar component10 = val4.GetComponent<Scrollbar>();
			component10.direction = (Direction)2;
			component4.verticalScrollbar = component10;
			component4.verticalScrollbarVisibility = (ScrollbarVisibility)2;
		}

		public void AddHeaderToScrollList(string title)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("GroupHeader", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParent(content.transform, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0.5f, 1f);
			component.anchorMax = new Vector2(0.5f, 1f);
			component.pivot = new Vector2(0.5f, 1f);
			component.anchoredPosition = new Vector2(0f, -10f);
			component.sizeDelta = new Vector2(300f, 30f);
			TextMeshProUGUI component2 = val.GetComponent<TextMeshProUGUI>();
			((TMP_Text)component2).text = Localization.instance.Localize(title);
			titleTranslations.Add(title, component2);
			((TMP_Text)component2).font = InventoryGui.instance.m_recipeName.font;
			((TMP_Text)component2).fontSize = 24f;
			((TMP_Text)component2).alignment = (TextAlignmentOptions)514;
			((Graphic)component2).color = Color.yellow;
		}

		public void AddRowToScrollList(Dictionary<PlayerStatType, float> entries)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_0112: 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_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("StatsRow", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(content.transform, false);
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 1f);
			component.anchorMax = new Vector2(1f, 1f);
			component.pivot = new Vector2(0f, 1f);
			component.sizeDelta = new Vector2(0f, 30f);
			float num = 250f;
			float num2 = 40f;
			int num3 = 0;
			foreach (KeyValuePair<PlayerStatType, float> entry in entries)
			{
				GameObject val2 = new GameObject("Stat", new Type[2]
				{
					typeof(RectTransform),
					typeof(TextMeshProUGUI)
				});
				val2.transform.SetParent(val.transform, false);
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = new Vector2(0f, 0.5f);
				component2.anchorMax = new Vector2(0f, 0.5f);
				component2.pivot = new Vector2(0f, 0.5f);
				component2.anchoredPosition = new Vector2(num2 + num * (float)num3, 0f);
				component2.sizeDelta = new Vector2(240f, 25f);
				TextMeshProUGUI component3 = val2.GetComponent<TextMeshProUGUI>();
				PlayerStatType key = entry.Key;
				((TMP_Text)component3).text = ((object)(PlayerStatType)(ref key)).ToString() + ": " + entry.Value;
				((TMP_Text)component3).font = PlayerUtils.getFontAsset("Valheim-AveriaSansLibre");
				((TMP_Text)component3).fontSize = 18f;
				((Graphic)component3).color = Color.white;
				((TMP_Text)component3).alignment = (TextAlignmentOptions)513;
				statsTexts.Add(entry.Key, component3);
				num3++;
			}
		}

		public void reloadHeaderTitles()
		{
			foreach (KeyValuePair<string, TextMeshProUGUI> titleTranslation in titleTranslations)
			{
				((TMP_Text)titleTranslation.Value).text = Localization.instance.Localize(titleTranslation.Key);
			}
		}
	}
}
namespace DetailedLevels.Features
{
	internal static class CampfireCheck
	{
		[HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[]
		{
			typeof(StatusEffect),
			typeof(bool),
			typeof(int),
			typeof(float)
		})]
		public class SEManAddStatusPatch1
		{
			[HarmonyPrefix]
			public static void Postfix(StatusEffect statusEffect, bool resetTime, int itemLevel, float skillLevel, ref Character ___m_character)
			{
				if (SEMan.s_statusEffectCampFire == ((object)statusEffect).GetHashCode() && !campfireCheckActive)
				{
					campfireCheckActive = true;
				}
				Logger.Log("SEMan.AddStatusEffect - SEManAddStatusPatch1");
				Character obj = ___m_character;
				PlayerInventoryChanges.recalculateSkillsAsync((Humanoid)(object)((obj is Humanoid) ? obj : null), null, 0.1f);
			}
		}

		[HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[]
		{
			typeof(int),
			typeof(bool),
			typeof(int),
			typeof(float)
		})]
		public class SEManAddStatusPatch2
		{
			[HarmonyPrefix]
			public static void Postfix(int nameHash, bool resetTime, int itemLevel, float skillLevel, ref Character ___m_character)
			{
				if (nameHash == SEMan.s_statusEffectCampFire && !campfireCheckActive)
				{
					campfireCheckActive = true;
					Logger.Log("SEMan.AddStatusEffect - SEManAddStatusPatch2");
					Character obj = ___m_character;
					PlayerInventoryChanges.recalculateSkillsAsync((Humanoid)(object)((obj is Humanoid) ? obj : null), null, 0.1f);
				}
			}
		}

		[HarmonyPatch(typeof(SEMan), "RemoveStatusEffect", new Type[]
		{
			typeof(StatusEffect),
			typeof(bool)
		})]
		public class SEManRemoveStatusPatch1
		{
			[HarmonyPrefix]
			public static void Postfix(StatusEffect se, bool quiet, ref Character ___m_character, ref bool __result)
			{
				if (SEMan.s_statusEffectCampFire == ((object)se).GetHashCode() && campfireCheckActive)
				{
					campfireCheckActive = false;
				}
				Logger.Log("SEMan.RemoveStatusEffect - SEManRemoveStatusPatch1");
				Character obj = ___m_character;
				PlayerInventoryChanges.recalculateSkillsAsync((Humanoid)(object)((obj is Humanoid) ? obj : null), null, 0.1f);
			}
		}

		[HarmonyPatch(typeof(SEMan), "RemoveStatusEffect", new Type[]
		{
			typeof(int),
			typeof(bool)
		})]
		public class SEManRemoveStatusPatch2
		{
			[HarmonyPrefix]
			public static void Postfix(int nameHash, bool quiet, ref Character ___m_character, ref bool __result)
			{
				if (nameHash == SEMan.s_statusEffectCampFire && campfireCheckActive)
				{
					campfireCheckActive = false;
					Logger.Log("SEMan.RemoveStatusEffect - SEManRemoveStatusPatch2");
					Character obj = ___m_character;
					PlayerInventoryChanges.recalculateSkillsAsync((Humanoid)(object)((obj is Humanoid) ? obj : null), null, 0.1f);
				}
			}
		}

		public static bool campfireCheckActive;
	}
	internal static class PlayerColorBuffs
	{
		public static void refreshAllBlueColors(Player player)
		{
			//IL_0027: 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)
			foreach (Skill value in PlayerBuffs.skills.Values)
			{
				float num = PlayerUtils.FindActiveModifierValue(player, value.m_info.m_skill);
				if (!(num > 0f))
				{
					continue;
				}
				string text = Localization.instance.Localize("$skill_" + ((object)(SkillType)(ref value.m_info.m_skill)).ToString().ToLower());
				for (int i = 0; i < ((Transform)Hud.instance.m_statusEffectListRoot).childCount; i++)
				{
					TextMeshProUGUI componentInChildren = ((Component)((Transform)Hud.instance.m_statusEffectListRoot).GetChild(i)).GetComponentInChildren<TextMeshProUGUI>();
					Logger.Log("Finding text " + text + " in " + ((TMP_Text)componentInChildren).text);
					if (((TMP_Text)componentInChildren).text.Contains(text) && ((TMP_Text)componentInChildren).text.Length > text.Length)
					{
						((TMP_Text)componentInChildren).faceColor = new Color32((byte)0, (byte)189, byte.MaxValue, byte.MaxValue);
						Logger.Log("Color updated.");
						break;
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(InventoryGui), "Show")]
	public static class SkillTypeCraftStationDescriptionsPatch
	{
		public static bool updated;

		public static void Prefix(Container container, int activeGroup)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Invalid comparison between Unknown and I4
			if (updated)
			{
				return;
			}
			foreach (Recipe recipe in ObjectDB.instance.m_recipes)
			{
				ItemDrop item = recipe.m_item;
				if ((Object)(object)item != (Object)null && (item.m_itemData.HavePrimaryAttack() || item.m_itemData.HaveSecondaryAttack()) && !isInToolList(((Object)item).name))
				{
					SkillType skillType = item.m_itemData.m_shared.m_skillType;
					if ((int)skillType > 0)
					{
						string text = item.m_itemData.m_shared.m_description.Split(new char[1] { '\n' })[0];
						item.m_itemData.m_shared.m_description = text + "\nSkill: $skill_" + ((object)(SkillType)(ref skillType)).ToString().ToLower();
					}
				}
			}
			updated = true;
		}

		private static bool isInToolList(string itemDropName)
		{
			return new List<string> { "Cultivator", "Hoe", "Tankard", "TankardAnniversary", "Tankard_dvergr" }.Contains(itemDropName);
		}
	}
	public static class PlayerBuffs
	{
		public static readonly Dictionary<SkillType, Sprite> sprites = new Dictionary<SkillType, Sprite>();

		public static readonly Dictionary<SkillType, Skill> skills = new Dictionary<SkillType, Skill>();

		public static void AddSkillBuff(Player player, Skill skill, Sprite skillIcon, GameObject skillRow = null)
		{
			//IL_0041: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			SEMan sEMan = ((Character)player).GetSEMan();
			float num = (((Object)(object)skillRow != (Object)null) ? float.Parse(((Component)Utils.FindChild(skillRow.transform, "leveltext", (IterativeSearchType)0)).GetComponent<TMP_Text>().text) : PlayerUtils.GetCurrentSkillLevelProgress(skill));
			float num2 = PlayerUtils.FindActiveModifierValue(player, skill.m_info.m_skill);
			Logger.Log("Skill current value: " + num + ". modifier: " + num2);
			SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
			((StatusEffect)val).m_name = $"$skill_{((object)(SkillType)(ref skill.m_info.m_skill)).ToString().ToLower()}: {num}" + ((num2 > 0f) ? $" (+{num2})" : "");
			((StatusEffect)val).m_tooltip = "$skill_" + ((object)(SkillType)(ref skill.m_info.m_skill)).ToString().ToLower() + "_description";
			((StatusEffect)val).m_icon = skillIcon;
			((Object)val).name = PlayerUtils.GetValueForNameHash(skill);
			int num3 = ((StatusEffect)val).NameHash();
			Logger.Log($"name: {((Object)val).name}, m_name: {((StatusEffect)val).m_name}, nameHash: {num3}");
			sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f);
			if (PlayerUtils.skillStatusEffects.ContainsKey(skill.m_info.m_skill))
			{
				PlayerUtils.skillStatusEffects.Remove(skill.m_info.m_skill);
			}
			PlayerUtils.skillStatusEffects.Add(skill.m_info.m_skill, num3);
			Logger.Log("Added buff: " + ((StatusEffect)val).m_name);
			if (!sprites.ContainsKey(skill.m_info.m_skill))
			{
				sprites.Add(skill.m_info.m_skill, skillIcon);
				Logger.Log("Cached sprite for " + ((StatusEffect)val).m_name + " with sprite.name " + ((Object)skillIcon).name);
			}
			if (!skills.ContainsKey(skill.m_info.m_skill))
			{
				skills.Add(skill.m_info.m_skill, skill);
				Logger.Log("Cached skill for " + ((StatusEffect)val).m_name);
			}
			refreshAllBlueColorsAsync(player, 0.1f);
		}

		public static void RemoveSkillBuff(Player player, Skill skill)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			SEMan sEMan = ((Character)player).GetSEMan();
			int valueSafe = GeneralExtensions.GetValueSafe<SkillType, int>(PlayerUtils.skillStatusEffects, skill.m_info.m_skill);
			StatusEffect statusEffect = sEMan.GetStatusEffect(valueSafe);
			if ((Object)(object)statusEffect != (Object)null)
			{
				sEMan.RemoveStatusEffect(statusEffect, false);
				PlayerUtils.skillStatusEffects.Remove(skill.m_info.m_skill);
				Logger.Log("Deleted buff: " + statusEffect.m_name);
				sprites.Remove(skill.m_info.m_skill);
				skills.Remove(skill.m_info.m_skill);
				refreshAllBlueColorsAsync(player, 0.1f);
			}
		}

		private static async Task refreshAllBlueColorsAsync(Player player, float seconds)
		{
			await Task.Delay((int)(Math.Max(0f, seconds) * 1000f));
			PlayerColorBuffs.refreshAllBlueColors(player);
		}
	}
	[HarmonyPatch(typeof(SkillsDialog), "Awake")]
	public class PlayerSkillupOptionsPatch
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__11_0;

			public static UnityAction <>9__11_1;

			public static UnityAction<float> <>9__16_0;

			public static UnityAction<float> <>9__17_0;

			public static UnityAction<float> <>9__18_0;

			public static UnityAction<float> <>9__19_0;

			internal void <Postfix>b__11_0()
			{
				Logger.Log("dlStatsButtonObject clicked.");
				statsPanel.reloadTexts();
				statsPanel.getPanel().SetActive(true);
				Logger.Log("dlStatsButtonObject - panel visible.");
			}

			internal void <Postfix>b__11_1()
			{
				Logger.Log("DLOptionsButton clicked.");
				panel.getPanel().SetActive(true);
				Logger.Log("DLOptionsButton - panel visible.");
			}

			internal void <addSaveSwitchButton>b__16_0(float value)
			{
				ConfigurationFile.saveSkillBuffs.Value = value.Equals(1f);
				customSliderSaveSwitch.updateValue(ConfigurationFile.saveSkillBuffs.Value.ToString());
			}

			internal void <addNumberOfDecimalsSlider>b__17_0(float value)
			{
				Logger.Log("slider changed to " + value);
				customSliderNumberOfDecimals.updateValue(value.ToString());
				ConfigurationFile.numberOfDecimals.Value = (int)value;
			}

			internal void <addSkillUpMessage>b__18_0(float value)
			{
				Logger.Log("message slider changed to " + value);
				customSliderSkillUpMessage.updateValue(calculateSkillupSliderValue(value));
				ConfigurationFile.skillUpMessageAfterMultipleLevel.Value = (int)value;
			}

			internal void <addSkillUpBigMessage>b__19_0(float value)
			{
				Logger.Log("bigMessage slider changed to " + value);
				customSliderSkillUpBigMessage.updateValue(calculateSkillupSliderValue(value));
				ConfigurationFile.skillUpBigMessageAfterMultipleLevel.Value = (int)value;
			}
		}

		public static CustomSkillOptionsPanel panel;

		private static readonly Color TITLE_COLOR = new Color(1f, 0.7176f, 0.3603f);

		private static TextMeshProUGUI buttonOptionsText;

		private static TextMeshProUGUI buttonStatsText;

		private static TextMeshProUGUI lossPercentageTextComponent;

		private static TextMeshProUGUI lossPercentageValueComponent;

		private static CustomSlider customSliderSaveSwitch;

		private static CustomSlider customSliderNumberOfDecimals;

		private static CustomSlider customSliderSkillUpMessage;

		private static CustomSlider customSliderSkillUpBigMessage;

		private static CustomStatsPanel statsPanel;

		private static void Postfix(SkillsDialog __instance)
		{
			//IL_0045: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Expected O, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Expected O, but got Unknown
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Expected O, but got Unknown
			TMP_FontAsset defaultFontAsset = TMP_Settings.defaultFontAsset;
			if ((Object)(object)defaultFontAsset == (Object)null)
			{
				TMP_Settings.defaultFontAsset = PlayerUtils.getFontAsset("Valheim-AveriaSansLibre");
			}
			Transform val = ((Component)__instance).transform.Find("SkillsFrame/Closebutton");
			((RectTransform)((val is RectTransform) ? val : null)).anchoredPosition = new Vector2(146f, 45f);
			((RectTransform)((val is RectTransform) ? val : null)).sizeDelta = new Vector2(140f, 46f);
			Button component = ((Component)val).GetComponent<Button>();
			GameObject val2 = Object.Instantiate<GameObject>(((Component)component).gameObject, ((Component)component).transform.parent);
			((Object)val2).name = "DLOptionsButton";
			RectTransform component2 = val2.GetComponent<RectTransform>();
			component2.anchoredPosition = new Vector2(-145f, 45f);
			component2.sizeDelta = new Vector2(140f, 46f);
			buttonOptionsText = val2.GetComponentInChildren<TextMeshProUGUI>();
			((TMP_Text)buttonOptionsText).fontStyle = (FontStyles)0;
			((Graphic)buttonOptionsText).color = TITLE_COLOR;
			((TMP_Text)buttonOptionsText).alignment = (TextAlignmentOptions)514;
			GameObject val3 = Object.Instantiate<GameObject>(((Component)component).gameObject, ((Component)component).transform.parent);
			((Object)val3).name = "DLStatsButton";
			RectTransform component3 = val3.GetComponent<RectTransform>();
			component3.anchoredPosition = new Vector2(0f, 45f);
			component3.sizeDelta = new Vector2(140f, 46f);
			Button component4 = val3.GetComponent<Button>();
			component4.onClick = new ButtonClickedEvent();
			ButtonClickedEvent onClick = component4.onClick;
			object obj = <>c.<>9__11_0;
			if (obj == null)
			{
				UnityAction val4 = delegate
				{
					Logger.Log("dlStatsButtonObject clicked.");
					statsPanel.reloadTexts();
					statsPanel.getPanel().SetActive(true);
					Logger.Log("dlStatsButtonObject - panel visible.");
				};
				<>c.<>9__11_0 = val4;
				obj = (object)val4;
			}
			((UnityEvent)onClick).AddListener((UnityAction)obj);
			buttonStatsText = val3.GetComponentInChildren<TextMeshProUGUI>();
			((TMP_Text)buttonStatsText).fontStyle = (FontStyles)0;
			((Graphic)buttonStatsText).color = TITLE_COLOR;
			((TMP_Text)buttonStatsText).alignment = (TextAlignmentOptions)514;
			panel = new CustomSkillOptionsPanel(((Component)component).transform.parent);
			statsPanel = new CustomStatsPanel();
			Button component5 = val2.GetComponent<Button>();
			component5.onClick = new ButtonClickedEvent();
			ButtonClickedEvent onClick2 = component5.onClick;
			object obj2 = <>c.<>9__11_1;
			if (obj2 == null)
			{
				UnityAction val5 = delegate
				{
					Logger.Log("DLOptionsButton clicked.");
					panel.getPanel().SetActive(true);
					Logger.Log("DLOptionsButton - panel visible.");
				};
				<>c.<>9__11_1 = val5;
				obj2 = (object)val5;
			}
			((UnityEvent)onClick2).AddListener((UnityAction)obj2);
			addSoftDeathInfo(panel.getPanel().transform);
			addSaveSwitchButton(panel.getPanel().transform);
			addNumberOfDecimalsSlider(panel.getPanel().transform);
			addSkillUpMessage(panel.getPanel().transform);
			addSkillUpBigMessage(panel.getPanel().transform);
			reloadTexts();
		}

		public static void reloadTexts()
		{
			((TMP_Text)buttonOptionsText).text = Localization.instance.Localize("$button_ps_start");
			((TMP_Text)buttonStatsText).text = ConfigurationFile.statsText.Value;
			panel.reloadTexts();
			statsPanel.reloadTexts();
		}

		private static void addSoftDeathInfo(Transform parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_004c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("NoSkillDrainText");
			lossPercentageTextComponent = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lossPercentageTextComponent).font = PlayerUtils.getFontAsset("Valheim-AveriaSansLibre");
			((TMP_Text)lossPercentageTextComponent).fontStyle = (FontStyles)0;
			((Graphic)lossPercentageTextComponent).color = new Color(1f, 1f, 0f);
			((TMP_Text)lossPercentageTextComponent).fontSize = 18f;
			((TMP_Text)lossPercentageTextComponent).alignment = (TextAlignmentOptions)516;
			RectTransform component = val.GetComponent<RectTransform>();
			((Transform)component).SetParent(parent, false);
			component.sizeDelta = new Vector2(200f, 50f);
			component.anchoredPosition = new Vector2(-141f, 188f);
			GameObject val2 = new GameObject("NoSkillDrainValue");
			lossPercentageValueComponent = val2.AddComponent<TextMeshProUGUI>();
			((TMP_Text)lossPercentageValueComponent).font = PlayerUtils.getFontAsset("Valheim-AveriaSansLibre");
			((TMP_Text)lossPercentageValueComponent).fontStyle = (FontStyles)0;
			((Graphic)lossPercentageValueComponent).color = new Color(1f, 1f, 0f);
			((TMP_Text)lossPercentageValueComponent).fontSize = 18f;
			((TMP_Text)lossPercentageValueComponent).alignment = (TextAlignmentOptions)513;
			RectTransform component2 = val2.GetComponent<RectTransform>();
			((Transform)component2).SetParent(parent, false);
			component2.sizeDelta = new Vector2(200f, 50f);
			component2.anchoredPosition = new Vector2(65f, 188f);
			updateSkillLossPercentage();
		}

		public static void updateSkillLossPercentage()
		{
			if ((Object)(object)lossPercentageTextComponent != (Object)null)
			{
				((TMP_Text)lossPercentageTextComponent).text = ConfigurationFile.deathPenaltyText.Value ?? "";
				float num = ((Character)Player.m_localPlayer).GetSkills().m_DeathLowerFactor * 100f;
				((TMP_Text)lossPercentageValueComponent).text = string.Format("= {0}{1}%", (num > 0f) ? "-" : "", num);
			}
		}

		public static void updateOptionsTexts()
		{
			((TMP_Text)customSliderSaveSwitch.sliderLabelDescription).text = ConfigurationFile.reloadAfterDyingText.Value;
			((TMP_Text)customSliderNumberOfDecimals.sliderLabelDescription).text = ConfigurationFile.numberOfDecimalsText.Value;
			((TMP_Text)customSliderSkillUpMessage.sliderLabelDescription).text = ConfigurationFile.skillUpMessageText.Value;
			customSliderSkillUpMessage.updateValue(calculateSkillupSliderValue(customSliderSkillUpMessage.getValue()));
			((TMP_Text)customSliderSkillUpBigMessage.sliderLabelDescription).text = ConfigurationFile.skillUpBigMessageText.Value;
			customSliderSkillUpBigMessage.updateValue(calculateSkillupSliderValue(customSliderSkillUpBigMessage.getValue()));
		}

		private static void addSaveSwitchButton(Transform parent)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			customSliderSaveSwitch = new CustomSlider("SkillsLevelSaveSlider", 1, new Vector2(25f, 10f), new Vector2(-17f, 163f), -1, null, -124, ConfigurationFile.reloadAfterDyingText.Value, 123, ConfigurationFile.saveSkillBuffs.Value ? 1 : 0, ConfigurationFile.saveSkillBuffs.Value.ToString());
			customSliderSaveSwitch.getGameObject().transform.SetParent(parent, false);
			customSliderSaveSwitch.OnValueChanged(delegate(float value)
			{
				ConfigurationFile.saveSkillBuffs.Value = value.Equals(1f);
				customSliderSaveSwitch.updateValue(ConfigurationFile.saveSkillBuffs.Value.ToString());
			});
		}

		private static void addNumberOfDecimalsSlider(Transform parent)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			customSliderNumberOfDecimals = new CustomSlider("NumberOfDecimalsSlider", 15, new Vector2(150f, 10f), new Vector2(45f, 135f), 0, null, -186, ConfigurationFile.numberOfDecimalsText.Value, 185, ConfigurationFile.numberOfDecimals.Value, ConfigurationFile.numberOfDecimals.Value.ToString());
			customSliderNumberOfDecimals.getGameObject().transform.SetParent(parent, false);
			customSliderNumberOfDecimals.OnValueChanged(delegate(float value)
			{
				Logger.Log("slider changed to " + value);
				customSliderNumberOfDecimals.updateValue(value.ToString());
				ConfigurationFile.numberOfDecimals.Value = (int)value;
			});
		}

		private static void addSkillUpMessage(Transform parent)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			customSliderSkillUpMessage = new CustomSlider("SkillUpMessageSlider", 100, new Vector2(150f, 10f), new Vector2(45f, 105f), 0, null, -186, ConfigurationFile.skillUpMessageText.Value, 185, ConfigurationFile.skillUpMessageAfterMultipleLevel.Value, calculateSkillupSliderValue(ConfigurationFile.skillUpMessageAfterMultipleLevel.Value));
			customSliderSkillUpMessage.getGameObject().transform.SetParent(parent, false);
			customSliderSkillUpMessage.OnValueChanged(delegate(float value)
			{
				Logger.Log("message slider changed to " + value);
				customSliderSkillUpMessage.updateValue(calculateSkillupSliderValue(value));
				ConfigurationFile.skillUpMessageAfterMultipleLevel.Value = (int)value;
			});
		}

		private static void addSkillUpBigMessage(Transform parent)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			customSliderSkillUpBigMessage = new CustomSlider("SkillUpBigMessageSlider", 100, new Vector2(150f, 10f), new Vector2(45f, 75f), 0, null, -186, ConfigurationFile.skillUpBigMessageText.Value, 185, ConfigurationFile.skillUpBigMessageAfterMultipleLevel.Value, calculateSkillupSliderValue(ConfigurationFile.skillUpBigMessageAfterMultipleLevel.Value));
			customSliderSkillUpBigMessage.getGameObject().transform.SetParent(parent, false);
			customSliderSkillUpBigMessage.OnValueChanged(delegate(float value)
			{
				Logger.Log("bigMessage slider changed to " + value);
				customSliderSkillUpBigMessage.updateValue(calculateSkillupSliderValue(value));
				ConfigurationFile.skillUpBigMessageAfterMultipleLevel.Value = (int)value;
			});
		}

		private static string calculateSkillupSliderValue(float value)
		{
			return value.Equals(0f) ? Localization.instance.Localize("$menu_none") : ConfigurationFile.skillUpValueText.Value.Replace("{0}", value.ToString());
		}
	}
	[HarmonyPatch(typeof(Player), "OnDeath")]
	public class Player_OnDeath_Patch
	{
		private static void Postfix(Player __instance)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			FieldInfo field = typeof(SkillsDialog).GetField("m_elements", BindingFlags.Instance | BindingFlags.NonPublic);
			List<GameObject> list = (List<GameObject>)field.GetValue(InventoryGui.instance.m_skillsDialog);
			foreach (GameObject item in list)
			{
				PlayerUtils.setSkillRowBackgroundColor(item, new Color(0f, 0f, 0f, 0f));
			}
			if (!ConfigurationFile.saveSkillBuffs.Value)
			{
				PlayerUtils.skillStatusEffects.Clear();
			}
		}
	}
	[HarmonyPatch(typeof(Player), "OnSpawned")]
	public class Player_OnSpawned_Patch
	{
		private static void Postfix(Player __instance, bool spawnValkyrie)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			((Character)__instance).GetSkills().m_DeathLowerFactor = ConfigurationFile.deathSkillLoss.Value / 100f;
			if (!ConfigurationFile.saveSkillBuffs.Value)
			{
				return;
			}
			List<SkillType> list = new List<SkillType>();
			foreach (SkillType key in PlayerUtils.skillStatusEffects.Keys)
			{
				list.Add(key);
			}
			foreach (SkillType item in list)
			{
				PlayerBuffs.AddSkillBuff(__instance, GeneralExtensions.GetValueSafe<SkillType, Skill>(PlayerBuffs.skills, item), GeneralExtensions.GetValueSafe<SkillType, Sprite>(PlayerBuffs.sprites, item));
			}
		}
	}
	[HarmonyPatch(typeof(SkillsDialog), "Setup")]
	[HarmonyPriority(700)]
	internal static class SkillsDialog_SkillStatusEffects_Patch
	{
		private static void Postfix(SkillsDialog __instance, ref List<GameObject> ___m_elements)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			Logger.Log("** SkillsDialog_SkillStatusEffects_Patch.Postfix");
			if ((Object)(object)InventoryGui.instance == (Object)null)
			{
				return;
			}
			for (int i = 0; i < ___m_elements.Count; i++)
			{
				GameObject skillRow = ___m_elements[i];
				int row = i;
				skillRow.GetComponent<Button>().onClick = new ButtonClickedEvent();
				((UnityEvent)skillRow.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
				{
					Player localPlayer = Player.m_localPlayer;
					Skill skill = ((Character)localPlayer).GetSkills().GetSkillList()[row];
					OnSkillClicked(localPlayer, skill, skillRow);
				});
			}
		}

		private static void OnSkillClicked(Player player, Skill skill, GameObject skillRow)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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)
			SkillType skill2 = skill.m_info.m_skill;
			bool flag = PlayerUtils.skillStatusEffects.ContainsKey(skill2);
			Logger.Log($"skillStatusEffects.ContainsKey: {flag}");
			if (!flag)
			{
				Sprite skillIcon = GetSkillIcon(skillRow);
				PlayerBuffs.AddSkillBuff(player, skill, skillIcon, skillRow);
				PlayerUtils.setSkillRowBackgroundColor(skillRow, ConfigurationFile.colorSkillBackground.Value);
			}
			else
			{
				PlayerBuffs.RemoveSkillBuff(player, skill);
				PlayerUtils.setSkillRowBackgroundColor(skillRow, new Color(0f, 0f, 0f, 0f));
			}
		}

		private static Sprite GetSkillIcon(GameObject skillRow)
		{
			Image component = ((Component)((Component)((Component)skillRow.transform.Find("icon_bkg")).GetComponent<Image>()).transform.Find("icon")).GetComponent<Image>();
			if ((Object)(object)component != (Object)null)
			{
				return component.sprite;
			}
			return null;
		}
	}
	[HarmonyPatch(typeof(Player), "RaiseSkill")]
	public class Player_RaiseSkill_Patch
	{
		private static void Postfix(Player __instance, SkillType skill, float value)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			Logger.Log($"Entering RaiseSkill.Postfix with skill {((object)(SkillType)(ref skill)).ToString()} and value {value}");
			if (PlayerUtils.skillStatusEffects.TryGetValue(skill, out var value2))
			{
				updateSkillTypeBuff(__instance, skill, value2);
			}
		}

		public static void updateSkillTypeBuff(Player player, SkillType skillType, int nameHash, bool forceUpdate = false)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			string text = ((object)(SkillType)(ref skillType)).ToString();
			int valueForHashCode = PlayerUtils.GetValueForHashCode(skillType);
			Logger.Log($"skillName to find corresponding buff: {text} with hash {valueForHashCode}. Stored nameHash: {nameHash}");
			SEMan sEMan = ((Character)player).GetSEMan();
			StatusEffect statusEffect = sEMan.GetStatusEffect(nameHash);
			if ((Object)(object)statusEffect != (Object)null)
			{
				Skill skill = PlayerUtils.FindPlayerSkill(player, skillType);
				float currentSkillLevelProgress = PlayerUtils.GetCurrentSkillLevelProgress(skill);
				float num = PlayerUtils.FindActiveModifierValue(player, skillType);
				Logger.Log($"About to update buff: $skill_{text.ToLower()} with skill level {currentSkillLevelProgress} and skill level modifier {num}.");
				string text2 = $"$skill_{((object)(SkillType)(ref skillType)).ToString().ToLower()}: {currentSkillLevelProgress}" + ((num > 0f) ? (" (+" + num + ")") : string.Empty);
				Logger.Log("Old buff name: " + statusEffect.m_name + ". New buff name: " + text2);
				if (statusEffect.m_name != text2 || forceUpdate)
				{
					statusEffect.m_name = text2;
					Logger.Log($"Updated buff: {text} with skill level: {currentSkillLevelProgress}");
				}
				else
				{
					Logger.Log("No need to update buff");
				}
			}
		}
	}
	[HarmonyPatch(typeof(Character), "Damage")]
	public class BloodMagic_BuffUpdate_Patch
	{
		private static void Postfix(Character __instance, HitData hit)
		{
			if (!((Object)(object)__instance != (Object)null))
			{
				return;
			}
			Character attacker = hit.GetAttacker();
			if (!((Object)(object)attacker != (Object)null))
			{
				return;
			}
			if (((object)__instance).GetType() == typeof(Player))
			{
				int num;
				if (((object)attacker).GetType() == typeof(Player))
				{
					Character obj = ((__instance is Player) ? __instance : null);
					string obj2 = ((obj != null) ? ((Player)obj).GetPlayerName() : null);
					Character obj3 = ((attacker is Player) ? attacker : null);
					num = ((obj2 == ((obj3 != null) ? ((Player)obj3).GetPlayerName() : null)) ? 1 : 0);
				}
				else
				{
					num = 0;
				}
				bool flag = (byte)num != 0;
				Logger.Log($"Checking staff shield autoDamage {flag}...");
				WaitForSecondsAsyncStaffShield((Player)(object)((__instance is Player) ? __instance : null), 0.1f, flag);
			}
			Logger.Log("Checking blood magic skill up...");
			if (attacker.IsTamed() && __instance.IsMonsterFaction(0f))
			{
				WaitForSecondsAsyncBloodMagic(null, 0.1f);
			}
			else if (attacker.IsMonsterFaction(0f) && ((object)__instance).GetType() == typeof(Player))
			{
				WaitForSecondsAsyncBloodMagic((Player)(object)((__instance is Player) ? __instance : null), 0.1f);
			}
			else if (((Object)attacker).name.Contains("Troll_Summoned"))
			{
				if (((object)__instance).GetType() == typeof(Player))
				{
					WaitForSecondsAsyncBloodMagic((Player)(object)((__instance is Player) ? __instance : null), 0.1f);
				}
				else if (__instance.IsTamed())
				{
					WaitForSecondsAsyncBloodMagic(null, 0.1f);
				}
			}
		}

		private static async Task WaitForSecondsAsyncStaffShield(Player player, float seconds, bool newShield)
		{
			await Task.Delay((int)(Math.Max(0f, seconds) * 1000f));
			Logger.Log("BloodMagic_BuffUpdate_Patch - Initialize staff shield value");
			SE_Shield_Setup_Patch.updateShieldBuffTextIfExists(player, newShield);
		}

		private static async Task WaitForSecondsAsyncBloodMagic(Player player, float seconds)
		{
			await Task.Delay((int)(Math.Max(0f, seconds) * 1000f));
			if (PlayerUtils.skillStatusEffects.TryGetValue((SkillType)10, out var nameHash))
			{
				Player_RaiseSkill_Patch.updateSkillTypeBuff(((Object)(object)player == (Object)null) ? Player.m_localPlayer : player, (SkillType)10, nameHash);
			}
		}
	}
	[HarmonyPatch(typeof(SE_Shield), "Setup")]
	public class SE_Shield_Setup_Patch
	{
		private static void Postfix(Character __instance)
		{
			if ((Object)(object)__instance != (Object)null && ((object)__instance).GetType() == typeof(Player))
			{
				Logger.Log("SE_Shield_Setup_Patch - Initialize staff shield value");
				updateShieldBuffTextIfExists((Player)(object)((__instance is Player) ? __instance : null), newShield: true);
				if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer)
				{
					Logger.Log("SE_Shield_Setup_Patch - Another player did the spell. Checking local player");
					updateShieldBuffTextIfExists(Player.m_localPlayer, newShield: true);
				}
			}
		}

		public static void updateShieldBuffTextIfExists(Player player, bool newShield)
		{
			StatusEffect val = ((Character)player).GetSEMan().GetStatusEffects().Find((StatusEffect se) => se.m_name.Contains("$se_shield"));
			if ((Object)(object)val != (Object)null && ((object)val).GetType() == typeof(SE_Shield))
			{
				SE_Shield val2 = (SE_Shield)(object)((val is SE_Shield) ? val : null);
				float num = (float)typeof(SE_Shield).GetField("m_totalAbsorbDamage", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val2);
				if (newShield)
				{
					((StatusEffect)val2).m_name = $"$se_shield: {num}";
					Logger.Log($"New shield: m_totalAbsorbDamage {num}");
					return;
				}
				float num2 = (float)typeof(SE_Shield).GetField("m_damage", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(val2);
				float num3 = (float)Math.Round(num - num2, Math.Min(15, Math.Max(0, ConfigurationFile.numberOfDecimals.Value)));
				((StatusEffect)val2).m_name = $"$se_shield: {num3}";
				Logger.Log($"Shield numbers: m_totalAbsorbDamage {num}, m_damage {num2}, remainingAbsorbDamage {num3}");
			}
		}
	}
	[HarmonyPatch]
	public class Dodge_BuffUpdate_Patch
	{
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(Player), "Dodge", (Type[])null, (Type[])null);
		}

		private static void Postfix(ref Player __instance, Vector3 dodgeDir)
		{
			Logger.Log("Checking dodge skill up...");
			WaitForSecondsAsync(__instance, 0.1f);
		}

		private static async Task WaitForSecondsAsync(Player player, float seconds)
		{
			await Task.Delay((int)(Math.Max(0f, seconds) * 1000f));
			if (PlayerUtils.skillStatusEffects.TryGetValue((SkillType)108, out var nameHash))
			{
				Player_RaiseSkill_Patch.updateSkillTypeBuff(player, (SkillType)108, nameHash);
			}
		}
	}
	[HarmonyPatch(typeof(Humanoid), "EquipItem")]
	[HarmonyPriority(100)]
	public class PlayerEquipItemPatch
	{
		[HarmonyPrefix]
		public static void Postfix(Humanoid __instance, ItemData item, bool triggerEquipEffects)
		{
			PlayerInventoryChanges.recalculateSkillsAsync(__instance, item, 0.1f);
		}
	}
	[HarmonyPatch(typeof(Humanoid), "DropItem")]
	[HarmonyPriority(100)]
	public class PlayerDropItemPatch
	{
		[HarmonyPrefix]
		public static void Postfix(Inventory inventory, ItemData item, int amount, ref Humanoid __instance)
		{
			PlayerInventoryChanges.recalculateSkillsAsync(__instance, item, 0.1f);
		}
	}
	[HarmonyPatch(typeof(Humanoid), "UnequipItem")]
	[HarmonyPriority(100)]
	public class PlayerUnequipItemPatch
	{
		[HarmonyPrefix]
		public static void Postfix(ItemData item, bool triggerEquipEffects, ref Humanoid __instance)
		{
			PlayerInventoryChanges.recalculateSkillsAsync(__instance, null, 0.1f);
		}
	}
	internal static class PlayerInventoryChanges
	{
		public static async Task recalculateSkillsAsync(Humanoid __instance, ItemData item, float seconds)
		{
			await Task.Delay((int)(Math.Max(0f, seconds) * 1000f));
			if (!(__instance is Player) || (item != null && !PlayerUtils.GetTypesThatModifyStats().Contains(item.m_shared.m_itemType)))
			{
				return;
			}
			Player player = (Player)(object)((__instance is Player) ? __instance : null);
			foreach (KeyValuePair<SkillType, int> skillStatusEffect in PlayerUtils.skillStatusEffects)
			{
				SkillType skillType = skillStatusEffect.Key;
				int nameHash = skillStatusEffect.Value;
				StatusEffect statusEffect = ((Character)player).GetSEMan().GetStatusEffect(nameHash);
				StatusEffect existingBuff = ((statusEffect is SE_Stats) ? statusEffect : null);
				if (!((Object)(object)existingBuff == (Object)null))
				{
					Skill playerSkill = PlayerUtils.FindPlayerSkill(player, skillType);
					string skillName = ((object)(SkillType)(ref skillType)).ToString();
					float currentSkillLevel = PlayerUtils.GetCurrentSkillLevelProgress(playerSkill);
					float skillLevelModifier = PlayerUtils.FindActiveModifierValue(player, skillType);
					Logger.Log($"About to update buff: $skill_{skillName.ToLower()} with skill level {currentSkillLevel} and skill level modifier {skillLevelModifier}.");
					string newBuffName = $"$skill_{((object)(SkillType)(ref skillType)).ToString().ToLower()}: {currentSkillLevel}" + ((skillLevelModifier > 0f) ? (" (+" + skillLevelModifier + ")") : string.Empty);
					Logger.Log("Old buff name: " + existingBuff.m_name + ". New buff name: " + newBuffName);
					existingBuff.m_name = newBuffName;
				}
			}
			PlayerColorBuffs.refreshAllBlueColors(player);
		}
	}
	[HarmonyPatch(typeof(SkillsDialog), "Setup")]
	[HarmonyPriority(100)]
	public class SkillsDialogAdditions_Patch
	{
		public static int azSorted;

		public static int levelSorted;

		private static bool init;

		private static void Postfix(SkillsDialog __instance, ref Player player, ref List<GameObject> ___m_elements)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			List<Skill> skillList = ((Character)player).GetSkills().GetSkillList();
			for (int i = 0; i < skillList.Count; i++)
			{
				GameObject val = ___m_elements[i];
				Skill val2 = skillList[i];
				float currentSkillLevelProgress = PlayerUtils.GetCurrentSkillLevelProgress(val2);
				float num = PlayerUtils.FindActiveModifierValue(player, val2.m_info.m_skill);
				string text = currentSkillLevelProgress + ((num > 0f) ? (" (+" + num + ")") : "");
				((Component)Utils.FindChild(val.transform, "leveltext", (IterativeSearchType)0)).GetComponent<TMP_Text>().text = currentSkillLevelProgress.ToString();
				string text2 = ((object)(SkillType)(ref val2.m_info.m_skill)).ToString();
				int valueSafe = GeneralExtensions.GetValueSafe<SkillType, int>(PlayerUtils.skillStatusEffects, val2.m_info.m_skill);
				StatusEffect statusEffect = ((Character)player).GetSEMan().GetStatusEffect(valueSafe);
				if ((Object)(object)statusEffect != (Object)null)
				{
					PlayerUtils.setSkillRowBackgroundColor(val, ConfigurationFile.colorSkillBackground.Value);
					statusEffect.m_name = "$skill_" + ((object)(SkillType)(ref val2.m_info.m_skill)).ToString().ToLower() + ": " + text;
				}
				else
				{
					PlayerUtils.setSkillRowBackgroundColor(val, new Color(0f, 0f, 0f, 0f));
				}
			}
			if (!init)
			{
				Transform val3 = ((Component)InventoryGui.instance.m_skillsDialog).transform.Find("SkillsFrame/Closebutton");
				Button component = ((Component)val3).GetComponent<Button>();
				azButton(component);
				levelButton(component);
				init = true;
			}
		}

		private static void azButton(Button baseButton)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(((Component)baseButton).gameObject, ((Component)baseButton).transform.parent);
			((Object)val).name = "AZButton";
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchoredPosition = new Vector2(-133f, 633f);
			component.sizeDelta = new Vector2(50f, 35f);
			TMP_Text buttonText = val.GetComponentInChildren<TMP_Text>();
			buttonText.text = ((azSorted != 1) ? "A-Z" : "Z-A");
			Button component2 = val.GetComponent<Button>();
			component2.onClick = new ButtonClickedEvent();
			((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
			{
				Logger.Log("AZButton clicked.");
				levelSorted = 0;
				if (azSorted != 1)
				{
					azSorted = 1;
					buttonText.text = "Z-A";
				}
				else
				{
					azSorted = 2;
					buttonText.text = "A-Z";
				}
				InventoryGui.instance.m_skillsDialog.Setup(Player.m_localPlayer);
			});
		}

		private static void levelButton(Button baseButton)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			GameObject val = Object.Instantiate<GameObject>(((Component)baseButton).gameObject, ((Component)baseButton).transform.parent);
			((Object)val).name = "LevelButton";
			RectTransform component = val.GetComponent<RectTransform>();
			component.anchoredPosition = new Vector2(133f, 633f);
			component.sizeDelta = new Vector2(50f, 35f);
			TMP_Text buttonText = val.GetComponentInChildren<TMP_Text>();
			buttonText.text = ((levelSorted != 1) ? "1-100" : "100-1");
			Button component2 = val.GetComponent<Button>();
			component2.onClick = new ButtonClickedEvent();
			((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
			{
				Logger.Log("LevelButton clicked.");
				azSorted = 0;
				if (levelSorted != 1)
				{
					levelSorted = 1;
					buttonText.text = "100-1";
				}
				else
				{
					levelSorted = 2;
					buttonText.text = "1-100";
				}
				InventoryGui.instance.m_skillsDialog.Setup(Player.m_localPlayer);
			});
		}
	}
	[HarmonyPatch(typeof(InventoryGui), "Show")]
	public class InventoryGui_Show_Patch
	{
		private static void Postfix(InventoryGui __instance)
		{
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)__instance.m_player != (Object)null))
			{
				return;
			}
			Transform val = ((Component)__instance).transform.Find("root/Info/Skills");
			if (!((Object)(object)val != (Object)null))
			{
				return;
			}
			UITooltip component = ((Component)val).GetComponent<UITooltip>();
			if ((Object)(object)component != (Object)null)
			{
				string text = "$inventory_skills";
				string text2 = $" ({ConfigurationFile.hotKey.Value})";
				component.m_text = text + text2;