Decompiled source of GroupLevelUp v1.0.0

GroupLevelUp.dll

Decompiled 5 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GroupLevelUp.Patches;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace GroupLevelUp
{
	[BepInPlugin("Jeff.GroupLevelUp", "GroupLevelUp", "1.0.0")]
	public class GroupLevelUpBase : BaseUnityPlugin
	{
		public const string modGUID = "Jeff.GroupLevelUp";

		public const string modName = "GroupLevelUp";

		public const string modVersion = "1.0.0";

		public static ConfigEntry<bool> PatchHealth;

		public static ConfigEntry<bool> PatchEnergy;

		public static ConfigEntry<bool> PatchSprintSpeed;

		public static ConfigEntry<bool> PatchRange;

		public static ConfigEntry<bool> PatchStrength;

		public static ConfigEntry<bool> PatchTumbleLaunch;

		public static ConfigEntry<bool> PatchThrowStrength;

		public static ConfigEntry<bool> PatchExtraJump;

		public static ConfigEntry<bool> PatchMapCount;

		public static ConfigEntry<bool> PatchTumbleClimb;

		public static ConfigEntry<bool> PatchTumbleWings;

		public static ConfigEntry<bool> PatchCrouchRest;

		public static ConfigEntry<bool> PatchDeathHeadBattery;

		private readonly Harmony harmony = new Harmony("Jeff.GroupLevelUp");

		public static GroupLevelUpBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Jeff.GroupLevelUp");
			PatchHealth = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableHealth", true, "Gives the Health upgrade to everyone when used");
			PatchEnergy = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableEnergy", true, "Gives the Energy upgrade to everyone when used");
			PatchSprintSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableSprintSpeed", true, "Gives the Sprint Speed upgrade to everyone when used");
			PatchRange = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableRange", true, "Gives the Range upgrade to everyone when used");
			PatchStrength = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableStrength", true, "Gives the Strength upgrade to everyone when used");
			PatchTumbleLaunch = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableTumbleLaunch", true, "Gives the Tumble Launch upgrade to everyone when used");
			PatchThrowStrength = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableThrowStrength", true, "Gives the Throw Strength upgrade to everyone when used");
			PatchExtraJump = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableExtraJump", true, "Gives the Extra Jump upgrade to everyone when used");
			PatchMapCount = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableMapCount", true, "Gives the Player Map Count upgrade to everyone when used");
			PatchTumbleClimb = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableTumbleClimb", true, "Gives the Tumble Climb upgrade to everyone when used");
			PatchTumbleWings = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableTumbleWings", true, "Gives the Tumble Wings upgrade to everyone when used");
			PatchCrouchRest = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableCrouchRest", true, "Gives the Crouch Rest upgrade to everyone when used");
			PatchDeathHeadBattery = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDeathHeadBattery", true, "Gives the Death Head Battery upgrade to everyone when used");
			if (PatchHealth.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeHealthPatch));
				mls.LogInfo((object)"Enabled Health Patch");
			}
			if (PatchEnergy.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeEnergyPatch));
				mls.LogInfo((object)"Enabled Energy Patch");
			}
			if (PatchSprintSpeed.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradePlayerSprintSpeedPatch));
				mls.LogInfo((object)"Enabled Sprint Speed Patch");
			}
			if (PatchRange.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeRangePatch));
				mls.LogInfo((object)"Enabled Range Patch");
			}
			if (PatchStrength.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeStrengthPatch));
				mls.LogInfo((object)"Enabled Strength Patch");
			}
			if (PatchTumbleLaunch.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeTumbleLaunchPatch));
				mls.LogInfo((object)"Enabled Tumble Launch Patch");
			}
			if (PatchThrowStrength.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeGrabThrowPatch));
				mls.LogInfo((object)"Enabled Grab Throw Patch");
			}
			if (PatchExtraJump.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeExtraJumpPatch));
				mls.LogInfo((object)"Enabled Extra Jump Patch");
			}
			if (PatchMapCount.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeMapPlayerCountPatch));
				mls.LogInfo((object)"Enabled Map Player Count Patch");
			}
			if (PatchTumbleClimb.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeTumbleClimbPatch));
				mls.LogInfo((object)"Enabled Tumble Climb Patch");
			}
			if (PatchTumbleWings.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeTumbleWingsPatch));
				mls.LogInfo((object)"Enabled Tumble Wings Patch");
			}
			if (PatchCrouchRest.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeCrouchRestPatch));
				mls.LogInfo((object)"Enabled Crouch Rest Patch");
			}
			if (PatchDeathHeadBattery.Value)
			{
				harmony.PatchAll(typeof(ItemUpgradeDeathHeadBatteryPatch));
				mls.LogInfo((object)"Enabled Death Head Battery Patch");
			}
			mls.LogInfo((object)"GroupLevelUp has loaded.");
		}
	}
}
namespace GroupLevelUp.Patches
{
	internal static class UpgradeAll
	{
		internal static bool Apply(Func<string, int> upgrade, string message)
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				upgrade(SemiFunc.PlayerGetSteamID(item));
			}
			GroupLevelUpBase.Instance.mls.LogInfo((object)message);
			return false;
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerHealth))]
	internal class ItemUpgradeHealthPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool healthPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerHealth(id, 1), "Upgraded Health for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerEnergy))]
	internal class ItemUpgradeEnergyPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool energyPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerEnergy(id, 1), "Upgraded Energy for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed))]
	internal class ItemUpgradePlayerSprintSpeedPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool sprintSpeedPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerSprintSpeed(id, 1), "Upgraded Speed for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange))]
	internal class ItemUpgradeRangePatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool rangePatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerGrabRange(id, 1), "Upgraded Range for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength))]
	internal class ItemUpgradeStrengthPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool strengthPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerGrabStrength(id, 1), "Upgraded Strength for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch))]
	internal class ItemUpgradeTumbleLaunchPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool tumbleLaunchPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerTumbleLaunch(id, 1), "Upgraded Tumble Launch for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerGrabThrow))]
	internal class ItemUpgradeGrabThrowPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool grabThrowPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerThrowStrength(id, 1), "Upgraded Throw Strength for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump))]
	internal class ItemUpgradeExtraJumpPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool extraJumpPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerExtraJump(id, 1), "Upgraded Extra Jump for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount))]
	internal class ItemUpgradeMapPlayerCountPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool plrMapCountPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradeMapPlayerCount(id, 1), "Upgraded Player Map Count for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerTumbleClimb))]
	internal class ItemUpgradeTumbleClimbPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool tumbleClimbPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerTumbleClimb(id, 1), "Upgraded Tumble Climb for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerTumbleWings))]
	internal class ItemUpgradeTumbleWingsPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool tumbleWingsPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerTumbleWings(id, 1), "Upgraded Tumble Wings for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradePlayerCrouchRest))]
	internal class ItemUpgradeCrouchRestPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool crouchRestPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradePlayerCrouchRest(id, 1), "Upgraded Crouch Rest for all players");
		}
	}
	[HarmonyPatch(typeof(ItemUpgradeDeathHeadBattery))]
	internal class ItemUpgradeDeathHeadBatteryPatch
	{
		[HarmonyPatch("Upgrade")]
		[HarmonyPrefix]
		private static bool deathHeadBatteryPatch()
		{
			return UpgradeAll.Apply((string id) => PunManager.instance.UpgradeDeathHeadBattery(id, 1), "Upgraded Death Head Battery for all players");
		}
	}
}