Decompiled source of DisplayCoordinates v1.0.2

DisplayCoordinates.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
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: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("DisplayCoordinates")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Displays player's coordinates")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+68ab6881c3f0182838b3614955d45e0c29f5f98a")]
[assembly: AssemblyProduct("DisplayCoordinates")]
[assembly: AssemblyTitle("DisplayCoordinates")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.0")]
[module: UnverifiableCode]
[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 DisplayCoordinates
{
	internal class PlayerCoordinatesBox : MonoBehaviour
	{
		private void OnGUI()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.box);
			val.fontSize = Plugin.fontSize;
			val.normal.textColor = Color.white;
			GUILayout.BeginArea(Plugin.layoutRect);
			GUILayout.Box(Plugin.name, val, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.Box($"x: {Plugin.coords.x:0.00}  y: {Plugin.coords.y:0.00}  z: {Plugin.coords.z:0.00}", val, (Il2CppReferenceArray<GUILayoutOption>)null);
			GUILayout.EndArea();
		}
	}
	[BepInPlugin("DisplayCoordinates", "DisplayCoordinates", "1.0.2")]
	public class Plugin : BasePlugin
	{
		internal readonly Harmony harmony = new Harmony("DisplayCoordinates");

		internal static ManualLogSource mls;

		internal static Vector3 coords;

		internal static string name = "Join the world to see coordinates";

		internal static Rect layoutRect;

		internal static int fontSize;

		public override void Load()
		{
			//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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			harmony.PatchAll(typeof(Plugin));
			mls = ((BasePlugin)this).Log;
			int value = ((BasePlugin)this).Config.Bind<int>("UI", "x", 0, "X position of coordinates box").Value;
			int value2 = ((BasePlugin)this).Config.Bind<int>("UI", "y", 0, "Y position of coordinates box").Value;
			int value3 = ((BasePlugin)this).Config.Bind<int>("UI", "width", 250, "width of coordinates box").Value;
			int value4 = ((BasePlugin)this).Config.Bind<int>("UI", "height", 50, "height of coordinates box").Value;
			fontSize = ((BasePlugin)this).Config.Bind<int>("UI", "fontSize", 14, "Font size of coordinates").Value;
			layoutRect = new Rect((float)value, (float)value2, (float)value3, (float)value4);
			IL2CPPChainloader.AddUnityComponent<PlayerCoordinatesBox>();
			GameObject val = new GameObject();
			val.AddComponent<PlayerCoordinatesBox>();
			Object.DontDestroyOnLoad((Object)(object)val);
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("DisplayCoordinates");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val2);
		}

		[HarmonyPatch(typeof(PlayerNetwork), "Update")]
		[HarmonyPrefix]
		private static void Update(PlayerNetwork __instance)
		{
			//IL_0020: 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)
			if (!__instance.NetworkInstantiated)
			{
				name = __instance.CharacterName;
				coords = __instance.PlayerSync.PlayerWorldPosition;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "DisplayCoordinates";

		public const string PLUGIN_NAME = "DisplayCoordinates";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}