Decompiled source of TeamUpgrades v1.1.4

TeamUpgrades.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using REPOTeamBoosters.Patches;
using TeamUpgrades.Configuration;
using TeamUpgrades.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("TeamUpgrades")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TeamUpgrades")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ef74d5e5-8fe6-4b6a-86ed-0e29e12695bb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPOTeamBoosters
{
	[BepInPlugin("EvilCheetah.REPO.TeamBoosters", "Team Boosters", "1.1.4")]
	public class TeamBoostersBase : BaseUnityPlugin
	{
		private const string mod_guid = "EvilCheetah.REPO.TeamBoosters";

		private const string mod_name = "Team Boosters";

		private const string mod_version = "1.1.4";

		private readonly Harmony harmony = new Harmony("EvilCheetah.REPO.TeamBoosters");

		private static TeamBoostersBase instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("EvilCheetah.REPO.TeamBoosters");
			harmony.PatchAll(typeof(TeamBoostersBase));
			Configuration.Init(((BaseUnityPlugin)this).Config);
			(ConfigEntry<bool>, Action, string)[] array = new(ConfigEntry<bool>, Action, string)[9]
			{
				(Configuration.EnableItemUpgradeMapPlayerCountPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradeMapPlayerCountPatch));
				}, "Map Player Count Upgrade"),
				(Configuration.EnableItemUpgradePlayerEnergyPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerEnergyPatch));
				}, "Player Energy Upgrade"),
				(Configuration.EnableItemUpgradePlayerExtraJumpPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerExtraJumpPatch));
				}, "Player Extra Jump Upgrade"),
				(Configuration.EnableItemUpgradePlayerGrabRangePatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerGrabRangePatch));
				}, "Player Grab Range Upgrade"),
				(Configuration.EnableItemUpgradePlayerGrabStrengthPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerGrabStrengthPatch));
				}, "Player Grab Strength Upgrade"),
				(Configuration.EnableItemUpgradePlayerGrabThrowPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerGrabThrowPatch));
				}, "Player Grab Throw Upgrade"),
				(Configuration.EnableItemUpgradePlayerHealthPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerHealthPatch));
				}, "Player Health Upgrade"),
				(Configuration.EnableItemUpgradePlayerSprintSpeedPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerSprintSpeedPatch));
				}, "Player Sprint Speed Upgrade"),
				(Configuration.EnableItemUpgradePlayerTumbleLaunchPatch, delegate
				{
					harmony.PatchAll(typeof(ItemUpgradePlayerTumbleLaunchPatch));
				}, "Player Thumle Lauch Upgrade")
			};
			for (int i = 0; i < array.Length; i++)
			{
				var (val, action, text) = array[i];
				if (val.Value)
				{
					action();
					mls.LogInfo((object)(text + " patch is applied"));
				}
			}
			mls.LogInfo((object)"Team Boosters mod has been activated");
		}
	}
}
namespace REPOTeamBoosters.Patches
{
	[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount), "Upgrade")]
	internal class ItemUpgradeMapPlayerCountPatch
	{
		private static bool Prefix(ItemUpgradeMapPlayerCount __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradeMapPlayerCount(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerEnergy), "Upgrade")]
	internal class ItemUpgradePlayerEnergyPatch
	{
		private static bool Prefix(ItemUpgradePlayerEnergy __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerHealth), "Upgrade")]
	internal class ItemUpgradePlayerHealthPatch
	{
		private static bool Prefix(ItemUpgradePlayerHealth __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed), "Upgrade")]
	internal class ItemUpgradePlayerSprintSpeedPatch
	{
		private static bool Prefix(ItemUpgradePlayerSprintSpeed __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
}
namespace TeamUpgrades.Patches
{
	[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump), "Upgrade")]
	internal class ItemUpgradePlayerExtraJumpPatch
	{
		private static bool Prefix(ItemUpgradePlayerExtraJump __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange), "Upgrade")]
	internal class ItemUpgradePlayerGrabRangePatch
	{
		private static bool Prefix(ItemUpgradePlayerGrabRange __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength), "Upgrade")]
	internal class ItemUpgradePlayerGrabStrengthPatch
	{
		private static bool Prefix(ItemUpgradePlayerGrabStrength __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabThrow), "Upgrade")]
	internal class ItemUpgradePlayerGrabThrowPatch
	{
		private static bool Prefix(ItemUpgradePlayerGrabThrow __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerThrowStrength(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch), "Upgrade")]
	internal class ItemUpgradePlayerTumbleLaunchPatch
	{
		private static bool Prefix(ItemUpgradePlayerTumbleLaunch __instance)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
			}
			return false;
		}
	}
}
namespace TeamUpgrades.Configuration
{
	internal class Configuration
	{
		public static ConfigEntry<bool> EnableItemUpgradeMapPlayerCountPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerEnergyPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerExtraJumpPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerGrabRangePatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerGrabStrengthPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerGrabThrowPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerHealthPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerSprintSpeedPatch;

		public static ConfigEntry<bool> EnableItemUpgradePlayerTumbleLaunchPatch;

		public static void Init(ConfigFile config)
		{
			EnableItemUpgradeMapPlayerCountPatch = config.Bind<bool>("General", "EnableUpgradeMapPlayer", true, "Enables Team Upgrades for Map Player Count Upgrade");
			EnableItemUpgradePlayerEnergyPatch = config.Bind<bool>("General", "EnableUpgradePlayerEnergy", true, "Enables Team Upgrades for Player Energy Upgrade");
			EnableItemUpgradePlayerExtraJumpPatch = config.Bind<bool>("General", "EnableUpgradePlayerExtraJump", true, "Enables Team Upgrades for Player Extra Jump Upgrade");
			EnableItemUpgradePlayerGrabRangePatch = config.Bind<bool>("General", "EnableUpgradePlayerGrabRange", true, "Enables Team Upgrades for Player Grab Range Upgrade");
			EnableItemUpgradePlayerGrabStrengthPatch = config.Bind<bool>("General", "EnableUpgradePlayerGrabStrength", true, "Enables Team Upgrades for Player Grab Strength Upgrade");
			EnableItemUpgradePlayerGrabThrowPatch = config.Bind<bool>("General", "EnableUpgradePlayerGrabThrow", true, "Enables Team Upgrades for Player Grab Throw Upgrade");
			EnableItemUpgradePlayerHealthPatch = config.Bind<bool>("General", "EnableUpgradePlayerHealth", true, "Enables Team Upgrades for Player Health Upgrade");
			EnableItemUpgradePlayerSprintSpeedPatch = config.Bind<bool>("General", "EnableUpgradePlayerSprintSpeed", true, "Enables Team Upgrades for Player Sprint Speed Upgrade");
			EnableItemUpgradePlayerTumbleLaunchPatch = config.Bind<bool>("General", "EnableUpgradePlayerTumbleLaunch", true, "Enables Team Upgrades for Player Tumble Launch Upgrade");
		}
	}
}