Please disclose if any significant portion of your mod was created 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 Ping It v0.4.4
PingIt.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using KeybindLib.Classes; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using TMPro; using UnityEngine; using UnityEngine.UI; [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("PingIt")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("This mod adds the ability to ping valuables and enemies.")] [assembly: AssemblyFileVersion("0.1.2.0")] [assembly: AssemblyInformationalVersion("0.1.2")] [assembly: AssemblyProduct("PingIt")] [assembly: AssemblyTitle("PingIt")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 PingIt { internal static class MyPluginInfo { public const string PLUGIN_GUID = "eberk30.pingit"; public const string PLUGIN_NAME = "Ping_It"; public const string PLUGIN_VERSION = "0.4.1"; } [HarmonyPatch(typeof(PlayerDeathHead))] internal static class DeathHeadTracker { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OnStart(PlayerDeathHead __instance) { Plugin._deathHeads.Add(__instance); } [HarmonyPatch("OnDestroy")] [HarmonyPostfix] private static void OnDestroy(PlayerDeathHead __instance) { Plugin._deathHeads.Remove(__instance); } } [BepInPlugin("eberk30.pingit", "Ping_It", "0.4.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal enum PingTarget { None, Valuable, Item, Enemy, Location } internal struct LookResult { public PingTarget Type; public PhysGrabObject? PhysGrab; public EnemyRigidbody? EnemyRb; public Vector3 Position; } private static FieldInfo? _genesisField; private static bool _genesisChecked; private static readonly RaycastHit[] _losHits = (RaycastHit[])(object)new RaycastHit[32]; private static readonly RaycastHit[] _pierceHits = (RaycastHit[])(object)new RaycastHit[32]; private static readonly Dictionary<int, List<GameObject>> _locationDots = new Dictionary<int, List<GameObject>>(); private const int MaxLocationDots = 3; private static readonly int _pierceMask = -5 & ~LayerMask.GetMask(new string[1] { "RoomVolume" }); internal static ManualLogSource Logger = null; private Harmony _harmony = null; public static ConfigEntry<float> rangeCfg = null; public static ConfigEntry<float> cooldownCfg = null; public static ConfigEntry<float> durationCfg = null; public static ConfigEntry<float> textSizeCfg = null; public static ConfigEntry<string> debugLoggingCfg = null; internal static Keybind? _pingKeybind; private static bool _pingPressed; internal static readonly FieldRef<ValuableDiscoverGraphic, float> WaitTimer = AccessTools.FieldRefAccess<ValuableDiscoverGraphic, float>("waitTimer"); internal static readonly FieldRef<ValuableObject, PhysGrabObject> ValuableGrab = AccessTools.FieldRefAccess<ValuableObject, PhysGrabObject>("physGrabObject"); internal static readonly FieldRef<ItemAttributes, PhysGrabObject> ItemGrab = AccessTools.FieldRefAccess<ItemAttributes, PhysGrabObject>("physGrabObject"); internal static readonly FieldRef<EnemyParent, Enemy> ParentEnemy = AccessTools.FieldRefAccess<EnemyParent, Enemy>("Enemy"); internal static readonly FieldRef<Enemy, EnemyRigidbody> EnemyRb = AccessTools.FieldRefAccess<Enemy, EnemyRigidbody>("Rigidbody"); internal static readonly FieldRef<ValuableObject, float> ValuableDollar = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueCurrent"); internal static readonly FieldRef<ValuableObject, bool> ValuableDollarSet = AccessTools.FieldRefAccess<ValuableObject, bool>("dollarValueSet"); internal static readonly FieldRef<ItemAttributes, string> ItemName = AccessTools.FieldRefAccess<ItemAttributes, string>("itemName"); internal static readonly FieldRef<Enemy, EnemyHealth> EnemyHealthComp = AccessTools.FieldRefAccess<Enemy, EnemyHealth>("Health"); internal static readonly FieldRef<EnemyHealth, int> HealthCurrent = AccessTools.FieldRefAccess<EnemyHealth, int>("healthCurrent"); internal static readonly FieldRef<PhysGrabHinge, bool> HingeClosed = AccessTools.FieldRefAccess<PhysGrabHinge, bool>("closed"); internal static readonly FieldRef<PlayerDeathHead, PlayerAvatar> DeathHeadAvatar = AccessTools.FieldRefAccess<PlayerDeathHead, PlayerAvatar>("playerAvatar"); internal static readonly FieldRef<PlayerAvatar, string> AvatarPlayerName = AccessTools.FieldRefAccess<PlayerAvatar, string>("playerName"); internal static GameObject? pingPrefab; internal static GameObject? itemPingPrefab; internal static GameObject? enemyPingPrefab; internal static GameObject? locationPrefab; internal static Mesh? _cubeMesh; internal static Camera? _mainCam; internal static readonly FieldInfo HudRectField = typeof(HUDCanvas).GetField("rect", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); internal static PlayerUpgrade? _pingAnywhereUpgrade; internal static PlayerUpgrade? _pingInfoUpgrade; internal static PlayerAvatar? _localPlayer; private static MethodInfo? _snapshotMethod; private static bool _snapshotChecked; internal const float PING_TYPE_VALUABLE = 0f; internal const float PING_TYPE_ENEMY = 1f; internal const float PING_TYPE_ITEM = 2f; internal const float PING_TYPE_LOCATION = 3f; internal static NetworkedEvent PingEvent = null; internal static readonly List<PlayerDeathHead> _deathHeads = new List<PlayerDeathHead>(); private static readonly FieldRef<PlayerAvatar, bool> _isLocalPlayer = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); private static float _lastPing = -999f; internal static void DoSpawnHighlight(PhysGrabObject? physGrab, PingTarget type, string? locationPrefix = null) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) PhysGrabObject physGrab2 = physGrab; string locationPrefix2 = locationPrefix; if ((Object)(object)physGrab2 == (Object)null || (Object)(object)ValuableDiscover.instance == (Object)null) { return; } if (type == PingTarget.Enemy) { AttachBoundsProxy(physGrab2); } if (1 == 0) { } GameObject val = (GameObject)(type switch { PingTarget.Enemy => enemyPingPrefab, PingTarget.Item => itemPingPrefab, PingTarget.Location => locationPrefab, _ => pingPrefab, }); if (1 == 0) { } GameObject val2 = val; if ((Object)(object)val2 != (Object)null) { GameObject val3 = Object.Instantiate<GameObject>(val2, ((Component)ValuableDiscover.instance).transform); val3.SetActive(true); ValuableDiscoverGraphic component = val3.GetComponent<ValuableDiscoverGraphic>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)$"prefab for {type} is missing ValuableDiscoverGraphic, bailing"); Object.Destroy((Object)(object)val3); return; } GameObject graphicPrefab = ValuableDiscover.instance.graphicPrefab; ValuableDiscoverGraphic val4 = ((graphicPrefab != null) ? graphicPrefab.GetComponent<ValuableDiscoverGraphic>() : null); if ((Object)(object)val4 != (Object)null) { component.sound = val4.sound; } if (type == PingTarget.Enemy) { physGrab2.centerPoint = Vector3.zero; } component.target = physGrab2; component.waitTime = durationCfg.Value; WaitTimer.Invoke(component) = durationCfg.Value; } else { ValuableDiscover.instance.New(physGrab2, (State)0); ValuableDiscoverGraphic[] array = Object.FindObjectsOfType<ValuableDiscoverGraphic>(); foreach (ValuableDiscoverGraphic val5 in array) { if (!((Object)(object)val5.target != (Object)(object)physGrab2)) { val5.waitTime = durationCfg.Value; WaitTimer.Invoke(val5) = durationCfg.Value; break; } } } if ((Object)(object)HUDCanvas.instance == (Object)null || !LocalHasPingInfo()) { return; } string text = null; switch (type) { case PingTarget.Valuable: { ValuableObject component4 = ((Component)physGrab2).GetComponent<ValuableObject>(); MonoBehaviour genesisBehaviour = GetGenesisBehaviour(physGrab2); PlayerDeathHead component5 = ((Component)physGrab2).GetComponent<PlayerDeathHead>(); if ((Object)(object)component5 != (Object)null) { text = GetDeathHeadName(component5) + "\nDEAD"; } else if ((Object)(object)component4 != (Object)null && ValuableDollarSet.Invoke(component4)) { string text3 = (((Object)(object)genesisBehaviour != (Object)null) ? "Genesis" : ((object)(Type)(ref component4.volumeType)).ToString()); string text4 = "$" + SemiFunc.DollarGetString((int)ValuableDollar.Invoke(component4)); text = text3 + "\n" + text4; } if ((Object)(object)genesisBehaviour != (Object)null) { int petsLeft = GetPetsLeft(genesisBehaviour); text = ((text != null) ? (text + "\n") : "") + petsLeft + " pet" + ((petsLeft == 1) ? "" : "s") + " left"; } break; } case PingTarget.Item: { ItemAttributes component2 = ((Component)physGrab2).GetComponent<ItemAttributes>(); if (!((Object)(object)component2 != (Object)null)) { break; } string text2 = ItemName.Invoke(component2); if (!string.IsNullOrEmpty(text2)) { text = text2; ItemBattery component3 = ((Component)physGrab2).GetComponent<ItemBattery>(); if ((Object)(object)component3 != (Object)null && !component3.isUnchargable) { text = text + "\n" + Mathf.RoundToInt(component3.batteryLife) + "%"; } } break; } case PingTarget.Enemy: { EnemyParent componentInParent = ((Component)physGrab2).GetComponentInParent<EnemyParent>(); if ((Object)(object)componentInParent != (Object)null && !string.IsNullOrEmpty(componentInParent.enemyName)) { text = componentInParent.enemyName; Enemy val6 = ParentEnemy.Invoke(componentInParent); EnemyHealth val7 = (((Object)(object)val6 != (Object)null) ? EnemyHealthComp.Invoke(val6) : null); if ((Object)(object)val7 != (Object)null && val7.health > 0) { text = text + "\n" + HealthCurrent.Invoke(val7) + " / " + val7.health + " HP"; } } break; } case PingTarget.Location: { bool isExtraction = IsExtractionPoint(((Component)physGrab2).transform.position); PingValueLabel pingValueLabel = PingValueLabel.Spawn(physGrab2, "", durationCfg.Value, 180f); pingValueLabel._dynamicText = delegate { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0039: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)physGrab2).transform; Vector3 val8 = (((Object)(object)_mainCam != (Object)null) ? ((Component)_mainCam).transform.position : transform.position); float num = Vector3.Distance(val8, transform.position); string text5 = ((num < 10f) ? (num.ToString("F1") + "m") : (Mathf.RoundToInt(num) + "m")); string text6 = (isExtraction ? ("Extraction\n" + text5) : text5); return (locationPrefix2 != null) ? (locationPrefix2 + "\n" + text6) : text6; }; break; } } if (text != null) { float lookAngle = ((type == PingTarget.Valuable) ? 5f : 10f); PingValueLabel.Spawn(physGrab2, text, durationCfg.Value, lookAngle); } } internal static bool IsExtractionPoint(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(pos, 2f, -1, (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val in array2) { if ((Object)(object)((Component)val).GetComponentInParent<ExtractionPoint>() != (Object)null) { return true; } } return false; } internal static void DoPingAtPos(Vector3 worldPos, int actorNumber) { //IL_007c: 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_00e4: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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 (!_locationDots.TryGetValue(actorNumber, out List<GameObject> value)) { value = (_locationDots[actorNumber] = new List<GameObject>()); } value.RemoveAll((GameObject g) => (Object)(object)g == (Object)null); if (value.Count >= 3) { Object.Destroy((Object)(object)value[0]); value.RemoveAt(0); } string locationPrefix = null; Collider[] array = Physics.OverlapSphere(worldPos, 0.3f, -1, (QueryTriggerInteraction)1); foreach (Collider val in array) { PhysGrabHinge componentInParent = ((Component)val).GetComponentInParent<PhysGrabHinge>(); if ((Object)(object)componentInParent != (Object)null && HingeClosed.Invoke(componentInParent)) { locationPrefix = "Door"; break; } } GameObject val2 = new GameObject("PingIt_LocationAnchor"); val2.transform.position = worldPos; val2.transform.localScale = Vector3.one * 0.3f; val2.AddComponent<MeshFilter>().mesh = GetCubeMesh(); ((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[0]; val2.AddComponent<PhotonView>(); ((Behaviour)val2.AddComponent<PhotonTransformView>()).enabled = false; Rigidbody val3 = val2.AddComponent<Rigidbody>(); val3.isKinematic = true; val3.constraints = (RigidbodyConstraints)126; PhysGrabObject val4 = val2.AddComponent<PhysGrabObject>(); val4.centerPoint = worldPos; ((Behaviour)val4).enabled = false; Object.Destroy((Object)(object)val2, durationCfg.Value + 5f); value.Add(val2); DoSpawnHighlight(val4, PingTarget.Location, locationPrefix); } private static void AttachBoundsProxy(PhysGrabObject physGrab) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_015b: 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_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0206: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in ((Component)physGrab).transform) { Transform val = item; if (((Object)val).name == "PingIt_BoundsProxy") { Object.Destroy((Object)(object)((Component)val).gameObject); } } EnemyParent componentInParent = ((Component)physGrab).GetComponentInParent<EnemyParent>(); if ((Object)(object)componentInParent == (Object)null) { return; } bool flag = false; Bounds val2 = default(Bounds); Vector3 position = ((Component)physGrab).transform.position; SkinnedMeshRenderer[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val3 in componentsInChildren) { if (IsUsableBounds(((Renderer)val3).bounds, position)) { if (!flag) { val2 = ((Renderer)val3).bounds; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(((Renderer)val3).bounds); } } } if (!flag) { MeshRenderer[] componentsInChildren2 = ((Component)componentInParent).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val4 in componentsInChildren2) { if (!((Component)val4).transform.IsChildOf(((Component)physGrab).transform) && IsUsableBounds(((Renderer)val4).bounds, position)) { if (!flag) { val2 = ((Renderer)val4).bounds; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(((Renderer)val4).bounds); } } } } if (flag && !(((Bounds)(ref val2)).size == Vector3.zero)) { float num = 3.5f; Vector3 size = ((Bounds)(ref val2)).size; if (size.x > num || size.y > num || size.z > num) { ((Bounds)(ref val2))..ctor(((Bounds)(ref val2)).center, new Vector3(Mathf.Min(size.x, num), Mathf.Min(size.y, num), Mathf.Min(size.z, num))); } GameObject val5 = new GameObject("PingIt_BoundsProxy"); val5.transform.SetParent(((Component)physGrab).transform); val5.transform.position = ((Bounds)(ref val2)).center; val5.transform.rotation = Quaternion.identity; Vector3 lossyScale = ((Component)physGrab).transform.lossyScale; val5.transform.localScale = new Vector3((lossyScale.x != 0f) ? (((Bounds)(ref val2)).size.x / lossyScale.x) : ((Bounds)(ref val2)).size.x, (lossyScale.y != 0f) ? (((Bounds)(ref val2)).size.y / lossyScale.y) : ((Bounds)(ref val2)).size.y, (lossyScale.z != 0f) ? (((Bounds)(ref val2)).size.z / lossyScale.z) : ((Bounds)(ref val2)).size.z); val5.AddComponent<MeshFilter>().mesh = GetCubeMesh(); ((Renderer)val5.AddComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[0]; Object.Destroy((Object)(object)val5, durationCfg.Value + 5f); } } internal static Mesh GetCubeMesh() { if ((Object)(object)_cubeMesh != (Object)null) { return _cubeMesh; } GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); _cubeMesh = val.GetComponent<MeshFilter>().sharedMesh; Object.Destroy((Object)(object)val); return _cubeMesh; } private static bool IsUsableBounds(Bounds b, Vector3 pivot) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (((Bounds)(ref b)).size == Vector3.zero) { return false; } float num = Mathf.Min(new float[3] { ((Bounds)(ref b)).size.x, ((Bounds)(ref b)).size.y, ((Bounds)(ref b)).size.z }); float num2 = Mathf.Max(new float[3] { ((Bounds)(ref b)).size.x, ((Bounds)(ref b)).size.y, ((Bounds)(ref b)).size.z }); if (num2 <= 0f || num2 >= 5f) { return false; } if (num / num2 < 0.2f) { return false; } if (((Bounds)(ref b)).center.y < pivot.y - 0.3f || ((Bounds)(ref b)).center.y > pivot.y + 4f) { return false; } float num3 = ((Bounds)(ref b)).center.x - pivot.x; float num4 = ((Bounds)(ref b)).center.z - pivot.z; return num3 * num3 + num4 * num4 <= 9f; } private static MonoBehaviour? GetGenesisBehaviour(PhysGrabObject pg) { if (!_genesisChecked) { _genesisChecked = true; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = assembly.GetType("GenesisHealBehaviour"); if (!(type == null)) { _genesisField = type.GetField("petsLeft", BindingFlags.Instance | BindingFlags.Public); break; } } } if (_genesisField == null) { return null; } Component component = ((Component)pg).GetComponent(_genesisField.DeclaringType); return (MonoBehaviour?)(object)((component is MonoBehaviour) ? component : null); } private static int GetPetsLeft(MonoBehaviour genesis) { return (_genesisField != null) ? ((int)(_genesisField.GetValue(genesis) ?? ((object)0))) : 0; } internal static LookResult GetLookedAtTarget(Camera cam, float range) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_0104: 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_010b: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_054c: 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_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)cam).transform.position; Vector3 forward = ((Component)cam).transform.forward; float num = range * range; PhysGrabObject val = null; PhysGrabObject val2 = null; PhysGrabObject val3 = null; EnemyRigidbody enemyRb = null; float num2 = 1f; float num3 = 1f; float num4 = 1f; Vector3 val4 = default(Vector3); Vector3 val5 = default(Vector3); Vector3 position2 = default(Vector3); List<ValuableObject> list = ValuableDirector.instance?.valuableList; Vector3 val8; if (list != null) { foreach (ValuableObject item in list) { if ((Object)(object)item == (Object)null) { continue; } PhysGrabObject val6 = ValuableGrab.Invoke(item) ?? GetPhysGrab((Component)(object)item); if ((Object)(object)val6 == (Object)null) { continue; } Vector3 center = GetCenter(val6); Vector3 val7 = center - position; if (!(((Vector3)(ref val7)).sqrMagnitude > num) && !(Vector3.Dot(forward, val7) < 0f)) { val8 = Vector3.Cross(forward, val7); float sqrMagnitude = ((Vector3)(ref val8)).sqrMagnitude; if (sqrMagnitude < num2) { num2 = sqrMagnitude; val = val6; val4 = center; } } } } foreach (PlayerDeathHead deathHead in _deathHeads) { if ((Object)(object)deathHead == (Object)null) { continue; } PhysGrabObject val9 = ((Component)deathHead).GetComponent<PhysGrabObject>(); if ((Object)(object)val9 == (Object)null) { val9 = ((Component)deathHead).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val9, durationCfg.Value + 5f); } Vector3 center2 = GetCenter(val9); Vector3 val10 = center2 - position; if (!(((Vector3)(ref val10)).sqrMagnitude > num) && !(Vector3.Dot(forward, val10) < 0f)) { val8 = Vector3.Cross(forward, val10); float sqrMagnitude2 = ((Vector3)(ref val8)).sqrMagnitude; if (sqrMagnitude2 < num2) { num2 = sqrMagnitude2; val = val9; val4 = center2; } } } List<ItemAttributes> list2 = ItemManager.instance?.spawnedItems; if (list2 != null) { foreach (ItemAttributes item2 in list2) { if ((Object)(object)item2 == (Object)null) { continue; } PhysGrabObject val11 = ItemGrab.Invoke(item2) ?? GetPhysGrab((Component)(object)item2); if ((Object)(object)val11 == (Object)null) { continue; } Vector3 center3 = GetCenter(val11); Vector3 val12 = center3 - position; if (!(((Vector3)(ref val12)).sqrMagnitude > num) && !(Vector3.Dot(forward, val12) < 0f)) { val8 = Vector3.Cross(forward, val12); float sqrMagnitude3 = ((Vector3)(ref val8)).sqrMagnitude; if (sqrMagnitude3 < num3) { num3 = sqrMagnitude3; val2 = val11; val5 = center3; } } } } List<EnemyParent> list3 = EnemyDirector.instance?.enemiesSpawned; if (list3 != null) { foreach (EnemyParent item3 in list3) { if ((Object)(object)item3 == (Object)null) { continue; } Enemy val13 = ParentEnemy.Invoke(item3); if ((Object)(object)val13 == (Object)null) { continue; } EnemyRigidbody val14 = EnemyRb.Invoke(val13); if ((Object)(object)val14 == (Object)null || !((Component)val14).gameObject.activeSelf) { continue; } Vector3 position3 = ((Component)val14).transform.position; Vector3 val15 = position3 - position; if (((Vector3)(ref val15)).sqrMagnitude > num || Vector3.Dot(forward, val15) < 0f) { continue; } val8 = Vector3.Cross(forward, val15); float sqrMagnitude4 = ((Vector3)(ref val8)).sqrMagnitude; if (!(sqrMagnitude4 >= num4)) { PhysGrabObject val16 = ((Component)val14).GetComponent<PhysGrabObject>(); if ((Object)(object)val16 == (Object)null) { val16 = ((Component)val14).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val16, durationCfg.Value + 5f); } if (EnemyLOSCheck(position, position3 + Vector3.up, ((Component)item3).transform)) { num4 = sqrMagnitude4; val3 = val16; enemyRb = val14; position2 = position3; } } } } LookResult result; if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null && (Object)(object)val3 == (Object)null) { result = default(LookResult); result.Type = PingTarget.None; return result; } bool flag = (Object)(object)val2 != (Object)null && ((Object)(object)val == (Object)null || num3 <= num2); PingTarget type = ((!flag) ? PingTarget.Valuable : PingTarget.Item); PhysGrabObject val17 = (flag ? val2 : val); Vector3 val18 = (flag ? val5 : val4); float num5 = (flag ? num3 : num2); if ((Object)(object)val3 != (Object)null && ((Object)(object)val17 == (Object)null || num4 < num5)) { result = default(LookResult); result.Type = PingTarget.Enemy; result.PhysGrab = val3; result.EnemyRb = enemyRb; result.Position = position2; return result; } if ((Object)(object)val17 != (Object)null && LOSClear(position, val18, ((Component)val17).transform)) { result = default(LookResult); result.Type = type; result.PhysGrab = val17; result.Position = val18; return result; } if ((Object)(object)val3 != (Object)null) { result = default(LookResult); result.Type = PingTarget.Enemy; result.PhysGrab = val3; result.EnemyRb = enemyRb; result.Position = position2; return result; } result = default(LookResult); result.Type = PingTarget.None; return result; } private static bool LOSClear(Vector3 from, Vector3 to, Transform? root) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(from, ((Vector3)(ref val)).normalized, ref val2, ((Vector3)(ref val)).magnitude - 0.1f, -5, (QueryTriggerInteraction)1)) { return true; } Transform transform = ((Component)((RaycastHit)(ref val2)).collider).transform; if ((Object)(object)root == (Object)null) { return false; } return transform.IsChildOf(root) || root.IsChildOf(transform); } internal static bool PiercingRaycast(Vector3 origin, Vector3 dir, float range, out RaycastHit result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00c1: Unknown result type (might be due to invalid IL or missing references) int num = Physics.RaycastNonAlloc(origin, dir, _pierceHits, range, _pierceMask, (QueryTriggerInteraction)1); if (num == 0) { result = default(RaycastHit); return false; } Array.Sort(_pierceHits, 0, num, Comparer<RaycastHit>.Create((RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance))); for (int i = 0; i < num; i++) { PhysGrabObject componentInParent = ((Component)((RaycastHit)(ref _pierceHits[i])).collider).GetComponentInParent<PhysGrabObject>(); if ((Object)(object)componentInParent != (Object)null) { PhysGrabHinge component = ((Component)componentInParent).GetComponent<PhysGrabHinge>(); if ((Object)(object)component != (Object)null && HingeClosed.Invoke(component)) { result = _pierceHits[i]; return true; } continue; } result = _pierceHits[i]; return true; } result = default(RaycastHit); return false; } private static bool EnemyLOSCheck(Vector3 from, Vector3 to, Transform enemyRoot) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; int num = Physics.RaycastNonAlloc(from, ((Vector3)(ref val)).normalized, _losHits, ((Vector3)(ref val)).magnitude - 0.1f, -5, (QueryTriggerInteraction)1); if (num == 0) { return true; } Array.Sort(_losHits, 0, num, Comparer<RaycastHit>.Create((RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance))); for (int i = 0; i < num; i++) { Transform transform = ((Component)((RaycastHit)(ref _losHits[i])).collider).transform; if (!transform.IsChildOf(enemyRoot) && !enemyRoot.IsChildOf(transform) && !((Object)(object)((Component)transform).GetComponentInParent<EnemyParent>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<PhysGrabObject>() != (Object)null)) { return false; } } return true; } private static ValuableObject? FindClosestValuable(Vector3 pos, float maxSqDist) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) List<ValuableObject> list = ValuableDirector.instance?.valuableList; if (list == null) { return null; } ValuableObject result = null; float num = maxSqDist; foreach (ValuableObject item in list) { if (!((Object)(object)item == (Object)null)) { PhysGrabObject val = ValuableGrab.Invoke(item); Vector3 val2 = (((Object)(object)val != (Object)null) ? GetCenter(val) : ((Component)item).transform.position); Vector3 val3 = val2 - pos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = item; } } } return result; } private static PlayerDeathHead? FindClosestDeathHead(Vector3 pos, float maxSqDist) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) PlayerDeathHead result = null; float num = maxSqDist; foreach (PlayerDeathHead deathHead in _deathHeads) { if (!((Object)(object)deathHead == (Object)null)) { PhysGrabObject component = ((Component)deathHead).GetComponent<PhysGrabObject>(); Vector3 val = (((Object)(object)component != (Object)null) ? GetCenter(component) : ((Component)deathHead).transform.position); Vector3 val2 = val - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = deathHead; } } } return result; } private static ItemAttributes? FindClosestItem(Vector3 pos, float sqRange) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) List<ItemAttributes> list = ItemManager.instance?.spawnedItems; if (list == null) { return null; } ItemAttributes result = null; float num = sqRange; for (int i = 0; i < list.Count; i++) { ItemAttributes val = list[i]; if (!((Object)(object)val == (Object)null)) { PhysGrabObject val2 = ItemGrab.Invoke(val); Vector3 val3 = (((Object)(object)val2 != (Object)null) ? GetCenter(val2) : ((Component)val).transform.position) - pos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private static EnemyRigidbody? FindClosestEnemyRigidbody(Vector3 pos, float maxSqDist) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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) if ((Object)(object)EnemyDirector.instance == (Object)null) { return null; } List<EnemyParent> enemiesSpawned = EnemyDirector.instance.enemiesSpawned; if (enemiesSpawned == null || enemiesSpawned.Count == 0) { return null; } EnemyRigidbody result = null; float num = maxSqDist; foreach (EnemyParent item in enemiesSpawned) { if ((Object)(object)item == (Object)null) { continue; } Enemy val = ParentEnemy.Invoke(item); if ((Object)(object)val == (Object)null) { continue; } EnemyRigidbody val2 = EnemyRb.Invoke(val); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.followTarget == (Object)null) && ((Component)val2).gameObject.activeSelf) { Vector3 val3 = val2.followTarget.position - pos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val2; } } } return result; } internal static void DebugLog(string msg) { if (debugLoggingCfg?.Value == "On") { Logger.LogDebug((object)msg); } } internal static bool ConsumePingPress() { if (!_pingPressed) { return false; } _pingPressed = false; return true; } internal static string GetDeathHeadName(PlayerDeathHead dh) { PlayerAvatar val = DeathHeadAvatar.Invoke(dh); return ((Object)(object)val != (Object)null) ? AvatarPlayerName.Invoke(val) : "Unknown"; } internal static Color WithAlpha(Color c, float a) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) return new Color(c.r, c.g, c.b, a); } private static int GetUpgradeLevel(string upgradeId, PlayerUpgrade? repoPU) { if (!_snapshotChecked) { _snapshotChecked = true; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type type = assembly.GetType("SharedUpgradesPlus.Services.SnapshotService"); if (!(type == null)) { _snapshotMethod = type.GetMethod("SnapshotPlayerStats", BindingFlags.Static | BindingFlags.Public, null, new Type[1] { typeof(string) }, null); DebugLog($"SnapshotService found: {_snapshotMethod != null}"); break; } } } if (_snapshotMethod != null) { try { Player localPlayer = PhotonNetwork.LocalPlayer; string text = ((localPlayer != null) ? localPlayer.UserId : null); if (!string.IsNullOrEmpty(text) && _snapshotMethod.Invoke(null, new object[1] { text }) is Dictionary<string, int> dictionary) { string text2 = "playerUpgrade" + upgradeId; int value; int num = (dictionary.TryGetValue(text2, out value) ? value : 0); DebugLog($"SharedUpgradesPlus level for '{text2}': {num}"); return num; } } catch (Exception ex) { DebugLog("SnapshotPlayerStats threw: " + ex.Message); } } if (repoPU != null && (Object)(object)_localPlayer != (Object)null) { int level = repoPU.GetLevel(_localPlayer); DebugLog($"REPOLib level for '{upgradeId}': {level}"); return level; } return -1; } internal static bool LocalHasPingInfo() { return GetUpgradeLevel("PingInfo", _pingInfoUpgrade) != 0; } private void Awake() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; _pingKeybind = Keybinds.Bind("PingIt", "Ping", "<Keyboard>/r"); _pingKeybind.inputAction.performed += delegate { _pingPressed = true; DebugLog("ping key callback fired"); }; rangeCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Ping", "Range", 20f, new ConfigDescription("How far out it tries to detect things to ping.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>())); cooldownCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Ping", "Cooldown", 0.5f, new ConfigDescription("How long between pings.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); durationCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Ping", "Highlight Duration", 8f, new ConfigDescription("How long the highlight sticks around.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); textSizeCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Ping", "Value Text Size", 1f, new ConfigDescription("Size multiplier for the ping value text.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>())); debugLoggingCfg = ((BaseUnityPlugin)this).Config.Bind<string>("Ping", "Debug Logging", "Off", new ConfigDescription("Log extra info to the BepInEx console. Useful for diagnosing issues.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Off", "On" }), Array.Empty<object>())); LoadBundle(); try { _pingAnywhereUpgrade = Upgrades.RegisterUpgrade("PingAnywhere", (Item)null, (Action<PlayerAvatar, int>)null, (Action<PlayerAvatar, int>)null); } catch { } try { _pingInfoUpgrade = Upgrades.RegisterUpgrade("PingInfo", (Item)null, (Action<PlayerAvatar, int>)null, (Action<PlayerAvatar, int>)null); } catch { } PingEvent = new NetworkedEvent("REPOPing_TriggerPing", (Action<EventData>)HandleRemotePing); _harmony = new Harmony("eberk30.pingit"); _harmony.PatchAll(); Logger.LogInfo((object)"Ping_It v0.4.1 loaded"); } private void Update() { //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0344: 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_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) if (!ConsumePingPress()) { return; } DebugLog("ping consumed by Plugin.Update"); float time = Time.time; if (time - _lastPing < cooldownCfg.Value) { DebugLog($"ping on cooldown ({cooldownCfg.Value - (time - _lastPing):F2}s left)"); return; } _lastPing = time; Camera val = Camera.main ?? Object.FindObjectOfType<Camera>(); if ((Object)(object)val == (Object)null) { DebugLog("no camera, bailing"); return; } if ((Object)(object)_localPlayer == (Object)null) { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val2 in array) { if (_isLocalPlayer.Invoke(val2)) { _localPlayer = val2; break; } } } LookResult lookedAtTarget = GetLookedAtTarget(val, rangeCfg.Value); object arg = lookedAtTarget.Type; PhysGrabObject? physGrab = lookedAtTarget.PhysGrab; DebugLog(string.Format("look result: {0} physgrab={1}", arg, ((physGrab != null) ? ((Object)physGrab).name : null) ?? "null")); if (lookedAtTarget.Type == PingTarget.None || (Object)(object)lookedAtTarget.PhysGrab == (Object)null) { RaycastHit result; if (GetUpgradeLevel("PingAnywhere", _pingAnywhereUpgrade) == 0) { DebugLog("no target and no PingAnywhere upgrade, bailing"); } else if (PiercingRaycast(((Component)val).transform.position, ((Component)val).transform.forward, rangeCfg.Value, out result)) { DebugLog($"location ping at {((RaycastHit)(ref result)).point}"); DoPingAtPos(((RaycastHit)(ref result)).point, PhotonNetwork.LocalPlayer.ActorNumber); Vector3 point = ((RaycastHit)(ref result)).point; NetworkedEvent pingEvent = PingEvent; if (pingEvent != null) { pingEvent.RaiseEvent((object)new float[4] { point.x, point.y, point.z, 3f }, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } else { DebugLog("piercing raycast found nothing"); } return; } DebugLog($"spawning highlight for {lookedAtTarget.Type} on {((Object)lookedAtTarget.PhysGrab).name}"); DoSpawnHighlight(lookedAtTarget.PhysGrab, lookedAtTarget.Type); float[] array2; if (lookedAtTarget.Type == PingTarget.Enemy && (Object)(object)lookedAtTarget.EnemyRb != (Object)null) { EnemyParent componentInParent = ((Component)lookedAtTarget.EnemyRb).GetComponentInParent<EnemyParent>(); PhotonView val3 = ((componentInParent != null) ? ((Component)componentInParent).GetComponent<PhotonView>() : null); array2 = new float[5] { lookedAtTarget.Position.x, lookedAtTarget.Position.y, lookedAtTarget.Position.z, 1f, ((Object)(object)val3 != (Object)null) ? ((float)val3.ViewID) : 0f }; } else { float num = ((lookedAtTarget.Type == PingTarget.Item) ? 2f : 0f); array2 = new float[4] { lookedAtTarget.Position.x, lookedAtTarget.Position.y, lookedAtTarget.Position.z, num }; } NetworkedEvent pingEvent2 = PingEvent; if (pingEvent2 != null) { pingEvent2.RaiseEvent((object)array2, NetworkingEvents.RaiseOthers, SendOptions.SendReliable); } } private void LoadBundle() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "pingbundle"); if (!File.Exists(text)) { Logger.LogError((object)("bundle missing at " + text)); return; } AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"AssetBundle.LoadFromFile came back null"); return; } pingPrefab = val.LoadAsset<GameObject>("ValuablePing"); itemPingPrefab = val.LoadAsset<GameObject>("ItemPing"); enemyPingPrefab = val.LoadAsset<GameObject>("EnemyPing"); locationPrefab = val.LoadAsset<GameObject>("LocationPing"); val.Unload(false); if ((Object)(object)pingPrefab == (Object)null) { Logger.LogError((object)"ValuablePing not in bundle"); } if ((Object)(object)itemPingPrefab == (Object)null) { Logger.LogError((object)"ItemPing not in bundle"); } if ((Object)(object)enemyPingPrefab == (Object)null) { Logger.LogError((object)"EnemyPing not in bundle"); } if ((Object)(object)locationPrefab == (Object)null) { Logger.LogError((object)"LocationPing not in bundle"); } } internal static Vector3 GetCenter(PhysGrabObject pg) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) Vector3 centerPoint = pg.centerPoint; if (centerPoint.x != 0f || centerPoint.y != 0f || centerPoint.z != 0f) { return centerPoint; } return ((Component)pg).transform.position; } internal static PhysGrabObject? GetPhysGrab(Component c) { PhysGrabObject component = c.GetComponent<PhysGrabObject>(); if ((Object)(object)component != (Object)null) { return component; } component = c.GetComponentInChildren<PhysGrabObject>(); if ((Object)(object)component != (Object)null) { return component; } return c.GetComponentInParent<PhysGrabObject>(); } private static void HandleRemotePing(EventData evt) { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) if (!(evt.CustomData is float[] array) || array.Length < 4) { return; } Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(array[0], array[1], array[2]); float num = array[3]; if (num == 1f) { EnemyRigidbody val2 = null; if (array.Length >= 5) { PhotonView val3 = PhotonView.Find((int)array[4]); if ((Object)(object)val3 != (Object)null) { EnemyParent component = ((Component)val3).GetComponent<EnemyParent>(); Enemy val4 = (((Object)(object)component != (Object)null) ? ParentEnemy.Invoke(component) : null); val2 = (((Object)(object)val4 != (Object)null) ? EnemyRb.Invoke(val4) : null); } } if ((Object)(object)val2 == (Object)null) { val2 = FindClosestEnemyRigidbody(val, 225f); } if (!((Object)(object)val2 == (Object)null)) { PhysGrabObject val5 = ((Component)val2).GetComponent<PhysGrabObject>(); if ((Object)(object)val5 == (Object)null) { val5 = ((Component)val2).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val5, durationCfg.Value + 5f); } DoSpawnHighlight(val5, PingTarget.Enemy); } return; } if (num == 2f) { ItemAttributes val6 = FindClosestItem(val, 25f); if (!((Object)(object)val6 == (Object)null)) { PhysGrabObject physGrab = ItemGrab.Invoke(val6) ?? GetPhysGrab((Component)(object)val6); DoSpawnHighlight(physGrab, PingTarget.Item); } return; } if (num == 3f) { DoPingAtPos(val, evt.Sender); return; } ValuableObject val7 = FindClosestValuable(val, 25f); if ((Object)(object)val7 != (Object)null) { PhysGrabObject physGrab2 = ValuableGrab.Invoke(val7) ?? GetPhysGrab((Component)(object)val7); DoSpawnHighlight(physGrab2, PingTarget.Valuable); return; } PlayerDeathHead val8 = FindClosestDeathHead(val, 25f); if (!((Object)(object)val8 == (Object)null)) { PhysGrabObject val9 = ((Component)val8).GetComponent<PhysGrabObject>(); if ((Object)(object)val9 == (Object)null) { val9 = ((Component)val8).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val9, durationCfg.Value + 5f); } DoSpawnHighlight(val9, PingTarget.Valuable); } } } internal class PingValueLabel : MonoBehaviour { private static readonly List<PingValueLabel> _active = new List<PingValueLabel>(); private PhysGrabObject? _target; private MeshRenderer[] _renderers = Array.Empty<MeshRenderer>(); private TextMeshProUGUI _text = null; private RectTransform _rect = null; private float _timer; private float _fadeTime = 0.5f; private string _fullText = ""; private float _typeProgress = 0f; private Color _baseColor; private float _lookAngle; internal Func<string>? _dynamicText; internal static PingValueLabel Spawn(PhysGrabObject target, string label, float duration, float lookAngle = 10f) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) WorldSpaceUIValue instance = WorldSpaceUIValue.instance; GameObject val = new GameObject("PingIt_ValueLabel"); RectTransform val2 = (RectTransform)Plugin.HudRectField.GetValue(HUDCanvas.instance); val.transform.SetParent((Transform)(object)val2, false); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); Color colorValue = default(Color); if ((Object)(object)instance != (Object)null) { TextMeshProUGUI component = ((Component)instance).GetComponent<TextMeshProUGUI>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)val3).font = ((TMP_Text)component).font; ((TMP_Text)val3).fontSharedMaterial = ((TMP_Text)component).fontSharedMaterial; ((TMP_Text)val3).fontSize = instance.textSizeValue; } colorValue = instance.colorValue; } else { ((TMP_Text)val3).fontSize = 36f; ((Color)(ref colorValue))..ctor(0.4f, 0.85f, 0.3f); } ((TMP_Text)val3).fontSize = ((TMP_Text)val3).fontSize * Plugin.textSizeCfg.Value; ((TMP_Text)val3).text = ""; ((TMP_Text)val3).alignment = (TextAlignmentOptions)514; ((Graphic)val3).raycastTarget = false; ((Graphic)val3).color = Plugin.WithAlpha(colorValue, 0f); for (int num = _active.Count - 1; num >= 0; num--) { if ((Object)(object)_active[num]._target == (Object)(object)target) { Object.Destroy((Object)(object)((Component)_active[num]).gameObject); } } PingValueLabel pingValueLabel = val.AddComponent<PingValueLabel>(); pingValueLabel._target = target; pingValueLabel._renderers = ((Component)target).GetComponentsInChildren<MeshRenderer>(); pingValueLabel._text = val3; pingValueLabel._rect = val.GetComponent<RectTransform>(); pingValueLabel._fullText = label; pingValueLabel._timer = duration; pingValueLabel._baseColor = colorValue; pingValueLabel._lookAngle = lookAngle; _active.Add(pingValueLabel); return pingValueLabel; } private void OnDestroy() { _active.Remove(this); } private Vector2 GetBelowBracketPosition() { //IL_0005: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) //IL_007f: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) bool flag = false; Bounds val = default(Bounds); for (int i = 0; i < _renderers.Length; i++) { if (!((Object)(object)_renderers[i] == (Object)null)) { if (!flag) { val = ((Renderer)_renderers[i]).bounds; flag = true; } else { ((Bounds)(ref val)).Encapsulate(((Renderer)_renderers[i]).bounds); } } } Vector3 val2 = (Vector3)(flag ? new Vector3(((Bounds)(ref val)).center.x, ((Bounds)(ref val)).min.y, ((Bounds)(ref val)).center.z) : Plugin.GetCenter(_target)); Vector3 val3 = SemiFunc.UIWorldToCanvasPosition(val2); return new Vector2(val3.x, val3.y - 40f); } private float AngleToCamera(Camera cam) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_target == (Object)null) { return float.MaxValue; } Vector3 forward = ((Component)cam).transform.forward; Vector3 val = Plugin.GetCenter(_target) - ((Component)cam).transform.position; return Vector3.Angle(forward, ((Vector3)(ref val)).normalized); } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_target == (Object)null || (Object)(object)HUDCanvas.instance == (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _timer -= Time.deltaTime; if (_timer <= 0f - _fadeTime) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } if ((Object)(object)Plugin._mainCam == (Object)null) { Plugin._mainCam = Camera.main; } _rect.anchoredPosition = GetBelowBracketPosition(); bool flag = false; if ((Object)(object)Plugin._mainCam != (Object)null) { float num = AngleToCamera(Plugin._mainCam); if (num <= _lookAngle) { bool flag2 = true; foreach (PingValueLabel item in _active) { if ((Object)(object)item == (Object)(object)this || !(item.AngleToCamera(Plugin._mainCam) < num)) { continue; } flag2 = false; break; } flag = flag2; } } if (_dynamicText != null) { ((TMP_Text)_text).text = (flag ? _dynamicText() : ""); } else if (flag) { _typeProgress += Time.deltaTime * 50f; int length = Mathf.Min((int)_typeProgress, _fullText.Length); ((TMP_Text)_text).text = _fullText.Substring(0, length); } else { _typeProgress = 0f; ((TMP_Text)_text).text = ""; } float a = ((_timer < 0f) ? Mathf.Clamp01(1f + _timer / _fadeTime) : 1f); ((Graphic)_text).color = Plugin.WithAlpha(_baseColor, a); } } }