Decompiled source of TeleporterDistanceIndicator v1.0.0

TeleporterDistanceIndicator.dll

Decompiled 12 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using RoR2;
using RoR2.UI;
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("TeleporterDistanceIndicator")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TeleporterDistanceIndicator")]
[assembly: AssemblyTitle("TeleporterDistanceIndicator")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TeleporterTrackerMod;

[BepInPlugin("com.ampck.teleporterdistanceindicator", "Teleporter Distance Indicator", "1.0.0")]
public class TeleporterTrackerPlugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.ampck.teleporterdistanceindicator");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Teleporter Tracker Loaded Successfully!");
	}
}
[HarmonyPatch(typeof(ObjectiveTracker), "GenerateString")]
public class TeleporterObjectiveStringPatch
{
	private static void Postfix(ObjectiveTracker __instance, ref string __result)
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		if (((object)__instance).GetType().Name == "FindTeleporterObjectiveTracker" && (Object)(object)TeleporterInteraction.instance != (Object)null)
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedBody != (Object)null)
			{
				float num = Vector3.Distance(firstLocalUser.cachedBody.corePosition, ((Component)TeleporterInteraction.instance).transform.position);
				__result = $"{__result} ({Mathf.RoundToInt(num)}m)";
			}
		}
	}
}
[HarmonyPatch(typeof(ObjectiveTracker), "IsDirty")]
public class TeleporterObjectiveDirtyPatch
{
	private static void Postfix(ObjectiveTracker __instance, ref bool __result)
	{
		if (((object)__instance).GetType().Name == "FindTeleporterObjectiveTracker")
		{
			__result = true;
		}
	}
}