Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ForsakenPowerSelector v1.0.0
ForsakenPowerSelector.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ForsakenPowerSelector")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForsakenPowerSelector")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("6b4b04ca-6c8c-41d6-8027-c95a47fe727d")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace ForsakenPowerSelector; [BepInPlugin("com.custom.valheim.forsakenpowerselector", "Forsaken Power Selector", "1.0.0")] public class ForsakenPowerSelectorPlugin : BaseUnityPlugin { private struct PowerEntry { public string DisplayName; public string StatusEffectName; public string DefeatedKey; public PowerEntry(string displayName, string effectName, string defeatedKey) { DisplayName = displayName; StatusEffectName = effectName; DefeatedKey = defeatedKey; } } public const string ModGUID = "com.custom.valheim.forsakenpowerselector"; public const string ModName = "Forsaken Power Selector"; public const string ModVersion = "1.0.0"; public static ConfigEntry<KeyCode> ToggleKey; private bool showMenu; private Rect windowRect = new Rect(60f, 60f, 260f, 200f); private static readonly List<PowerEntry> Powers = new List<PowerEntry> { new PowerEntry("Eikthyr", "GP_Eikthyr", "defeated_eikthyr"), new PowerEntry("The Elder", "GP_TheElder", "defeated_gdking"), new PowerEntry("Bonemass", "GP_Bonemass", "defeated_bonemass"), new PowerEntry("Moder", "GP_Moder", "defeated_dragon"), new PowerEntry("Yagluth", "GP_Yagluth", "defeated_goblinking"), new PowerEntry("The Queen", "GP_Queen", "defeated_queen"), new PowerEntry("Fader", "GP_Fader", "defeated_fader") }; private void Awake() { ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)289, "Key to open the Forsaken Power selection panel."); } private void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || ((Character)Player.m_localPlayer).IsDead()) { if (showMenu) { CloseMenu(); } return; } if (Input.GetKeyDown(ToggleKey.Value)) { showMenu = !showMenu; UpdateInputState(showMenu); } if (showMenu) { if (Input.GetKeyDown((KeyCode)27)) { CloseMenu(); return; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void CloseMenu() { showMenu = false; UpdateInputState(open: false); } private void UpdateInputState(bool open) { Cursor.lockState = (CursorLockMode)(!open); Cursor.visible = open; if ((Object)(object)GameCamera.instance != (Object)null) { ((Behaviour)GameCamera.instance).enabled = !open; } } private void OnGUI() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (showMenu && !((Object)(object)Player.m_localPlayer == (Object)null)) { GUI.depth = -1000; GUI.backgroundColor = new Color(0.12f, 0.12f, 0.12f, 0.95f); windowRect = GUILayout.Window(994321, windowRect, new WindowFunction(DrawWindow), "Forsaken Powers", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(260f), GUILayout.Height(1f) }); } } private void DrawWindow(int windowID) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 25f)); Player localPlayer = Player.m_localPlayer; string guardianPowerName = localPlayer.GetGuardianPowerName(); string powerDisplayName = GetPowerDisplayName(guardianPowerName); GUILayout.Space(5f); GUILayout.Label("<b>Active:</b> " + powerDisplayName, Array.Empty<GUILayoutOption>()); float guardianPowerCooldown = localPlayer.m_guardianPowerCooldown; if (guardianPowerCooldown > 0f) { int num = Mathf.FloorToInt(guardianPowerCooldown / 60f); int num2 = Mathf.FloorToInt(guardianPowerCooldown % 60f); GUILayout.Label($"<b>Cooldown:</b> {num:00}:{num2:00}", Array.Empty<GUILayoutOption>()); } else { GUILayout.Label("<color=#7CFC00>Ready to use</color>", Array.Empty<GUILayoutOption>()); } GUILayout.Space(8f); HashSet<string> allKnownDefeatedKeys = GetAllKnownDefeatedKeys(); int num3 = 0; foreach (PowerEntry power in Powers) { if (allKnownDefeatedKeys.Contains(power.DefeatedKey.ToLower())) { num3++; bool num4 = guardianPowerName == power.StatusEffectName; GUI.enabled = !num4; if (GUILayout.Button(num4 ? (power.DisplayName + " (Active)") : power.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) })) { SetGuardianPower(localPlayer, power.DisplayName, power.StatusEffectName); CloseMenu(); } } } GUI.enabled = true; if (num3 == 0) { GUILayout.Label("<color=#FFA500>No defeated bosses unlocked yet.</color>", Array.Empty<GUILayoutOption>()); } GUILayout.Space(8f); if (GUILayout.Button("Close", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { CloseMenu(); } } private string GetPowerDisplayName(string statusEffectName) { if (string.IsNullOrEmpty(statusEffectName)) { return "None"; } foreach (PowerEntry power in Powers) { if (power.StatusEffectName == statusEffectName) { return power.DisplayName; } } return statusEffectName; } private HashSet<string> GetAllKnownDefeatedKeys() { HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); if ((Object)(object)ZoneSystem.instance != (Object)null) { List<string> globalKeys = ZoneSystem.instance.GetGlobalKeys(); if (globalKeys != null) { foreach (string item in globalKeys) { hashSet.Add(item.ToLower()); } } foreach (PowerEntry power in Powers) { if (ZoneSystem.instance.GetGlobalKey(power.DefeatedKey)) { hashSet.Add(power.DefeatedKey.ToLower()); } } } if ((Object)(object)Player.m_localPlayer != (Object)null) { foreach (PowerEntry power2 in Powers) { if (((Humanoid)Player.m_localPlayer).HaveUniqueKey(power2.DefeatedKey)) { hashSet.Add(power2.DefeatedKey.ToLower()); } } } return hashSet; } private void SetGuardianPower(Player player, string displayName, string statusEffectName) { player.SetGuardianPower(statusEffectName); ((Character)player).Message((MessageType)2, "Forsaken Power set to: " + displayName, 0, (Sprite)null, false); } }