using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Jotunn.Managers; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using Vanablade.TalentTree; using Vanablade.TalentTree.Effects; using Vanablade.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] [assembly: AssemblyCompany("Vanablade")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+ae6e4555945ad7d526958a632e886379469f7eb2")] [assembly: AssemblyProduct("Vanablade")] [assembly: AssemblyTitle("Vanablade")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Vanablade { [BepInPlugin("com.vanablade.core", "Vanablade", "0.1.0")] public class VanabladePlugin : BaseUnityPlugin { [CompilerGenerated] private sealed class d__13 : global::System.Collections.Generic.IEnumerator, global::System.Collections.IEnumerator, global::System.IDisposable { private int <>1__state; private object <>2__current; public VanabladePlugin <>4__this; object global::System.Collections.Generic.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object global::System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__13(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void global::System.IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func)(() => (Object)(object)Player.m_localPlayer != (Object)null)); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.AttachPlayerStats(Player.m_localPlayer); return false; } } bool global::System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void global::System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } } private TalentTreeUI _talentUI = null; private StatAllocationUI _statUI = null; private PlayerStats _playerStats = null; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public static ManualLogSource Log { [CompilerGenerated] get; [CompilerGenerated] private set; } [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public static Harmony Harmony { [CompilerGenerated] get; [CompilerGenerated] private set; } private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony = new Harmony("com.vanablade.core"); Log.LogInfo((object)"Vanablade initializing..."); TalentTreeManager.Instance.Initialize(Log); TalentTreeData.Instance.Initialize(); Log.LogInfo((object)"Talent tree registered. Cleave node available (req: Might 5)."); GameObject val = new GameObject("VanabladeUI"); _talentUI = val.AddComponent(); _statUI = val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); SetupPlayer(); Harmony.Patch((MethodBase)(object)AccessTools.Method(typeof(Skills), "RaiseSkill", (global::System.Type[])null, (global::System.Type[])null), new HarmonyMethod(typeof(LevelUpPatch), "Prefix", (global::System.Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.PatchAll(typeof(PlayerAttackSpeedPatch)); Harmony.PatchAll(typeof(DualWieldEquipPatch)); Log.LogInfo((object)"Harmony patches applied."); Log.LogInfo((object)"Vanablade ready. F4 for stat allocation, F5 for talent tree."); } private void SetupPlayer() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { AttachPlayerStats(localPlayer); } else { ((MonoBehaviour)this).StartCoroutine(WaitForPlayer()); } } [IteratorStateMachine(typeof(d__13))] private global::System.Collections.IEnumerator WaitForPlayer() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__13(0) { <>4__this = this }; } private void AttachPlayerStats(Player player) { _playerStats = ((Component)player).GetComponent(); if ((Object)(object)_playerStats == (Object)null) { _playerStats = ((Component)player).gameObject.AddComponent(); } _playerStats.Initialize(); TalentTreeManager.Instance.SetStats(_playerStats); Log.LogInfo((object)$"PlayerStats attached to {player.GetPlayerName()}. Might={_playerStats.Might}, Mind={_playerStats.Mind}, Agility={_playerStats.Agility}, Points={_playerStats.AvailableStatPoints}"); } private void Update() { if (Input.GetKeyDown((KeyCode)285)) { _statUI?.Toggle(); } if (Input.GetKeyDown((KeyCode)286)) { _talentUI?.Toggle(); } } } public static class LevelUpPatch { public static void Prefix(Skills self, SkillType skill, float floatParameter) { Player component = ((Component)self).GetComponent(); PlayerStats playerStats = ((component != null) ? ((Component)component).GetComponent() : null); if ((Object)(object)playerStats != (Object)null) { playerStats.AwardStatPoints(1); TalentTreeManager.Log.LogInfo((object)$"Level up! Awarded 1 stat point. Total: {playerStats.AvailableStatPoints}"); } } } } namespace Vanablade.UI { public class StatAllocationUI : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__14_0; public static Action <>9__14_1; public static Func <>9__14_2; public static Action <>9__14_3; public static Func <>9__14_4; public static Action <>9__14_5; internal int b__14_0() { return TalentTreeManager.Instance.Stats.Might; } internal void b__14_1() { TalentTreeManager.Instance.AllocateStat(StatType.Might); } internal int b__14_2() { return TalentTreeManager.Instance.Stats.Mind; } internal void b__14_3() { TalentTreeManager.Instance.AllocateStat(StatType.Mind); } internal int b__14_4() { return TalentTreeManager.Instance.Stats.Agility; } internal void b__14_5() { TalentTreeManager.Instance.AllocateStat(StatType.Agility); } } private GameObject? _panel; private Text? _pointsText; private Text? _mightText = null; private Text? _mindText = null; private Text? _agilityText = null; private bool _isOpen; [field: CompilerGenerated] [field: DebuggerBrowsable(/*Could not decode attribute arguments.*/)] public static StatAllocationUI Instance { [CompilerGenerated] get; [CompilerGenerated] private set; } private void Awake() { Instance = this; } private void Start() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown GUIManager.OnCustomGUIAvailable += new Action(OnGUIAvailable); } private void OnDestroy() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown GUIManager.OnCustomGUIAvailable -= new Action(OnGUIAvailable); } private void OnGUIAvailable() { CreatePanel(); } private void CreatePanel() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Expected O, but got Unknown //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown if ((Object)(object)_panel != (Object)null) { return; } Transform transform = GUIManager.CustomGUIFront.transform; _panel = GUIManager.Instance.CreateWoodpanel(transform, new Vector2(0.35f, 0.15f), new Vector2(0.65f, 0.5f), Vector2.zero, 350f, 280f); ((Object)_panel).name = "VanabladeStatAllocation"; GameObject val = GUIManager.Instance.CreateText("Stat Allocation", _panel.transform, new Vector2(0.1f, 0.82f), new Vector2(0.9f, 0.95f), Vector2.zero, GUIManager.Instance.NorseBold, 24, GUIManager.Instance.ValheimOrange, true, Color.black, 0f, 0f, true); ((Object)val).name = "Title"; GameObject val2 = GUIManager.Instance.CreateText($"Points Available: {TalentTreeManager.Instance.AvailableStatPoints}", _panel.transform, new Vector2(0.05f, 0.65f), new Vector2(0.95f, 0.75f), Vector2.zero, GUIManager.Instance.Norse, 18, GUIManager.Instance.ValheimOrange, true, Color.black, 0f, 0f, true); ((Object)val2).name = "PointsText"; _pointsText = val2.GetComponent(); Func getValue = () => TalentTreeManager.Instance.Stats.Might; object obj = <>c.<>9__14_1; if (obj == null) { Action val3 = delegate { TalentTreeManager.Instance.AllocateStat(StatType.Might); }; <>c.<>9__14_1 = val3; obj = (object)val3; } CreateStatRow("Might", getValue, (Action)obj, 0.62f); Func getValue2 = () => TalentTreeManager.Instance.Stats.Mind; object obj2 = <>c.<>9__14_3; if (obj2 == null) { Action val4 = delegate { TalentTreeManager.Instance.AllocateStat(StatType.Mind); }; <>c.<>9__14_3 = val4; obj2 = (object)val4; } CreateStatRow("Mind", getValue2, (Action)obj2, 0.46f); Func getValue3 = () => TalentTreeManager.Instance.Stats.Agility; object obj3 = <>c.<>9__14_5; if (obj3 == null) { Action val5 = delegate { TalentTreeManager.Instance.AllocateStat(StatType.Agility); }; <>c.<>9__14_5 = val5; obj3 = (object)val5; } CreateStatRow("Agility", getValue3, (Action)obj3, 0.3f); GameObject val6 = GUIManager.Instance.CreateButton("X", _panel.transform, new Vector2(0.93f, 0.85f), new Vector2(1f, 0.95f), Vector2.zero, 35f, 35f); Button component = val6.GetComponent