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 UnityEngine;
using UpgradesForAll.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UpgradesForAll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UpgradesForAll")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5416bca-2afb-4138-b419-9cb71871fe4c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UpgradesForAll
{
[BepInPlugin("DuckyVR.UpgradesForAll", "UpgradesForAll", "1.0.1")]
public class UpgradesForAllBase : BaseUnityPlugin
{
private const string modGUID = "DuckyVR.UpgradesForAll";
private const string modName = "UpgradesForAll";
private const string modVersion = "1.0.1";
internal static ConfigEntry<bool> PatchHealth;
internal static ConfigEntry<bool> PatchEnergy;
internal static ConfigEntry<bool> PatchSprintSpeed;
internal static ConfigEntry<bool> PatchRange;
internal static ConfigEntry<bool> PatchStrength;
internal static ConfigEntry<bool> PatchTumbleLaunch;
internal static ConfigEntry<bool> PatchThrowStrength;
internal static ConfigEntry<bool> PatchExtraJump;
internal static ConfigEntry<bool> PatchMapCount;
private readonly Harmony harmony = new Harmony("DuckyVR.UpgradesForAll");
public static UpgradesForAllBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("DuckyVR.UpgradesForAll");
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");
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 Extra Jump Patch");
}
mls.LogInfo((object)"Upgrades For All has loaded.");
}
}
}
namespace UpgradesForAll.Patches
{
[HarmonyPatch(typeof(ItemUpgradeMapPlayerCount))]
internal class ItemUpgradeMapPlayerCountPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool plrMapCountPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradeMapPlayerCount(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Player Map Count for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabThrow))]
internal class ItemUpgradeGrabThrowPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool grabThrowPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerThrowStrength(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Throw Strength for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerTumbleLaunch))]
internal class ItemUpgradeTumbleLaunchPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool tumbleLaunchPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded TumbleLaunch for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerExtraJump))]
internal class ItemUpgradeExtraJumpPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool extraJumpPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Extra Jump for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabRange))]
internal class ItemUpgradeRangePatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool rangePatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Range for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerGrabStrength))]
internal class ItemUpgradeStrengthPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool strengthPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Strength for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerEnergy))]
internal class ItemUpgradeEnergyPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool energyPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Energy for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerSprintSpeed))]
internal class ItemUpgradePlayerSprintSpeedPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool sprintSpeedPatch()
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(player));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Speed for all players");
return false;
}
}
[HarmonyPatch(typeof(ItemUpgradePlayerHealth))]
internal class ItemUpgradeHealthPatch
{
[HarmonyPatch("Upgrade")]
[HarmonyPrefix]
private static bool healthPatch(ItemUpgradePlayerHealth __instance)
{
foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
{
PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
}
UpgradesForAllBase.Instance.mls.LogInfo((object)"Upgraded Health for all players");
return false;
}
}
}