Decompiled source of CorpseJugglerPatched v1.0.4

plugins/CorpseJuggler.dll

Decompiled 8 hours 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 GameplayEntities;
using LLBML.Utils;
using LLHandlers;
using LLModdingTools;
using LLScreen;
using Rewired;
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("CorpseJuggler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CorpseJuggler")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ed9ee237-fba9-4971-9679-253fb6d1646b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LLModdingTools
{
	public class GUITools
	{
		public static Rect ClampWindowToScreen(Rect rect)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			((Rect)(ref rect)).x = ((((Rect)(ref rect)).x < 0f) ? 0f : ((((Rect)(ref rect)).x + ((Rect)(ref rect)).width > (float)Screen.width) ? ((float)Screen.width - ((Rect)(ref rect)).width) : ((Rect)(ref rect)).x));
			((Rect)(ref rect)).y = ((((Rect)(ref rect)).y < 0f) ? 0f : ((((Rect)(ref rect)).y + ((Rect)(ref rect)).height > (float)Screen.height) ? ((float)Screen.height - ((Rect)(ref rect)).height) : ((Rect)(ref rect)).y));
			return rect;
		}

		public static Rect ClampWindowTo1080p(Rect rect)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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)
			((Rect)(ref rect)).x = ((((Rect)(ref rect)).x < 0f) ? 0f : ((((Rect)(ref rect)).x + ((Rect)(ref rect)).width > 1920f) ? (1920f - ((Rect)(ref rect)).width) : ((Rect)(ref rect)).x));
			((Rect)(ref rect)).y = ((((Rect)(ref rect)).y < 0f) ? 0f : ((((Rect)(ref rect)).y + ((Rect)(ref rect)).height > 1080f) ? (1080f - ((Rect)(ref rect)).height) : ((Rect)(ref rect)).y));
			return rect;
		}

		public static void ScaleGUIToViewPort()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor((float)Screen.width, (float)Screen.height);
			float num = 1f;
			float num2 = val.x / val.y;
			float num3 = ((num2 < num) ? (val.x / 1920f) : (val.y / 1080f));
			GUI.matrix = Matrix4x4.TRS(KeepTo16by9(Vector3.zero), Quaternion.identity, new Vector3(num3, num3, 1f));
		}

		private static Vector3 KeepTo16by9(Vector3 pos)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			float num = 1.7777778f;
			float num2 = Screen.width;
			float num3 = Screen.height;
			float num4 = num2 / num3;
			Vector3 zero = Vector3.zero;
			if (num4 < num)
			{
				zero.y = (num3 - num2 / num) / 2f;
				zero.y *= ((pos.y < num2 * 0.5f) ? 1 : (-1));
			}
			else
			{
				zero.x = (num2 - num3 * num) / 2f;
				zero.x *= ((pos.x < num2 * 0.5f) ? 1 : (-1));
			}
			return pos + zero;
		}
	}
}
namespace CorpseJuggler
{
	[BepInPlugin("uk.daioutzu.plugins.llb.CorpseJuggler", "CorpseJuggler", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class CorpseJuggler : BaseUnityPlugin
	{
		internal delegate void DirectionPressed(float f, bool isGamePad);

		internal delegate void StandardEvent();

		public const string modVersion = "1.0.1";

		public const string repositoryOwner = "Daioutzu";

		public const string repositoryName = "LLBMM-CorpseJuggler";

		private bool initialModIntegration;

		private IGamepadTemplate gamePad;

		private ConfigEntry<KeyCode> enableCorpseSpawner;

		private ConfigEntry<KeyCode> spawnCorpseKey;

		private ConfigEntry<KeyCode> moveBallKey;

		private static ConfigEntry<bool> gamePadSpawnCorpse;

		private static ConfigEntry<bool> gamePadenableCorpseSpawner;

		private static ConfigEntry<bool> gamePadMoveBall;

		public ConfigEntry<int> joyStickBallMoveSpeed;

		public readonly int mouseBallMoveSpeed = 18;

		private const float DEAD_ZONE = 0.2f;

		private bool trainingModeStart = false;

		private Controller Controller
		{
			get
			{
				if (!ReInput.isReady)
				{
					return null;
				}
				return ReInput.controllers.GetLastActiveController();
			}
		}

		public static ConfigEntry<bool> CreditsEnabled { get; private set; }

		internal static JOFJHDJHJGI CurrentGameState => DNPFJHMAIBP.HHMOGKIMBNM();

		internal static GameMode CurrentGameMode => JOMBNFKIHIC.GIGAKBJGFDI.PNJOKAICMNN;

		internal static bool InGame => (Object)(object)World.instance != (Object)null && ((int)DNPFJHMAIBP.HHMOGKIMBNM() == 19 || (int)DNPFJHMAIBP.HHMOGKIMBNM() == 20) && !UIScreen.loadingScreenActive;

		internal static bool IsOffline => !JOMBNFKIHIC.DGGHBHPEGNK();

		internal static Spawner CorpseSpawner { get; private set; }

		internal static CorpseJuggler Instance { get; private set; }

		internal event DirectionPressed OnCursorMoveVert;

		internal event DirectionPressed OnCursorMoveHori;

		internal event StandardEvent OnTrainingModeStart;

		internal event StandardEvent OnTrainingModeEnd;

		internal event StandardEvent OnSpawnCorpseKeyDown;

		internal event StandardEvent OnEnableCorpseSpawner;

		internal event StandardEvent OnMoveBallKeyDown;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello from corpse juggler");
			InitConfig();
		}

		private void Start()
		{
			Instance = this;
			ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, (List<string>)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Corpse juggler started");
		}

		private void InitConfig()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Expected O, but got Unknown
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			enableCorpseSpawner = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Toggles", "enableCorpseJuggleKey", (KeyCode)98, "Key to toggle corpse juggler");
			spawnCorpseKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Toggles", "spawnCorpseKey", (KeyCode)113, "Key to spawn corpse");
			moveBallKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Toggles", "enableBallPositioningKey", (KeyCode)324, "Key to enable ball positioning");
			((BaseUnityPlugin)this).Config.Bind<string>("Toggles", "toggles_header_controller", "Controller", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" }));
			gamePadenableCorpseSpawner = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "enableCorpseSpawnerWithSelect", true, "Enable corpse spawner with select");
			gamePadSpawnCorpse = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "SpawnCorpseWithRightStickDown", true, "Spawn corpse with right stick down");
			gamePadMoveBall = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "enableBallPositioningWithRightStickPressed", true, "Enable ball positioning with right stick pressed");
			((BaseUnityPlugin)this).Config.Bind<string>("Toggles", "toggles_gap", "gap", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" }));
			joyStickBallMoveSpeed = ((BaseUnityPlugin)this).Config.Bind<int>("Tuning", "ballSpeedSlider", 25, new ConfigDescription("Speed for the joystick to move ball", (AcceptableValueBase)(object)new AcceptableValueRange<int>(21, 33), new object[0]));
			CreditsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "In-GameCredit", true, "Toggle in game credit");
		}

		private void GetGamePad()
		{
			Controller controller = Controller;
			if (controller != null)
			{
				controller.ImplementsTemplate<IGamepadTemplate>();
				if (true)
				{
					gamePad = Controller.GetTemplate<IGamepadTemplate>();
				}
			}
		}

		private void Update()
		{
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Invalid comparison between Unknown and I4
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			GetGamePad();
			IGamepadTemplate obj = gamePad;
			bool flag = obj != null && obj.center1.justPressed && gamePadenableCorpseSpawner.Value;
			IGamepadTemplate obj2 = gamePad;
			bool flag2 = obj2 != null && obj2.rightStick.press.justPressed && gamePadMoveBall.Value;
			int num;
			if (!Input.anyKey)
			{
				IGamepadTemplate obj3 = gamePad;
				if ((double?)((obj3 != null) ? new float?(obj3.rightStick.value.y) : ((float?)null)) < -0.35)
				{
					IGamepadTemplate obj4 = gamePad;
					if (!((double?)((obj4 != null) ? new float?(obj4.rightStick.valuePrev.y) : ((float?)null)) < -0.35))
					{
						num = (gamePadSpawnCorpse.Value ? 1 : 0);
						goto IL_0150;
					}
				}
			}
			num = 0;
			goto IL_0150;
			IL_0150:
			bool flag3 = (byte)num != 0;
			if ((int)CurrentGameMode == 100 && InGame && IsOffline)
			{
				if (!trainingModeStart)
				{
					trainingModeStart = true;
					TrainingModStart();
				}
			}
			else if (trainingModeStart)
			{
				trainingModeStart = false;
				TrainingModeEnd();
			}
			if (Input.GetKeyDown(enableCorpseSpawner.Value) || flag)
			{
				this.OnEnableCorpseSpawner?.Invoke();
			}
			else if (Input.GetKeyDown(spawnCorpseKey.Value) || flag3)
			{
				this.OnSpawnCorpseKeyDown?.Invoke();
			}
			else if (Input.GetKeyDown(moveBallKey.Value) || flag2)
			{
				this.OnMoveBallKeyDown?.Invoke();
			}
			if (Mathf.Abs(Input.GetAxis("Mouse X")) > 0.025f)
			{
				this.OnCursorMoveHori?.Invoke(Input.GetAxis("Mouse X"), isGamePad: false);
			}
			else
			{
				IGamepadTemplate obj5 = gamePad;
				if (Mathf.Abs((obj5 != null) ? obj5.rightStick.value.x : 0f) > 0.2f)
				{
					this.OnCursorMoveHori?.Invoke(gamePad.rightStick.value.x, isGamePad: true);
				}
			}
			if (Mathf.Abs(Input.GetAxis("Mouse Y")) > 0.025f)
			{
				this.OnCursorMoveVert?.Invoke(Input.GetAxis("Mouse Y"), isGamePad: false);
				return;
			}
			IGamepadTemplate obj6 = gamePad;
			if (Mathf.Abs((obj6 != null) ? obj6.rightStick.value.y : 0f) > 0.2f)
			{
				this.OnCursorMoveVert?.Invoke(gamePad.rightStick.value.y, isGamePad: true);
			}
		}

		protected virtual void TrainingModStart()
		{
			CorpseSpawner = ((Component)World.instance).gameObject.AddComponent<Spawner>();
			this.OnTrainingModeStart?.Invoke();
		}

		protected virtual void TrainingModeEnd()
		{
			this.OnTrainingModeEnd?.Invoke();
			CorpseSpawner = null;
		}
	}
	internal static class PluginInfos
	{
		public const string PLUGIN_NAME = "CorpseJuggler";

		public const string PLUGIN_ID = "uk.daioutzu.plugins.llb.CorpseJuggler";

		public const string PLUGIN_VERSION = "1.0.2";
	}
	internal class Spawner : MonoBehaviour
	{
		private static int previousControllerMapID;

		private BallEntity ball = null;

		private PlayerEntity player = null;

		private OEMHHMCDHGK dummy = null;

		private HHBCPNCDNDH prevBallSpeed;

		private IBGCBLLKIHA ballPos;

		private Vector2 ballMoveDirection;

		private float ballMoveSpeed;

		private bool expressCancelled;

		private bool ballMoveToggle;

		private bool corpseMode;

		private bool mouseCursorLocked;

		private const int GUI_HEIGHT = 1080;

		private const int GUI_WIDTH = 1920;

		private static bool UsingController => InputHandler.GetLastActiveController(false) != Controller.mouseKeyboard;

		private static int CurrentControllerMapID
		{
			get
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Controller lastActiveController = InputHandler.GetLastActiveController(false);
				return ((Controller)(ref lastActiveController)).GetMap().id;
			}
		}

		private void TrainingModeStart()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"[LLBMM] \"Spawner\" Invoked TrainingModeStart");
			dummy = PlayerHandler.instance.CreateDummyPlayerEntity(6);
			((MovableEntity)dummy).SetPlayerState((PlayerState)9, "", (HitPauseState)4, (HitstunState)51);
			((Entity)dummy).SetPosition(World.OFF_SCREEN_POSITION);
			ball = BallHandler.instance.GetBall(0);
			player = PlayerHandler.instance.GetPlayerEntity(0);
		}

		private void TrainingModeEnded()
		{
			Debug.Log((object)"[LLBMM] \"Spawner\" Invoked TrainingModeEnded");
			Cursor.lockState = (CursorLockMode)0;
			RestoreControllerExpress(previousControllerMapID);
			RestoreControllerExpress(CurrentControllerMapID);
			((AbilityEntity)dummy).player.OKDEILOGKFB();
			ball = null;
			Object.Destroy((Object)(object)dummy);
			Object.Destroy((Object)(object)this);
		}

		private void OnDestroy()
		{
			CorpseJuggler.Instance.OnTrainingModeStart -= TrainingModeStart;
			CorpseJuggler.Instance.OnTrainingModeEnd -= TrainingModeEnded;
			CorpseJuggler.Instance.OnEnableCorpseSpawner -= EnableCorpseSpawner;
			CorpseJuggler.Instance.OnSpawnCorpseKeyDown -= SpawnCorpseKeyDown;
			CorpseJuggler.Instance.OnMoveBallKeyDown -= MoveBallKeyDown;
			CorpseJuggler.Instance.OnCursorMoveHori -= MouseMoveHori;
			CorpseJuggler.Instance.OnCursorMoveVert -= MouseMoveVert;
		}

		private void Awake()
		{
			CorpseJuggler.Instance.OnTrainingModeStart += TrainingModeStart;
			CorpseJuggler.Instance.OnTrainingModeEnd += TrainingModeEnded;
			CorpseJuggler.Instance.OnEnableCorpseSpawner += EnableCorpseSpawner;
		}

		private void MoveBallKeyDown()
		{
			if (!ballMoveToggle)
			{
				CorpseJuggler.Instance.OnCursorMoveHori += MouseMoveHori;
				CorpseJuggler.Instance.OnCursorMoveVert += MouseMoveVert;
				ballMoveToggle = true;
			}
			else
			{
				ballMoveToggle = false;
				CorpseJuggler.Instance.OnCursorMoveHori -= MouseMoveHori;
				CorpseJuggler.Instance.OnCursorMoveVert -= MouseMoveVert;
			}
		}

		private void EnableCorpseSpawner()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Invalid comparison between Unknown and I4
			if ((int)((BouncingData)((GetHitBallEntity)ball).ballData).ballState != 26 && (int)((BouncingData)((GetHitBallEntity)ball).ballData).ballState != 1 && !((HitableEntity)ball).InHitstunByAPlayer())
			{
				if (!corpseMode)
				{
					CorpseJuggler.Instance.OnMoveBallKeyDown += MoveBallKeyDown;
					CorpseJuggler.Instance.OnSpawnCorpseKeyDown += SpawnCorpseKeyDown;
					MoveBallKeyDown();
					CorpseModeEnabled();
				}
				else
				{
					CorpseModeDisabled();
					CorpseJuggler.Instance.OnSpawnCorpseKeyDown -= SpawnCorpseKeyDown;
					CorpseJuggler.Instance.OnMoveBallKeyDown -= MoveBallKeyDown;
				}
			}
		}

		private void StickBallToPlayer()
		{
			((HitableData)((GetHitBallEntity)ball).ballData).lastHitterIndex = 0;
			((BouncableEntity)ball).SetToTeam((BGHNEHPFHGC)0);
			((BouncableEntity)ball).SetBallState((BallState)21, (HitstunState)51);
		}

		private void MouseMoveVert(float f, bool isGamePad)
		{
			ballMoveSpeed = (isGamePad ? CorpseJuggler.Instance.joyStickBallMoveSpeed.Value : CorpseJuggler.Instance.mouseBallMoveSpeed);
			ballMoveDirection.y = f;
		}

		private void MouseMoveHori(float f, bool isGamePad)
		{
			ballMoveSpeed = (isGamePad ? CorpseJuggler.Instance.joyStickBallMoveSpeed.Value : CorpseJuggler.Instance.mouseBallMoveSpeed);
			ballMoveDirection.x = f;
		}

		private void SpawnCorpseKeyDown()
		{
			SpawnCorpse();
		}

		private void CorpseModeEnabled()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			ballPos = ((Entity)ball).GetPosition();
			((HitableData)((GetHitBallEntity)ball).ballData).flyDirection = new IBGCBLLKIHA(0, 0);
			prevBallSpeed = ((HitableEntity)ball).GetFlySpeed(true);
			((HitableEntity)ball).hitableData.canHitPlayer = false;
			((BouncableEntity)ball).SetToTeam((BGHNEHPFHGC)4);
			AudioHandler.PlaySfx((Sfx)6);
			corpseMode = true;
		}

		private void CorpseModeDisabled()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			if (expressCancelled)
			{
				RestoreControllerExpress(previousControllerMapID);
			}
			UnlockCursor();
			ballMoveToggle = false;
			expressCancelled = false;
			((HitableEntity)ball).SetFlySpeed(prevBallSpeed, true);
			((HitableEntity)ball).hitableData.canHitPlayer = true;
			((HitableEntity)ball).EndHitstun();
			((BouncableEntity)ball).SetToTeam((BGHNEHPFHGC)0);
			((HitableData)((GetHitBallEntity)ball).ballData).flyDirection = new IBGCBLLKIHA(0, 0);
			corpseMode = false;
			StickBallToPlayer();
			AudioHandler.PlaySfx((Sfx)8);
		}

		private void UpdateExpress()
		{
			if (UsingController && !expressCancelled)
			{
				int currentControllerMapID = CurrentControllerMapID;
				previousControllerMapID = currentControllerMapID;
				DisableControllerExpress(previousControllerMapID);
				expressCancelled = true;
			}
			if (CurrentControllerMapID != previousControllerMapID && expressCancelled)
			{
				RestoreControllerExpress(previousControllerMapID);
				expressCancelled = false;
			}
		}

		private void DisableControllerExpress(int mapID)
		{
			if (!UsingController)
			{
				return;
			}
			foreach (ActionElementMap allMap in ReInput.mapping.GetControllerMap(mapID).AllMaps)
			{
				if (allMap.actionDescriptiveName.Contains("Express"))
				{
					allMap.enabled = false;
				}
			}
			Debug.Log((object)$"[LLBMM] Spawner: Disabled Express for {mapID}");
		}

		private void RestoreControllerExpress(int mapID)
		{
			foreach (ActionElementMap allMap in ReInput.mapping.GetControllerMap(mapID).AllMaps)
			{
				if (allMap.actionDescriptiveName.Contains("Express"))
				{
					allMap.enabled = true;
				}
			}
			Debug.Log((object)$"[LLBMM] Spawner: Re-enabled Express for {mapID}");
		}

		private void SpawnCorpse()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (!ballMoveToggle)
			{
				bool flag = GreaterThanAndEqual(((Entity)ball).GetPosition().GCPKPHMKLBN, ((Entity)player).GetPosition().GCPKPHMKLBN);
				ItemHandler.instance.SpawnCorpse(((AbilityEntity)dummy).playerIndex, ((Entity)ball).GetPosition(), (Side)(!flag));
			}
		}

		private void CantHitBall()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			if (!((HitableEntity)ball).InHitstunByAPlayer())
			{
				((HitableEntity)ball).StartHitstun(new HHBCPNCDNDH(10), (HitstunState)51);
				((Entity)ball).SetPosition(ballPos);
				if ((int)CorpseJuggler.CurrentGameState == 20 && ballMoveToggle)
				{
					((VisualEntity)ball).SetColorOutlinesColor(new Color(1f, 1f, 0.4f));
					return;
				}
				((VisualEntity)ball).SetColorOutlinesColor(new Color(1f, 0.4f, 0.4f));
				((VisualEntity)ball).SetScale(new Vector3(2f, 2f, 2f), "main");
			}
		}

		private void MoveBall()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			((HitableEntity)ball).EndHitstun();
			((HitableEntity)ball).hitableData.canBeHitByPlayer = false;
			((HitableEntity)ball).hitableData.canHitPlayer = false;
			((VisualEntity)ball).SetColorOutlinesColor(new Color(0.4f, 1f, 0.4f));
			((HitableData)((GetHitBallEntity)ball).ballData).flyDirection = new IBGCBLLKIHA(Floatf(ballMoveDirection.x), Floatf(ballMoveDirection.y));
			((HitableData)((BouncableEntity)ball).bouncingData).flySpeed = Floatf(ballMoveSpeed * 0.6f);
			ballMoveDirection = Vector2.zero;
			ballPos = ((Entity)ball).GetPosition();
		}

		private void LockCursor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			if ((int)Cursor.lockState == 0 && !mouseCursorLocked)
			{
				Cursor.lockState = (CursorLockMode)1;
				mouseCursorLocked = true;
			}
		}

		private void UnlockCursor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)Cursor.lockState >= 1 && mouseCursorLocked)
			{
				Cursor.lockState = (CursorLockMode)0;
				mouseCursorLocked = false;
			}
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			if (corpseMode)
			{
				UpdateExpress();
				if (!ballMoveToggle || (int)CorpseJuggler.CurrentGameState == 20)
				{
					UnlockCursor();
					CantHitBall();
				}
				else
				{
					LockCursor();
					MoveBall();
				}
			}
		}

		public static bool GreaterThanAndEqual(HHBCPNCDNDH a, HHBCPNCDNDH b)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			return HHBCPNCDNDH.OCDKNPDIPOB(a, b);
		}

		public static HHBCPNCDNDH Floatf(float a)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			return HHBCPNCDNDH.NKKIFJJEPOL((decimal)a);
		}

		private void OnGUI()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			if (CorpseJuggler.CreditsEnabled.Value && corpseMode)
			{
				GUITools.ScaleGUIToViewPort();
				GUIStyle val = new GUIStyle(GUI.skin.box)
				{
					fontSize = 14,
					alignment = (TextAnchor)4
				};
				int num = 30;
				GUI.Label(new Rect(0f, (float)(1080 - num), 390f, (float)num), "CorpseJuggler v1.0.1 by Daioutzu", val);
			}
		}
	}
}