Decompiled source of Valheim Level System by Lorska v0.98.1
BepInEx/plugins/ValheimLevelSystem.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; 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: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: CompilationRelaxations(8)] [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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0112: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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(), 250f, (float)(50 + 17 * value), true); GameObject value2 = GUIManager.Instance.CreateText("", GUILogWindow.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -25f), GUIManager.Instance.AveriaSerifBold, 16, GUIManager.Instance.ValheimOrange, true, Color.black, 200f, 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, 13, GUIManager.Instance.ValheimBeige, true, Color.black, 250f, (float)(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_012e: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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) Vector2 result = default(Vector2); ((Vector2)(ref result))..ctor(-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()); if (0f - num > (float)Screen.width || num > 0f || num2 > (float)Screen.height || num2 < 0f) { return result; } return new Vector2(num, num2); } 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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), 600f, 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), new Vector2(0f, -40f + (float)(-50 * num)), 140f, 40f); val.SetActive(true); Button component = val.GetComponent<Button>(); ((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), new Vector2(0f, -78f + (float)(-50 * num)), GUIManager.Instance.AveriaSerifBold, 12, GUIManager.Instance.ValheimBeige, true, Color.black, 350f, 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), new Vector2(0f, 50f), 150f, 50f); val2.SetActive(true); Button component2 = val2.GetComponent<Button>(); ((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 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0214: 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(), 450f, 35f, true); float num = (float)int.Parse(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), new Vector2(65f, 0f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 100f, 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), new Vector2(275f, 0f), GUIManager.Instance.AveriaSerifBold, 14, GUIManager.Instance.ValheimBeige, false, Color.black, 300f, 20f, false); GameObject value3 = GUIManager.Instance.CreateText(GetShortStance(), XPBar.transform, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(420f, 0f), GUIManager.Instance.AveriaSerifBold, 14, GUIManager.Instance.ValheimOrange, true, Color.black, 50f, 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) Vector2 result = default(Vector2); ((Vector2)(ref result))..ctor(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()); if (num > (float)Screen.width || num < 0f || num2 > (float)Screen.height || num2 < 0f) { return result; } return new Vector2(num, num2); } 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)int.Parse(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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_014f: Expected O, but got Unknown //IL_0175: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028d: 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), 600f, 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), new Vector2(0f, -55f + (float)(-115 * num)), 100f, 40f); val.SetActive(true); Button component = val.GetComponent<Button>(); ((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), new Vector2(0f, -70f + (float)(-115 * num)), GUIManager.Instance.AveriaSerifBold, 12, GUIManager.Instance.ValheimBeige, true, Color.black, 400f, 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), new Vector2(0f, -450f), 150f, 50f); val2.SetActive(true); Button component2 = val2.GetComponent<Button>(); ((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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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), 300f, 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), new Vector2(0f, -60f), GUIManager.Instance.AveriaSerifBold, 25, GUIManager.Instance.ValheimOrange, true, Color.black, 180f, 40f, false); GameObject val2 = GUIManager.Instance.CreateButton(ValheimLevelSystem.LocGUI["Yes"], menu.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(70f, -30f), 100f, 50f); val2.SetActive(true); Button component = val2.GetComponent<Button>(); ((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), new Vector2(-70f, -30f), 100f, 50f); val3.SetActive(true); Button component2 = val3.GetComponent<Button>(); ((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); } } 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 (GetSpecialization() != PlayerSpecialization.Worker) { AddExp(expAmount); } } public static void RaiseExpWork(int expToGive) { 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) { 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 num = long.Parse(GetExp()); if (currentLevel >= ValheimLevelSystem.MaxLevel.Value) { return; } long num2 = exp + num; LevelRequirement levelRequirement = LevelRequirementList.FirstOrDefault((LevelRequirement x) => x.Level == currentLevel); if (levelRequirement == null) { return; } if (num2 >= levelRequirement.ExpAmount) { GUILog.UpdateLog("You gained {0} XP.", levelRequirement.ExpAmount - num); PlayerLevelUp(currentLevel); AddExp(num2 - levelRequirement.ExpAmount); } else { if (exp > 0) { GUILog.UpdateLog("You gained {0} XP.", exp); } else { GUILog.UpdateLog("You lost {0} XP.", -exp); } SaveManager.saveEntry("playerExp", num2.ToString()); } GUI.UpdateExpText(); GUIXP.UpdateXPBar(); } public static void RemoveExpOnDeath() { if (ValheimLevelSystem.ExpPercentageToLoseOnDeath.Value > 0f) { long num = Convert.ToInt64(GetExp()); long maxExpForCurrentLevel = GetMaxExpForCurrentLevel(); float value = ValheimLevelSystem.ExpPercentageToLoseOnDeath.Value; long num2 = (long)((float)(maxExpForCurrentLevel / 100) * value); if (num2 > num) { num2 = num; } AddExp(num2 * -1); } } private static void PlayerLevelUp(int currentLevel) { 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); } 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 string 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 SaveManager.readEntry("playerExp"); } public static void ResetExp() { SaveManager.saveEntry("playerExp", "0"); } public static string GetExpVerbose() { float num = Convert.ToInt32(GetExp()); float num2 = Convert.ToInt32(GetMaxExpForCurrentLevel()); string text = ((num > 1000000f) ? (GetThreeDigits(Math.Round(num / 1000000f, 2)) + "M") : ((!(num > 1000f)) ? Math.Round(num).ToString() : (GetThreeDigits(Math.Round(num / 1000f, 2)) + "K"))); string text2 = ((num2 > 1000000f) ? (GetThreeDigits(Math.Round(num2 / 1000000f, 2)) + "M") : ((!(num2 > 1000f)) ? Math.Round(num2).ToString() : (GetThreeDigits(Math.Round(num2 / 1000f, 2)) + "K"))); return text + " / " + text2; } 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 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00d9: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Expected O, but got Unknown //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Expected O, but got Unknown //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_0774: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07da: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0874: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Unknown result type (might be due to invalid IL or missing references) //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Unknown result type (might be due to invalid IL or missing references) //IL_0934: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Unknown result type (might be due to invalid IL or missing references) //IL_09ce: Unknown result type (might be due to invalid IL or missing references) //IL_09dd: 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_0a1d: Expected O, but got Unknown //IL_0a46: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Unknown result type (might be due to invalid IL or missing references) //IL_0a64: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0aa4: Expected O, but got Unknown //IL_0aca: Unknown result type (might be due to invalid IL or missing references) //IL_0ad9: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Unknown result type (might be due to invalid IL or missing references) //IL_0afe: Unknown result type (might be due to invalid IL or missing references) //IL_0b04: Unknown result type (might be due to invalid IL or missing references) //IL_0b39: Unknown result type (might be due to invalid IL or missing references) //IL_0b48: Unknown result type (might be due to invalid IL or missing references) //IL_0b57: Unknown result type (might be due to invalid IL or missing references) //IL_0b6d: Unknown result type (might be due to invalid IL or missing references) //IL_0b73: Unknown result type (might be due to invalid IL or missing references) //IL_0bcc: Unknown result type (might be due to invalid IL or missing references) //IL_0bdb: Unknown result type (might be due to invalid IL or missing references) //IL_0bea: Unknown result type (might be due to invalid IL or missing references) //IL_0c20: Unknown result type (might be due to invalid IL or missing references) //IL_0c2a: Expected O, but got Unknown //IL_0c8d: Unknown result type (might be due to invalid IL or missing references) //IL_0c9c: Unknown result type (might be due to invalid IL or missing references) //IL_0cbc: Unknown result type (might be due to invalid IL or missing references) //IL_0cf0: Unknown result type (might be due to invalid IL or missing references) //IL_0cff: Unknown result type (might be due to invalid IL or missing references) //IL_0d1f: Unknown result type (might be due to invalid IL or missing references) //IL_0d35: Unknown result type (might be due to invalid IL or missing references) //IL_0d3b: Unknown result type (might be due to invalid IL or missing references) //IL_0d72: Unknown result type (might be due to invalid IL or missing references) //IL_0d7c: Expected O, but got Unknown //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0616: 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), 1350f, 800f, true); ValheimLevelSystem.Menu.SetActive(false); GameObject val = GUIManager.Instance.CreateScrollView(ValheimLevelSystem.Menu.transform, false, true, 8f, 50f, GUIManager.Instance.ValheimScrollbarHandleColorBlock, new Color(0.1568628f, 0.1019608f, 0.0627451f, 1f), 280f, 500f); RectTransform val2 = (RectTransform)val.transform; val2.anchoredPosition = 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), new Vector2(550f, -50f), GUIManager.Instance.AveriaSerifBold, 25, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 40f, false); GameObject value2 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(120f, -50f), GUIManager.Instance.AveriaSerifBold, 25, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 40f, false); ValheimLevelSystem.menuItems.Add("levelText", value2); ValheimLevelSystem.menuItems.Add("nameText", value); int num = 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), new Vector2(100f, -155f + (float)(-28 * num)), GUIManager.Instance.AveriaSerifBold, 18, GUIManager.Instance.ValheimBeige, true, Color.black, 150f, 25f, false); GameObject val4 = GUIManager.Instance.CreateButton(" + ", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(210f, -153f + (float)(-28 * num)), 30f, 25f); val4.SetActive(true); Button component = val4.GetComponent<Button>(); ((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), new Vector2(175f, -155f + (float)(-28 * num++)), GUIManager.Instance.AveriaSerifBold, 18, GUIManager.Instance.ValheimBeige, true, Color.black, 40f, 25f, false); ValheimLevelSystem.menuItems.Add(playerAttribute.ToString() + "Text", value3); ValheimLevelSystem.menuItems.Add(playerAttribute.ToString() + "Button", val4); } int num2 = 0; num = 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), new Vector2(390f + 140f * (float)num2, -150f), 140f, 30f); val5.SetActive(true); Button component2 = val5.GetComponent<Button>(); ((UnityEvent)component2.onClick).AddListener((UnityAction)delegate { SkillManager.pickMastery(skill); }); num = 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), new Vector2(390f + 140f * (float)num2, -205f + (float)(-75 * num)), 140f, 75f); val6.SetActive(true); Button component3 = val6.GetComponent<Button>(); ((UnityEvent)component3.onClick).AddListener((UnityAction)delegate { StatManager.SkillUp(stat); }); ValheimLevelSystem.menuItems.Add(stat.name + "Text", val6); num++; } } num2++; } GameObject val7 = GUIManager.Instance.CreateText(ValheimLevelSystem.LocGUI["Available Effects"], ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(100f, -250f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 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), new Vector2(120f, -85f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 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), new Vector2(100f, -115f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 40f, false); GameObject value5 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(200f, -115f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 50f, 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), new Vector2(100f, -135f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 150f, 40f, false); GameObject value6 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(200f, -135f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimOrange, true, Color.black, 50f, 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), new Vector2(-90f, -45f), 80f, 30f); val10.SetActive(true); Button component4 = val10.GetComponent<Button>(); ((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), new Vector2(0f, 50f), 170f, 45f); val11.SetActive(true); Button component5 = val11.GetComponent<Button>(); ((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), new Vector2(135f, -85f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimBeige, true, Color.black, 950f, 20f, false); GameObject value8 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(135f, -105f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimBeige, true, Color.black, 950f, 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), new Vector2(390f, -45f), 140f, 30f); val10.SetActive(true); Button component6 = val12.GetComponent<Button>(); ((UnityEvent)component6.onClick).AddListener(new UnityAction(GUISpec.CreateSpecializationMenu)); ValheimLevelSystem.menuItems.Add("specButton", val12); int num3 = Math.Min(ValheimLevelSystem.MaxLevel.Value / ValheimLevelSystem.LevelsForSpecial.Value, ValheimLevelSystem.MaxSpecials.Value); int num4 = 0; for (int i = 0; i < num3; i++) { GameObject val13 = GUIManager.Instance.CreateButton("", ValheimLevelSystem.Menu.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(390f, -205f - ((float)(75 * num) + (float)num4 * 50f)), 140f, 40f); GameObject value9 = GUIManager.Instance.CreateText("", ValheimLevelSystem.Menu.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(235f, -213f - ((float)(75 * num) + (float)num4 * 50f)), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimBeige, true, Color.black, 850f, 40f, false); val13.SetActive(true); Button component7 = val13.GetComponent<Button>(); ((UnityEvent)component7.onClick).AddListener(new UnityAction(GUISkill.CreateSkillMenu)); ValheimLevelSystem.menuItems.Add("Skill" + i + "Button", val13); ValheimLevelSystem.menuItems.Add("Skill" + i + "Text", value9); num4++; } } 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_0059: 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) GameObject value = GUIManager.Instance.CreateText("", scrollView.transform.Find("Scroll View/Viewport/Content"), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(-300f, -120f), GUIManager.Instance.AveriaSerifBold, 15, GUIManager.Instance.ValheimBeige, true, Color.black, 250f, 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"; 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)); } } } 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 { [HarmonyPrefix] [HarmonyPatch(typeof(Game), "Start")] 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_02a7: 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; 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); } } [BepInPlugin("Lorska.ValheimLevelSystem", "Lorska.ValheimLevelSystem", "0.9.8.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [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 = "0.9.8.1"; public static bool listInitiliazed = false; public static bool exphideactive = false; public static List<string> PotionToReduceCooldownNameList = new List<string>(new string[0]); public static List<string> PotionToIncreaseTimeNameList = new List<string>(new string[0]); public static List<string> PotionNameList = new List<string>(new string[0]); public static List<string> PotionAlchemyList = new List<string>(new string[0]); public static List<Stat> stats = new List<Stat>(); public static List<Specialization> specs = new List<Specialization>(); public static List<SpecialSkill> specialSkills = new List<SpecialSkill>(); public static Dictionary<string, GameObject> menuItems = new Dictionary<string, GameObject>(); public static ConfigEntry<bool> RunSpeedFix; public static ConfigEntry<float> ExpRate; public static ConfigEntry<float> ExpRateWork; public static ConfigEntry<float> ExpPercentageBonusPerStar; public static ConfigEntry<int> ExpToDivideWhenNotKilledByPlayer; public static ConfigEntry<bool> OnlyGiveExpIfDamageComesFromPlayer; public static ConfigEntry<int> StartingPoints; public static ConfigEntry<int> MaxLevel; public static ConfigEntry<int> LevelsForSpecial; public static ConfigEntry<int> MaxSpecials; public static ConfigEntry<int> AttributePointsPerLevel; public static ConfigEntry<int> PointsPerLevel; public static ConfigEntry<int> PointsPerBoss; public static ConfigEntry<int> BaseExpPerLevel; public static ConfigEntry<int> RangeToDivideExp; public static ConfigEntry<float> ExpPercentageToLoseOnDeath; public static ConfigEntry<float> ExpMultiplierPerLevel; public static ConfigEntry<KeyCode> KeyboardShortcut; public static ConfigEntry<KeyCode> KeyboardShortcutStance; public static ConfigEntry<KeyCode> KeyboardShortcutLog; public static ConfigEntry<int> LogEntries; public static ConfigEntry<float> StanceCD; public static ConfigEntry<bool> ResetFree; public static ConfigEntry<int> MaxLevelResetFree; public static ConfigEntry<int> Tier1Exp; public static ConfigEntry<int> Tier2Exp; public static ConfigEntry<int> Tier3Exp; public static ConfigEntry<int> Tier4Exp; public static ConfigEntry<int> Tier5Exp; public static ConfigEntry<int> Tier6Exp; public static ConfigEntry<int> Tier7Exp; public static ConfigEntry<int> Tier8Exp; public static ConfigEntry<int> BossExpMultiplier; public static ConfigEntry<float> FishingQualityMultiplier; public static ConfigEntry<string> Tier1Creatures; public static ConfigEntry<string> Tier2Creatures; public static ConfigEntry<string> Tier3Creatures; public static ConfigEntry<string> Tier4Creatures; public static ConfigEntry<string> Tier5Creatures; public static ConfigEntry<string> Tier6Creatures; public static ConfigEntry<string> Tier7Creatures; public static ConfigEntry<string> Tier8Creatures; public static ConfigEntry<string> Tier1Pickables; public static ConfigEntry<string> Tier2Pickables; public static ConfigEntry<string> Tier3Pickables; public static ConfigEntry<string> Tier4Pickables; public static ConfigEntry<string> Tier5Pickables; public static ConfigEntry<string> Tier6Pickables; public static ConfigEntry<string> Tier7Pickables; public static ConfigEntry<string> Tier1Mineables; public static ConfigEntry<string> Tier2Mineables; public static ConfigEntry<string> Tier3Mineables; public static ConfigEntry<string> Tier4Mineables; public static ConfigEntry<string> Tier6Mineables; public static ConfigEntry<string> Tier7Mineables; public static ConfigEntry<string> Tier1Choppables; public static ConfigEntry<string> Tier2Choppables; public static ConfigEntry<string> Tier3Choppables; public static ConfigEntry<string> Tier6Choppables; public static ConfigEntry<string> Tier7Choppables; public static ConfigEntry<string> Tier2Fishables; public static ConfigEntry<string> Tier3Fishables; public static ConfigEntry<string> Tier4Fishables; public static ConfigEntry<string> Tier5Fishables; public static ConfigEntry<string> Tier6Fishables; public static ConfigEntry<string> AllPotions; public static ConfigEntry<string> DurationPotions; public static ConfigEntry<string> CDPotions; public static ConfigEntry<string> EnhancedPotions; public static List<string> LocGUIBase = new List<string>(new string[26] { "Available Effects", "Reset", "Close", "<Select>", "Stat Points:", "Attribute Points:", "{0} XP", "Level {0}", "Lvl {0} {1}%", "HpReg", "StReg", "EiReg", "Poison", "Fire", "Spirit", "On", "Off", "Reset Points?", "Yes", "No", "You have points to spend!", "Choose a mastery tree!", "Choose a special skill!", "Choose a specialization!", "Attributes: +{0} health +{1} stamina +{2} eitr", "Passive: {0}" }); public static List<string> LocGUILogUpdateBase = new List<string>(new string[31] { "Current level is above maximum level!", "Skill points or attribute points impossible!", "Special skill amount impossible!", "{0} - {1}.", "You gained {0} XP.", "You lost {0} XP.", "Reached level {0}!", "You gained {0} attribute points!", "{0} +{1}.", "Reset level to {0}!", "New mastery: {0}!", "New specialization: {0}!", "New special skill: {0}!", "Dodging restored {0} stamina!", "Parrying restored {0} stamina!", "Reduced power cd by {0} seconds!", "x{0} Channel Strike!", "+{0} Fire Imbue!", "+{0} Frost Imbue!", "+{0} Lightning Imbue!", "x{0} Critical Hit!", "x{0} Charge!", "x{0} Overpower!", "Absorbed {0} damage ({1})", "Survivor activated!", "Forsaken power removed!", "Revelry restored {0}%!", "Power Shield ({0})", "Power Heal restored {0}%!", "Power Attack ready!", "Stance change ready!" }); public static Dictionary<string, string> LocSkills = new Dictionary<string, string>(); public static Dictionary<string, string> LocAttrs = new Dictionary<string, string>(); public static Dictionary<string, string> LocGUI = new Dictionary<string, string>(); public static Dictionary<string, string> LocGUILogUpdate = new Dictionary<string, string>(); private Harmony harmony = new Harmony("Lorska.ValheimLevelSystem"); public static GameObject Menu; public static bool hasAwake = false; public void Awake() { ((object)GUIManager.Instance).GetType(); ((BaseUnityPlugin)this).Config.SaveOnConfigSet = true; InitStats(); InitSpecs(); InitSpecialSkills(); SaveManager.Init(); InitConfigs(); InitLocalization(); SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr) { if (attr.InitialSynchronization) { Logger.LogMessage((object)"Initial Config sync event received"); } else { Logger.LogMessage((object)"Config sync event received"); } }; harmony.PatchAll(); ExpTable.InitMonsterExpList(); ExpTable.InitPickableExpList(); ExpTable.InitMineableExpList(); ExpTable.InitChoppableExpList(); ExpTable.InitFishableExpList(); PotionToReduceCooldownNameList = CDPotions.Value.Split(new char[1] { ',' }).ToList(); PotionToIncreaseTimeNameList = DurationPotions.Value.Split(new char[1] { ',' }).ToList(); PotionNameList = AllPotions.Value.Split(new char[1] { ',' }).ToList(); PotionAlchemyList = EnhancedPotions.Value.Split(new char[1] { ',' }).ToList(); } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (Input.GetKeyDown(KeyboardShortcut.Value) && !blockInput()) { if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || ((Character)localPlayer).InCutscene() || ((Character)localPlayer).IsTeleporting()) { return; } GUI.ToggleMenu(); } if (Input.GetKeyDown(KeyboardShortcutStance.Value) && !blockInput()) { if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || ((Character)localPlayer).InCutscene() || ((Character)localPlayer).IsTeleporting()) { return; } Level.ToggleStance(); } if (Input.GetKeyDown(KeyboardShortcutLog.Value) && !blockInput()) { if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead() || ((Character)localPlayer).InCutscene() || ((Character)localPlayer).IsTeleporting()) { return; } GUILog.toggle(); if (exphideactive) { GUIXP.toggle(); } exphideactive = !exphideactive; } if (Input.GetKeyDown((KeyCode)27) && listInitiliazed) { GUI.DestroyMenu(); } } public static bool blockInput() { return Minimap.IsOpen() || Console.IsVisible() || TextInput.IsVisible() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || !listInitiliazed; } public void InitStats() { stats.Add(Stat.Init("EitrRegen", 20, 0f, 0.05f, 10, Skill.Magic, "Eitr\nRegeneration", "+{0}% eitr regeneration", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("Imbue", 10, 0.6f, 0.15f, 5, Skill.Magic, "Imbue\nWeapon", "use 15% of maximum eitr to deal +{0} elemental damage per eitr", ((BaseUnityPlugin)this).Config, additive: true, is_percentage: false)); stats.Add(Stat.Init("Channel", 10, 0.0055f, 0.0013f, 5, Skill.Magic, "Channel\nStrike", "use 100% of maximum eitr to deal +{0}% physical damage per eitr", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("MagicExp", 5, 0f, 0.5f, 2, Skill.Magic, "Magic Skill\nXP", "+{0}% magic skill experience", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("CritChance", 20, 0.05f, 0.005f, 10, Skill.Strength, "Critical\nChance", "+{0}% critical hit chance", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("CritDmg", 10, 0.5f, 0.05f, 5, Skill.Strength, "Critical\nDamage", "+{0}% critical hit damage", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("Stagger", 10, 0f, 0.03f, 5, Skill.Strength, "Stagger\nDamage", "+{0}% stagger damage dealt", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("WeaponExp", 5, 0f, 0.5f, 2, Skill.Strength, "Weapon Skill\nXP", "+{0}% weapon skill experience", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("Armor", 20, 0f, 0.008f, 10, Skill.Constitution, "Armor", "+{0}% armor", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("HealthRegen", 10, 0f, 0.04f, 5, Skill.Constitution, "Health\nRegeneration", "+{0}% health regeneration", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("ElemRed", 10, 0f, 0.04f, 5, Skill.Constitution, "Elemental\nReduction", "{0}% elemental damage taken", ((BaseUnityPlugin)this).Config, additive: false)); stats.Add(Stat.Init("BlockExp", 5, 0f, 0.5f, 2, Skill.Constitution, "Block Skill\nXP", "+{0}% block skill experience", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("Runspeed", 20, 0f, 0.008f, 10, Skill.Agility, "Movement\nSpeed", "+{0}% movement speed", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("StamRegen", 10, 0f, 0.04f, 5, Skill.Agility, "Stamina\nRegeneration", "+{0}% stamina regeneration", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("EvadeStam", 10, 0.05f, 0.01f, 5, Skill.Agility, "Parry/Dodge\nRecovery", "+{0}% max stamina restored when parrying or dodging successfully", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("MoveExp", 5, 0f, 0.5f, 2, Skill.Agility, "Movement Skill\nXP", "+{0}% movement skill experience", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("BuffCdr", 20, 0f, 0.025f, 10, Skill.Intelligence, "Power\nCooldown", "{0}% power cooldown", ((BaseUnityPlugin)this).Config, additive: false)); stats.Add(Stat.Init("SkillEff", 10, 0f, 0.025f, 5, Skill.Intelligence, "Skill\nEffect", "+{0}% skill effectiveness", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("StanceEff", 10, 0f, 0.03f, 5, Skill.Intelligence, "Stance\nEffect", "+{0}% stance effectiveness", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("PotionCdr", 5, 0f, 0.13f, 2, Skill.Intelligence, "Potion\nCooldown", "{0}% potion cooldown", ((BaseUnityPlugin)this).Config, additive: false)); stats.Add(Stat.Init("BuffDur", 20, 0f, 0.05f, 10, Skill.Focus, "Power\nDuration", "+{0}% power duration", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("ConsumeDur", 10, 0f, 0.2f, 5, Skill.Focus, "Consumable\nDuration", "+{0}% food and potion effect duration", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("AttrPoints", 10, 0f, 2f, 5, Skill.Focus, "Attribute\nPoints", "+{0} attribute points", ((BaseUnityPlugin)this).Config, additive: true, is_percentage: false)); stats.Add(Stat.Init("Comfort", 5, 1f, 2f, 2, Skill.Focus, "Comfort", "+{0} comfort", ((BaseUnityPlugin)this).Config, additive: true, is_percentage: false)); stats.Add(Stat.Init("Carry", 20, 0f, 10f, 10, Skill.Diligence, "Carry\nCapacity", "+{0} carry capacity", ((BaseUnityPlugin)this).Config, additive: true, is_percentage: false)); stats.Add(Stat.Init("ChopMine", 10, 0f, 0.2f, 5, Skill.Diligence, "Chop/Mine\nEfficiency", "+{0}% chopping and mining damage and experience gain", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("FoodEff", 10, 0f, 0.02f, 5, Skill.Diligence, "Food\nEffect", "+{0}% food effectiveness", ((BaseUnityPlugin)this).Config)); stats.Add(Stat.Init("WorkExp", 5, 0f, 0.5f, 2, Skill.Diligence, "Work Skill\nXP", "+{0}% working skill experience", ((BaseUnityPlugin)this).Config)); } public void InitSpecs() { specs.Add(Specialization.Init("Slugger", "Slugger", 15f, 0f, 0f, "+{0}% stagger damage per 1% remaining stamina", new string[1] { "StaggerStamRatio" }, new float[1] { 0.004f }, new bool[1] { true }, "Overpower Stance", "Convert all stagger damage dealt into bonus damage at {0}% efficiency", new string[1] { "StaggerConversionCoeff" }, new float[1] { 0.35f }, new string[1] { "powinv" }, new bool[1] { true }, ((BaseUnityPlugin)this).Config)); specs.Add(Specialization.Init("Protector", "Protector", 10f, 5f, 0f, "Blocking reduces stagger taken to {0}%", new string[1] { "BlockStagger" }, new float[1] { 0.7f }, new bool[1] { true }, "Defensive Stance", "{0}% damage dealt and {1}% damage taken", new string[2] { "DamageDealt", "DamageTaken" }, new float[2] { 0.75f, 0.75f }, new string[2] { "powinv", "pow" }, new bool[2] { true, true }, ((BaseUnityPlugin)this).Config)); specs.Add(Specialization.Init("Berserker", "Berserker", 5f, 10f, 0f, "+{0}% movement speed per 1% missing health", new string[1] { "SpeedHealthRatio" }, new float[1] { 0.002f }, new bool[1] { true }, "Aggressive Stance", "{0}% damage dealt and {1}% damage taken", new string[2] { "DamageDealt", "DamageTaken" }, new float[2] { 1.25f, 1.25f }, new string[2] { "pow", "powinv" }, new bool[2] { true, true }, ((BaseUnityPlugin)this).Config)); specs.Add(Specialization.Init("Worker", "Worker", 0f, 15f, 0f, "Gain {0}% XP but reduces combat XP to 0", new string[1] { "XPMult" }, new float[1] { 3f }, new bool[1] { true }, "Burden Stance", "Each point of stamina increases carry capacity by {0} and health by {1} but reduces movement speed to {2}%", new string[3] { "CarryConversion", "HealthConversion", "MovementModifier" }, new float[3] { 1f, 0.3f, 0.75f }, new string[3] { "mult", "mult", "powinv" }, new bool[3] { false, false, true }, ((BaseUnityPlugin)this).Config)); specs.Add(Specialization.Init("Ritualist", "Ritualist", 5f, 5f, 5f, "Hits/parries reduce power CD by {0}/{1} seconds", new string[2] { "HitCDR