Decompiled source of Valheim Level System by Lorska v0.99.1

BepInEx/plugins/ValheimLevelSystem.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Groups;
using HarmonyLib;
using Jotunn;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using ValheimLevelSystem.PlayerSkills;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: CompilationRelaxations(8)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
internal class <Module>
{
	static <Module>()
	{
		Initializer.Init();
	}
}
namespace ValheimLevelSystem
{
	public class ExpTable
	{
		public static List<MonsterExp> MonsterExpList { get; set; }

		public static List<PickableExp> PickableExpList { get; set; }

		public static List<MineableExp> MineableExpList { get; set; }

		public static List<ChoppableExp> ChoppableExpList { get; set; }

		public static List<FishableExp> FishableExpList { get; set; }

		public static void InitMonsterExpList()
		{
			MonsterExpList = new List<MonsterExp>();
			ValheimLevelSystem.Tier1Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier1Exp.Value));
			});
			ValheimLevelSystem.Tier2Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier2Exp.Value));
			});
			ValheimLevelSystem.Tier3Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier3Exp.Value));
			});
			ValheimLevelSystem.Tier4Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier4Exp.Value));
			});
			ValheimLevelSystem.Tier5Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier5Exp.Value));
			});
			ValheimLevelSystem.Tier6Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier6Exp.Value));
			});
			ValheimLevelSystem.Tier7Creatures.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MonsterExpList.Add(new MonsterExp(x, ValheimLevelSystem.Tier7Exp.Value));
			});
		}

		public static void InitPickableExpList()
		{
			PickableExpList = new List<PickableExp>();
			ValheimLevelSystem.Tier1Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier1Exp.Value));
			});
			ValheimLevelSystem.Tier2Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier2Exp.Value));
			});
			ValheimLevelSystem.Tier3Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier3Exp.Value));
			});
			ValheimLevelSystem.Tier4Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier4Exp.Value));
			});
			ValheimLevelSystem.Tier5Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier5Exp.Value));
			});
			ValheimLevelSystem.Tier6Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier6Exp.Value));
			});
			ValheimLevelSystem.Tier7Pickables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				PickableExpList.Add(new PickableExp(x, ValheimLevelSystem.Tier7Exp.Value));
			});
		}

		public static void InitMineableExpList()
		{
			MineableExpList = new List<MineableExp>();
			ValheimLevelSystem.Tier1Mineables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MineableExpList.Add(new MineableExp(x, ValheimLevelSystem.Tier1Exp.Value));
			});
			ValheimLevelSystem.Tier2Mineables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MineableExpList.Add(new MineableExp(x, ValheimLevelSystem.Tier2Exp.Value));
			});
			ValheimLevelSystem.Tier3Mineables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MineableExpList.Add(new MineableExp(x, ValheimLevelSystem.Tier3Exp.Value));
			});
			ValheimLevelSystem.Tier4Mineables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MineableExpList.Add(new MineableExp(x, ValheimLevelSystem.Tier4Exp.Value));
			});
			ValheimLevelSystem.Tier6Mineables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MineableExpList.Add(new MineableExp(x, ValheimLevelSystem.Tier6Exp.Value));
			});
			ValheimLevelSystem.Tier7Mineables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				MineableExpList.Add(new MineableExp(x, ValheimLevelSystem.Tier7Exp.Value));
			});
		}

		public static void InitChoppableExpList()
		{
			ChoppableExpList = new List<ChoppableExp>();
			ValheimLevelSystem.Tier1Choppables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				ChoppableExpList.Add(new ChoppableExp(x, ValheimLevelSystem.Tier1Exp.Value));
			});
			ValheimLevelSystem.Tier2Choppables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				ChoppableExpList.Add(new ChoppableExp(x, ValheimLevelSystem.Tier2Exp.Value));
			});
			ValheimLevelSystem.Tier3Choppables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				ChoppableExpList.Add(new ChoppableExp(x, ValheimLevelSystem.Tier3Exp.Value));
			});
			ValheimLevelSystem.Tier6Choppables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				ChoppableExpList.Add(new ChoppableExp(x, ValheimLevelSystem.Tier6Exp.Value));
			});
			ValheimLevelSystem.Tier7Choppables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				ChoppableExpList.Add(new ChoppableExp(x, ValheimLevelSystem.Tier7Exp.Value));
			});
		}

		public static void InitFishableExpList()
		{
			FishableExpList = new List<FishableExp>();
			ValheimLevelSystem.Tier2Fishables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				FishableExpList.Add(new FishableExp(x, ValheimLevelSystem.Tier2Exp.Value));
			});
			ValheimLevelSystem.Tier3Fishables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				FishableExpList.Add(new FishableExp(x, ValheimLevelSystem.Tier3Exp.Value));
			});
			ValheimLevelSystem.Tier4Fishables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				FishableExpList.Add(new FishableExp(x, ValheimLevelSystem.Tier4Exp.Value));
			});
			ValheimLevelSystem.Tier5Fishables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				FishableExpList.Add(new FishableExp(x, ValheimLevelSystem.Tier5Exp.Value));
			});
			ValheimLevelSystem.Tier6Fishables.Value.Split(new char[1] { ',' }).ToList().ForEach(delegate(string x)
			{
				FishableExpList.Add(new FishableExp(x, ValheimLevelSystem.Tier6Exp.Value));
			});
		}
	}
	public class MonsterExp
	{
		public string Name { get; set; }

		public int ExpAmount { get; set; }

		public MonsterExp(string name, int exp = 100)
		{
			Name = name;
			ExpAmount = exp;
		}
	}
	public class PickableExp
	{
		public string Name { get; set; }

		public int ExpAmount { get; set; }

		public PickableExp(string name, int exp = 100)
		{
			Name = name;
			ExpAmount = exp;
		}
	}
	public class MineableExp
	{
		public string Name { get; set; }

		public int ExpAmount { get; set; }

		public MineableExp(string name, int exp = 100)
		{
			Name = name;
			ExpAmount = exp;
		}
	}
	public class ChoppableExp
	{
		public string Name { get; set; }

		public int ExpAmount { get; set; }

		public ChoppableExp(string name, int exp = 100)
		{
			Name = name;
			ExpAmount = exp;
		}
	}
	public class FishableExp
	{
		public string Name { get; set; }

		public int ExpAmount { get; set; }

		public FishableExp(string name, int exp = 100)
		{
			Name = name;
			ExpAmount = exp;
		}
	}
	public class GUILog
	{
		public static GameObject GUILogWindow;

		public static bool state = true;

		public static void CreateLogWindow()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)GUILogWindow) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				int value = ValheimLevelSystem.LogEntries.Value;
				GUILogWindow = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(1f, 0f), new Vector2(1f, 0f), loadLocation(), GUI.lengthScaler(250f), GUI.lengthScaler(50 + 17 * value), true);
				GameObject value2 = GUIManager.Instance.CreateText("", GUILogWindow.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), GUI.posScaler(new Vector2(0f, -25f)), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(16), GUIManager.Instance.ValheimOrange, true, Color.black, GUI.lengthScaler(200f), GUI.lengthScaler(30f), false);
				GameObject value3 = GUIManager.Instance.CreateText("", GUILogWindow.transform, new Vector2(0.65f, 0.5f), new Vector2(0.65f, 0.5f), new Vector2(-10f, -10f), GUIManager.Instance.AveriaSerif, GUI.fontScaler(13), GUIManager.Instance.ValheimBeige, true, Color.black, GUI.lengthScaler(250f), GUI.lengthScaler(17 * value), false);
				ValheimLevelSystem.menuItems.Add("LogWarning", value2);
				ValheimLevelSystem.menuItems.Add("LogEntries", value3);
				UpdateWarning();
				GUILogWindow.SetActive(true);
				state = true;
			}
		}

		public static void toggle()
		{
			state = !state;
			GUILogWindow.SetActive(state);
		}

		public static void saveLocation()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				RectTransform component = GUILogWindow.GetComponent<RectTransform>();
				Vector2 anchoredPosition = component.anchoredPosition;
				SaveManager.saveEntry("logPosition", ((object)(Vector2)(ref anchoredPosition)).ToString());
			}
			catch
			{
			}
		}

		public static Vector2 loadLocation()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			Vector2 result = GUI.posScaler(new Vector2(-130f, 200f));
			if (Player.m_localPlayer.m_knownTexts.ContainsKey("logPosition"))
			{
				SaveManager.saveEntry("logPosition", Player.m_localPlayer.m_knownTexts["logPosition"]);
				Player.m_localPlayer.m_knownTexts.Remove("logPosition");
			}
			if (SaveManager.readEntry("logPosition").Equals(""))
			{
				return result;
			}
			try
			{
				string text = SaveManager.readEntry("logPosition");
				float num = float.Parse(text.Split(new char[1] { ',' })[0].Replace("(", "").Trim());
				float num2 = float.Parse(text.Split(new char[1] { ',' })[1].Replace(")", "").Trim());
				float num3 = 0f - num;
				Resolution currentResolution = Screen.currentResolution;
				if (!(num3 > (float)((Resolution)(ref currentResolution)).width) && !(num > 0f))
				{
					currentResolution = Screen.currentResolution;
					if (!(num2 > (float)((Resolution)(ref currentResolution)).height) && !(num2 < 0f))
					{
						return new Vector2(num, num2);
					}
				}
				return result;
			}
			catch
			{
				return result;
			}
		}

		public static void UpdateWarning()
		{
			ValheimLevelSystem.menuItems.TryGetValue("LogWarning", out var value);
			if (Object.op_Implicit((Object)(object)value))
			{
				if (!Level.GetAvailablePoints().Equals("0") || !Level.GetAvailableAttributePoints().Equals("0"))
				{
					value.GetComponent<Text>().text = ValheimLevelSystem.LocGUI["You have points to spend!"];
				}
				else
				{
					value.GetComponent<Text>().text = "";
				}
				if (SaveManager.readEntry("playerMastery").Equals(""))
				{
					value.GetComponent<Text>().text = ValheimLevelSystem.LocGUI["Choose a mastery tree!"];
				}
				if (int.Parse(Level.GetLevel()) / ValheimLevelSystem.LevelsForSpecial.Value > SpecialSkillManager.getSpecialSkills().Count)
				{
					value.GetComponent<Text>().text = ValheimLevelSystem.LocGUI["Choose a special skill!"];
				}
				if (Level.GetSpecialization() == PlayerSpecialization.None)
				{
					value.GetComponent<Text>().text = ValheimLevelSystem.LocGUI["Choose a specialization!"];
				}
			}
		}

		public static void UpdateLog(string logentry, params object[] values)
		{
			logentry = ValheimLevelSystem.LocGUILogUpdate[logentry];
			if (values.Length != 0)
			{
				logentry = string.Format(logentry, values);
			}
			int value = ValheimLevelSystem.LogEntries.Value;
			string text = "";
			ValheimLevelSystem.menuItems.TryGetValue("LogEntries", out var value2);
			string[] array = value2.GetComponent<Text>().text.Split(new char[1] { '\n' });
			for (int i = Math.Max(array.Length - value, 0); i < array.Length; i++)
			{
				text = ((i != Math.Max(array.Length - value, 0)) ? (text + "\n" + array[i]) : array[i]);
			}
			if (!text.Equals(""))
			{
				text += "\n";
			}
			text += logentry;
			if (Object.op_Implicit((Object)(object)value2))
			{
				value2.GetComponent<Text>().text = text;
			}
		}
	}
	public class GUISkill
	{
		public static GameObject menu;

		public static void CreateSkillMenu()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Expected O, but got Unknown
			if (int.Parse(Level.GetLevel()) / ValheimLevelSystem.LevelsForSpecial.Value <= SpecialSkillManager.getSpecialSkills().Count)
			{
				return;
			}
			GUI.DestroyMenu();
			if (!Object.op_Implicit((Object)(object)menu) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				menu = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), GUI.lengthScaler(600f), GUI.lengthScaler(1000f), true);
				ValheimLevelSystem.Menu.SetActive(false);
				int num = 0;
				foreach (SpecialSkill specialSkill in ValheimLevelSystem.specialSkills)
				{
					GameObject val = GUIManager.Instance.CreateButton(specialSkill.displayName, menu.transform, new Vector2(0.15f, 1f), new Vector2(0.15f, 1f), GUI.posScaler(new Vector2(0f, -40f + (float)(-50 * num))), GUI.lengthScaler(140f), GUI.lengthScaler(40f));
					val.SetActive(true);
					Button component = val.GetComponent<Button>();
					GUIManager.Instance.ApplyButtonStyle(component, GUI.fontScaler(16));
					((UnityEvent)component.onClick).AddListener((UnityAction)delegate
					{
						SpecialSkillManager.SkillUp(specialSkill);
					});
					ValheimLevelSystem.menuItems.Add(specialSkill.name + specialSkill.level + "skillButton", val);
					GameObject value = GUIManager.Instance.CreateText(specialSkill.getskillDescr(), menu.transform, new Vector2(0.65f, 1f), new Vector2(0.65f, 1f), GUI.posScaler(new Vector2(0f, -78f + (float)(-50 * num))), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(12), GUIManager.Instance.ValheimBeige, true, Color.black, GUI.lengthScaler(350f), GUI.lengthScaler(110f), false);
					ValheimLevelSystem.menuItems.Add(specialSkill.name + specialSkill.level + "skillDescr", value);
					num++;
				}
				GameObject val2 = GUIManager.Instance.CreateButton("Cancel", menu.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), GUI.posScaler(new Vector2(0f, 50f)), GUI.lengthScaler(150f), GUI.lengthScaler(50f));
				val2.SetActive(true);
				Button component2 = val2.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component2, GUI.fontScaler(16));
				((UnityEvent)component2.onClick).AddListener(new UnityAction(DestroyMenu));
			}
			bool active = !ValheimLevelSystem.Menu.activeSelf;
			menu.SetActive(active);
			UpdateSkillDescr();
		}

		public static void UpdateSkillDescr()
		{
			foreach (SpecialSkill specialSkill in ValheimLevelSystem.specialSkills)
			{
				ValheimLevelSystem.menuItems.TryGetValue(specialSkill.name + specialSkill.level + "skillDescr", out var value);
				if (Object.op_Implicit((Object)(object)value))
				{
					value.GetComponent<Text>().text = specialSkill.getskillDescr();
				}
				ValheimLevelSystem.menuItems.TryGetValue(specialSkill.name + specialSkill.level + "skillButton", out var value2);
				if (Object.op_Implicit((Object)(object)value2))
				{
					if (Level.HasSpecialSkill(specialSkill.name, specialSkill.level) || (specialSkill.level > 1 && !Level.HasSpecialSkill(specialSkill.name, specialSkill.level - 1)))
					{
						value2.SetActive(false);
					}
					else
					{
						value2.SetActive(true);
					}
				}
			}
		}

		public static void DestroyMenu()
		{
			menu.SetActive(false);
		}
	}
	public class GUITrophy
	{
		public static GameObject menu;

		public static void CreateTrophyMenu()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Expected O, but got Unknown
			GUI.DestroyMenu();
			UpdateTrophyDescr();
			if (!Object.op_Implicit((Object)(object)menu) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				menu = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), GUI.lengthScaler(600f), GUI.lengthScaler(1000f), true);
				ValheimLevelSystem.Menu.SetActive(false);
				int num = 0;
				foreach (Trophy trophy in ValheimLevelSystem.trophies)
				{
					GameObject val = GUIManager.Instance.CreateButton(trophy.getLevelVerbose(), menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), GUI.posScaler(new Vector2(0f, -60f + (float)(-125 * num))), GUI.lengthScaler(220f), GUI.lengthScaler(40f));
					val.SetActive(true);
					Button component = val.GetComponent<Button>();
					GUIManager.Instance.ApplyButtonStyle(component, GUI.fontScaler(16));
					GameObject value = GUIManager.Instance.CreateText(trophy.getRequirementDescr() + "\n\n" + trophy.getEffectDescr(), menu.transform, new Vector2(0.6f, 1f), new Vector2(0.6f, 1f), GUI.posScaler(new Vector2(0f, -150f + (float)(-125 * num))), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(12), GUIManager.Instance.ValheimBeige, true, Color.black, GUI.lengthScaler(420f), GUI.lengthScaler(110f), false);
					ValheimLevelSystem.menuItems.Add(trophy.name + "trophyDescr", value);
					num++;
				}
				GameObject val2 = GUIManager.Instance.CreateButton("Cancel", menu.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), GUI.posScaler(new Vector2(0f, -450f)), GUI.lengthScaler(150f), GUI.lengthScaler(50f));
				val2.SetActive(true);
				Button component2 = val2.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component2, GUI.fontScaler(16));
				((UnityEvent)component2.onClick).AddListener(new UnityAction(DestroyMenu));
			}
			bool active = !ValheimLevelSystem.Menu.activeSelf;
			menu.SetActive(active);
		}

		public static void UpdateTrophyDescr()
		{
			foreach (Trophy trophy in ValheimLevelSystem.trophies)
			{
				ValheimLevelSystem.menuItems.TryGetValue(trophy.name + "trophyDescr", out var value);
				if (Object.op_Implicit((Object)(object)value))
				{
					value.GetComponent<Text>().text = trophy.getRequirementDescr() + "\n\n" + trophy.getEffectDescr();
				}
			}
		}

		public static void DestroyMenu()
		{
			menu.SetActive(false);
		}
	}
	public class GUIXP
	{
		public static GameObject XPBar;

		public static bool state = true;

		public static void CreateXPBar()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: 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_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)XPBar) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				XPBar = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0f, 0f), new Vector2(0f, 0f), loadLocation(), GUI.lengthScaler(450f), GUI.lengthScaler(35f), true);
				float num = (float)Level.GetExp() * 100f / (float)Level.GetMaxExpForCurrentLevel();
				if (num > 100f)
				{
					num = 100f;
				}
				if (Level.GetMaxExpForCurrentLevel() == 0)
				{
					num = 0f;
				}
				GameObject value = GUIManager.Instance.CreateText("", XPBar.transform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), GUI.posScaler(new Vector2(65f, 0f)), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, GUI.lengthScaler(100f), GUI.lengthScaler(20f), false);
				string text = "";
				for (int i = 1; i <= (int)(2f * num / 3f); i++)
				{
					text += "|";
				}
				GameObject value2 = GUIManager.Instance.CreateText(text, XPBar.transform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), GUI.posScaler(new Vector2(275f, 0f)), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(14), GUIManager.Instance.ValheimBeige, false, Color.black, GUI.lengthScaler(300f), GUI.lengthScaler(20f), false);
				GameObject value3 = GUIManager.Instance.CreateText(GetShortStance(), XPBar.transform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), GUI.posScaler(new Vector2(420f, 0f)), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(14), GUIManager.Instance.ValheimOrange, true, Color.black, GUI.lengthScaler(50f), GUI.lengthScaler(20f), false);
				ValheimLevelSystem.menuItems.Add("XPBarLvl", value);
				ValheimLevelSystem.menuItems.Add("XPBarBars", value2);
				ValheimLevelSystem.menuItems.Add("XPBarStanceInfo", value3);
				XPBar.SetActive(true);
				UpdateXPBar();
				state = true;
			}
		}

		public static void toggle()
		{
			state = !state;
			XPBar.SetActive(state);
		}

		public static void saveLocation()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				RectTransform component = XPBar.GetComponent<RectTransform>();
				Vector2 anchoredPosition = component.anchoredPosition;
				SaveManager.saveEntry("xpbarPosition", ((object)(Vector2)(ref anchoredPosition)).ToString());
			}
			catch
			{
			}
		}

		public static Vector2 loadLocation()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: 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_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			Vector2 result = GUI.posScaler(new Vector2(275f, 67.5f));
			if (Player.m_localPlayer.m_knownTexts.ContainsKey("xpbarPosition"))
			{
				SaveManager.saveEntry("xpbarPosition", Player.m_localPlayer.m_knownTexts["xpbarPosition"]);
				Player.m_localPlayer.m_knownTexts.Remove("xpbarPosition");
			}
			if (SaveManager.readEntry("xpbarPosition").Equals(""))
			{
				return result;
			}
			try
			{
				string text = SaveManager.readEntry("xpbarPosition");
				float num = float.Parse(text.Split(new char[1] { ',' })[0].Replace("(", "").Trim());
				float num2 = float.Parse(text.Split(new char[1] { ',' })[1].Replace(")", "").Trim());
				Resolution currentResolution = Screen.currentResolution;
				if (!(num > (float)((Resolution)(ref currentResolution)).width) && !(num < 0f))
				{
					currentResolution = Screen.currentResolution;
					if (!(num2 > (float)((Resolution)(ref currentResolution)).height) && !(num2 < 0f))
					{
						return new Vector2(num, num2);
					}
				}
				return result;
			}
			catch
			{
				return result;
			}
		}

		public static string GetShortStance()
		{
			switch (Level.GetSpecialization())
			{
			case PlayerSpecialization.None:
				return "";
			case PlayerSpecialization.Ritualist:
				switch (Level.GetStanceCycle())
				{
				case 1:
					return ValheimLevelSystem.LocGUI["HpReg"];
				case 2:
					return ValheimLevelSystem.LocGUI["StReg"];
				case 3:
					return ValheimLevelSystem.LocGUI["EiReg"];
				}
				break;
			case PlayerSpecialization.Torturer:
				switch (Level.GetStanceCycle())
				{
				case 1:
					return ValheimLevelSystem.LocGUI["Poison"];
				case 2:
					return ValheimLevelSystem.LocGUI["Fire"];
				case 3:
					return ValheimLevelSystem.LocGUI["Spirit"];
				}
				break;
			default:
				return (Level.GetStanceCycle() > 0) ? ValheimLevelSystem.LocGUI["On"] : ValheimLevelSystem.LocGUI["Off"];
			}
			return "";
		}

		public static void UpdateXPBar()
		{
			float num = (float)Level.GetExp() * 100f / (float)Level.GetMaxExpForCurrentLevel();
			if (num > 100f)
			{
				num = 100f;
			}
			if (Level.GetMaxExpForCurrentLevel() == 0)
			{
				num = 0f;
			}
			string text = "";
			for (int i = 1; i <= (int)(2f * num / 3f); i++)
			{
				text += "|";
			}
			ValheimLevelSystem.menuItems.TryGetValue("XPBarLvl", out var value);
			if (Object.op_Implicit((Object)(object)value))
			{
				value.GetComponent<Text>().text = string.Format(ValheimLevelSystem.LocGUI["Lvl {0}  {1}%"], Level.GetLevel(), num.ToString("0.00"));
			}
			ValheimLevelSystem.menuItems.TryGetValue("XPBarBars", out var value2);
			if (Object.op_Implicit((Object)(object)value2))
			{
				value2.GetComponent<Text>().text = text;
			}
			ValheimLevelSystem.menuItems.TryGetValue("XPBarStanceInfo", out var value3);
			if (Object.op_Implicit((Object)(object)value3))
			{
				value3.GetComponent<Text>().text = GetShortStance();
			}
		}
	}
	public class GUISpec
	{
		public static GameObject menu;

		public static void CreateSpecializationMenu()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Expected O, but got Unknown
			//IL_01a2: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			if (Level.GetSpecialization() != 0)
			{
				return;
			}
			GUI.DestroyMenu();
			UpdateSpecDescr();
			if (!Object.op_Implicit((Object)(object)menu) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				menu = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), GUI.lengthScaler(600f), GUI.lengthScaler(1000f), true);
				ValheimLevelSystem.Menu.SetActive(false);
				int num = 0;
				foreach (Specialization specialization in ValheimLevelSystem.specs)
				{
					GameObject val = GUIManager.Instance.CreateButton(specialization.displayName, menu.transform, new Vector2(0.12f, 1f), new Vector2(0.12f, 1f), GUI.posScaler(new Vector2(0f, -55f + (float)(-115 * num))), GUI.lengthScaler(100f), GUI.lengthScaler(40f));
					val.SetActive(true);
					Button component = val.GetComponent<Button>();
					GUIManager.Instance.ApplyButtonStyle(component, GUI.fontScaler(16));
					((UnityEvent)component.onClick).AddListener((UnityAction)delegate
					{
						SpecializationManager.SkillUp(specialization);
					});
					GameObject value = GUIManager.Instance.CreateText(SpecializationManager.SpecializationDescription(specialization), menu.transform, new Vector2(0.6f, 1f), new Vector2(0.6f, 1f), GUI.posScaler(new Vector2(0f, -70f + (float)(-115 * num))), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(12), GUIManager.Instance.ValheimBeige, true, Color.black, GUI.lengthScaler(400f), GUI.lengthScaler(110f), false);
					ValheimLevelSystem.menuItems.Add(specialization.name + "specDescr", value);
					num++;
				}
				GameObject val2 = GUIManager.Instance.CreateButton("Cancel", menu.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), GUI.posScaler(new Vector2(0f, -450f)), GUI.lengthScaler(150f), GUI.lengthScaler(50f));
				val2.SetActive(true);
				Button component2 = val2.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component2, GUI.fontScaler(16));
				((UnityEvent)component2.onClick).AddListener(new UnityAction(DestroyMenu));
			}
			bool active = !ValheimLevelSystem.Menu.activeSelf;
			menu.SetActive(active);
		}

		public static void UpdateSpecDescr()
		{
			foreach (Specialization spec in ValheimLevelSystem.specs)
			{
				ValheimLevelSystem.menuItems.TryGetValue(spec.name + "specDescr", out var value);
				if (Object.op_Implicit((Object)(object)value))
				{
					value.GetComponent<Text>().text = SpecializationManager.SpecializationDescription(spec);
				}
			}
		}

		public static void DestroyMenu()
		{
			menu.SetActive(false);
		}
	}
	public class GUIConfirm
	{
		public static GameObject menu;

		public static void CreateResetSkillMenu()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Expected O, but got Unknown
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Expected O, but got Unknown
			GUI.DestroyMenu();
			if (!Object.op_Implicit((Object)(object)menu) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				menu = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), GUI.lengthScaler(300f), GUI.lengthScaler(220f), true);
				ValheimLevelSystem.Menu.SetActive(false);
				GameObject val = GUIManager.Instance.CreateText(ValheimLevelSystem.LocGUI["Reset Points?"], menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), GUI.posScaler(new Vector2(0f, -60f)), GUIManager.Instance.AveriaSerifBold, GUI.fontScaler(25), GUIManager.Instance.ValheimOrange, true, Color.black, GUI.lengthScaler(180f), GUI.lengthScaler(40f), false);
				GameObject val2 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocGUI["Yes"], menu.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), GUI.posScaler(new Vector2(70f, -30f)), GUI.lengthScaler(100f), GUI.lengthScaler(50f));
				val2.SetActive(true);
				Button component = val2.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component, GUI.fontScaler(16));
				((UnityEvent)component.onClick).AddListener(new UnityAction(Reset.ResetSkills));
				GameObject val3 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocGUI["No"], menu.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), GUI.posScaler(new Vector2(-70f, -30f)), GUI.lengthScaler(100f), GUI.lengthScaler(50f));
				val3.SetActive(true);
				Button component2 = val3.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component2, GUI.fontScaler(16));
				((UnityEvent)component2.onClick).AddListener(new UnityAction(DestroyMenu));
			}
			bool active = !ValheimLevelSystem.Menu.activeSelf;
			menu.SetActive(active);
		}

		public static void DestroyMenu()
		{
			menu.SetActive(false);
		}
	}
	public class SaveManager
	{
		private static char separator = '|';

		private static List<string> blockSequence = new List<string>();

		public static void Init()
		{
			blockSequence.Clear();
			blockSequence.Add("playerLevel");
			blockSequence.Add("playerExp");
			blockSequence.Add("playerAvailablePoints");
			blockSequence.Add("playerAvailableAttributePoints");
			blockSequence.Add("playerSpecialization");
			blockSequence.Add("playerHighestBoss");
			blockSequence.Add("playerAttributeHealth");
			blockSequence.Add("playerAttributeStamina");
			blockSequence.Add("playerAttributeEitr");
			blockSequence.Add("playerMastery");
			blockSequence.Add("playerSpecial");
			blockSequence.Add("StanceCycle");
			blockSequence.Add("logPosition");
			blockSequence.Add("xpbarPosition");
			foreach (Stat stat in ValheimLevelSystem.stats)
			{
				blockSequence.Add(stat.name);
			}
			foreach (Trophy trophy in ValheimLevelSystem.trophies)
			{
				blockSequence.Add(trophy.name);
			}
		}

		private static string ReadSave()
		{
			if (!Player.m_localPlayer.m_knownTexts.ContainsKey("VLS-Savedata"))
			{
				Player.m_localPlayer.m_knownTexts["VLS-Savedata"] = new string('|', blockSequence.Count - 1);
			}
			string text = Player.m_localPlayer.m_knownTexts["VLS-Savedata"];
			if (text.Split(new char[1] { separator }).Count() >= blockSequence.Count)
			{
				return text;
			}
			string text2 = text + new string('|', blockSequence.Count - text.Split(new char[1] { separator }).Count());
			Player.m_localPlayer.m_knownTexts["VLS-Savedata"] = text2;
			return text2;
		}

		public static void saveEntry(string name, string value)
		{
			string text = ReadSave();
			string[] array = text.Split(new char[1] { separator });
			array[blockSequence.FindIndex((string x) => x.Equals(name))] = value;
			Player.m_localPlayer.m_knownTexts["VLS-Savedata"] = string.Join("|", array);
		}

		public static string readEntry(string name)
		{
			string text = ReadSave();
			return text.Split(new char[1] { separator })[blockSequence.FindIndex((string x) => x.Equals(name))];
		}
	}
	public class Level
	{
		public static float StanceCD;

		public static List<LevelRequirement> LevelRequirementList { get; set; }

		public static void ToggleStance()
		{
			if (GetSpecialization() == PlayerSpecialization.None || StanceCD > 0f)
			{
				return;
			}
			if (GetSpecialization() == PlayerSpecialization.Ritualist || GetSpecialization() == PlayerSpecialization.Torturer)
			{
				SetStanceCycle(GetStanceCycle() % 3 + 1);
			}
			else
			{
				SetStanceCycle((GetStanceCycle() + 1) % 2);
			}
			StanceCD = ValheimLevelSystem.StanceCD.Value;
			Specialization specializationByName = ValheimLevelSystem.getSpecializationByName(GetSpecializationStr());
			string text = specializationByName.stanceName;
			if (specializationByName.name == "Ritualist")
			{
				text += " - ";
				StanceCD *= 0.25f;
				switch (GetStanceCycle())
				{
				case 1:
					text += ValheimLevelSystem.LocAttrs["Health"];
					break;
				case 2:
					text += ValheimLevelSystem.LocAttrs["Stamina"];
					break;
				case 3:
					text += ValheimLevelSystem.LocAttrs["Eitr"];
					break;
				}
			}
			if (specializationByName.name == "Torturer")
			{
				text += " - ";
				StanceCD *= 0.25f;
				switch (GetStanceCycle())
				{
				case 1:
					text += ValheimLevelSystem.LocGUI["Poison"];
					break;
				case 2:
					text += ValheimLevelSystem.LocGUI["Fire"];
					break;
				case 3:
					text += ValheimLevelSystem.LocGUI["Spirit"];
					break;
				}
			}
			GUILog.UpdateLog("{0} - {1}.", text, (GetStanceCycle() > 0) ? ValheimLevelSystem.LocGUI["On"] : ValheimLevelSystem.LocGUI["Off"]);
			GUIXP.UpdateXPBar();
		}

		public static void InitLevelRequirementList()
		{
			LevelRequirementList = new List<LevelRequirement>();
			int value = ValheimLevelSystem.BaseExpPerLevel.Value;
			float value2 = ValheimLevelSystem.ExpMultiplierPerLevel.Value;
			for (int i = 0; i <= ValheimLevelSystem.MaxLevel.Value; i++)
			{
				LevelRequirement levelRequirement = new LevelRequirement
				{
					Level = i
				};
				if (i == 0)
				{
					levelRequirement.ExpAmount = value;
					LevelRequirementList.Add(levelRequirement);
				}
				else
				{
					long expAmount = LevelRequirementList.Last().ExpAmount;
					levelRequirement.ExpAmount = (long)Math.Round((float)(expAmount + value) * value2);
					LevelRequirementList.Add(levelRequirement);
				}
			}
		}

		public static void RaiseExpWithValues(int expAmount)
		{
			if (ValheimLevelSystem.EnableTrophies.Value)
			{
				ValheimLevelSystem.getTrophyByName("Warrior").updateProgress(1);
				expAmount += (int)Math.Floor((float)expAmount * ValheimLevelSystem.getTrophyByName("Warrior").getEffect());
			}
			if (GetSpecialization() != PlayerSpecialization.Worker)
			{
				AddExp(expAmount);
			}
		}

		public static void RaiseExpWork(int expToGive)
		{
			if (ValheimLevelSystem.EnableTrophies.Value)
			{
				ValheimLevelSystem.getTrophyByName("Laborer").updateProgress(1);
				expToGive += (int)Math.Floor((float)expToGive * ValheimLevelSystem.getTrophyByName("Laborer").getEffect());
			}
			float num = expToGive;
			num *= ValheimLevelSystem.ExpRateWork.Value;
			if (GetSpecialization() == PlayerSpecialization.Worker)
			{
				num *= ValheimLevelSystem.getSpecializationByName("Worker").getPassiveEffect("XPMult");
			}
			AddExp(Convert.ToInt32(num));
		}

		public static void RaiseExpBase(int expToGive)
		{
			if (ValheimLevelSystem.EnableTrophies.Value)
			{
				expToGive += (int)Math.Floor((float)expToGive * ValheimLevelSystem.getTrophyByName("Laborer").getEffect());
			}
			float num = expToGive;
			if (GetSpecialization() == PlayerSpecialization.Worker)
			{
				num *= ValheimLevelSystem.getSpecializationByName("Worker").getPassiveEffect("XPMult");
			}
			AddExp(Convert.ToInt32(num));
		}

		public static void AddExp(long exp)
		{
			int currentLevel = Convert.ToInt32(GetLevel());
			long exp2 = GetExp();
			if (currentLevel >= ValheimLevelSystem.MaxLevel.Value)
			{
				return;
			}
			long num = exp + exp2;
			LevelRequirement levelRequirement = LevelRequirementList.FirstOrDefault((LevelRequirement x) => x.Level == currentLevel);
			if (levelRequirement == null)
			{
				return;
			}
			if (num >= levelRequirement.ExpAmount)
			{
				GUILog.UpdateLog("You gained {0} XP.", levelRequirement.ExpAmount - exp2);
				PlayerLevelUp(currentLevel);
				AddExp(num - levelRequirement.ExpAmount);
			}
			else
			{
				if (exp > 0)
				{
					GUILog.UpdateLog("You gained {0} XP.", exp);
				}
				else
				{
					GUILog.UpdateLog("You lost {0} XP.", -exp);
				}
				SaveManager.saveEntry("playerExp", num.ToString());
			}
			GUI.UpdateExpText();
			GUIXP.UpdateXPBar();
		}

		public static void RemoveExpOnDeath()
		{
			if (ValheimLevelSystem.ExpPercentageToLoseOnDeath.Value > 0f)
			{
				long exp = GetExp();
				long maxExpForCurrentLevel = GetMaxExpForCurrentLevel();
				float value = ValheimLevelSystem.ExpPercentageToLoseOnDeath.Value;
				long num = (long)((float)(maxExpForCurrentLevel / 100) * value);
				if (num > exp)
				{
					num = exp;
				}
				AddExp(num * -1);
			}
		}

		private static void PlayerLevelUp(int currentLevel)
		{
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			SaveManager.saveEntry("playerExp", "0");
			SaveManager.saveEntry("playerLevel", (currentLevel + 1).ToString());
			AddPoints(ValheimLevelSystem.PointsPerLevel.Value);
			AddAttributePoints(ValheimLevelSystem.AttributePointsPerLevel.Value);
			((Character)Player.m_localPlayer).Message((MessageType)2, "Level: " + (currentLevel + 1), 0, (Sprite)null);
			GUI.UpdatePlayerLevelText();
			GUILog.UpdateWarning();
			GUILog.UpdateLog("Reached level {0}!", currentLevel + 1);
			Player.m_localPlayer.m_skillLevelupEffects.Create(((Character)Player.m_localPlayer).m_head.position, ((Character)Player.m_localPlayer).m_head.rotation, ((Character)Player.m_localPlayer).m_head, 1f, -1);
		}

		public static long GetMaxExpForCurrentLevel()
		{
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).InCutscene() || ((Character)localPlayer).IsTeleporting())
			{
				return 0L;
			}
			return LevelRequirementList.FirstOrDefault((LevelRequirement x) => x.Level == long.Parse(GetLevel()))?.ExpAmount ?? 0;
		}

		public static int GetStatLevel(string name)
		{
			string text = SaveManager.readEntry(name);
			return (!text.Equals("")) ? Convert.ToInt32(text) : 0;
		}

		public static string GetLevel()
		{
			if (SaveManager.readEntry("playerLevel").Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("playerLevel"))
				{
					SaveManager.saveEntry("playerLevel", Player.m_localPlayer.m_knownTexts["playerLevel"]);
					Player.m_localPlayer.m_knownTexts.Remove("playerLevel");
				}
				else
				{
					SaveManager.saveEntry("playerLevel", "0");
				}
			}
			return SaveManager.readEntry("playerLevel");
		}

		public static void SetStanceCycle(int cycle)
		{
			SaveManager.saveEntry("StanceCycle", cycle.ToString());
		}

		public static int GetStanceCycle()
		{
			if (SaveManager.readEntry("StanceCycle").Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("StanceCycle"))
				{
					SaveManager.saveEntry("StanceCycle", Player.m_localPlayer.m_knownTexts["StanceCycle"]);
					Player.m_localPlayer.m_knownTexts.Remove("StanceCycle");
				}
				else
				{
					SaveManager.saveEntry("StanceCycle", "0");
				}
			}
			return int.Parse(SaveManager.readEntry("StanceCycle"));
		}

		public static void SetLevelMax()
		{
			SaveManager.saveEntry("playerLevel", ValheimLevelSystem.MaxLevel.Value.ToString());
			ResetExp();
		}

		public static long GetExp()
		{
			if (SaveManager.readEntry("playerExp").Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("playerExp"))
				{
					SaveManager.saveEntry("playerExp", Player.m_localPlayer.m_knownTexts["playerExp"]);
					Player.m_localPlayer.m_knownTexts.Remove("playerExp");
				}
				else
				{
					SaveManager.saveEntry("playerExp", "0");
				}
			}
			return long.Parse(SaveManager.readEntry("playerExp"));
		}

		public static void ResetExp()
		{
			SaveManager.saveEntry("playerExp", "0");
		}

		public static string GetExpVerbose()
		{
			return GetPowerRepr(GetExp()) + " / " + GetPowerRepr(GetMaxExpForCurrentLevel());
		}

		private static string GetPowerRepr(long number)
		{
			if (number <= 0)
			{
				return "0";
			}
			double num = Math.Log10(number);
			string text = "";
			string text2 = number.ToString();
			string[] array = ValheimLevelSystem.LocGUI["K,M,B,T,Qa,Qi"].Split(new char[1] { ',' });
			int num2 = 3;
			string[] array2 = array;
			foreach (string text3 in array2)
			{
				if (num >= (double)num2)
				{
					text = text3;
					text2 = GetThreeDigits(Math.Round((double)number / Math.Pow(10.0, num2), 2));
					num2 += 3;
				}
			}
			return text2 + text;
		}

		private static string GetThreeDigits(double number)
		{
			string text = "";
			string text2 = number.ToString();
			int num = 0;
			string text3 = text2;
			for (int i = 0; i < text3.Length; i++)
			{
				char c = text3[i];
				if (num == 3)
				{
					break;
				}
				text += c;
				if (c != '.')
				{
					num++;
				}
			}
			return text;
		}

		public static string GetAvailablePoints()
		{
			if (SaveManager.readEntry("playerAvailablePoints").Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("playerAvailablePoints"))
				{
					SaveManager.saveEntry("playerAvailablePoints", Player.m_localPlayer.m_knownTexts["playerAvailablePoints"]);
					Player.m_localPlayer.m_knownTexts.Remove("playerAvailablePoints");
				}
				else
				{
					SaveManager.saveEntry("playerAvailablePoints", ValheimLevelSystem.StartingPoints.Value.ToString());
				}
			}
			return SaveManager.readEntry("playerAvailablePoints");
		}

		public static string GetAvailableAttributePoints()
		{
			if (SaveManager.readEntry("playerAvailableAttributePoints").Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("playerAvailableAttributePoints"))
				{
					SaveManager.saveEntry("playerAvailableAttributePoints", Player.m_localPlayer.m_knownTexts["playerAvailableAttributePoints"]);
					Player.m_localPlayer.m_knownTexts.Remove("playerAvailableAttributePoints");
				}
				else
				{
					SaveManager.saveEntry("playerAvailableAttributePoints", "0");
				}
			}
			return SaveManager.readEntry("playerAvailableAttributePoints");
		}

		public static PlayerSpecialization GetSpecialization()
		{
			if (SaveManager.readEntry("playerSpecialization").Equals(""))
			{
				if (!Player.m_localPlayer.m_knownTexts.ContainsKey("playerSpecialization"))
				{
					SaveManager.saveEntry("playerSpecialization", "None");
					return PlayerSpecialization.None;
				}
				SaveManager.saveEntry("playerSpecialization", Player.m_localPlayer.m_knownTexts["playerSpecialization"]);
				Player.m_localPlayer.m_knownTexts.Remove("playerSpecialization");
			}
			return SaveManager.readEntry("playerSpecialization") switch
			{
				"Protector" => PlayerSpecialization.Protector, 
				"Ritualist" => PlayerSpecialization.Ritualist, 
				"Runeblade" => PlayerSpecialization.Runeblade, 
				"Berserker" => PlayerSpecialization.Berserker, 
				"Torturer" => PlayerSpecialization.Torturer, 
				"Worker" => PlayerSpecialization.Worker, 
				"Slugger" => PlayerSpecialization.Slugger, 
				"Infused" => PlayerSpecialization.Infused, 
				_ => PlayerSpecialization.None, 
			};
		}

		public static string GetSpecializationStr()
		{
			return GetSpecialization().ToString();
		}

		public static string GetAttributeTotal(PlayerAttribute playerAttribute)
		{
			int attributeLevel = GetAttributeLevel(playerAttribute);
			return playerAttribute switch
			{
				PlayerAttribute.Health => (attributeLevel + 25).ToString(), 
				PlayerAttribute.Stamina => (attributeLevel + 50).ToString(), 
				PlayerAttribute.Eitr => (attributeLevel + 20).ToString(), 
				_ => "0", 
			};
		}

		public static string GetHighestBossKill()
		{
			if (SaveManager.readEntry("playerHighestBoss").Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("playerHighestBoss"))
				{
					SaveManager.saveEntry("playerHighestBoss", Player.m_localPlayer.m_knownTexts["playerHighestBoss"]);
					Player.m_localPlayer.m_knownTexts.Remove("playerHighestBoss");
				}
				else
				{
					SaveManager.saveEntry("playerHighestBoss", "0");
				}
			}
			return SaveManager.readEntry("playerHighestBoss");
		}

		public static void AddPoints(int points)
		{
			int num = Convert.ToInt32(GetAvailablePoints());
			SaveManager.saveEntry("playerAvailablePoints", (num + points).ToString());
			GUI.UpdatePlayerPointsAvailable();
		}

		public static void AddAttributePoints(int points)
		{
			int num = Convert.ToInt32(GetAvailableAttributePoints());
			SaveManager.saveEntry("playerAvailableAttributePoints", (num + points).ToString());
			GUI.UpdatePlayerAttributePointsAvailable();
		}

		public static void IncreaseHighestBossKill(int boss_lvl)
		{
			int num = boss_lvl - Convert.ToInt32(GetHighestBossKill());
			if (num > 0)
			{
				SaveManager.saveEntry("playerAvailableAttributePoints", (Convert.ToInt32(GetAvailableAttributePoints()) + ValheimLevelSystem.PointsPerBoss.Value * num).ToString());
				SaveManager.saveEntry("playerHighestBoss", boss_lvl.ToString());
				GUI.UpdatePlayerAttributePointsAvailable();
				GUILog.UpdateWarning();
				GUILog.UpdateLog("You gained {0} attribute points!", ValheimLevelSystem.PointsPerBoss.Value * num);
			}
		}

		public static void RemovePoints(int points)
		{
			int num = Convert.ToInt32(GetAvailablePoints());
			SaveManager.saveEntry("playerAvailablePoints", (num - points).ToString());
			GUI.UpdatePlayerPointsAvailable();
		}

		public static void RemoveAttributePoints(int points)
		{
			int num = Convert.ToInt32(GetAvailableAttributePoints());
			SaveManager.saveEntry("playerAvailableAttributePoints", (num - points).ToString());
			GUI.UpdatePlayerAttributePointsAvailable();
		}

		public static int GetSkillLevel(Skill skill)
		{
			if (!ValheimLevelSystem.listInitiliazed)
			{
				return 0;
			}
			if (Player.m_localPlayer.m_knownTexts.TryGetValue("player" + skill, out var value))
			{
				return Convert.ToInt32(value);
			}
			Debug.Log((object)("Unable to find player" + skill));
			StackTrace stackTrace = new StackTrace();
			Debug.Log((object)stackTrace);
			Player.m_localPlayer.m_knownTexts.Add("player" + skill, "0");
			return Convert.ToInt32(Player.m_localPlayer.m_knownTexts["player" + skill]);
		}

		public static int GetAttributeLevel(PlayerAttribute attribute)
		{
			if (!ValheimLevelSystem.listInitiliazed)
			{
				return 0;
			}
			if (SaveManager.readEntry("playerAttribute" + attribute).Equals(""))
			{
				if (Player.m_localPlayer.m_knownTexts.ContainsKey("playerAttribute" + attribute))
				{
					SaveManager.saveEntry("playerAttribute" + attribute, Player.m_localPlayer.m_knownTexts["playerAttribute" + attribute]);
					Player.m_localPlayer.m_knownTexts.Remove("playerAttribute" + attribute);
				}
				else
				{
					SaveManager.saveEntry("playerAttribute" + attribute, "0");
				}
			}
			return Convert.ToInt32(SaveManager.readEntry("playerAttribute" + attribute));
		}

		public static bool HasMastery(Skill skill)
		{
			return SaveManager.readEntry("playerMastery").Contains(skill.ToString());
		}

		public static bool HasSpecialSkill(string name, int level)
		{
			return SaveManager.readEntry("playerSpecial").Contains(name + ":" + level);
		}
	}
	public class LevelRequirement
	{
		public int Level { get; set; }

		public long ExpAmount { get; set; }
	}
	internal class GUI
	{
		public static float scale = ValheimLevelSystem.UIScale.Value;

		public static int fontScaler(int fontsize)
		{
			return (int)Math.Round((float)fontsize * scale);
		}

		public static Vector2 posScaler(Vector2 pos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			return new Vector2((float)Math.Round(pos.x * scale), (float)Math.Round(pos.y * scale));
		}

		public static float lengthScaler(float length)
		{
			return (float)Math.Round(length * scale);
		}

		public static void ToggleMenu()
		{
			if (!Object.op_Implicit((Object)(object)ValheimLevelSystem.Menu) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				if (GUIManager.Instance == null)
				{
					Debug.LogError((object)"GUIManager instance is null");
					return;
				}
				if (!Object.op_Implicit((Object)(object)GUIManager.CustomGUIFront))
				{
					Debug.LogError((object)"GUIManager CustomGUI is null");
					return;
				}
				LoadMenu();
				if (ValheimLevelSystem.listInitiliazed)
				{
					UpdateAll();
				}
			}
			ResetIfIncompatible();
			if (ValheimLevelSystem.listInitiliazed)
			{
				UpdateAll();
			}
			bool active = !ValheimLevelSystem.Menu.activeSelf;
			ValheimLevelSystem.Menu.SetActive(active);
		}

		public static void DestroyMenu()
		{
			ValheimLevelSystem.Menu.SetActive(false);
		}

		public static void LoadMenu()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: 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_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0421: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0441: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Expected O, but got Unknown
			//IL_078a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0834: Unknown result type (might be due to invalid IL or missing references)
			//IL_0843: Unknown result type (might be due to invalid IL or missing references)
			//IL_0852: Unknown result type (might be due to invalid IL or missing references)
			//IL_0857: Unknown result type (might be due to invalid IL or missing references)
			//IL_0872: Unknown result type (might be due to invalid IL or missing references)
			//IL_0878: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Unknown result type (might be due to invalid IL or missing references)
			//IL_0917: Unknown result type (might be due to invalid IL or missing references)
			//IL_0956: Unknown result type (might be due to invalid IL or missing references)
			//IL_0965: Unknown result type (might be due to invalid IL or missing references)
			//IL_0974: Unknown result type (might be due to invalid IL or missing references)
			//IL_0979: Unknown result type (might be due to invalid IL or missing references)
			//IL_0994: Unknown result type (might be due to invalid IL or missing references)
			//IL_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a78: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a87: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b17: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b98: Expected O, but got Unknown
			//IL_0bc1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c42: Expected O, but got Unknown
			//IL_0c68: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ceb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d29: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0db5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e09: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e13: Expected O, but got Unknown
			//IL_0e62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e85: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ee3: Expected O, but got Unknown
			//IL_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f6: Expected O, but got Unknown
			//IL_0f35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f64: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fb6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fdb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ff6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ffc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1051: Unknown result type (might be due to invalid IL or missing references)
			//IL_105b: Expected O, but got Unknown
			if ((Object)(object)Player.m_localPlayer == (Object)null)
			{
				return;
			}
			ValheimLevelSystem.Menu = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, 0f), lengthScaler(1350f), lengthScaler(800f), true);
			ValheimLevelSystem.Menu.SetActive(false);
			GUIManager instance = GUIManager.Instance;
			Transform transform = ValheimLevelSystem.Menu.transform;
			float num = lengthScaler(8f);
			ColorBlock valheimScrollbarHandleColorBlock = GUIManager.Instance.ValheimScrollbarHandleColorBlock;
			GameObject val = instance.CreateScrollView(transform, false, true, num, lengthScaler(50f), valheimScrollbarHandleColorBlock, new Color(0.1568628f, 0.1019608f, 0.0627451f, 1f), lengthScaler(280f), lengthScaler(500f));
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchoredPosition = posScaler(new Vector2(-510f, -105f));
			val.SetActive(true);
			((Component)val.transform.Find("Scroll View")).GetComponent<ScrollRect>().verticalNormalizedPosition = 1f;
			GameObject value = GUIManager.Instance.CreateText(Player.m_localPlayer.GetPlayerName(), ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(550f, -50f)), GUIManager.Instance.AveriaSerifBold, fontScaler(25), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(150f), lengthScaler(40f), false);
			GameObject value2 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(120f, -50f)), GUIManager.Instance.AveriaSerifBold, fontScaler(25), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(150f), lengthScaler(40f), false);
			ValheimLevelSystem.menuItems.Add("levelText", value2);
			ValheimLevelSystem.menuItems.Add("nameText", value);
			int num2 = 0;
			foreach (PlayerAttribute playerAttribute in Enum.GetValues(typeof(PlayerAttribute)).Cast<PlayerAttribute>().ToList())
			{
				int attributeLevel = Level.GetAttributeLevel(playerAttribute);
				GameObject val3 = GUIManager.Instance.CreateText(ValheimLevelSystem.LocAttrs[playerAttribute.ToString()], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(100f, -155f + (float)(-28 * num2))), GUIManager.Instance.AveriaSerifBold, fontScaler(18), GUIManager.Instance.ValheimBeige, true, Color.black, lengthScaler(150f), lengthScaler(25f), false);
				GameObject val4 = GUIManager.Instance.CreateButton(" + ", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(210f, -153f + (float)(-28 * num2))), lengthScaler(30f), lengthScaler(25f));
				val4.SetActive(true);
				Button component = val4.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component, fontScaler(16));
				((UnityEvent)component.onClick).AddListener((UnityAction)delegate
				{
					AttributeManager.SkillUp(playerAttribute);
				});
				GameObject value3 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(175f, -155f + (float)(-28 * num2++))), GUIManager.Instance.AveriaSerifBold, fontScaler(18), GUIManager.Instance.ValheimBeige, true, Color.black, lengthScaler(40f), lengthScaler(25f), false);
				ValheimLevelSystem.menuItems.Add(playerAttribute.ToString() + "Text", value3);
				ValheimLevelSystem.menuItems.Add(playerAttribute.ToString() + "Button", val4);
			}
			int num3 = 0;
			num2 = 0;
			foreach (Skill skill in Enum.GetValues(typeof(Skill)).Cast<Skill>().ToList())
			{
				GameObject val5 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocSkills[skill.ToString()], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(390f + 140f * (float)num3, -150f)), lengthScaler(140f), lengthScaler(30f));
				val5.SetActive(true);
				Button component2 = val5.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component2, fontScaler(16));
				((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
				{
					SkillManager.pickMastery(skill);
				});
				num2 = 0;
				foreach (Stat stat in ValheimLevelSystem.stats)
				{
					if (stat.skill == skill)
					{
						GameObject val6 = GUIManager.Instance.CreateButton("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(390f + 140f * (float)num3, -205f + (float)(-75 * num2))), lengthScaler(140f), lengthScaler(75f));
						val6.SetActive(true);
						Button component3 = val6.GetComponent<Button>();
						GUIManager.Instance.ApplyButtonStyle(component3, fontScaler(16));
						((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
						{
							StatManager.SkillUp(stat);
						});
						ValheimLevelSystem.menuItems.Add(stat.name + "Text", val6);
						num2++;
					}
				}
				num3++;
			}
			GameObject val7 = GUIManager.Instance.CreateText(ValheimLevelSystem.LocGUI["Available Effects"], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(100f, -250f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(150f), lengthScaler(20f), false);
			CreateAvailableEffectListText(val);
			((Component)val.transform.Find("Scroll View")).GetComponent<ScrollRect>().verticalNormalizedPosition = 1f;
			GameObject value4 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(120f, -85f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(150f), lengthScaler(40f), false);
			ValheimLevelSystem.menuItems.Add("ExpText", value4);
			GameObject val8 = GUIManager.Instance.CreateText(ValheimLevelSystem.LocGUI["Stat Points:"], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(100f, -115f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(150f), lengthScaler(40f), false);
			GameObject value5 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(200f, -115f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(50f), lengthScaler(40f), false);
			ValheimLevelSystem.menuItems.Add("PlayerPointsAvailableText", value5);
			GameObject val9 = GUIManager.Instance.CreateText(ValheimLevelSystem.LocGUI["Attribute Points:"], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(100f, -135f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(150f), lengthScaler(40f), false);
			GameObject value6 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(200f, -135f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimOrange, true, Color.black, lengthScaler(50f), lengthScaler(40f), false);
			ValheimLevelSystem.menuItems.Add("PlayerAttributePointsAvailableText", value6);
			GameObject val10 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocGUI["Reset"], ValheimLevelSystem.Menu.transform, new Vector2(1f, 1f), new Vector2(1f, 1f), posScaler(new Vector2(-90f, -45f)), lengthScaler(80f), lengthScaler(30f));
			val10.SetActive(true);
			Button component4 = val10.GetComponent<Button>();
			GUIManager.Instance.ApplyButtonStyle(component4, fontScaler(16));
			((UnityEvent)component4.onClick).AddListener(new UnityAction(GUIConfirm.CreateResetSkillMenu));
			GameObject val11 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocGUI["Close"], ValheimLevelSystem.Menu.transform, new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), posScaler(new Vector2(0f, 50f)), lengthScaler(170f), lengthScaler(45f));
			val11.SetActive(true);
			Button component5 = val11.GetComponent<Button>();
			GUIManager.Instance.ApplyButtonStyle(component5, fontScaler(16));
			((UnityEvent)component5.onClick).AddListener(new UnityAction(DestroyMenu));
			string specializationStr = Level.GetSpecializationStr();
			GameObject value7 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), posScaler(new Vector2(135f, -85f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimBeige, true, Color.black, lengthScaler(950f), lengthScaler(20f), false);
			GameObject value8 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), posScaler(new Vector2(135f, -105f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimBeige, true, Color.black, lengthScaler(950f), lengthScaler(20f), false);
			ValheimLevelSystem.menuItems.Add("specPassive", value7);
			ValheimLevelSystem.menuItems.Add("specStance", value8);
			GameObject val12 = GUIManager.Instance.CreateButton("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(390f, -45f)), lengthScaler(140f), lengthScaler(30f));
			val10.SetActive(true);
			Button component6 = val12.GetComponent<Button>();
			GUIManager.Instance.ApplyButtonStyle(component6, fontScaler(16));
			((UnityEvent)component6.onClick).AddListener(new UnityAction(GUISpec.CreateSpecializationMenu));
			ValheimLevelSystem.menuItems.Add("specButton", val12);
			if (ValheimLevelSystem.EnableTrophies.Value)
			{
				GameObject val13 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocGUI["Trophies"], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(1000f, -45f)), lengthScaler(140f), lengthScaler(30f));
				val13.SetActive(true);
				Button component7 = val13.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component7, fontScaler(16));
				((UnityEvent)component7.onClick).AddListener(new UnityAction(GUITrophy.CreateTrophyMenu));
			}
			int num4 = Math.Min(ValheimLevelSystem.MaxLevel.Value / ValheimLevelSystem.LevelsForSpecial.Value, ValheimLevelSystem.MaxSpecials.Value);
			int num5 = 0;
			for (int i = 0; i < num4; i++)
			{
				GameObject val14 = GUIManager.Instance.CreateButton("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(390f, -205f - ((float)(75 * num2) + (float)num5 * 50f))), lengthScaler(140f), lengthScaler(40f));
				GameObject value9 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), posScaler(new Vector2(235f, -213f - ((float)(75 * num2) + (float)num5 * 50f))), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimBeige, true, Color.black, lengthScaler(850f), lengthScaler(40f), false);
				val14.SetActive(true);
				Button component8 = val14.GetComponent<Button>();
				GUIManager.Instance.ApplyButtonStyle(component8, fontScaler(16));
				((UnityEvent)component8.onClick).AddListener(new UnityAction(GUISkill.CreateSkillMenu));
				ValheimLevelSystem.menuItems.Add("Skill" + i + "Button", val14);
				ValheimLevelSystem.menuItems.Add("Skill" + i + "Text", value9);
				num5++;
			}
		}

		private static void CreateAvailableEffectListText(GameObject scrollView)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			GameObject value = GUIManager.Instance.CreateText("", scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0f, 1f), new Vector2(0f, 1f), posScaler(new Vector2(-300f, -120f)), GUIManager.Instance.AveriaSerifBold, fontScaler(15), GUIManager.Instance.ValheimBeige, true, Color.black, lengthScaler(250f), lengthScaler(500f), false);
			ValheimLevelSystem.menuItems.Add("availableEffectsListText", value);
			SetAvailableEffectListText();
		}

		private static void ResetIfIncompatible()
		{
			int attributeLevel = Level.GetAttributeLevel(PlayerAttribute.Health);
			int attributeLevel2 = Level.GetAttributeLevel(PlayerAttribute.Stamina);
			int attributeLevel3 = Level.GetAttributeLevel(PlayerAttribute.Eitr);
			int num = ValheimLevelSystem.stats.Sum((Stat item) => Level.GetStatLevel(item.name));
			int num2 = attributeLevel + attributeLevel2 + attributeLevel3;
			int num3 = Convert.ToInt32(Level.GetAvailablePoints());
			int num4 = Convert.ToInt32(Level.GetAvailableAttributePoints());
			int num5 = Convert.ToInt32(Level.GetLevel());
			int num6 = (int)ValheimLevelSystem.getStatByName("AttrPoints").getEffect();
			int specializationAttribute = SpecializationManager.getSpecializationAttribute(Level.GetSpecialization(), PlayerAttribute.Health);
			specializationAttribute += SpecializationManager.getSpecializationAttribute(Level.GetSpecialization(), PlayerAttribute.Stamina);
			specializationAttribute += SpecializationManager.getSpecializationAttribute(Level.GetSpecialization(), PlayerAttribute.Eitr);
			int value = ValheimLevelSystem.MaxLevel.Value;
			if (num5 > value)
			{
				GUILog.UpdateLog("Current level is above maximum level!");
				Level.SetLevelMax();
				Reset.ResetSkillsIgnorePenalty();
			}
			int num7 = Convert.ToInt32(Level.GetHighestBossKill()) * ValheimLevelSystem.PointsPerBoss.Value;
			if (num5 * ValheimLevelSystem.PointsPerLevel.Value + ValheimLevelSystem.StartingPoints.Value != num3 + num || num5 * ValheimLevelSystem.AttributePointsPerLevel.Value + num7 + num6 + specializationAttribute != num4 + num2)
			{
				GUILog.UpdateLog("Skill points or attribute points impossible!");
				Reset.ResetSkillsIgnorePenalty();
			}
			if (SpecialSkillManager.getSpecialSkills().Count > Math.Min(ValheimLevelSystem.MaxSpecials.Value, int.Parse(Level.GetLevel()) / ValheimLevelSystem.LevelsForSpecial.Value))
			{
				GUILog.UpdateLog("Special skill amount impossible!");
				Reset.ResetSkillsIgnorePenalty();
			}
		}

		public static void SetAvailableEffectListText()
		{
			ValheimLevelSystem.menuItems.TryGetValue("availableEffectsListText", out var value);
			if (!Object.op_Implicit((Object)(object)value))
			{
				return;
			}
			value.GetComponent<Text>().text = "";
			foreach (Stat stat in ValheimLevelSystem.stats)
			{
				if (Level.GetStatLevel(stat.name) > 0)
				{
					Text component = value.GetComponent<Text>();
					component.text += "\n";
					if (stat.constantValue != 0f)
					{
						Text component2 = value.GetComponent<Text>();
						component2.text += string.Format(stat.description, stat.is_percentage ? Math.Round(100f * stat.getEffect(), 2) : Math.Round(stat.getEffect(), 1), stat.constantValue_is_percentage ? Math.Round(100f * stat.constantValue, 2) : Math.Round(stat.constantValue, 1));
					}
					else
					{
						Text component3 = value.GetComponent<Text>();
						component3.text += string.Format(stat.description, stat.is_percentage ? Math.Round(100f * stat.getEffect(), 2) : Math.Round(stat.getEffect(), 1));
					}
				}
			}
		}

		public static void UpdateAll()
		{
			UpdatePlayerPointsAvailable();
			UpdatePlayerAttributePointsAvailable();
			UpdateStatLevels();
			UpdateAttributeLevels();
			UpdateExpText();
			UpdatePlayerLevelText();
			SetAvailableEffectListText();
			UpdatePlayerSkillText();
		}

		public static void UpdatePlayerPointsAvailable()
		{
			ValheimLevelSystem.menuItems.TryGetValue("PlayerPointsAvailableText", out var value);
			if (Object.op_Implicit((Object)(object)value))
			{
				value.GetComponent<Text>().text = Level.GetAvailablePoints();
			}
		}

		public static void UpdatePlayerAttributePointsAvailable()
		{
			ValheimLevelSystem.menuItems.TryGetValue("PlayerAttributePointsAvailableText", out var value);
			if (!Object.op_Implicit((Object)(object)value))
			{
				return;
			}
			value.GetComponent<Text>().text = Level.GetAvailableAttributePoints();
			foreach (PlayerAttribute item in Enum.GetValues(typeof(PlayerAttribute)).Cast<PlayerAttribute>().ToList())
			{
				ValheimLevelSystem.menuItems.TryGetValue(item.ToString() + "Button", out var value2);
				if (Object.op_Implicit((Object)(object)value2))
				{
					if (Level.GetAvailableAttributePoints().Equals("0"))
					{
						value2.SetActive(false);
					}
					else
					{
						value2.SetActive(true);
					}
				}
			}
		}

		public static void UpdateStatLevels()
		{
			foreach (Stat stat in ValheimLevelSystem.stats)
			{
				ValheimLevelSystem.menuItems.TryGetValue(stat.name + "Text", out var value);
				if (Object.op_Implicit((Object)(object)value))
				{
					value.GetComponentInChildren<Text>().text = stat.displayName + "\n(" + Level.GetStatLevel(stat.name) + "/" + stat.getCurrentMax() + ")";
				}
			}
		}

		public static void UpdateAttributeLevels()
		{
			foreach (PlayerAttribute value2 in Enum.GetValues(typeof(PlayerAttribute)))
			{
				string name = Enum.GetName(typeof(PlayerAttribute), value2);
				string attributeTotal = Level.GetAttributeTotal(value2);
				ValheimLevelSystem.menuItems.TryGetValue(name + "Text", out var value);
				if (Object.op_Implicit((Object)(object)value))
				{
					value.GetComponent<Text>().text = attributeTotal;
				}
			}
		}

		public static void UpdateExpText()
		{
			ValheimLevelSystem.menuItems.TryGetValue("ExpText", out var value);
			if (Object.op_Implicit((Object)(object)value))
			{
				value.GetComponent<Text>().text = string.Format(ValheimLevelSystem.LocGUI["{0}  XP"], Level.GetExpVerbose());
			}
		}

		public static void UpdatePlayerLevelText()
		{
			ValheimLevelSystem.menuItems.TryGetValue("levelText", out var value);
			if (Object.op_Implicit((Object)(object)value))
			{
				value.GetComponent<Text>().text = string.Format(ValheimLevelSystem.LocGUI["Level {0}"], Level.GetLevel());
			}
			ValheimLevelSystem.menuItems.TryGetValue("nameText", out var value2);
			value2.GetComponent<Text>().text = Player.m_localPlayer.GetPlayerName();
			string specializationStr = Level.GetSpecializationStr();
			ValheimLevelSystem.menuItems.TryGetValue("specButton", out var value3);
			value3.GetComponentInChildren<Text>().text = (specializationStr.Equals("None") ? ValheimLevelSystem.LocGUI["<Select>"] : ValheimLevelSystem.getSpecializationByName(specializationStr).displayName);
			ValheimLevelSystem.menuItems.TryGetValue("specPassive", out var value4);
			ValheimLevelSystem.menuItems.TryGetValue("specStance", out var value5);
			if (specializationStr.Equals("None"))
			{
				value4.GetComponent<Text>().text = "";
				value5.GetComponent<Text>().text = "";
			}
			else
			{
				value4.GetComponent<Text>().text = ValheimLevelSystem.getSpecializationByName(specializationStr).getPassiveDescr();
				value5.GetComponent<Text>().text = ValheimLevelSystem.getSpecializationByName(specializationStr).stanceName + " - " + ValheimLevelSystem.getSpecializationByName(specializationStr).getStanceDescr();
			}
		}

		public static void UpdatePlayerSkillText()
		{
			int num = Math.Min(ValheimLevelSystem.MaxLevel.Value / ValheimLevelSystem.LevelsForSpecial.Value, ValheimLevelSystem.MaxSpecials.Value);
			int num2 = Math.Min(int.Parse(Level.GetLevel()) / ValheimLevelSystem.LevelsForSpecial.Value, ValheimLevelSystem.MaxSpecials.Value);
			SpecialSkill[] array = SpecialSkillManager.getSpecialSkills().ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				ValheimLevelSystem.menuItems.TryGetValue("Skill" + i + "Button", out var value);
				ValheimLevelSystem.menuItems.TryGetValue("Skill" + i + "Text", out var value2);
				value2.GetComponent<Text>().text = array[i].getskillDescr();
				value.GetComponentInChildren<Text>().text = array[i].displayName;
				value.SetActive(true);
			}
			for (int j = array.Length; j < num2; j++)
			{
				ValheimLevelSystem.menuItems.TryGetValue("Skill" + j + "Button", out var value3);
				ValheimLevelSystem.menuItems.TryGetValue("Skill" + j + "Text", out var value4);
				value4.GetComponent<Text>().text = "";
				value3.GetComponentInChildren<Text>().text = ValheimLevelSystem.LocGUI["<Select>"];
				value3.SetActive(true);
			}
			for (int k = num2; k < num; k++)
			{
				ValheimLevelSystem.menuItems.TryGetValue("Skill" + k + "Button", out var value5);
				ValheimLevelSystem.menuItems.TryGetValue("Skill" + k + "Text", out var value6);
				value6.GetComponent<Text>().text = "";
				value5.SetActive(false);
			}
		}
	}
	[HarmonyPatch]
	public class RPC
	{
		[HarmonyPatch(typeof(Game), "Start")]
		[HarmonyPrefix]
		public static void Prefix()
		{
			ZRoutedRpc.instance.Register<ZPackage>("RaiseExp", (Action<long, ZPackage>)RPC_RaiseExp);
			ZRoutedRpc.instance.Register<ZPackage>("RaiseExpPick", (Action<long, ZPackage>)RPC_RaiseExpPick);
			ZRoutedRpc.instance.Register<ZPackage>("RaiseExpMine", (Action<long, ZPackage>)RPC_RaiseExpMine);
			ZRoutedRpc.instance.Register<ZPackage>("RaiseExpChop", (Action<long, ZPackage>)RPC_RaiseExpChop);
			ZRoutedRpc.instance.Register<ZPackage>("RaiseExpFish", (Action<long, ZPackage>)RPC_RaiseExpFish);
		}

		public static void RPC_RaiseExpPick(long sender, ZPackage pkg)
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			string[] array = pkg.ReadString().Split(new char[1] { ',' });
			string pickedname = array[0];
			int num = Convert.ToInt32(array[1]);
			pickedname = pickedname.Replace("(Clone)", "");
			PickableExp pickableExp = ExpTable.PickableExpList.Where((PickableExp xx) => xx.Name.ToLower() == pickedname.ToLower()).FirstOrDefault();
			if (pickableExp == null)
			{
				Debug.Log((object)("Unable to find pickable in ExpList: " + pickedname));
				return;
			}
			int expAmount = pickableExp.ExpAmount;
			if (((Object)Player.m_localPlayer).GetInstanceID() == num)
			{
				Level.RaiseExpWork(expAmount);
			}
		}

		public static void RPC_RaiseExpMine(long sender, ZPackage pkg)
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			string[] array = pkg.ReadString().Split(new char[1] { ',' });
			string minedname = array[0];
			int num = Convert.ToInt32(array[1]);
			minedname = minedname.Replace("(Clone)", "");
			MineableExp mineableExp = ExpTable.MineableExpList.Where((MineableExp xx) => xx.Name.ToLower() == minedname.ToLower()).FirstOrDefault();
			if (mineableExp == null)
			{
				if (minedname.ToLower().Contains("rock"))
				{
					mineableExp = ExpTable.MineableExpList.Where((MineableExp xx) => xx.Name.ToLower() == "rock".ToLower()).FirstOrDefault();
				}
				if (mineableExp == null)
				{
					Debug.Log((object)("Unable to find mineable in ExpList: " + minedname));
					return;
				}
			}
			int expAmount = mineableExp.ExpAmount;
			if (((Object)Player.m_localPlayer).GetInstanceID() == num)
			{
				Level.RaiseExpWork(expAmount);
			}
		}

		public static void RPC_RaiseExpChop(long sender, ZPackage pkg)
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			string[] array = pkg.ReadString().Split(new char[1] { ',' });
			string choppedname = array[0];
			int num = Convert.ToInt32(array[1]);
			choppedname = choppedname.Replace("(Clone)", "");
			ChoppableExp choppableExp = ExpTable.ChoppableExpList.Where((ChoppableExp xx) => choppedname.ToLower().Contains(xx.Name.ToLower())).FirstOrDefault();
			if (choppableExp == null)
			{
				Debug.Log((object)("Unable to find choppable in ExpList: " + choppedname));
				return;
			}
			int expAmount = choppableExp.ExpAmount;
			if (((Object)Player.m_localPlayer).GetInstanceID() == num)
			{
				Level.RaiseExpWork(expAmount);
			}
		}

		public static void RPC_RaiseExpFish(long sender, ZPackage pkg)
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			string[] array = pkg.ReadString().Split(new char[1] { ',' });
			string fishname = array[0];
			int num = Convert.ToInt32(array[1]);
			int num2 = Convert.ToInt32(array[2]);
			FishableExp fishableExp = ExpTable.FishableExpList.Where((FishableExp xx) => fishname.ToLower().Contains(xx.Name.ToLower())).FirstOrDefault();
			if (fishableExp == null)
			{
				Debug.Log((object)("Unable to find fishable in ExpList: " + fishname));
				return;
			}
			int expToGive = (int)Math.Round((float)fishableExp.ExpAmount * (1f + ValheimLevelSystem.FishingQualityMultiplier.Value * (float)(num - 1)));
			if (((Object)Player.m_localPlayer).GetInstanceID() == num2)
			{
				Level.RaiseExpBase(expToGive);
			}
		}

		public static void RPC_RaiseExp(long sender, ZPackage pkg)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Invalid comparison between Unknown and I4
			//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			string[] array = pkg.ReadString().Split(new char[1] { ',' });
			int num = Convert.ToInt32(array[0]);
			int num2 = Convert.ToInt32(array[1]);
			int num3 = Convert.ToInt32(array[2]);
			string name = array[3];
			int num4 = Convert.ToInt32(array[4]);
			bool flag = Convert.ToBoolean(array[5]);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor((float)num, (float)num2, (float)num3);
			if ((double)Vector3.Distance(val, ((Component)Player.m_localPlayer).transform.position) > (double)ValheimLevelSystem.RangeToDivideExp.Value)
			{
				return;
			}
			name = name.Replace("(Clone)", "");
			MonsterExp monsterExp = ExpTable.MonsterExpList.Where((MonsterExp xx) => xx.Name.ToLower() == name.ToLower()).FirstOrDefault();
			if (monsterExp == null)
			{
				Debug.Log((object)("Unable to find creature in ExpList: " + name));
				return;
			}
			Character component = PrefabManager.Instance.GetPrefab(name).GetComponent<Character>();
			bool flag2 = ((int)component.m_faction == 8 && !ValheimLevelSystem.NonBossFactionOverride.Value.Split(new char[1] { ',' }).Contains(monsterExp.Name)) || ValheimLevelSystem.BossFactionOverride.Value.Split(new char[1] { ',' }).Contains(monsterExp.Name);
			if (flag2)
			{
				switch (name.ToLower())
				{
				case "eikthyr":
					Level.IncreaseHighestBossKill(1);
					break;
				case "gd_king":
					Level.IncreaseHighestBossKill(2);
					break;
				case "bonemass":
					Level.IncreaseHighestBossKill(3);
					break;
				case "dragon":
					Level.IncreaseHighestBossKill(4);
					break;
				case "goblinking":
					Level.IncreaseHighestBossKill(5);
					break;
				case "seekerqueen":
					Level.IncreaseHighestBossKill(6);
					break;
				case "fader":
					Level.IncreaseHighestBossKill(7);
					break;
				}
			}
			float num5 = monsterExp.ExpAmount;
			num5 *= 1f + (float)(num4 - 1) * ValheimLevelSystem.ExpPercentageBonusPerStar.Value;
			num5 *= ValheimLevelSystem.ExpRate.Value;
			if (flag2)
			{
				num5 *= (float)ValheimLevelSystem.BossExpMultiplier.Value;
			}
			int playersInRangeXZ = Player.GetPlayersInRangeXZ(val, (float)ValheimLevelSystem.RangeToDivideExp.Value);
			int num6 = (flag ? 1 : ValheimLevelSystem.ExpToDivideWhenNotKilledByPlayer.Value);
			if ((playersInRangeXZ > 0 || num6 > 0) && !flag2)
			{
				num5 /= (float)Math.Max(playersInRangeXZ, num6);
			}
			int expAmount = Math.Max(Convert.ToInt32(num5), 1);
			Level.RaiseExpWithValues(expAmount);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Lorska.ValheimLevelSystem", "Lorska.ValheimLevelSystem", "0.9.9.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ValheimLevelSystem : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Game), "Logout")]
		public static class Logout
		{
			private static void Postfix()
			{
				hasAwake = false;
			}
		}

		[HarmonyPatch(typeof(Game), "Shutdown")]
		public static class Shutdown
		{
			private static void Prefix()
			{
				GUILog.saveLocation();
				GUIXP.saveLocation();
			}
		}

		[HarmonyPatch(typeof(Player), "OnSpawned")]
		public static class OnSpawned
		{
			private static void Postfix()
			{
				if (!hasAwake)
				{
					hasAwake = true;
					Level.InitLevelRequirementList();
					ExpTable.InitMonsterExpList();
					ExpTable.InitPickableExpList();
					ExpTable.InitMineableExpList();
					ExpTable.InitChoppableExpList();
					ExpTable.InitFishableExpList();
					GUI.LoadMenu();
					GUIXP.CreateXPBar();
					GUILog.CreateLogWindow();
				}
			}
		}

		public const string PluginGUID = "Lorska.ValheimLevelSystem";

		public const string Name = "ValheimLevelSystem";

		public const string Version