Decompiled source of MultiBallReal v1.0.1

multiballreal.dll

Decompiled 8 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameplayEntities;
using HarmonyLib;
using LLBML.Utils;
using LLHandlers;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("multiballreal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("multiballreal")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("664de4af-aa69-4f3a-9e6b-dd07c879adf5")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace multiballreal;

[BepInPlugin("us.wallace.plugins.llb.multiballreal", "multiballreal Plug-In", "1.0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("LLBlaze.exe")]
public class Plugin : BaseUnityPlugin
{
	public static ConfigEntry<int> maxBalls;

	public static ConfigEntry<int> enableMultiBall;

	public static ManualLogSource Log { get; private set; }

	private void Awake()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		maxBalls = ((BaseUnityPlugin)this).Config.Bind<int>("1. multiBallConfig", "Number of Balls", 2, "Number of Balls");
		Log = ((BaseUnityPlugin)this).Logger;
		((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching effects settings...");
		Harmony val = new Harmony("us.wallace.plugins.llb.multiballreal");
		val.PatchAll(typeof(BallHandlerSpawnBallPatch));
		((BaseUnityPlugin)this).Logger.LogDebug((object)"multiballreal is loaded");
		World.MAX_BALLS = maxBalls.Value;
	}

	private void Start()
	{
		ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, (List<string>)null);
	}

	private void FixedUpdate()
	{
		World.MAX_BALLS = maxBalls.Value;
	}
}
internal class BallHandlerSpawnBallPatch
{
	[HarmonyPatch(typeof(BallHandler), "SpawnBall")]
	[HarmonyPrefix]
	public static bool SpawnBall_Prefix(BallHandler __instance, int ballIndex = 0)
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Invalid comparison between Unknown and I4
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Invalid comparison between Unknown and I4
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		int num = PlayerHandler.instance.playerHandlerData.firstLosingPlayerOfBurst;
		if (num != World.NO_PLAYER_INDEX && !ALDOKEMAOMB.BJDPHEHJJJK(num).LAADACKBGLL())
		{
			num = World.NO_PLAYER_INDEX;
		}
		PlayerHandler.instance.playerHandlerData.firstLosingPlayerOfBurst = World.NO_PLAYER_INDEX;
		__instance.ballHandlerData.ballSpawnPos = new IBGCBLLKIHA(((Handler)__instance).world.GetStageCenter().GCPKPHMKLBN, HHBCPNCDNDH.FCKBPDNEAOG(((Handler)__instance).world.stageMax.CGJJEHPPOAN, HHBCPNCDNDH.AJOCFFLIIIH(HHBCPNCDNDH.NKKIFJJEPOL(200.0m), World.FPIXEL_SIZE)));
		if (num != World.NO_PLAYER_INDEX)
		{
			if ((int)JOMBNFKIHIC.GIGAKBJGFDI.PNJOKAICMNN == 4 || (int)JOMBNFKIHIC.GIGAKBJGFDI.PNJOKAICMNN == 5)
			{
				if ((int)((HitableData)PlayerHandler.instance.GetPlayerEntity(num).playerData).team == 0)
				{
					__instance.ballHandlerData.ballSpawnPos.GCPKPHMKLBN = HHBCPNCDNDH.FCKBPDNEAOG(((Handler)__instance).world.GetStageCenter().GCPKPHMKLBN, HHBCPNCDNDH.FCGOICMIBEA(((Handler)__instance).world.stageSize.GCPKPHMKLBN, HHBCPNCDNDH.NKKIFJJEPOL(5)));
				}
				else
				{
					__instance.ballHandlerData.ballSpawnPos.GCPKPHMKLBN = HHBCPNCDNDH.GAFCIOAEGKD(((Handler)__instance).world.GetStageCenter().GCPKPHMKLBN, HHBCPNCDNDH.FCGOICMIBEA(((Handler)__instance).world.stageSize.GCPKPHMKLBN, HHBCPNCDNDH.NKKIFJJEPOL(5)));
				}
			}
			((BouncableEntity)__instance.balls[ballIndex]).SetToTeam(((HitableData)PlayerHandler.instance.GetPlayerEntity(num).playerData).team);
		}
		else
		{
			__instance.ballHandlerData.ballSpawnPos = new IBGCBLLKIHA(((Handler)__instance).world.GetStageCenter().GCPKPHMKLBN, HHBCPNCDNDH.FCKBPDNEAOG(((Handler)__instance).world.stageMax.CGJJEHPPOAN, HHBCPNCDNDH.AJOCFFLIIIH(HHBCPNCDNDH.NKKIFJJEPOL(200.0m), World.FPIXEL_SIZE)));
			((BouncableEntity)__instance.balls[ballIndex]).SetToTeam((BGHNEHPFHGC)4);
		}
		for (int i = ballIndex; i < World.MAX_BALLS; i++)
		{
			__instance.balls[i].Spawn(num);
		}
		return false;
	}
}