Decompiled source of PingEverything v3.0.1

Localia.PingEverything.dll

Decompiled 2 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.Logging;
using BepInEx.Unity.IL2CPP;
using Enemies;
using Globals;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Player;
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("PingEverything")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PingEverything")]
[assembly: AssemblyTitle("PingEverything")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 PingEverything
{
	[BepInPlugin("Localia.PingEverything", "PingEverything", "3.0.1")]
	public class EntryPoint : BasePlugin
	{
		private Harmony m_Harmony;

		public override void Load()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			m_Harmony = new Harmony("Localia.PingEverything");
			m_Harmony.PatchAll();
		}
	}
	internal static class Logs
	{
		private static readonly ManualLogSource _logger;

		static Logs()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			_logger = new ManualLogSource("Localia.PingEve");
			Logger.Sources.Add((ILogSource)(object)_logger);
		}

		private static string Format(object msg)
		{
			return msg.ToString();
		}

		public static void Info(object data)
		{
			_logger.LogMessage((object)Format(data));
		}

		public static void Verbose(object data)
		{
			_logger.LogDebug((object)Format(data));
		}

		public static void Debug(object data)
		{
			_logger.LogDebug((object)Format(data));
		}

		public static void Error(object data)
		{
			_logger.LogError((object)Format(data));
		}
	}
	[HarmonyPatch(typeof(LocalPlayerAgent), "UpdateGlobalInput")]
	internal static class Patch_PlayerAgent
	{
		public static float extdelay;

		public static bool Prefix(LocalPlayerAgent __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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: Invalid comparison between Unknown and I4
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: 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)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Invalid comparison between Unknown and I4
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKey(__instance.m_ffKey1) && Input.GetKeyDown(__instance.m_ffKey2))
			{
				return true;
			}
			if (FocusStateManager.MapToggleAllowed && InputMapper.GetButtonDown.Invoke((InputAction)33, (eFocusState)0))
			{
				return true;
			}
			if (FocusStateManager.MapToggleAllowed && InputMapper.GetButtonDown.Invoke((InputAction)34, (eFocusState)0))
			{
				return true;
			}
			if ((Global.ForceAllowF12 || FocusStateManager.MenuToggleAllowed) && InputMapper.GetButtonDown.Invoke((InputAction)36, (eFocusState)0))
			{
				return true;
			}
			if (InputMapper.GetButtonDown.Invoke((InputAction)62, (eFocusState)0))
			{
				return true;
			}
			if ((int)FocusStateManager.Current.m_currentState == 6)
			{
				return false;
			}
			if (!InputMapper.GetButtonDown.Invoke((InputAction)58, ((PlayerAgent)__instance).InputFilter))
			{
				return true;
			}
			if (GuiManager.PlayerMarkerIsVisibleAndInFocus((PlayerAgent)(object)__instance))
			{
				GuiManager.AttemptSetPlayerPingStatus((PlayerAgent)(object)__instance, false, default(Vector3), (eNavMarkerStyle)1);
			}
			else
			{
				bool flag = false;
				RaycastHit val = default(RaycastHit);
				if (!flag && (Clock.Time > extdelay || extdelay - Clock.Time > 3f) && Physics.Raycast(__instance.CamPos, ((PlayerAgent)__instance).FPSCamera.Forward, ref val, 11f, LayerManager.MASK_BULLETWEAPON_RAY, (QueryTriggerInteraction)1))
				{
					GameObject gameObject = ((Component)((Component)((RaycastHit)(ref val)).collider).transform).gameObject;
					EnemyAgent componentInParent = gameObject.GetComponentInParent<EnemyAgent>();
					if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.Locomotion.CurrentStateEnum == 14 && !((Object)componentInParent).name.Contains("Shadow"))
					{
						PlayerPingTarget val2 = gameObject.AddComponent<PlayerPingTarget>();
						val2.m_pingTargetStyle = (eNavMarkerStyle)2;
						__instance.m_pingTarget = gameObject.GetComponent<iPlayerPingTarget>();
						__instance.m_pingPos = ((RaycastHit)(ref val)).point;
						if (__instance.m_pingTarget != null && (__instance.m_pingTarget != __instance.m_lastPingedTarget || Clock.Time > __instance.m_pingAgainTimer))
						{
							((PlayerAgent)__instance).TriggerMarkerPing(__instance.m_pingTarget, ((Component)((RaycastHit)(ref val)).transform).gameObject, __instance.m_pingPos);
							__instance.m_pingAgainTimer = Clock.Time + 0.5f;
							__instance.m_lastPingedTarget = __instance.m_pingTarget;
							flag = true;
							extdelay = Clock.Time + 0.5f;
						}
						Object.Destroy((Object)(object)gameObject.GetComponent<PlayerPingTarget>());
					}
				}
				if (!flag && Physics.Raycast(__instance.CamPos, ((PlayerAgent)__instance).FPSCamera.Forward, ref val, 40f, LayerManager.MASK_PING_TARGET, (QueryTriggerInteraction)1))
				{
					__instance.m_pingTarget = ((Component)((RaycastHit)(ref val)).collider).GetComponentInChildren<iPlayerPingTarget>();
					__instance.m_pingPos = ((RaycastHit)(ref val)).point;
					if (__instance.m_pingTarget != null && (__instance.m_pingTarget != __instance.m_lastPingedTarget || Clock.Time > __instance.m_pingAgainTimer))
					{
						flag = true;
						((PlayerAgent)__instance).TriggerMarkerPing(__instance.m_pingTarget, ((Component)((RaycastHit)(ref val)).transform).gameObject, __instance.m_pingPos);
						__instance.m_pingAgainTimer = Clock.Time + 0.5f;
						__instance.m_lastPingedTarget = __instance.m_pingTarget;
						extdelay = Clock.Time + 0.5f;
					}
				}
				if (!flag && (Clock.Time > extdelay || extdelay - Clock.Time > 3f) && Physics.Raycast(__instance.CamPos, ((PlayerAgent)__instance).FPSCamera.Forward, ref val, 40f, LayerManager.MASK_DEFAULT, (QueryTriggerInteraction)1))
				{
					GameObject gameObject2 = ((Component)((Component)((RaycastHit)(ref val)).collider).transform).gameObject;
					if (!((Object)(object)gameObject2.GetComponent<PlayerPingTarget>() != (Object)null))
					{
						PlayerPingTarget val3 = gameObject2.AddComponent<PlayerPingTarget>();
						__instance.m_pingTarget = gameObject2.GetComponent<iPlayerPingTarget>();
						__instance.m_pingPos = ((RaycastHit)(ref val)).point;
						if (__instance.m_pingTarget != null && (__instance.m_pingTarget != __instance.m_lastPingedTarget || Clock.Time > __instance.m_pingAgainTimer))
						{
							((PlayerAgent)__instance).TriggerMarkerPing(__instance.m_pingTarget, ((Component)((RaycastHit)(ref val)).transform).gameObject, __instance.m_pingPos);
							__instance.m_pingAgainTimer = Clock.Time + 0.5f;
							__instance.m_lastPingedTarget = __instance.m_pingTarget;
							flag = true;
							extdelay = Clock.Time + 0.5f;
						}
						Object.Destroy((Object)(object)gameObject2.GetComponent<PlayerPingTarget>());
					}
				}
				if (!flag)
				{
					GuiManager.CrosshairLayer.PopAngryPingIndicator();
				}
			}
			return false;
		}
	}
}