Decompiled source of Passive Powers Progression Addon v1.0.0

PassivePowersAddon.dll

Decompiled 16 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using PassivePowers;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("PassivePowersAddon")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PassivePowersAddon")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d3ca5b96-2e20-4eef-9623-e1ef8125d49d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PassivePowersAddon;

[BepInPlugin("com.LeviHollow.passivepowersaddon", "Passive Powers Progression Addon", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ProgressionAddonPlugin : BaseUnityPlugin
{
	public static ConfigEntry<int> BaseSlots;

	public static ConfigEntry<int> EikthyrSlots;

	public static ConfigEntry<int> ElderSlots;

	public static ConfigEntry<int> BonemassSlots;

	public static ConfigEntry<int> ModerSlots;

	public static ConfigEntry<int> YagluthSlots;

	public static ConfigEntry<int> QueenSlots;

	public static ConfigEntry<int> FaderSlots;

	public static ConfigEntry<string> UnlockMessage;

	private int _lastKnownSlots = -1;

	private void Awake()
	{
		BaseSlots = ((BaseUnityPlugin)this).Config.Bind<int>("1 - Slots", "BaseSlots", 1, "Starting number of slots.");
		EikthyrSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "Eikthyr", 0, "Extra slots when Eikthyr trophy is hung.");
		ElderSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "TheElder", 0, "Extra slots when The Elder trophy is hung.");
		BonemassSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "Bonemass", 0, "Extra slots when Bonemass trophy is hung.");
		ModerSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "Moder", 1, "Extra slots when Moder trophy is hung.");
		YagluthSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "Yagluth", 0, "Extra slots when Yagluth trophy is hung.");
		QueenSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "Queen", 0, "Extra slots when Queen trophy is hung.");
		FaderSlots = ((BaseUnityPlugin)this).Config.Bind<int>("2 - Boss Unlocks", "Fader", 0, "Extra slots when Fader trophy is hung.");
		UnlockMessage = ((BaseUnityPlugin)this).Config.Bind<string>("3 - Notifications", "UnlockMessage", "You feel stronger... New passive power slot unlocked!", "Message shown on screen.");
	}

	private void Update()
	{
		if (!((Object)(object)Player.m_localPlayer == (Object)null) && !((Object)(object)ZoneSystem.instance == (Object)null) && PassivePowers.maximumBossPowers != null)
		{
			int dynamicMaxPowers = GetDynamicMaxPowers();
			PassivePowers.maximumBossPowers.Value = dynamicMaxPowers;
			if (_lastKnownSlots == -1)
			{
				_lastKnownSlots = dynamicMaxPowers;
			}
			else if (dynamicMaxPowers > _lastKnownSlots)
			{
				((Character)Player.m_localPlayer).Message((MessageType)2, UnlockMessage.Value, 0, (Sprite)null);
				_lastKnownSlots = dynamicMaxPowers;
			}
			else if (dynamicMaxPowers < _lastKnownSlots)
			{
				_lastKnownSlots = dynamicMaxPowers;
			}
		}
	}

	public int GetDynamicMaxPowers()
	{
		int num = BaseSlots.Value;
		if (Utils.PassivePowerEnabled("GP_Eikthyr"))
		{
			num += EikthyrSlots.Value;
		}
		if (Utils.PassivePowerEnabled("GP_TheElder"))
		{
			num += ElderSlots.Value;
		}
		if (Utils.PassivePowerEnabled("GP_Bonemass"))
		{
			num += BonemassSlots.Value;
		}
		if (Utils.PassivePowerEnabled("GP_Moder"))
		{
			num += ModerSlots.Value;
		}
		if (Utils.PassivePowerEnabled("GP_Yagluth"))
		{
			num += YagluthSlots.Value;
		}
		if (Utils.PassivePowerEnabled("GP_Queen"))
		{
			num += QueenSlots.Value;
		}
		if (Utils.PassivePowerEnabled("GP_Fader"))
		{
			num += FaderSlots.Value;
		}
		return num;
	}
}