Decompiled source of SharedUpgradeChance v1.0.0

SharedUpgradeChance.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using SharedUpgradeChance.patches;
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("SharedUpgradeChance")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharedUpgradeChance")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d96a4024-1851-46f7-bdb8-c86b880eac22")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SharedUpgradeChance
{
	[BepInPlugin("SharedUpgradeChance", "Shared Upgrade Chance", "1.0")]
	public class plugin : BaseUnityPlugin
	{
		public const string pluginGuid = "SharedUpgradeChance";

		public const string pluginName = "Shared Upgrade Chance";

		public const string pluginVersion = "1.0";

		internal static ManualLogSource Loger;

		public void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Expected O, but got Unknown
			Loger = new ManualLogSource("SHAREDUPGRADECHANCE");
			Logger.Sources.Add((ILogSource)(object)Loger);
			Loger.LogInfo((object)"Shared Upgrade Chance Loading");
			Harmony val = new Harmony("SharedUpgradeChance");
			List<MethodInfo> list = new List<MethodInfo>();
			List<MethodInfo> list2 = new List<MethodInfo>();
			list.Add(AccessTools.Method(typeof(ItemUpgradeMapPlayerCount), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradeMapPlayerCount_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerEnergy), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerEnergy_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerExtraJump), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerExtraJump_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerGrabRange), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerGrabRange_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerGrabStrength), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerGrabStrength_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerGrabThrow), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerGrabThrow_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerHealth), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerHealth_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerSprintSpeed), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerSprintSpeed_Patch.Upgrade_Patch())));
			list.Add(AccessTools.Method(typeof(ItemUpgradePlayerTumbleLaunch), "Upgrade", (Type[])null, (Type[])null));
			list2.Add(SymbolExtensions.GetMethodInfo((Expression<Action>)(() => ItemUpgradePlayerTumbleLaunch_Patch.Upgrade_Patch())));
			for (int i = 0; i < list.Count; i++)
			{
				val.Patch((MethodBase)list[i], new HarmonyMethod(list2[i]), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
	}
}
namespace SharedUpgradeChance.patches
{
	public class ItemUpgradeMapPlayerCount_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradeMapPlayerCount(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Map Player Count upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerEnergy_Patch : MonoBehaviour
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerEnergy(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Player Energy upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerExtraJump_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerExtraJump(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Extra Jump upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerGrabRange_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerGrabRange(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Grab Range upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerGrabStrength_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerGrabStrength(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Grab Strength upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerGrabThrow_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerThrowStrength(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Throw Strength upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerHealth_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerHealth(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Health upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerSprintSpeed_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerSprintSpeed(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Sprint Speed upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
	public class ItemUpgradePlayerTumbleLaunch_Patch
	{
		public static bool Upgrade_Patch()
		{
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				Random random = new Random();
				int num = random.Next(1, 5);
				plugin.Loger.LogInfo((object)("Chance generated for: " + SemiFunc.PlayerGetName(item) + " : " + num));
				if (num != 1)
				{
					PunManager.instance.UpgradePlayerTumbleLaunch(SemiFunc.PlayerGetSteamID(item));
					plugin.Loger.LogInfo((object)("Tumble Launch upgrade given to: " + SemiFunc.PlayerGetName(item)));
				}
			}
			return false;
		}
	}
}