Decompiled source of MoveBindings v1.0.0

MoveBindings/MoveBindings.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using FastScale.Patches;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Placing;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoveBindings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0659acc3f72cf27ee3b6468ad06430c99e9ed258")]
[assembly: AssemblyProduct("MoveBindings")]
[assembly: AssemblyTitle("MoveBindings")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace FastScale
{
	[BepInPlugin("Endskill.ScaleExpander", "ScaleExpander", "1.0.0")]
	public class BepinexLoader : BaseUnityPlugin
	{
		public const string MODNAME = "ScaleExpander";

		public const string AUTHOR = "Endskill";

		public const string GUID = "Endskill.ScaleExpander";

		public const string VERSION = "1.0.0";

		private Transform _currentObject;

		private ConfigEntry<bool> _slowPc;

		public static Harmony ScaleExpanderHarmony { get; } = new Harmony("ScaleExpander");


		public static ManualLogSource Log { get; set; }

		public static GameObject CurrentSelectedObject { get; set; }

		public void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			ScaleExpanderHarmony.PatchAll(typeof(ObjectSelectingPatches));
			Object.DontDestroyOnLoad((Object)(object)this);
			_slowPc = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance", "60 UpdateCycles", false, "If set to true, check for keys 60 times a second instead of every frame. Might be better for games running slower than 60fps.");
		}

		public void Update()
		{
			if (Input.GetKeyDown((KeyCode)271) || Input.GetKeyDown((KeyCode)305))
			{
				_currentObject = CurrentSelectedObject.transform;
				LogManager.Message("New object selected " + ((Object)_currentObject).name);
			}
			if (!_slowPc.Value)
			{
				CustomUpdate();
			}
		}

		public void FixedUpdate()
		{
			if (_slowPc.Value)
			{
				CustomUpdate();
			}
		}

		private void CustomUpdate()
		{
			//IL_0073: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00b0: 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)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_0564: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_064d: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0691: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			if (_currentObject == null)
			{
				return;
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)261,
				(KeyCode)121
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)261,
				(KeyCode)121
			}))
			{
				Vector3 localPosition = ((Component)_currentObject).transform.localPosition;
				LogManager.Message($"Keypad 5 while _object not null, before change: {localPosition.x} {localPosition.y} {localPosition.z}");
				_currentObject.localPosition = new Vector3(localPosition.x + 0.005f, localPosition.y, localPosition.z);
				localPosition = _currentObject.localPosition;
				LogManager.Message($"Keypad 5 while _object not null, before change: {localPosition.x} {localPosition.y} {localPosition.z}");
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)259,
				(KeyCode)103
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)259,
				(KeyCode)103
			}))
			{
				Vector3 localPosition2 = ((Component)_currentObject).transform.localPosition;
				_currentObject.localPosition = new Vector3(localPosition2.x, localPosition2.y, localPosition2.z + 0.005f);
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)258,
				(KeyCode)104
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)258,
				(KeyCode)104
			}))
			{
				Vector3 localPosition3 = ((Component)_currentObject).transform.localPosition;
				_currentObject.localPosition = new Vector3(localPosition3.x - 0.005f, localPosition3.y, localPosition3.z);
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)257,
				(KeyCode)106
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)257,
				(KeyCode)106
			}))
			{
				Vector3 localPosition4 = ((Component)_currentObject).transform.localPosition;
				_currentObject.localPosition = new Vector3(localPosition4.x, localPosition4.y, localPosition4.z - 0.005f);
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)265,
				(KeyCode)105
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)265,
				(KeyCode)105
			}))
			{
				Vector3 localPosition5 = ((Component)_currentObject).transform.localPosition;
				_currentObject.localPosition = new Vector3(localPosition5.x, localPosition5.y + 0.005f, localPosition5.z);
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)262,
				(KeyCode)107
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)262,
				(KeyCode)107
			}))
			{
				Vector3 localPosition6 = ((Component)_currentObject).transform.localPosition;
				_currentObject.localPosition = new Vector3(localPosition6.x, localPosition6.y - 0.005f, localPosition6.z);
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)263,
				(KeyCode)111
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)263,
				(KeyCode)111
			}))
			{
				Vector3 localScale = ((Component)_currentObject).transform.localScale;
				_currentObject.localScale = new Vector3(localScale.x + 0.3f, localScale.y + 0.3f, localScale.z + 0.3f);
			}
			if (BothPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)303,
				(KeyCode)256
			}, (KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)260,
				(KeyCode)108
			}) || CheckPressed((KeyCode[])(object)new KeyCode[2]
			{
				(KeyCode)260,
				(KeyCode)108
			}))
			{
				Vector3 localScale2 = ((Component)_currentObject).transform.localScale;
				_currentObject.localScale = new Vector3(localScale2.x - 0.3f, localScale2.y - 0.3f, localScale2.z - 0.3f);
			}
			if (CheckPressed((KeyCode[])(object)new KeyCode[1] { (KeyCode)273 }))
			{
				Vector3 eulerAngles = ((Component)_currentObject).transform.eulerAngles;
				_currentObject.eulerAngles = new Vector3(0f, eulerAngles.y, eulerAngles.z + 5f);
			}
			if (CheckPressed((KeyCode[])(object)new KeyCode[1] { (KeyCode)275 }))
			{
				Vector3 eulerAngles2 = ((Component)_currentObject).transform.eulerAngles;
				if (eulerAngles2.z % 180f != 0f)
				{
					_currentObject.eulerAngles = new Vector3(eulerAngles2.x, eulerAngles2.y, 0f);
				}
				_currentObject.Rotate(5f, 0f, 0f);
			}
			if (CheckPressed((KeyCode[])(object)new KeyCode[1] { (KeyCode)274 }))
			{
				Vector3 eulerAngles3 = ((Component)_currentObject).transform.eulerAngles;
				_currentObject.eulerAngles = new Vector3(0f, eulerAngles3.y, eulerAngles3.z - 5f);
			}
			if (CheckPressed((KeyCode[])(object)new KeyCode[1] { (KeyCode)276 }))
			{
				Vector3 eulerAngles4 = ((Component)_currentObject).transform.eulerAngles;
				if (eulerAngles4.z % 180f != 0f)
				{
					_currentObject.eulerAngles = new Vector3(eulerAngles4.x, eulerAngles4.y, 0f);
				}
				_currentObject.Rotate(-5f, 0f, 0f);
			}
		}

		private bool BothPressed(KeyCode[] firstButton, KeyCode[] second)
		{
			return firstButton.Select((KeyCode x) => Input.GetKey(x)).Any((bool x) => x) && second.Select((KeyCode x) => Input.GetKey(x)).Any((bool x) => x);
		}

		private bool CheckPressed(KeyCode[] button)
		{
			return button.Select((KeyCode x) => Input.GetKeyDown(x)).Any((bool x) => x);
		}
	}
	internal static class LogManager
	{
		private static readonly ManualLogSource logger;

		static LogManager()
		{
			logger = BepinexLoader.Log;
		}

		public static void Verbose(object msg)
		{
			logger.LogInfo(msg);
		}

		public static void Debug(object msg)
		{
			logger.LogDebug(msg);
		}

		public static void Message(object msg)
		{
			logger.LogMessage(msg);
		}

		public static void Error(object msg)
		{
			logger.LogError(msg);
		}

		public static void Warn(object msg)
		{
			logger.LogWarning(msg);
		}
	}
}
namespace FastScale.Patches
{
	[HarmonyPatch(typeof(ObjectSelecting))]
	public static class ObjectSelectingPatches
	{
		[HarmonyPatch("SelectObject")]
		[HarmonyPostfix]
		public static void SelectObjectPostfix(ObjectSelecting __instance)
		{
			BepinexLoader.CurrentSelectedObject = __instance._selectedObject;
			GameObject currentSelectedObject = BepinexLoader.CurrentSelectedObject;
			LogManager.Message("New object selected " + (((currentSelectedObject != null) ? ((Object)currentSelectedObject).name : null) ?? "null"));
		}
	}
}