Decompiled source of DSPBetterMove v0.0.6

DSPBetterMove.dll

Decompiled 5 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("DSPBetterMove")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.4")]
[assembly: AssemblyInformationalVersion("0.0.4")]
[assembly: AssemblyProduct("DSPBetterMove")]
[assembly: AssemblyTitle("DSPBetterMove")]
[assembly: NeutralResourcesLanguage("0.0.4")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("0.0.4.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace DSPBetterMove
{
	[BepInPlugin("redhot.plugin.DSPBetterMove", "DSPBetterMove", "0.0.0.6")]
	public class DSPBetterMove : BaseUnityPlugin
	{
		private const string PluginGuid = "redhot.plugin.DSPBetterMove";

		private const string PluginName = "DSPBetterMove";

		private const string PluginVersion = "0.0.0.6";

		private Harmony _harmony;

		private static Vector3 _dragBeginMousePosition;

		private static RaycastHit _hitInfo;

		private static bool _hit;

		private static ConfigEntry<bool> _isDefault;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			_harmony = new Harmony("redhot.plugin.DSPBetterMove");
			_harmony.PatchAll(typeof(DSPBetterMove));
			_isDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "checkLabel", false, "false only)");
			Debug.Log((object)_isDefault.Value);
			Debug.Log((object)"DSPBetterMove started!");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerController), "GameTick")]
		private static void PlayerControllerGameTick_Postfix(long time)
		{
			//IL_0021: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_008e: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			if (!((ManualBehaviour)UIRoot.instance.uiGame.globemap).active)
			{
				return;
			}
			if (VFInput._rtsMove.onDown)
			{
				_dragBeginMousePosition = Input.mousePosition;
				if ((Object)(object)Camera.main != (Object)null)
				{
					_hit = Physics.Raycast(Camera.main.ScreenPointToRay(_dragBeginMousePosition), ref _hitInfo, 800f, 8720, (QueryTriggerInteraction)2);
				}
			}
			else if (VFInput._rtsMove.onUp)
			{
				Vector3 val = _dragBeginMousePosition - Input.mousePosition;
				if ((double)((Vector3)(ref val)).sqrMagnitude < 800.0 && _hit)
				{
					GameMain.data.mainPlayer.Order(OrderNode.MoveTo(((RaycastHit)(ref _hitInfo)).point), InputValue.op_Implicit(VFInput._multiOrdering));
					RTSTargetGizmo.Create(((RaycastHit)(ref _hitInfo)).point);
					_hit = false;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIVersionText), "Refresh")]
		public static void RefreshPrefix(UIVersionText __instance)
		{
			if ((Object)(object)__instance.textComp != (Object)null && _isDefault.Value)
			{
				__instance.textComp.text = string.Empty;
			}
		}

		private void OnDestroy()
		{
			Debug.Log((object)"Destroying BGM ;)");
			AssetBundle.UnloadAllAssetBundles(true);
			_harmony.UnpatchSelf();
		}
	}
}