Decompiled source of DSPCompass v0.0.6

DSPCompass.dll

Decompiled 9 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.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace DSPCompass;

[BepInPlugin("Appun.DSP.plugin.Compass", "DSPCompass", "0.0.6")]
[BepInProcess("DSPGAME.exe")]
[HarmonyPatch]
public class Main : BaseUnityPlugin
{
	public class CreateTriangleMeshRed : MonoBehaviour
	{
		private void Start()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			List<Vector3> vertices = new List<Vector3>
			{
				new Vector3(-0.5f, 0f, 4.3f),
				new Vector3(0f, 0f, 5.3f),
				new Vector3(0.5f, 0f, 4.3f),
				new Vector3(-0.4f, 0f, 5.5f),
				new Vector3(-0.4f, 0f, 6.3f),
				new Vector3(-0.2f, 0f, 5.5f),
				new Vector3(-0.2f, 0f, 6.3f),
				new Vector3(0.4f, 0f, 5.5f),
				new Vector3(0.4f, 0f, 6.3f),
				new Vector3(0.2f, 0f, 5.5f),
				new Vector3(0.2f, 0f, 6.3f),
				new Vector3(0f, 0f, 4.6f),
				new Vector3(-0.2f, 0f, 6f),
				new Vector3(0.2f, 0f, 5.8f)
			};
			val.SetVertices(vertices);
			List<int> list = new List<int>
			{
				0, 1, 11, 11, 1, 2, 3, 4, 5, 4,
				6, 5, 7, 9, 8, 8, 9, 10, 6, 9,
				12, 6, 13, 9
			};
			val.SetTriangles(list, 0);
			MeshFilter component = ((Component)this).GetComponent<MeshFilter>();
			component.mesh = val;
			MeshRenderer component2 = ((Component)this).GetComponent<MeshRenderer>();
			((Renderer)component2).material.color = Color.red;
			((Renderer)component2).material.EnableKeyword("_EMISSION");
			((Renderer)component2).material.SetColor("_EmissionColor", Color.red);
			((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component2).receiveShadows = false;
		}
	}

	public class CreateTriangleMeshBlue : MonoBehaviour
	{
		private void Start()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			Mesh val = new Mesh();
			List<Vector3> vertices = new List<Vector3>
			{
				new Vector3(-0.5f, 0f, 4.3f),
				new Vector3(0f, 0f, 5.3f),
				new Vector3(0.5f, 0f, 4.3f),
				new Vector3(-0.4f, 0f, 5.5f),
				new Vector3(-0.4f, 0f, 6.3f),
				new Vector3(-0.2f, 0f, 5.5f),
				new Vector3(-0.2f, 0f, 6.3f),
				new Vector3(0.4f, 0f, 5.5f),
				new Vector3(0.4f, 0f, 6.3f),
				new Vector3(0.2f, 0f, 5.5f),
				new Vector3(0.2f, 0f, 6.3f),
				new Vector3(0f, 0f, 4.6f),
				new Vector3(-0.2f, 0f, 6f),
				new Vector3(0.2f, 0f, 5.8f)
			};
			val.SetVertices(vertices);
			List<int> list = new List<int>
			{
				0, 1, 11, 11, 1, 2, 3, 4, 5, 4,
				6, 5, 7, 9, 8, 8, 9, 10, 6, 9,
				12, 6, 13, 9
			};
			val.SetTriangles(list, 0);
			MeshFilter component = ((Component)this).GetComponent<MeshFilter>();
			component.mesh = val;
			MeshRenderer component2 = ((Component)this).GetComponent<MeshRenderer>();
			((Renderer)component2).material.color = Color.blue;
			((Renderer)component2).material.EnableKeyword("_EMISSION");
			((Renderer)component2).material.SetColor("_EmissionColor", Color.blue);
			((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component2).receiveShadows = false;
		}
	}

	public static GameObject ArrowRed;

	public static GameObject ArrowBlue;

	public static GameObject ArrowBase;

	public void Start()
	{
		LogManager.Logger = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}

	public void Update()
	{
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Expected O, but got Unknown
		//IL_01ee: 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_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Expected O, but got Unknown
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Expected O, but got Unknown
		//IL_0306: Unknown result type (might be due to invalid IL or missing references)
		//IL_032f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: 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)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: 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_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)DSPGame.Game == (Object)null || DSPGame.Game.isMenuDemo || !GameMain.isRunning)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)ArrowBase))
		{
			if (GameMain.localPlanet != null && !GameMain.data.mainPlayer.sailing && (!UIRoot.instance.uiGame.hideAllUI0 || !UIRoot.instance.uiGame.hideAllUI0))
			{
				GameObject gameObject = GameMain.data.mainPlayer.gameObject;
				if (gameObject.activeSelf)
				{
					PlayerController controller = GameMain.data.mainPlayer.controller;
					if (!controller.gameData.hidePlayerModel)
					{
						Plane val = default(Plane);
						((Plane)(ref val))..ctor(gameObject.transform.up, gameObject.transform.position);
						Vector3 val2 = default(Vector3);
						((Vector3)(ref val2))..ctor(0f, GameMain.data.localPlanet.realRadius, 0f);
						Vector3 val3 = ((Plane)(ref val)).ClosestPointOnPlane(val2);
						ArrowBase.transform.localPosition = new Vector3(0f, 0.8f, 0f);
						Vector3 forward = val3 - gameObject.transform.position;
						ArrowBase.transform.forward = forward;
						ArrowBase.gameObject.SetActive(true);
					}
				}
			}
			else
			{
				ArrowBase.gameObject.SetActive(false);
			}
		}
		else
		{
			GameObject gameObject2 = GameMain.data.mainPlayer.gameObject;
			ArrowBase = new GameObject("ArrowBase");
			ArrowBase.transform.parent = gameObject2.transform;
			ArrowBase.transform.localPosition = new Vector3(0f, 0f, 0f);
			ArrowBase.transform.localScale = new Vector3(1f, 1f, 1f);
			ArrowRed = new GameObject("ArrowRed");
			ArrowRed.transform.parent = ArrowBase.transform;
			ArrowRed.AddComponent<CreateTriangleMeshRed>();
			ArrowRed.AddComponent<MeshRenderer>();
			ArrowRed.AddComponent<MeshFilter>();
			ArrowRed.transform.localPosition = new Vector3(0f, 0f, 0f);
			ArrowRed.SetActive(true);
			ArrowBlue = new GameObject("ArrowBlue");
			ArrowBlue.transform.parent = ArrowBase.transform;
			ArrowBlue.AddComponent<CreateTriangleMeshBlue>();
			ArrowBlue.AddComponent<MeshRenderer>();
			ArrowBlue.AddComponent<MeshFilter>();
			ArrowBlue.SetActive(true);
			ArrowBlue.transform.localPosition = new Vector3(0f, 0f, 0f);
			ArrowBlue.transform.localRotation = new Quaternion(0f, 0f, 180f, 0f);
		}
	}
}
public class LogManager
{
	public static ManualLogSource Logger;
}