Decompiled source of Ant Man v1.0.1

Antman.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BoplFixedMath;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Utilities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("54c5e5dc-6fbc-469c-8637-47964d72e6e5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.campdjc.ant-man", "Ant Man", "1.0.0")]
public class AntManPlugin : BaseUnityPlugin
{
	private static Fix MouseFactor = (Fix)0.5;

	private static Fix GamepadFactor = (Fix)0.03;

	private void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Ant Man 1.0 loaded");
	}

	private void Update()
	{
		UpdateLocal();
	}

	private static void UpdateLocal()
	{
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0140: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		PlayerHandler obj = PlayerHandler.Get();
		List<Player> list = ((obj != null) ? obj.PlayerList() : null);
		if (list == null)
		{
			return;
		}
		foreach (Player item in list)
		{
			if (item == null)
			{
				continue;
			}
			if (item.UsesKeyboardAndMouse)
			{
				float y = ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y;
				if (y > 0f)
				{
					item.Scale += MouseFactor;
				}
				else if (y < 0f)
				{
					item.Scale -= MouseFactor;
				}
				if (((ButtonControl)Keyboard.current[(Key)20]).wasPressedThisFrame)
				{
					item.Scale = Fix.One;
				}
			}
			else
			{
				Enumerator<Gamepad> enumerator2 = Gamepad.all.GetEnumerator();
				try
				{
					while (enumerator2.MoveNext())
					{
						Gamepad current2 = enumerator2.Current;
						if (item.inputDevice.deviceId == ((InputDevice)current2).deviceId)
						{
							float num = ((InputControl<float>)(object)current2.rightTrigger).ReadValue() - ((InputControl<float>)(object)current2.leftTrigger).ReadValue();
							item.Scale += GamepadFactor * (Fix)num;
							if (current2.leftStickButton.isPressed)
							{
								item.Scale = Fix.One;
							}
						}
					}
				}
				finally
				{
					((IDisposable)enumerator2).Dispose();
				}
			}
			item.Scale = Fix.Max(item.Scale, (Fix)0.01f);
		}
	}
}