Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalPing v1.2.4
BepInEx/plugins/LethalPing.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BiggerLobby; using GameNetcodeStuff; using HarmonyLib; using LC_API.ServerAPI; using LethalCompanyInputUtils.Api; using LethalPing.Patches; using MoreCompany; using Newtonsoft.Json; using Steamworks.Data; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [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("LethalPing")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b0b85a090cae8e344a22016d72c34831d8fe6f75")] [assembly: AssemblyProduct("LethalPing")] [assembly: AssemblyTitle("LethalPing")] [assembly: AssemblyVersion("1.0.0.0")] namespace LethalPing { [JsonObject] internal class LocationPing { [JsonProperty] public string pingUsername { get; set; } [JsonProperty] public string pingText { get; set; } [JsonProperty] public Vector3 pingPosition { get; set; } [JsonProperty] public double pingLifetime { get; set; } [JsonProperty] public int nodeType { get; set; } [JsonProperty] public ulong clientId { get; set; } } [JsonObject] internal class ObjectPing { [JsonProperty] public string pingUsername { get; set; } [JsonProperty] public string pingText { get; set; } [JsonProperty] public ulong networkObjId { get; set; } [JsonProperty] public double pingLifetime { get; set; } [JsonProperty] public int nodeType { get; set; } [JsonProperty] public ulong clientId { get; set; } } public class PingController { public Dictionary<ulong, PingElement> pings = new Dictionary<ulong, PingElement>(); public static PingController Instance { get; private set; } public PingController() { Instance = this; handleIncomingPing(); } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] public static void CreatePingElements(StartOfRound __instance) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogInfo((object)"Creating PingElements..."); } int num = 0; while (true) { int num2 = num; Lobby value = GameNetworkManager.Instance.currentLobby.Value; if (num2 < ((Lobby)(ref value)).MaxMembers) { Instance.pings[Convert.ToUInt64(num)] = new PingElement(); num++; continue; } break; } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPrefix] public static void Uninstantiate() { Instance.pings = new Dictionary<ulong, PingElement>(); } [HarmonyPatch(typeof(StartOfRound), "StartGame")] [HarmonyPostfix] public static void clearPingsOnSceneChange() { foreach (KeyValuePair<ulong, PingElement> ping in Instance.pings) { ping.Value.pingLifetime = 0.0; ((Component)HUDManagerPatch.pingElements[ping.Key]).gameObject.SetActive(false); } } private void handleIncomingPing() { Networking.GetString = delegate(string message, string signature) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogInfo((object)(signature + " Received message: " + message)); } if (signature.Equals("location_ping")) { LocationPing locationPing = JsonConvert.DeserializeObject<LocationPing>(message); if (locationPing == null) { if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogWarning((object)"Failed to parse ping data"); } } else { if (LethalPingPlugin.debugLogs.Value) { ManualLogSource mls = LethalPingPlugin.mls; object[] obj = new object[4] { locationPing.pingUsername, locationPing.pingText, null, null }; Vector3 pingPosition = locationPing.pingPosition; obj[2] = ((object)(Vector3)(ref pingPosition)).ToString(); obj[3] = locationPing.pingLifetime; mls.LogMessage((object)string.Format("Received ping from {0} containing {1} at {2} until {3}", obj)); } pings[locationPing.clientId].pingUsername = locationPing.pingUsername; pings[locationPing.clientId].pingText = locationPing.pingText; pings[locationPing.clientId].pingPosition = locationPing.pingPosition; pings[locationPing.clientId].pingLifetime = locationPing.pingLifetime; pings[locationPing.clientId].nodeType = locationPing.nodeType; ((Component)HUDManagerPatch.pingElements[locationPing.clientId]).gameObject.SetActive(false); } } else if (signature.Equals("object_ping")) { ObjectPing objectPing = JsonConvert.DeserializeObject<ObjectPing>(message); if (objectPing == null) { if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogWarning((object)"Failed to parse ping data"); } } else { if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogMessage((object)$"Received ping from {objectPing.pingUsername} containing {objectPing.pingText} referencing objectId {objectPing.networkObjId} until {objectPing.pingLifetime}"); } pings[objectPing.clientId].pingUsername = objectPing.pingUsername; pings[objectPing.clientId].pingText = objectPing.pingText; pings[objectPing.clientId].pingLifetime = objectPing.pingLifetime; pings[objectPing.clientId].nodeType = objectPing.nodeType; pings[objectPing.clientId].isAttachedToObj = objectPing.networkObjId != 0L; pings[objectPing.clientId].attachedNode = ((objectPing.networkObjId == 0L) ? null : findObjectById(objectPing.networkObjId)); ((Component)HUDManagerPatch.pingElements[objectPing.clientId]).gameObject.SetActive(false); } } }; } public void setLocationPing(Vector3 position, double lifetime, string username, string text, int nodeType, ulong clientId) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) pings[clientId].pingPosition = position; pings[clientId].pingLifetime = lifetime; pings[clientId].pingUsername = username; pings[clientId].pingText = text; pings[clientId].nodeType = nodeType; Networking.Broadcast(JsonConvert.SerializeObject((object)new LocationPing { pingPosition = pings[clientId].pingPosition, pingLifetime = pings[clientId].pingLifetime, pingUsername = pings[clientId].pingUsername, pingText = pings[clientId].pingText, nodeType = pings[clientId].nodeType, clientId = clientId }, (Formatting)0, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), "location_ping"); if (LethalPingPlugin.debugLogs.Value) { ManualLogSource mls = LethalPingPlugin.mls; Vector3 pingPosition = pings[clientId].pingPosition; mls.LogMessage((object)$"Sending ping at {((object)(Vector3)(ref pingPosition)).ToString()} until {pings[clientId].pingLifetime}"); } } public void setObjectPing(GameObject refObj, double lifetime, string username, string text, int nodeType, ulong clientId) { pings[clientId].pingUsername = username; pings[clientId].pingText = text; pings[clientId].pingLifetime = lifetime; pings[clientId].attachedNode = refObj; pings[clientId].isAttachedToObj = true; pings[clientId].nodeType = nodeType; Networking.Broadcast(JsonConvert.SerializeObject((object)new ObjectPing { pingLifetime = pings[clientId].pingLifetime, pingUsername = pings[clientId].pingUsername, pingText = pings[clientId].pingText, networkObjId = (((Object)(object)refObj.GetComponent<NetworkObject>() != (Object)null) ? refObj.GetComponent<NetworkObject>().NetworkObjectId : 0), nodeType = pings[clientId].nodeType, clientId = clientId }), "object_ping"); if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogMessage((object)$"Sending object ping for object {(((Object)(object)refObj.GetComponent<NetworkObject>() != (Object)null) ? refObj.GetComponent<NetworkObject>().NetworkObjectId : 0)} until {lifetime}"); } } public static GameObject findObjectById(ulong networkId) { if (networkId == 0) { return null; } return ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[networkId]).gameObject; } public static PingElement getPing(ulong num) { return Instance.pings[num]; } } public class PingElement { public string pingUsername { get; set; } public string pingText { get; set; } public double pingLifetime { get; set; } public int nodeType { get; set; } public bool isAttachedToObj { get; set; } public int ObjHash { get; set; } public GameObject attachedNode { get; set; } public Vector3 pingPosition { get; set; } } public class PingInputClass : LcInputActions { public static PingInputClass Instance = new PingInputClass(); [InputAction("ping", "<Keyboard>/v", "", Name = "Ping")] public InputAction pingKey { get; set; } } [BepInPlugin("com.greyull.lethalping", "Lethal Ping", "1.2.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LethalPingPlugin : BaseUnityPlugin { private const string pluginGUID = "com.greyull.lethalping"; private const string pluginName = "Lethal Ping"; private const string pluginVersion = "1.2.3"; public static PingController pingController; public static ManualLogSource mls = Logger.CreateLogSource("com.greyull.lethalping"); public static bool initializing = true; public static ConfigFile config; public static ConfigEntry<bool> objPings; public static ConfigEntry<bool> plyPings; public static ConfigEntry<double> genericTime; public static ConfigEntry<double> scrapTime; public static ConfigEntry<double> enemyTime; public static ConfigEntry<double> playerTime; public static ConfigEntry<bool> debugLogs; private Harmony _harmony = new Harmony("com.greyull.lethalping"); private void Awake() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0036: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0065: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_009c: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00d3: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_010a: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0141: Expected O, but got Unknown //IL_0155: 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) //IL_0170: Expected O, but got Unknown //IL_0170: Expected O, but got Unknown config = ((BaseUnityPlugin)this).Config; objPings = config.Bind<bool>(new ConfigDefinition("General", "Object Pings Enabled"), true, new ConfigDescription("Whether or not object-type pings will be enabled, allowing ping position to move with the tagged object.", (AcceptableValueBase)null, Array.Empty<object>())); plyPings = config.Bind<bool>(new ConfigDefinition("General", "Player Pings Enabled"), true, new ConfigDescription("Whether or not player-type pings will be enabled, allowing you to ping other players.", (AcceptableValueBase)null, Array.Empty<object>())); genericTime = config.Bind<double>(new ConfigDefinition("Timings", "Generic Ping Duration"), 10.0, new ConfigDescription("Time in seconds that generic pings will last for.", (AcceptableValueBase)null, Array.Empty<object>())); scrapTime = config.Bind<double>(new ConfigDefinition("Timings", "Scrap Ping Duration"), 15.0, new ConfigDescription("Time in seconds that scrap pings will last for.", (AcceptableValueBase)null, Array.Empty<object>())); enemyTime = config.Bind<double>(new ConfigDefinition("Timings", "Enemy Ping Duration"), 30.0, new ConfigDescription("Time in seconds that enemy pings will last for.", (AcceptableValueBase)null, Array.Empty<object>())); playerTime = config.Bind<double>(new ConfigDefinition("Timings", "Player Ping Duration"), 15.0, new ConfigDescription("Time in seconds that player pings will last for.", (AcceptableValueBase)null, Array.Empty<object>())); debugLogs = config.Bind<bool>(new ConfigDefinition("Debug", "Debug Logging Enabled"), false, new ConfigDescription("Whether or not debug logs should be printed to console.", (AcceptableValueBase)null, Array.Empty<object>())); mls.LogInfo((object)"LethalPing Plugin Loaded"); _harmony.PatchAll(typeof(LethalPingPlugin)); _harmony.PatchAll(typeof(HUDManagerPatch)); _harmony.PatchAll(typeof(PlayerControllerPatch)); _harmony.PatchAll(typeof(PingController)); } private int GetPlayerCount() { try { return CheckForMoreCompany(); } catch (TypeLoadException) { try { return CheckForBiggerLobby(); } catch (TypeLoadException) { if (debugLogs.Value) { mls.LogMessage((object)"No larger lobby mods detected, playercount kept at default of 4..."); } return 4; } } } private int CheckForMoreCompany() { if (debugLogs.Value) { mls.LogMessage((object)$"MoreCompany detected, adjusting playercount to MoreCompany count {MainClass.newPlayerCount}..."); } return MainClass.newPlayerCount; } private int CheckForBiggerLobby() { if (debugLogs.Value) { mls.LogMessage((object)$"BiggerLobby detected, adjusting playercount to BiggerLobby count {Plugin.MaxPlayers}..."); } return Plugin.MaxPlayers; } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPrefix] private static void SpawnElements() { if (initializing) { pingController = new PingController(); initializing = false; } } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] private static void uninitialize() { initializing = true; pingController = null; } public static double GetCurTime() { return DateTime.UtcNow.ToOADate() * 86400.0; } } } namespace LethalPing.Patches { [HarmonyPatch] internal class HUDManagerPatch : MonoBehaviour { public static Dictionary<ulong, RectTransform> pingElements = new Dictionary<ulong, RectTransform>(); public static bool instantiating = true; [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] public static void NewScanElements() { //IL_0101: 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) if (!instantiating) { return; } if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogInfo((object)"Patching scanElements..."); } GameObject gameObject = ((Component)HUDManager.Instance.scanElements[0]).gameObject; Transform val = Object.Instantiate<Transform>(((Component)HUDManager.Instance.scanElements[0]).transform.parent, ((Transform)HUDManager.Instance.scanElements[0]).parent.parent); ((Object)val).name = "pingContainer"; for (int i = 0; i < val.childCount; i++) { Object.Destroy((Object)(object)((Component)val.GetChild(i)).gameObject); } val.SetSiblingIndex(10); int num = 0; while (true) { int num2 = num; Lobby value = GameNetworkManager.Instance.currentLobby.Value; if (num2 >= ((Lobby)(ref value)).MaxMembers) { break; } GameObject val2 = Object.Instantiate<GameObject>(gameObject, val); pingElements[Convert.ToUInt64(num)] = val2.GetComponent<RectTransform>(); ((Object)val2).name = "pingObject"; num++; } instantiating = false; } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPrefix] public static void Uninstantiate() { instantiating = true; } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPrefix] public static void RemoveScanElement(StartOfRound __instance, int playerObjectNumber, ulong clientId) { pingElements.Remove(clientId); } [HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")] [HarmonyPrefix] private static void updatePingElements(HUDManager __instance, PlayerControllerB playerScript) { //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); foreach (KeyValuePair<ulong, PingElement> ping in PingController.Instance.pings) { if (ping.Value.pingUsername == null || ((object)ping.Value.pingLifetime == null && ping.Value.pingLifetime == 0.0)) { continue; } if (LethalPingPlugin.GetCurTime() - ping.Value.pingLifetime < 0.0) { ((Component)pingElements[ping.Key]).gameObject.SetActive(true); TextMeshProUGUI[] componentsInChildren = ((Component)pingElements[ping.Key]).gameObject.GetComponentsInChildren<TextMeshProUGUI>(); ((TMP_Text)componentsInChildren[0]).text = ping.Value.pingUsername; ((TMP_Text)componentsInChildren[1]).text = ping.Value.pingText; ((Vector3)(ref val))..ctor(0f, 0f, 0f); float num = 1f; if (ping.Value.isAttachedToObj) { val = StartOfRound.Instance.localPlayerController.gameplayCamera.WorldToScreenPoint(ping.Value.attachedNode.transform.position); float num2 = Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController).transform.position, ping.Value.attachedNode.transform.position); if (!(num2 > 100f)) { num = ((!(num2 < 6f)) ? ((float)(1.0 / Math.Log(num2, 6.0))) : 1f); } else { ((Component)pingElements[ping.Key]).gameObject.SetActive(false); } } else { val = StartOfRound.Instance.localPlayerController.gameplayCamera.WorldToScreenPoint(ping.Value.pingPosition); float num2 = Vector3.Distance(((Component)StartOfRound.Instance.localPlayerController).transform.position, ping.Value.pingPosition); if (!(num2 > 100f)) { num = ((!(num2 < 6f)) ? ((float)(1.0 / Math.Log(num2, 6.0))) : 1f); } else { ((Component)pingElements[ping.Key]).gameObject.SetActive(false); } } pingElements[ping.Key].anchoredPosition = new Vector2(val.x - 439.48f, val.y - 244.8f); ((Transform)pingElements[ping.Key]).localScale = new Vector3(num, num, num); ((Component)pingElements[ping.Key]).GetComponent<Animator>().SetInteger("colorNumber", ping.Value.nodeType); if (val.z < 0f) { ((Component)pingElements[ping.Key]).gameObject.SetActive(false); } } else { ((Component)pingElements[ping.Key]).gameObject.SetActive(false); if (ping.Value.isAttachedToObj) { ping.Value.isAttachedToObj = false; } } } } } [Flags] public enum GameLayers { Default = 1, TransparentFX = 2, IgnoreRaycast = 4, Player = 8, Water = 0x10, UI = 0x20, Props = 0x40, HelmetVisor = 0x80, Room = 0x100, InteractableObject = 0x200, Foliage = 0x400, Colliders = 0x800, PhysicsObject = 0x1000, Triggers = 0x2000, MapRadar = 0x4000, NavigationSurface = 0x8000, RoomLight = 0x10000, Anomaly = 0x20000, LineOfSight = 0x40000, Enemies = 0x80000, PlayerRagdoll = 0x100000, MapHazards = 0x200000, ScanNode = 0x400000, EnemiesNotRendered = 0x800000, MiscLevelGeometry = 0x1000000, Terrain = 0x2000000, PlaceableShipobjects = 0x4000000, PlacementBlocker = 0x8000000, Railing = 0x10000000 } [HarmonyPatch] internal class PlayerControllerPatch { private static float pingInterval = 1f; private static RaycastHit pingHit; private static bool hasHit = false; private static PlayerControllerB __mainPlayer; private static bool initializing = true; [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] public static void ReadInput(PlayerControllerB __instance) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) try { if (initializing) { return; } if (__mainPlayer == null) { __mainPlayer = StartOfRound.Instance.localPlayerController; } if (((NetworkBehaviour)__instance).IsOwner && !__mainPlayer.inTerminalMenu && !__mainPlayer.isTypingChat && !__mainPlayer.isPlayerDead && !__mainPlayer.quickMenuManager.isMenuOpen && PingInputClass.Instance.pingKey.WasPressedThisFrame() && pingInterval <= 0f) { pingInterval = 0.25f; if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogInfo((object)"Ping Key Pressed!"); } Vector3 val = ((Component)__mainPlayer.gameplayCamera).transform.position + ((Component)__mainPlayer.gameplayCamera).transform.forward * 0.5f; hasHit = Physics.BoxCast(val, new Vector3(0.25f, 0.25f, 0.25f), ((Component)__mainPlayer.gameplayCamera).transform.forward, ref pingHit, ((Component)__mainPlayer.gameplayCamera).transform.rotation, 75f, 524288); if (hasHit) { if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogInfo((object)"Boxcast object was hit!"); LethalPingPlugin.mls.LogInfo((object)("Object name hit: " + ((Object)((Component)((RaycastHit)(ref pingHit)).collider).gameObject).name)); LethalPingPlugin.mls.LogInfo((object)$"Object position hit: {((RaycastHit)(ref pingHit)).point}"); LethalPingPlugin.mls.LogInfo((object)$"Object layer hit: {((Component)((RaycastHit)(ref pingHit)).collider).gameObject.layer}"); LethalPingPlugin.mls.LogInfo((object)("Scannode properties (if any): " + GetHeaderText(pingHit))); } ulong playerClientId = GameNetworkManager.Instance.localPlayerController.playerClientId; if (LethalPingPlugin.objPings.Value) { PingController.Instance.setObjectPing(((Component)((Component)((RaycastHit)(ref pingHit)).collider).transform.root).gameObject, GetPingLifetime(pingHit), StartOfRound.Instance.allPlayerScripts[playerClientId].playerUsername, GetHeaderText(pingHit), GetNodeType(pingHit), playerClientId); } else { PingController.Instance.setLocationPing(((RaycastHit)(ref pingHit)).point, GetPingLifetime(pingHit), StartOfRound.Instance.allPlayerScripts[playerClientId].playerUsername, GetHeaderText(pingHit), GetNodeType(pingHit), playerClientId); } if (((Component)HUDManagerPatch.pingElements[playerClientId]).gameObject.activeSelf) { ((Component)HUDManagerPatch.pingElements[playerClientId]).gameObject.SetActive(false); } } else { if (LethalPingPlugin.plyPings.Value) { hasHit = Physics.BoxCast(val, new Vector3(0.1f, 0.1f, 0.1f), ((Component)__mainPlayer.gameplayCamera).transform.forward, ref pingHit, ((Component)__mainPlayer.gameplayCamera).transform.rotation, 30f, 8); if (hasHit) { ulong playerClientId2 = GameNetworkManager.Instance.localPlayerController.playerClientId; if (LethalPingPlugin.objPings.Value) { PingController.Instance.setObjectPing(((Component)((RaycastHit)(ref pingHit)).collider).gameObject, LethalPingPlugin.GetCurTime() + LethalPingPlugin.playerTime.Value, StartOfRound.Instance.allPlayerScripts[playerClientId2].playerUsername, (((Component)((RaycastHit)(ref pingHit)).collider).gameObject.GetComponent<NetworkObject>() != null) ? GetPlayerName(((Component)((RaycastHit)(ref pingHit)).collider).gameObject.GetComponent<NetworkObject>().OwnerClientId) : "new phone who dis", 2, playerClientId2); } else { PingController.Instance.setLocationPing(((RaycastHit)(ref pingHit)).point, LethalPingPlugin.GetCurTime() + LethalPingPlugin.playerTime.Value, StartOfRound.Instance.allPlayerScripts[playerClientId2].playerUsername, (((Component)((RaycastHit)(ref pingHit)).collider).gameObject.GetComponent<NetworkObject>() != null) ? GetPlayerName(((Component)((RaycastHit)(ref pingHit)).collider).gameObject.GetComponent<NetworkObject>().OwnerClientId) : "new phone who dis", 2, playerClientId2); } if (((Component)HUDManagerPatch.pingElements[playerClientId2]).gameObject.activeSelf) { ((Component)HUDManagerPatch.pingElements[playerClientId2]).gameObject.SetActive(false); } } } if (LethalPingPlugin.plyPings.Value && !hasHit) { GameLayers gameLayers = GameLayers.Player | GameLayers.Props | GameLayers.Room | GameLayers.InteractableObject | GameLayers.PhysicsObject | GameLayers.Anomaly | GameLayers.Enemies | GameLayers.PlayerRagdoll | GameLayers.Terrain; hasHit = Physics.Raycast(((Component)__mainPlayer.gameplayCamera).transform.position + ((Component)__mainPlayer.gameplayCamera).transform.forward * 0.5f, ((Component)__mainPlayer.gameplayCamera).transform.forward, ref pingHit, 100f, (int)gameLayers); if (hasHit) { if (LethalPingPlugin.debugLogs.Value) { LethalPingPlugin.mls.LogInfo((object)"Raycast object was hit!"); LethalPingPlugin.mls.LogInfo((object)("Object name hit: " + ((Object)((Component)((RaycastHit)(ref pingHit)).collider).gameObject).name)); LethalPingPlugin.mls.LogInfo((object)$"Object position hit: {((RaycastHit)(ref pingHit)).point}"); LethalPingPlugin.mls.LogInfo((object)$"Object layer hit: {((Component)((RaycastHit)(ref pingHit)).collider).gameObject.layer}"); LethalPingPlugin.mls.LogInfo((object)("Scannode properties (if any): " + GetHeaderText(pingHit))); } ulong playerClientId3 = GameNetworkManager.Instance.localPlayerController.playerClientId; PingController.Instance.setLocationPing(((RaycastHit)(ref pingHit)).point, GetPingLifetime(pingHit), StartOfRound.Instance.allPlayerScripts[playerClientId3].playerUsername, GetHeaderText(pingHit), GetNodeType(pingHit), playerClientId3); if (((Component)HUDManagerPatch.pingElements[playerClientId3]).gameObject.activeSelf) { ((Component)HUDManagerPatch.pingElements[playerClientId3]).gameObject.SetActive(false); PingController.Instance.pings[playerClientId3].isAttachedToObj = false; } } } } } pingInterval -= Time.deltaTime; } catch { } } public static ScanNodeProperties getScanNodeProperties(RaycastHit pingHit) { if ((Object)(object)((Component)((RaycastHit)(ref pingHit)).collider).gameObject.GetComponentInChildren<ScanNodeProperties>() != (Object)null) { return ((Component)((RaycastHit)(ref pingHit)).collider).gameObject.GetComponentInChildren<ScanNodeProperties>(); } if ((Object)(object)((Component)((RaycastHit)(ref pingHit)).transform.root).gameObject.GetComponentInChildren<ScanNodeProperties>() != (Object)null && ((Object)((Component)((RaycastHit)(ref pingHit)).transform.root).gameObject).name != "Environment") { return ((Component)((RaycastHit)(ref pingHit)).transform.root).gameObject.GetComponentInChildren<ScanNodeProperties>(); } return null; } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] public static void Uninitialize() { __mainPlayer = null; initializing = true; } [HarmonyPatch(typeof(StartOfRound), "SceneManager_OnLoadComplete1")] [HarmonyPostfix] public static void Initialize() { initializing = false; } public static double GetPingLifetime(RaycastHit pingHit) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) double curTime = LethalPingPlugin.GetCurTime(); double result = curTime + LethalPingPlugin.genericTime.Value; ScanNodeProperties scanNodeProperties = getScanNodeProperties(pingHit); if (scanNodeProperties != null) { if (scanNodeProperties.nodeType == 1) { result = curTime + LethalPingPlugin.enemyTime.Value; } else if (scanNodeProperties.nodeType == 2) { result = curTime + LethalPingPlugin.scrapTime.Value; } } return result; } public static string GetHeaderText(RaycastHit pingHit) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) string result = "Generic"; ScanNodeProperties scanNodeProperties = getScanNodeProperties(pingHit); if (scanNodeProperties != null) { result = scanNodeProperties.headerText; } return result; } public static int GetNodeType(RaycastHit pingHit) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) int result = 0; ScanNodeProperties scanNodeProperties = getScanNodeProperties(pingHit); if (scanNodeProperties != null) { result = scanNodeProperties.nodeType; } return result; } public static string GetPlayerName(ulong ownerClientId) { string result = "new phone who dis"; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (((NetworkBehaviour)val).OwnerClientId == ownerClientId) { result = val.playerUsername; } } return result; } } }