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.6.1
PingIt.dll
Decompiled 4 hours 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 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.5.0"; } [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.5.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { 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 Dictionary<PhysGrabObject, ValuableDiscoverGraphic> _pingGraphics = new Dictionary<PhysGrabObject, ValuableDiscoverGraphic>(); private static ExtractionPoint[]? _epCache; 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[2] { "RoomVolume", "Player" }); internal static ManualLogSource Logger = null; private Harmony _harmony = null; public static ConfigEntry<float> cfgRange = null; public static ConfigEntry<float> cfgCooldown = null; public static ConfigEntry<float> cfgDuration = null; public static ConfigEntry<float> cfgTextSize = null; public static ConfigEntry<string> cfgDebugLogging = null; internal static ConfigEntry<KeyCode> cfgKey = null; 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<ValuableObject, float> ValuableDollar = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueCurrent"); internal static readonly FieldRef<ValuableObject, float> ValuableOriginalDollar = AccessTools.FieldRefAccess<ValuableObject, float>("dollarValueOriginal"); internal static readonly FieldRef<ValuableObject, bool> ValuableDollarSet = AccessTools.FieldRefAccess<ValuableObject, bool>("dollarValueSet"); internal static readonly FieldRef<ItemAttributes, PhysGrabObject> ItemGrab = AccessTools.FieldRefAccess<ItemAttributes, PhysGrabObject>("physGrabObject"); internal static readonly FieldRef<ItemAttributes, string> ItemName = AccessTools.FieldRefAccess<ItemAttributes, string>("itemName"); internal static readonly FieldRef<PhysGrabCart, int> CartHaulCurrent = AccessTools.FieldRefAccess<PhysGrabCart, int>("haulCurrent"); internal static readonly FieldRef<PhysGrabCart, int> CartItemCount = AccessTools.FieldRefAccess<PhysGrabCart, int>("itemsInCartCount"); 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<Enemy, EnemyHealth> EnemyHealthComp = AccessTools.FieldRefAccess<Enemy, EnemyHealth>("Health"); internal static readonly FieldRef<EnemyHealth, int> HealthCurrent = AccessTools.FieldRefAccess<EnemyHealth, int>("healthCurrent"); internal static readonly FieldRef<EnemyRigidbody, float> RbYOffset = AccessTools.FieldRefAccess<EnemyRigidbody, float>("yOffset"); internal static readonly FieldRef<EnemyRigidbody, Rigidbody> RbPhysics = AccessTools.FieldRefAccess<EnemyRigidbody, Rigidbody>("rb"); 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 GameObject? cartPingPrefab; internal static GameObject? cosmeticPingPrefab; internal static readonly FieldRef<CosmeticWorldObject, float> CosmeticHealAmount = AccessTools.FieldRefAccess<CosmeticWorldObject, float>("healthAmountTarget"); 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 const float PING_TYPE_COSMETIC = 4f; 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_00e4: 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_0668: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Invalid comparison between Unknown and I4 //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_07f5: Unknown result type (might be due to invalid IL or missing references) //IL_07f7: Unknown result type (might be due to invalid IL or missing references) //IL_0626: 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.Cart => cartPingPrefab ?? itemPingPrefab, PingTarget.Item => itemPingPrefab, PingTarget.Location => locationPrefab, PingTarget.Cosmetic => cosmeticPingPrefab ?? pingPrefab, _ => pingPrefab, }); if (1 == 0) { } GameObject val2 = val; if ((Object)(object)val2 != (Object)null) { if (type == PingTarget.Enemy) { physGrab2.centerPoint = Vector3.zero; } if (_pingGraphics.TryGetValue(physGrab2, out ValuableDiscoverGraphic value) && (Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } _pingGraphics.Remove(physGrab2); 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; } component.target = physGrab2; component.waitTime = cfgDuration.Value; WaitTimer.Invoke(component) = cfgDuration.Value; _pingGraphics[physGrab2] = component; } else { ValuableDiscover.instance.New(physGrab2, (State)0, (ValuableDiscoverCustom)null); ValuableDiscoverGraphic[] componentsInChildren = ((Component)ValuableDiscover.instance).GetComponentsInChildren<ValuableDiscoverGraphic>(); foreach (ValuableDiscoverGraphic val5 in componentsInChildren) { if (!((Object)(object)val5.target != (Object)(object)physGrab2)) { val5.waitTime = cfgDuration.Value; WaitTimer.Invoke(val5) = cfgDuration.Value; break; } } } if ((Object)(object)HUDCanvas.instance == (Object)null || !LocalHasPingInfo()) { return; } PingValueLabel.ClearLabels(physGrab2); string text = null; Color? color = null; switch (type) { case PingTarget.Valuable: { ValuableObject component5 = ((Component)physGrab2).GetComponent<ValuableObject>(); MonoBehaviour genesisBehaviour = GetGenesisBehaviour(physGrab2); PlayerDeathHead component6 = ((Component)physGrab2).GetComponent<PlayerDeathHead>(); if ((Object)(object)component6 != (Object)null) { text = GetDeathHeadName(component6) + "\nDEAD"; } else if ((Object)(object)component5 != (Object)null && ValuableDollarSet.Invoke(component5)) { string text5 = (((Object)(object)genesisBehaviour != (Object)null) ? "Genesis" : ((object)(Type)(ref component5.volumeType)).ToString()); string text6 = "$" + SemiFunc.DollarGetString((int)ValuableDollar.Invoke(component5)); text = text5 + "\n" + text6; } if ((Object)(object)genesisBehaviour != (Object)null) { int petsLeft = GetPetsLeft(genesisBehaviour); text = ((text != null) ? (text + "\n") : "") + petsLeft + " pet" + ((petsLeft == 1) ? "" : "s") + " left"; } if ((Object)(object)component6 == (Object)null && (Object)(object)component5 != (Object)null && ValuableDollarSet.Invoke(component5)) { float num3 = ValuableOriginalDollar.Invoke(component5); if (num3 > 0f) { color = ConditionColor(ValuableDollar.Invoke(component5) / num3); } } break; } case PingTarget.Item: { ItemAttributes component3 = ((Component)physGrab2).GetComponent<ItemAttributes>(); if (!((Object)(object)component3 != (Object)null)) { break; } string text3 = ItemName.Invoke(component3); if (!string.IsNullOrEmpty(text3)) { text = text3; ItemBattery component4 = ((Component)physGrab2).GetComponent<ItemBattery>(); if ((Object)(object)component4 != (Object)null && !component4.isUnchargable) { text = text + "\n" + Mathf.RoundToInt(component4.batteryLife) + "%"; color = ConditionColor(component4.batteryLife / 100f); } } break; } case PingTarget.Enemy: { EnemyParent componentInParent = ((Component)physGrab2).GetComponentInParent<EnemyParent>(); if ((Object)(object)componentInParent != (Object)null && !string.IsNullOrEmpty(componentInParent.enemyName)) { text = componentInParent.enemyName; Enemy val7 = ParentEnemy.Invoke(componentInParent); EnemyHealth val8 = (((Object)(object)val7 != (Object)null) ? EnemyHealthComp.Invoke(val7) : null); if ((Object)(object)val8 != (Object)null && val8.health > 0) { text = text + "\n" + HealthCurrent.Invoke(val8) + " / " + val8.health + " HP"; color = ConditionColor((float)HealthCurrent.Invoke(val8) / (float)val8.health); } } break; } case PingTarget.Location: { ExtractionPoint extractionPt = FindNearestExtractionPoint(((Component)physGrab2).transform.position); bool isExtraction = (Object)(object)extractionPt != (Object)null; Func<string> locText = 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 val9 = (((Object)(object)_mainCam != (Object)null) ? ((Component)_mainCam).transform.position : transform.position); float num9 = Vector3.Distance(val9, transform.position); string text11 = ((num9 < 10f) ? (num9.ToString("F1") + "m") : (Mathf.RoundToInt(num9) + "m")); string text12; if ((Object)(object)extractionPt != (Object)null) { int valueOrDefault = (RoundDirector.instance?.dollarHaulList?.Count).GetValueOrDefault(); text12 = "Extraction\n" + valueOrDefault + " item" + ((valueOrDefault == 1) ? "" : "s") + "\n" + text11; } else { text12 = (isExtraction ? ("Extraction\n" + text11) : text11); } return (locationPrefix2 != null) ? (locationPrefix2 + "\n" + text12) : text12; }; string cachedStr = ""; int cachedFrame = -1; Func<string> getStr = delegate { if (Time.frameCount != cachedFrame) { cachedStr = locText(); cachedFrame = Time.frameCount; } return cachedStr; }; PingValueLabel pingValueLabel = PingValueLabel.Spawn(physGrab2, "", cfgDuration.Value, 180f, above: true); PingValueLabel pingValueLabel2 = PingValueLabel.Spawn(physGrab2, "", cfgDuration.Value, 180f); pingValueLabel._dynamicText = delegate { string text10 = getStr(); int num8 = text10.IndexOf('\n'); return (num8 > 0) ? text10.Substring(0, num8) : text10; }; pingValueLabel2._dynamicText = delegate { string text8 = getStr(); int num6 = text8.IndexOf('\n'); object result; if (num6 <= 0) { result = ""; } else { string text9 = text8; int num7 = num6 + 1; result = text9.Substring(num7, text9.Length - num7); } return (string)result; }; break; } case PingTarget.Cosmetic: { CosmeticWorldObject val6 = ((Component)physGrab2).GetComponent<CosmeticWorldObject>() ?? ((Component)physGrab2).GetComponentInChildren<CosmeticWorldObject>(); if ((Object)(object)val6 != (Object)null) { Rarity rarity = val6.rarity; string text4 = (((int)rarity == 3) ? "ULTRA RARE" : ((object)(Rarity)(ref rarity)).ToString().ToUpper()); text = text4 + "\n" + Mathf.RoundToInt(Mathf.Clamp01(CosmeticHealAmount.Invoke(val6)) * 100f) + "%"; color = RarityColor(rarity); } break; } case PingTarget.Cart: { PhysGrabCart component2 = ((Component)physGrab2).GetComponent<PhysGrabCart>(); if ((Object)(object)component2 != (Object)null) { int num = CartItemCount.Invoke(component2); int num2 = CartHaulCurrent.Invoke(component2); string text2 = num + " item" + ((num == 1) ? "" : "s"); text = "C.A.R.T.\n" + ((num > 0) ? (text2 + "\n$" + SemiFunc.DollarGetString(num2)) : "Empty"); } else { text = "C.A.R.T."; } break; } } if (text != null) { float lookAngle = ((type == PingTarget.Valuable) ? 5f : 10f); int num4 = text.IndexOf('\n'); if (num4 > 0) { PingValueLabel.Spawn(physGrab2, text.Substring(0, num4), cfgDuration.Value, lookAngle, above: true, color); PhysGrabObject target = physGrab2; string text7 = text; int num5 = num4 + 1; PingValueLabel.Spawn(target, text7.Substring(num5, text7.Length - num5), cfgDuration.Value, lookAngle, above: false, color); } else { PingValueLabel.Spawn(physGrab2, text, cfgDuration.Value, lookAngle, above: true, color); } } } private static Color ConditionColor(float t) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (t > 0.66f) { return new Color(0.2f, 0.85f, 0.2f); } if (t > 0.33f) { return new Color(0.9f, 0.55f, 0.1f); } return new Color(0.85f, 0.15f, 0.15f); } private static Color RarityColor(Rarity r) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) if (1 == 0) { } Color result = (Color)((int)r switch { 0 => new Color(0.4f, 1f, 0.4f), 1 => new Color(0.4f, 0.6f, 1f), 2 => new Color(1f, 0.45f, 0.75f), 3 => new Color(1f, 0.84f, 0.2f), _ => Color.white, }); if (1 == 0) { } return result; } 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; } private static ExtractionPoint? FindNearestExtractionPoint(Vector3 pos) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (_epCache == null || (_epCache.Length != 0 && (Object)(object)_epCache[0] == (Object)null)) { _epCache = Object.FindObjectsOfType<ExtractionPoint>(); } ExtractionPoint result = null; float num = 25f; ExtractionPoint[] epCache = _epCache; foreach (ExtractionPoint val in epCache) { if (!((Object)(object)val == (Object)null)) { Vector3 val2 = ((Component)val).transform.position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } 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, cfgDuration.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_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_035a: 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_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_03de: 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_0401: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: 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_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0497: 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_049f: 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) { SkinnedMeshRenderer[] componentsInChildren3 = ((Component)componentInParent).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val5 in componentsInChildren3) { Bounds bounds = ((Renderer)val5).bounds; if (((Bounds)(ref bounds)).size == Vector3.zero) { continue; } float num = ((Bounds)(ref bounds)).center.x - position.x; float num2 = ((Bounds)(ref bounds)).center.z - position.z; if (!(num * num + num2 * num2 > 9f)) { if (!flag) { val2 = bounds; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(bounds); } } } if (!flag) { MeshRenderer[] componentsInChildren4 = ((Component)componentInParent).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val6 in componentsInChildren4) { if (((Component)val6).transform.IsChildOf(((Component)physGrab).transform)) { continue; } Bounds bounds2 = ((Renderer)val6).bounds; if (((Bounds)(ref bounds2)).size == Vector3.zero) { continue; } float num3 = ((Bounds)(ref bounds2)).center.x - position.x; float num4 = ((Bounds)(ref bounds2)).center.z - position.z; if (!(num3 * num3 + num4 * num4 > 9f)) { if (!flag) { val2 = bounds2; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(bounds2); } } } } } if (flag && !(((Bounds)(ref val2)).size == Vector3.zero)) { float num5 = 3.5f; Vector3 size = ((Bounds)(ref val2)).size; if (size.x > num5 || size.y > num5 || size.z > num5) { ((Bounds)(ref val2))..ctor(((Bounds)(ref val2)).center, new Vector3(Mathf.Min(size.x, num5), Mathf.Min(size.y, num5), Mathf.Min(size.z, num5))); } GameObject val7 = new GameObject("PingIt_BoundsProxy"); val7.transform.SetParent(((Component)physGrab).transform); val7.transform.position = ((Bounds)(ref val2)).center; val7.transform.rotation = Quaternion.identity; Vector3 lossyScale = ((Component)physGrab).transform.lossyScale; val7.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); val7.AddComponent<MeshFilter>().mesh = GetCubeMesh(); ((Renderer)val7.AddComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[0]; Object.Destroy((Object)(object)val7, cfgDuration.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_0049: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_01ff: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: 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_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0124: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: 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_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0168: 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_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0582: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: 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) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_068b: 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_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_074d: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_079c: 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; PhysGrabObject val4 = null; EnemyRigidbody enemyRb = null; float num2 = 1f; float num3 = 1f; float num4 = float.MaxValue; float num5 = float.MaxValue; Vector3 val5 = default(Vector3); Vector3 val6 = default(Vector3); Vector3 position2 = default(Vector3); Vector3 val7 = default(Vector3); List<ValuableObject> list = ValuableDirector.instance?.valuableList; Vector3 val10; if (list != null) { foreach (ValuableObject item in list) { if ((Object)(object)item == (Object)null) { continue; } PhysGrabObject val8 = ValuableGrab.Invoke(item) ?? GetPhysGrab((Component)(object)item); if ((Object)(object)val8 == (Object)null) { continue; } PhysGrabObjectImpactDetector component = ((Component)val8).GetComponent<PhysGrabObjectImpactDetector>(); if ((Object)(object)component != (Object)null && component.inCart) { continue; } Vector3 center = GetCenter(val8); Vector3 val9 = center - position; if (!(((Vector3)(ref val9)).sqrMagnitude > num) && !(Vector3.Dot(forward, val9) < 0f)) { val10 = Vector3.Cross(forward, val9); float sqrMagnitude = ((Vector3)(ref val10)).sqrMagnitude; if (!(sqrMagnitude >= num2)) { num2 = sqrMagnitude; val = val8; val5 = center; } } } } foreach (PlayerDeathHead deathHead in _deathHeads) { if ((Object)(object)deathHead == (Object)null) { continue; } PhysGrabObject val11 = ((Component)deathHead).GetComponent<PhysGrabObject>(); if ((Object)(object)val11 == (Object)null) { val11 = ((Component)deathHead).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val11, cfgDuration.Value + 5f); } Vector3 center2 = GetCenter(val11); Vector3 val12 = center2 - position; if (!(((Vector3)(ref val12)).sqrMagnitude > num) && !(Vector3.Dot(forward, val12) < 0f)) { val10 = Vector3.Cross(forward, val12); float sqrMagnitude2 = ((Vector3)(ref val10)).sqrMagnitude; if (!(sqrMagnitude2 >= num2)) { num2 = sqrMagnitude2; val = val11; val5 = center2; } } } List<ItemAttributes> list2 = ItemManager.instance?.spawnedItems; if (list2 != null) { foreach (ItemAttributes item2 in list2) { if ((Object)(object)item2 == (Object)null) { continue; } PhysGrabObject val13 = ItemGrab.Invoke(item2) ?? GetPhysGrab((Component)(object)item2); if ((Object)(object)val13 == (Object)null) { continue; } Vector3 center3 = GetCenter(val13); Vector3 val14 = center3 - position; if (!(((Vector3)(ref val14)).sqrMagnitude > num) && !(Vector3.Dot(forward, val14) < 0f)) { val10 = Vector3.Cross(forward, val14); float sqrMagnitude3 = ((Vector3)(ref val10)).sqrMagnitude; if (!(sqrMagnitude3 >= num3)) { num3 = sqrMagnitude3; val2 = val13; val6 = center3; } } } } int num6 = Physics.RaycastNonAlloc(position, forward, _pierceHits, range, _pierceMask, (QueryTriggerInteraction)1); if (num6 > 0) { Array.Sort(_pierceHits, 0, num6, Comparer<RaycastHit>.Create((RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance))); for (int i = 0; i < num6; i++) { Collider collider = ((RaycastHit)(ref _pierceHits[i])).collider; if (((Object)collider).name.IndexOf("navmesh", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } EnemyParent componentInParent = ((Component)collider).GetComponentInParent<EnemyParent>(); if ((Object)(object)componentInParent != (Object)null) { Enemy val15 = ParentEnemy.Invoke(componentInParent); EnemyRigidbody val16 = (((Object)(object)val15 != (Object)null) ? EnemyRb.Invoke(val15) : null); if ((Object)(object)val16 != (Object)null) { Rigidbody val17 = RbPhysics.Invoke(val16); Vector3 val18 = (((Object)(object)val17 != (Object)null && ((Component)val16).gameObject.activeSelf) ? val17.worldCenterOfMass : (val16.followTarget.position + Vector3.up * RbYOffset.Invoke(val16))); PhysGrabObject val19 = ((Component)val16).GetComponent<PhysGrabObject>(); if ((Object)(object)val19 == (Object)null) { val19 = ((Component)val16).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val19, cfgDuration.Value + 5f); } Vector3 val20 = ((RaycastHit)(ref _pierceHits[i])).point - position; val10 = Vector3.Cross(forward, val20); num4 = ((Vector3)(ref val10)).sqrMagnitude; val3 = val19; enemyRb = val16; position2 = val18; } break; } CosmeticWorldObject componentInParent2 = ((Component)collider).GetComponentInParent<CosmeticWorldObject>(); if ((Object)(object)componentInParent2 != (Object)null) { PhysGrabObject physGrab = GetPhysGrab((Component)(object)componentInParent2); if ((Object)(object)physGrab != (Object)null) { Vector3 center4 = GetCenter(physGrab); Vector3 val21 = ((RaycastHit)(ref _pierceHits[i])).point - position; val10 = Vector3.Cross(forward, val21); num5 = ((Vector3)(ref val10)).sqrMagnitude; val4 = physGrab; val7 = center4; } break; } if (!((Object)(object)((Component)collider).GetComponentInParent<PhysGrabObject>() != (Object)null)) { break; } } } LookResult result; if ((Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null && (Object)(object)val3 == (Object)null && (Object)(object)val4 == (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 pingTarget = ((!flag) ? PingTarget.Valuable : PingTarget.Item); if (pingTarget == PingTarget.Item && (Object)(object)val2 != (Object)null && (Object)(object)((Component)val2).GetComponent<PhysGrabCart>() != (Object)null) { pingTarget = PingTarget.Cart; } PhysGrabObject val22 = (flag ? val2 : val); Vector3 val23 = (flag ? val6 : val5); float num7 = (flag ? num3 : num2); if ((Object)(object)val4 != (Object)null && ((Object)(object)val22 == (Object)null || num5 < num7)) { pingTarget = PingTarget.Cosmetic; val22 = val4; val23 = val7; num7 = num5; } if ((Object)(object)val3 != (Object)null && pingTarget != PingTarget.Cart && ((Object)(object)val22 == (Object)null || num4 < num7)) { result = default(LookResult); result.Type = PingTarget.Enemy; result.PhysGrab = val3; result.EnemyRb = enemyRb; result.Position = position2; return result; } if ((Object)(object)val22 != (Object)null) { if (pingTarget != PingTarget.Cosmetic && !LOSClear(position, val23, ((Component)val22).transform)) { 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; } result = default(LookResult); result.Type = pingTarget; result.PhysGrab = val22; result.Position = val23; return result; } result = default(LookResult); result.Type = PingTarget.Enemy; result.PhysGrab = val3; result.EnemyRb = enemyRb; result.Position = position2; 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to - from; if (!PiercingRaycast(from, ((Vector3)(ref val)).normalized, ((Vector3)(ref val)).magnitude - 0.1f, out var result, out var passedHinge)) { return true; } Transform transform = ((Component)((RaycastHit)(ref result)).collider).transform; if ((Object)(object)root != (Object)null && (transform.IsChildOf(root) || root.IsChildOf(transform))) { return true; } Vector3 val2 = ((RaycastHit)(ref result)).point - to; if (((Vector3)(ref val2)).sqrMagnitude < 0.09f) { return true; } return passedHinge; } internal static bool PiercingRaycast(Vector3 origin, Vector3 dir, float range, out RaycastHit result) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) bool passedHinge; return PiercingRaycast(origin, dir, range, out result, out passedHinge); } internal static bool PiercingRaycast(Vector3 origin, Vector3 dir, float range, out RaycastHit result, out bool passedHinge) { //IL_0005: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_00ec: Unknown result type (might be due to invalid IL or missing references) passedHinge = false; 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++) { Collider collider = ((RaycastHit)(ref _pierceHits[i])).collider; if (((Object)collider).name.IndexOf("navmesh", StringComparison.OrdinalIgnoreCase) >= 0) { continue; } PhysGrabObject componentInParent = ((Component)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; } if ((Object)(object)component != (Object)null) { passedHinge = true; } continue; } PhysGrabHinge componentInParent2 = ((Component)collider).GetComponentInParent<PhysGrabHinge>(); if ((Object)(object)componentInParent2 != (Object)null) { if (HingeClosed.Invoke(componentInParent2)) { result = _pierceHits[i]; return true; } passedHinge = true; continue; } result = _pierceHits[i]; return true; } result = default(RaycastHit); return false; } 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 CosmeticWorldObject? FindClosestCosmetic(Vector3 pos, float maxSqDist) { //IL_0031: 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_003c: Unknown result type (might be due to invalid IL or missing references) CosmeticWorldObject[] array = Object.FindObjectsOfType<CosmeticWorldObject>(); CosmeticWorldObject result = null; float num = maxSqDist; CosmeticWorldObject[] array2 = array; foreach (CosmeticWorldObject val in array2) { if (!((Object)(object)val == (Object)null)) { Vector3 val2 = ((Component)val).transform.position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private static EnemyRigidbody? FindClosestEnemyRigidbody(Vector3 pos, float maxSqDist) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) if ((Object)(object)EnemyDirector.instance == (Object)null) { return null; } List<EnemyParent> enemiesSpawned = EnemyDirector.instance.enemiesSpawned; if (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) && ((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 (cfgDebugLogging?.Value == "On") { Logger.LogDebug((object)msg); } } internal static bool ConsumePingPress() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Input.GetKeyDown(cfgKey.Value); } 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) { return repoPU.GetLevel(_localPlayer); } return -1; } internal static bool LocalHasPingInfo() { return GetUpgradeLevel("PingInfo", _pingInfoUpgrade) != 0; } private void Awake() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; cfgKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Ping", "Key", (KeyCode)325, "Key to trigger a ping"); cfgRange = ((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>())); cfgCooldown = ((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>())); cfgDuration = ((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>())); cfgTextSize = ((BaseUnityPlugin)this).Config.Bind<float>("Ping", "Value Text Size", 0.85f, new ConfigDescription("Size multiplier for the ping value text.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 3f), Array.Empty<object>())); cfgDebugLogging = ((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 { } PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); foreach (PlayerAvatar val in array) { if (_isLocalPlayer.Invoke(val)) { _localPlayer = val; break; } } PingEvent = new NetworkedEvent("PingIt_TriggerPing", (Action<EventData>)RemotePing); _harmony = new Harmony("eberk30.pingit"); _harmony.PatchAll(); Logger.LogInfo((object)"Ping It! v0.5.0 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_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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_039d: 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 < cfgCooldown.Value) { DebugLog($"ping on cooldown ({cfgCooldown.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, cfgRange.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, cfgRange.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 { PingTarget type = lookedAtTarget.Type; if (1 == 0) { } float num; switch (type) { case PingTarget.Item: case PingTarget.Cart: num = 2f; break; case PingTarget.Cosmetic: num = 4f; break; default: num = 0f; break; } if (1 == 0) { } float num2 = num; array2 = new float[4] { lookedAtTarget.Position.x, lookedAtTarget.Position.y, lookedAtTarget.Position.z, num2 }; } 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"); cartPingPrefab = val.LoadAsset<GameObject>("CartPing"); cosmeticPingPrefab = val.LoadAsset<GameObject>("CosmeticPing"); 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"); } if ((Object)(object)cartPingPrefab == (Object)null) { Logger.LogError((object)"CartPing not in bundle"); } if ((Object)(object)cosmeticPingPrefab == (Object)null) { Logger.LogWarning((object)"CosmeticPing not in bundle, will fall back to ValuablePing"); } } 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 RemotePing(EventData evt) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0244: 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 == 3f) { DoPingAtPos(val, evt.Sender); return; } if (num == 1f) { EnemyRigidbody val2 = null; if (array.Length >= 5) { PhotonView val3 = PhotonView.Find((int)array[4]); EnemyParent val4 = ((val3 != null) ? ((Component)val3).GetComponent<EnemyParent>() : null); Enemy val5 = (((Object)(object)val4 != (Object)null) ? ParentEnemy.Invoke(val4) : null); val2 = (((Object)(object)val5 != (Object)null) ? EnemyRb.Invoke(val5) : null); } if ((Object)(object)val2 == (Object)null) { val2 = FindClosestEnemyRigidbody(val, 225f); } if (!((Object)(object)val2 == (Object)null)) { PhysGrabObject val6 = ((Component)val2).GetComponent<PhysGrabObject>(); if ((Object)(object)val6 == (Object)null) { val6 = ((Component)val2).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val6, cfgDuration.Value + 5f); } DoSpawnHighlight(val6, PingTarget.Enemy); } return; } if (num == 2f) { ItemAttributes val7 = FindClosestItem(val, 25f); if (!((Object)(object)val7 == (Object)null)) { PhysGrabObject val8 = ItemGrab.Invoke(val7) ?? GetPhysGrab((Component)(object)val7); PingTarget type = (((Object)(object)((val8 != null) ? ((Component)val8).GetComponent<PhysGrabCart>() : null) != (Object)null) ? PingTarget.Cart : PingTarget.Item); DoSpawnHighlight(val8, type); } return; } if (num == 4f) { CosmeticWorldObject val9 = FindClosestCosmetic(val, 25f); if (!((Object)(object)val9 == (Object)null)) { PhysGrabObject physGrab = GetPhysGrab((Component)(object)val9); DoSpawnHighlight(physGrab, PingTarget.Cosmetic); } return; } ValuableObject val10 = FindClosestValuable(val, 25f); if ((Object)(object)val10 != (Object)null) { DoSpawnHighlight(ValuableGrab.Invoke(val10) ?? GetPhysGrab((Component)(object)val10), PingTarget.Valuable); return; } PlayerDeathHead val11 = FindClosestDeathHead(val, 25f); if (!((Object)(object)val11 == (Object)null)) { PhysGrabObject val12 = ((Component)val11).GetComponent<PhysGrabObject>(); if ((Object)(object)val12 == (Object)null) { val12 = ((Component)val11).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val12, cfgDuration.Value + 5f); } DoSpawnHighlight(val12, 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; private bool _aboveBracket; internal Func<string>? _dynamicText; internal static PingValueLabel Spawn(PhysGrabObject target, string label, float duration, float lookAngle = 10f, bool above = false, Color? color = null) { //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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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) 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.cfgTextSize.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 && _active[num]._aboveBracket == above) { 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 = color.GetValueOrDefault(colorValue); pingValueLabel._lookAngle = lookAngle; pingValueLabel._aboveBracket = above; _active.Add(pingValueLabel); return pingValueLabel; } internal static void ClearLabels(PhysGrabObject target) { 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); } } } 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 Vector2 GetAboveBracketPosition() { //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)).max.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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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 = (_aboveBracket ? GetAboveBracketPosition() : 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); } } internal enum PingTarget { None, Valuable, Item, Cart, Enemy, Location, Cosmetic } }