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 v1.0.0
PingIt.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using 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.Bootstrap; 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: IgnoresAccessChecksTo("Assembly-CSharp")] [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 { [BepInPlugin("eberk30.pingit", "Ping It!", "0.6.10")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PingIt : BaseUnityPlugin { internal class MapMarker : MonoBehaviour { private static Camera? _mapCamera; private static float _offMapRadius = 22.5f; private static readonly Color OnMapColor = new Color(1f, 1f, 1f, 1f); private static readonly Color OffMapColor = new Color(1f, 0.9f, 0.2f, 1f); private MapCustom _mc = null; private MapCustomEntity? _entity; private SpriteRenderer? _sr; private Sprite? _dotSprite; private float _life; internal void Init(MapCustom mc, float lifetime) { _mc = mc; _life = lifetime; _dotSprite = mc.sprite; } private void LateUpdate() { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028e: 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_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: 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_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: 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_043f: Unknown result type (might be due to invalid IL or missing references) _life -= Time.deltaTime; if (_life <= 0f) { if ((Object)(object)_entity != (Object)null) { Object.Destroy((Object)(object)((Component)_entity).gameObject); } ((Behaviour)this).enabled = false; return; } if ((Object)(object)_sr == (Object)null) { _entity = _mc.mapCustomEntity; if ((Object)(object)_entity == (Object)null) { return; } _sr = ((Component)_entity).GetComponentInChildren<SpriteRenderer>(true); if ((Object)(object)_sr == (Object)null) { return; } } float num = Mathf.Lerp(0.15f, 1f, 0.5f + 0.5f * Mathf.Sin(Time.time * MathF.PI * 2f)); Transform val = Map.Instance?.playerTransformSource; if ((Object)(object)val == (Object)null) { _sr.color = new Color(OnMapColor.r, OnMapColor.g, OnMapColor.b, num); return; } Map instance = Map.Instance; if ((Object)(object)_mapCamera == (Object)null && (Object)(object)_entity != (Object)null) { _offMapRadius = 22.5f; int layer = ((Component)_entity).gameObject.layer; Camera[] array = Object.FindObjectsOfType<Camera>(); foreach (Camera val2 in array) { if (val2.orthographic && (val2.cullingMask & (1 << layer)) != 0 && !((Object)(object)val2 == (Object)(object)Camera.main)) { _mapCamera = val2; _offMapRadius = val2.orthographicSize / Mathf.Max(0.001f, instance.Scale); DebugLog($"map camera resolved: {((Object)val2).name} orthoSize={val2.orthographicSize} mapScale={instance.Scale} -> offMapRadius={_offMapRadius:F1} world units"); break; } } } Vector3 position = ((Component)this).transform.position; float num2 = position.x - val.position.x; float num3 = position.z - val.position.z; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); if (num4 > _offMapRadius) { float num5 = _offMapRadius / num4; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val.position.x + num2 * num5, position.y, val.position.z + num3 * num5); ((Component)_entity).transform.position = val3 * instance.Scale + instance.OverLayerParent.position; if ((Object)(object)_sr.sprite != (Object)(object)GetPingArrowSprite()) { _sr.sprite = GetPingArrowSprite(); } float num6 = (0f - Mathf.Atan2(num2, num3)) * 57.29578f; ((Component)_entity).transform.localRotation = Quaternion.Euler(0f, 0f, num6); _sr.color = new Color(OffMapColor.r, OffMapColor.g, OffMapColor.b, num); } else { if ((Object)(object)_dotSprite != (Object)null && (Object)(object)_sr.sprite != (Object)(object)_dotSprite) { _sr.sprite = _dotSprite; } ((Component)_entity).transform.localRotation = Quaternion.identity; _sr.color = new Color(OnMapColor.r, OnMapColor.g, OnMapColor.b, num); } } } internal enum PingWire { Valuable, Enemy, Item, Location, Cosmetic, Cart } internal struct LookResult { public PingTarget Type; public PhysGrabObject? PhysGrab; public EnemyRigidbody? EnemyRb; public Vector3 Position; } private static FieldInfo? _genesisField; private static bool _genesisMODchecked; private static readonly Dictionary<PhysGrabObject, ValuableDiscoverGraphic> _pingGraphics = new Dictionary<PhysGrabObject, ValuableDiscoverGraphic>(); private static ExtractionPoint[]? _epCache; private static Sprite? _pingMapSprite; private static Sprite? _pingMapArrow; private static readonly HashSet<string> _skipRoomVolume = new HashSet<string> { "Cleanup Crew", "Clown", "Trudge" }; public const string PLUGIN_GUID = "eberk30.pingit"; public const string PLUGIN_NAME = "Ping It!"; public const string PLUGIN_VERSION = "0.6.10"; 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 Keybind PingKeybind = null; internal static readonly Dictionary<PingTarget, GameObject?> prefabs = new Dictionary<PingTarget, GameObject>(); internal static Mesh? _cubeMesh; internal static Camera? _mainCam; internal static PlayerUpgrade? _pingAnywhereUpgrade; internal static PlayerUpgrade? _pingInfoUpgrade; internal static PlayerAvatar? _localPlayer; private static bool _sharedUpgradesMODchecked; private static bool _sharedUpgradesMOD; private const string PHOTON_FLAG = "PingIt"; internal static NetworkedEvent PingEvent = null; internal static readonly List<PlayerDeathHead> _deathHeads = new List<PlayerDeathHead>(); private static bool _photonFlagSet; private static float _lastPing = -999f; private static readonly RaycastHit[] _pierceHits = (RaycastHit[])(object)new RaycastHit[32]; private static readonly Comparer<RaycastHit> _byDistance = Comparer<RaycastHit>.Create((RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); 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" }); private static CosmeticWorldObject[]? _cosmeticCache; internal static void Spawn(PhysGrabObject? physGrab, PingTarget type, string? locationPrefix = null) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Invalid comparison between Unknown and I4 //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0753: 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) 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); } prefabs.TryGetValue(type, out GameObject value); if (value == null) { value = prefabs[PingTarget.Valuable]; } if ((Object)(object)value != (Object)null) { if (type == PingTarget.Enemy) { physGrab2.centerPoint = Vector3.zero; } if (_pingGraphics.TryGetValue(physGrab2, out ValuableDiscoverGraphic value2) && (Object)(object)value2 != (Object)null) { Object.Destroy((Object)(object)((Component)value2).gameObject); } _pingGraphics.Remove(physGrab2); GameObject val = Object.Instantiate<GameObject>(value, ((Component)ValuableDiscover.instance).transform); val.SetActive(true); ValuableDiscoverGraphic component = val.GetComponent<ValuableDiscoverGraphic>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)$"prefab for {type} is missing ValuableDiscoverGraphic, bailing"); Object.Destroy((Object)(object)val); return; } GameObject graphicPrefab = ValuableDiscover.instance.graphicPrefab; ValuableDiscoverGraphic val2 = ((graphicPrefab != null) ? graphicPrefab.GetComponent<ValuableDiscoverGraphic>() : null); if ((Object)(object)val2 != (Object)null) { component.sound = val2.sound; } component.target = physGrab2; component.waitTime = cfgDuration.Value; component.waitTimer = cfgDuration.Value; _pingGraphics[physGrab2] = component; } else { ValuableDiscover.instance.New(physGrab2, (State)0, (ValuableDiscoverCustom)null); ValuableDiscoverGraphic[] componentsInChildren = ((Component)ValuableDiscover.instance).GetComponentsInChildren<ValuableDiscoverGraphic>(); foreach (ValuableDiscoverGraphic val3 in componentsInChildren) { if (!((Object)(object)val3.target != (Object)(object)physGrab2)) { val3.waitTime = cfgDuration.Value; val3.waitTimer = cfgDuration.Value; break; } } } if ((Object)(object)HUDCanvas.instance == (Object)null || !LocalHasPingInfo()) { return; } PingLabel.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 && component5.dollarValueSet) { string text4 = (((Object)(object)genesisBehaviour != (Object)null) ? "Genesis" : ((object)(Type)(ref component5.volumeType)).ToString()); string text5 = "$" + SemiFunc.DollarGetString((int)component5.dollarValueCurrent); text = text4 + "\n" + text5; } 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 && component5.dollarValueSet) { float dollarValueOriginal = component5.dollarValueOriginal; if (dollarValueOriginal > 0f) { color = ConditionColor(component5.dollarValueCurrent / dollarValueOriginal); } } break; } case PingTarget.Item: { ItemAttributes component3 = ((Component)physGrab2).GetComponent<ItemAttributes>(); if (!((Object)(object)component3 != (Object)null)) { break; } string itemName = component3.itemName; if (!string.IsNullOrEmpty(itemName)) { text = itemName; 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 enemy = componentInParent.Enemy; EnemyHealth val5 = (((Object)(object)enemy != (Object)null) ? enemy.Health : null); if ((Object)(object)val5 != (Object)null && val5.health > 0) { text = text + "\n" + val5.healthCurrent + " / " + val5.health + " HP"; color = ConditionColor((float)val5.healthCurrent / (float)val5.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 val6 = (((Object)(object)_mainCam != (Object)null) ? ((Component)_mainCam).transform.position : transform.position); float num6 = Vector3.Distance(val6, transform.position); string text10 = ((num6 < 10f) ? (num6.ToString("F1") + "m") : (Mathf.RoundToInt(num6) + "m")); string text11; if ((Object)(object)extractionPt != (Object)null) { int valueOrDefault = (RoundDirector.instance?.dollarHaulList?.Count).GetValueOrDefault(); text11 = "Extraction\n" + valueOrDefault + " item" + ((valueOrDefault == 1) ? "" : "s") + "\n" + text10; } else { text11 = (isExtraction ? ("Extraction\n" + text10) : text10); } return (locationPrefix2 != null) ? (locationPrefix2 + "\n" + text11) : text11; }; string cachedStr = ""; int cachedFrame = -1; Func<string> getStr = delegate { if (Time.frameCount != cachedFrame) { cachedStr = locText(); cachedFrame = Time.frameCount; } return cachedStr; }; PingLabel pingLabel = PingLabel.Spawn(physGrab2, "", cfgDuration.Value, 180f, above: true); PingLabel pingLabel2 = PingLabel.Spawn(physGrab2, "", cfgDuration.Value, 180f); pingLabel._dynamicText = delegate { string text9 = getStr(); int num5 = text9.IndexOf('\n'); return (num5 > 0) ? text9.Substring(0, num5) : text9; }; pingLabel2._dynamicText = delegate { string text7 = getStr(); int num3 = text7.IndexOf('\n'); object result; if (num3 <= 0) { result = ""; } else { string text8 = text7; int num4 = num3 + 1; result = text8.Substring(num4, text8.Length - num4); } return (string)result; }; break; } case PingTarget.Cosmetic: { CosmeticWorldObject val4 = ((Component)physGrab2).GetComponent<CosmeticWorldObject>() ?? ((Component)physGrab2).GetComponentInChildren<CosmeticWorldObject>(); if ((Object)(object)val4 != (Object)null) { Rarity rarity = val4.rarity; string text3 = (((int)rarity == 3) ? "ULTRA RARE" : ((object)(Rarity)(ref rarity)).ToString().ToUpper()); text = text3 + "\n" + Mathf.RoundToInt(Mathf.Clamp01(val4.healthAmountTarget) * 100f) + "%"; color = RarityColor(rarity); } break; } case PingTarget.Cart: { PhysGrabCart component2 = ((Component)physGrab2).GetComponent<PhysGrabCart>(); if ((Object)(object)component2 != (Object)null) { int itemsInCartCount = component2.itemsInCartCount; int haulCurrent = component2.haulCurrent; string text2 = itemsInCartCount + " item" + ((itemsInCartCount == 1) ? "" : "s"); text = "C.A.R.T.\n" + ((itemsInCartCount > 0) ? (text2 + "\n$" + SemiFunc.DollarGetString(haulCurrent)) : "Empty"); } else { text = "C.A.R.T."; } break; } } if (text != null) { float lookAngle = ((type == PingTarget.Valuable) ? 5f : 10f); int num = text.IndexOf('\n'); if (num > 0) { PingLabel.Spawn(physGrab2, text.Substring(0, num), cfgDuration.Value, lookAngle, above: true, color); PhysGrabObject target = physGrab2; string text6 = text; int num2 = num + 1; PingLabel.Spawn(target, text6.Substring(num2, text6.Length - num2), cfgDuration.Value, lookAngle, above: false, color); } else { PingLabel.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; } 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 PingAtPos(Vector3 worldPos, int actorNumber) { //IL_007c: 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_00de: Expected O, but got Unknown //IL_00e4: 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_00fb: 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_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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 && componentInParent.closed) { 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; MapCustom val5 = val2.AddComponent<MapCustom>(); val5.autoAdd = true; val5.color = Color.white; val5.sprite = GetPingMapSprite(); val2.AddComponent<MapMarker>().Init(val5, cfgDuration.Value); Object.Destroy((Object)(object)val2, cfgDuration.Value + 5f); value.Add(val2); Spawn(val4, PingTarget.Location, locationPrefix); } private static Sprite GetPingMapSprite() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_pingMapSprite != (Object)null) { return _pingMapSprite; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; float num = 15f; Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num2 = (float)j - 16f + 0.5f; float num3 = (float)i - 16f + 0.5f; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); byte b = (byte)Mathf.Clamp(Mathf.RoundToInt((num - num4) * 255f), 0, 255); array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(array); val.Apply(); _pingMapSprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 320f); return _pingMapSprite; } private static Sprite GetPingArrowSprite() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_pingMapArrow != (Object)null) { return _pingMapArrow; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false) { filterMode = (FilterMode)1 }; Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Mathf.InverseLerp(2f, 30f, (float)i); if (num < 0f || num > 1f) { array[i * 32 + j] = default(Color32); continue; } float num2 = (1f - num) * 14.4f; float num3 = 15.5f; float num4 = Mathf.Abs((float)j - num3); byte b = (byte)((num4 <= num2) ? byte.MaxValue : 0); array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(array); val.Apply(); _pingMapArrow = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 220f); return _pingMapArrow; } 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_0109: 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_0128: 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) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_00d8: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: 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_0217: 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) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: 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_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: 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_02f5: 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) 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; } if (!_skipRoomVolume.Contains(componentInParent.enemyName)) { RoomVolumeCheck componentInChildren = ((Component)componentInParent).GetComponentInChildren<RoomVolumeCheck>(true); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.currentSize != Vector3.zero) { Vector3 worldCenter = ((Component)componentInChildren).transform.TransformPoint(componentInChildren.CheckPosition); Vector3 worldSize = Vector3.Scale(componentInChildren.currentSize, ((Component)componentInChildren).transform.lossyScale); BuildBoundsProxy(physGrab, worldCenter, worldSize); return; } } bool flag = false; Bounds val2 = default(Bounds); SkinnedMeshRenderer[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val3 in componentsInChildren) { Bounds bounds = ((Renderer)val3).bounds; if (!(((Bounds)(ref bounds)).size == Vector3.zero)) { if (!flag) { val2 = ((Renderer)val3).bounds; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(((Renderer)val3).bounds); } } } if (flag && ((Bounds)(ref val2)).size != Vector3.zero) { BuildBoundsProxy(physGrab, ((Bounds)(ref val2)).center, ((Bounds)(ref val2)).size); return; } Vector3 position = ((Component)physGrab).transform.position; 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) { MeshRenderer[] componentsInChildren3 = ((Component)componentInParent).GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val5 in componentsInChildren3) { if (((Component)val5).transform.IsChildOf(((Component)physGrab).transform)) { continue; } Bounds bounds2 = ((Renderer)val5).bounds; if (((Bounds)(ref bounds2)).size == Vector3.zero) { continue; } float num = ((Bounds)(ref bounds2)).center.x - position.x; float num2 = ((Bounds)(ref bounds2)).center.z - position.z; if (!(num * num + num2 * num2 > 9f)) { if (!flag) { val2 = bounds2; flag = true; } else { ((Bounds)(ref val2)).Encapsulate(bounds2); } } } } if (flag && !(((Bounds)(ref val2)).size == Vector3.zero)) { float num3 = 3.5f; Vector3 size = ((Bounds)(ref val2)).size; if (size.x > num3 || size.y > num3 || size.z > num3) { ((Bounds)(ref val2))..ctor(((Bounds)(ref val2)).center, new Vector3(Mathf.Min(size.x, num3), Mathf.Min(size.y, num3), Mathf.Min(size.z, num3))); } BuildBoundsProxy(physGrab, ((Bounds)(ref val2)).center, ((Bounds)(ref val2)).size); } } 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 void BuildBoundsProxy(PhysGrabObject physGrab, Vector3 worldCenter, Vector3 worldSize) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_004e: 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_0069: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PingIt_BoundsProxy"); val.transform.SetParent(((Component)physGrab).transform); val.transform.position = worldCenter; val.transform.rotation = Quaternion.identity; Vector3 lossyScale = ((Component)physGrab).transform.lossyScale; val.transform.localScale = new Vector3((lossyScale.x != 0f) ? (worldSize.x / lossyScale.x) : worldSize.x, (lossyScale.y != 0f) ? (worldSize.y / lossyScale.y) : worldSize.y, (lossyScale.z != 0f) ? (worldSize.z / lossyScale.z) : worldSize.z); val.AddComponent<MeshFilter>().mesh = GetCubeMesh(); ((Renderer)val.AddComponent<MeshRenderer>()).sharedMaterials = (Material[])(object)new Material[0]; Object.Destroy((Object)(object)val, 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 MonoBehaviour? GetGenesisBehaviour(PhysGrabObject pg) { if (!_genesisMODchecked) { _genesisMODchecked = 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 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 SemiFunc.InputDown(PingKeybind.inputKey); } internal static string GetDeathHeadName(PlayerDeathHead dh) { return ((Object)(object)dh.playerAvatar != (Object)null) ? dh.playerAvatar.playerName : "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); } internal static bool HasSharedUpgradesPlus() { if (!_sharedUpgradesMODchecked) { _sharedUpgradesMODchecked = true; _sharedUpgradesMOD = Chainloader.PluginInfos.ContainsKey("Vippy.SharedUpgradesPlus"); } return _sharedUpgradesMOD; } private static bool HostIsVanilla() { EnsurePhotonFlag(); if (!PhotonNetwork.InRoom) { return false; } if (PhotonNetwork.IsMasterClient) { return false; } Player masterClient = PhotonNetwork.MasterClient; return masterClient != null && !((Dictionary<object, object>)(object)masterClient.CustomProperties).ContainsKey((object)"PingIt"); } private static int GetUpgradeLevel(string upgradeId, PlayerUpgrade? repoPU) { if (HostIsVanilla()) { return 1; } 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; PingKeybind = Keybinds.Bind("Ping", "<Mouse>/middleButton"); 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", 15f, new ConfigDescription("How long the highlight sticks around.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), 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 (val.isLocal) { _localPlayer = val; break; } } PingEvent = new NetworkedEvent("PingIt_TriggerPing", (Action<EventData>)RemotePing); _harmony = new Harmony("eberk30.pingit"); _harmony.PatchAll(); Logger.LogInfo((object)$"Ping nanobots initiated, {cfgRange.Value:F0}m range"); } private static void EnsurePhotonFlag() { //IL_002f: 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_004e: Expected O, but got Unknown if (!_photonFlagSet && PhotonNetwork.IsConnected && PhotonNetwork.LocalPlayer != null) { _photonFlagSet = true; PhotonNetwork.LocalPlayer.SetCustomProperties(new Hashtable { [(object)"PingIt"] = "0.6.10" }, (Hashtable)null, (WebFlags)null); } } private void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0266: 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_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: 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_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonFlag(); if (!ConsumePingPress()) { return; } DebugLog("ping consumed by PingIt.Update"); if ((Object)(object)_localPlayer != (Object)null && _localPlayer.isDisabled) { SpectateCamera instance = SpectateCamera.instance; if ((Object)(object)instance == (Object)null || (int)instance.currentState != 2) { DebugLog("dead but not controlling death head (state=" + (((Object)(object)instance != (Object)null) ? ((object)(State)(ref instance.currentState)).ToString() : "no camera") + "), ping ignored"); return; } } 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 (val2.isLocal) { _localPlayer = val2; break; } } } LookResult lookResult = Aim(val, cfgRange.Value); object obj; if (lookResult.Type != PingTarget.Enemy) { obj = null; } else { PhysGrabObject? physGrab = lookResult.PhysGrab; obj = ((physGrab == null) ? null : ((Component)physGrab).GetComponentInParent<EnemyParent>()?.enemyName); } string text = (string)obj; object arg = lookResult.Type; PhysGrabObject? physGrab2 = lookResult.PhysGrab; DebugLog(string.Format("look result: {0} physgrab={1}", arg, ((physGrab2 != null) ? ((Object)physGrab2).name : null) ?? "null") + ((text != null) ? (" enemyName=\"" + text + "\"") : "")); if (lookResult.Type == PingTarget.None || (Object)(object)lookResult.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}"); PingAtPos(((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 {lookResult.Type} on {((Object)lookResult.PhysGrab).name}"); Spawn(lookResult.PhysGrab, lookResult.Type); float[] array2; if (lookResult.Type == PingTarget.Enemy && (Object)(object)lookResult.EnemyRb != (Object)null) { EnemyParent componentInParent = ((Component)lookResult.EnemyRb).GetComponentInParent<EnemyParent>(); PhotonView val3 = ((componentInParent != null) ? ((Component)componentInParent).GetComponent<PhotonView>() : null); array2 = new float[5] { lookResult.Position.x, lookResult.Position.y, lookResult.Position.z, 1f, ((Object)(object)val3 != (Object)null) ? ((float)val3.ViewID) : 0f }; } else { PingTarget type = lookResult.Type; if (1 == 0) { } PingWire pingWire = type switch { PingTarget.Cart => PingWire.Cart, PingTarget.Item => PingWire.Item, PingTarget.Cosmetic => PingWire.Cosmetic, _ => PingWire.Valuable, }; if (1 == 0) { } PingWire pingWire2 = pingWire; array2 = new float[4] { lookResult.Position.x, lookResult.Position.y, lookResult.Position.z, (float)pingWire2 }; } 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; } prefabs[PingTarget.Valuable] = val.LoadAsset<GameObject>("ValuablePing"); prefabs[PingTarget.Item] = val.LoadAsset<GameObject>("ItemPing"); prefabs[PingTarget.Enemy] = val.LoadAsset<GameObject>("EnemyPing"); prefabs[PingTarget.Location] = val.LoadAsset<GameObject>("LocationPing"); prefabs[PingTarget.Cart] = val.LoadAsset<GameObject>("CartPing"); prefabs[PingTarget.Cosmetic] = val.LoadAsset<GameObject>("CosmeticPing"); val.Unload(false); Dictionary<PingTarget, GameObject> dictionary = prefabs; if (dictionary[PingTarget.Cart] == null) { GameObject val3 = (dictionary[PingTarget.Cart] = prefabs[PingTarget.Item]); } dictionary = prefabs; if (dictionary[PingTarget.Cosmetic] == null) { GameObject val3 = (dictionary[PingTarget.Cosmetic] = prefabs[PingTarget.Valuable]); } foreach (KeyValuePair<PingTarget, GameObject> prefab in prefabs) { if ((Object)(object)prefab.Value == (Object)null) { Logger.LogError((object)$"{prefab.Key}Ping 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 RemotePing(EventData evt) { //IL_0044: 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_014d: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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]); PingWire pingWire = (PingWire)array[3]; switch (pingWire) { case PingWire.Location: PingAtPos(val, evt.Sender); break; case PingWire.Enemy: { EnemyRigidbody val6 = null; if (array.Length >= 5) { PhotonView val7 = PhotonView.Find((int)array[4]); EnemyParent val8 = ((val7 != null) ? ((Component)val7).GetComponent<EnemyParent>() : null); Enemy val9 = (((Object)(object)val8 != (Object)null) ? val8.Enemy : null); val6 = (((Object)(object)val9 != (Object)null) ? val9.Rigidbody : null); } if ((Object)(object)val6 == (Object)null) { val6 = FindClosestEnemyRigidbody(val, 225f); } if (!((Object)(object)val6 == (Object)null)) { PhysGrabObject val10 = ((Component)val6).GetComponent<PhysGrabObject>(); if ((Object)(object)val10 == (Object)null) { val10 = ((Component)val6).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val10, cfgDuration.Value + 5f); } Spawn(val10, PingTarget.Enemy); } break; } default: if (pingWire != PingWire.Cart) { if (pingWire == PingWire.Cosmetic) { CosmeticWorldObject val2 = FindClosestCosmetic(val, 25f); if (!((Object)(object)val2 == (Object)null)) { PhysGrabObject physGrab = GetPhysGrab((Component)(object)val2); Spawn(physGrab, PingTarget.Cosmetic); } break; } ValuableObject val3 = FindClosestValuable(val, 25f); if ((Object)(object)val3 != (Object)null) { Spawn(val3.physGrabObject ?? GetPhysGrab((Component)(object)val3), PingTarget.Valuable); break; } PlayerDeathHead val4 = FindClosestDeathHead(val, 25f); if (!((Object)(object)val4 == (Object)null)) { PhysGrabObject physGrab2 = ((Component)val4).GetComponent<PhysGrabObject>() ?? AddDeathHeadProxy(val4); Spawn(physGrab2, PingTarget.Valuable); } break; } goto case PingWire.Item; case PingWire.Item: { ItemAttributes val5 = FindClosestItem(val, 25f); if (!((Object)(object)val5 == (Object)null)) { PhysGrabObject physGrab3 = val5.physGrabObject ?? GetPhysGrab((Component)(object)val5); PingTarget type = ((pingWire == PingWire.Cart) ? PingTarget.Cart : PingTarget.Item); Spawn(physGrab3, type); } break; } } } private static PhysGrabObject AddDeathHeadProxy(PlayerDeathHead dh) { PhysGrabObject val = ((Component)dh).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val, cfgDuration.Value + 5f); return val; } internal static LookResult Aim(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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: 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_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010e: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0142: 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_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0321: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_058e: 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_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034a: 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_04a4: 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) //IL_0373: 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) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: 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_0688: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06c1: Unknown result type (might be due to invalid IL or missing references) //IL_06c3: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: 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_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0775: Unknown result type (might be due to invalid IL or missing references) //IL_0777: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_0880: Unknown result type (might be due to invalid IL or missing references) //IL_0882: 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; PhysGrabObject val5 = null; EnemyRigidbody enemyRb = null; float num2 = 1f; float num3 = 1f; float num4 = float.MaxValue; float num5 = float.MaxValue; Vector3 val6 = default(Vector3); Vector3 val7 = default(Vector3); Vector3 position2 = default(Vector3); Vector3 val8 = default(Vector3); List<ValuableObject> list = ValuableDirector.instance?.valuableList; Vector3 val11; if (list != null) { foreach (ValuableObject item in list) { if ((Object)(object)item == (Object)null) { continue; } PhysGrabObject val9 = item.physGrabObject ?? GetPhysGrab((Component)(object)item); if ((Object)(object)val9 == (Object)null) { continue; } PhysGrabObjectImpactDetector component = ((Component)val9).GetComponent<PhysGrabObjectImpactDetector>(); if ((Object)(object)component != (Object)null && component.inCart) { continue; } Vector3 center = GetCenter(val9); Vector3 val10 = center - position; if (!(((Vector3)(ref val10)).sqrMagnitude > num) && !(Vector3.Dot(forward, val10) < 0f)) { val11 = Vector3.Cross(forward, val10); float sqrMagnitude = ((Vector3)(ref val11)).sqrMagnitude; if (!(sqrMagnitude >= num2)) { num2 = sqrMagnitude; val = val9; val6 = center; } } } } foreach (PlayerDeathHead deathHead in _deathHeads) { if ((Object)(object)deathHead == (Object)null || (Object)(object)deathHead.playerAvatar == (Object)(object)_localPlayer) { continue; } Vector3 position3 = ((Component)deathHead).transform.position; Vector3 val12 = position3 - position; if (((Vector3)(ref val12)).sqrMagnitude > num || Vector3.Dot(forward, val12) < 0f) { continue; } val11 = Vector3.Cross(forward, val12); float sqrMagnitude2 = ((Vector3)(ref val11)).sqrMagnitude; if (!(sqrMagnitude2 >= num2)) { PhysGrabObject val13 = ((Component)deathHead).GetComponent<PhysGrabObject>(); if ((Object)(object)val13 == (Object)null) { val13 = ((Component)deathHead).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val13, cfgDuration.Value + 5f); } num2 = sqrMagnitude2; val = val13; val6 = GetCenter(val13); } } List<ItemAttributes> list2 = ItemManager.instance?.spawnedItems; if (list2 != null) { foreach (ItemAttributes item2 in list2) { if ((Object)(object)item2 == (Object)null) { continue; } PhysGrabObject val14 = item2.physGrabObject ?? GetPhysGrab((Component)(object)item2); if ((Object)(object)val14 == (Object)null) { continue; } Vector3 center2 = GetCenter(val14); Vector3 val15 = center2 - position; if (!(((Vector3)(ref val15)).sqrMagnitude > num) && !(Vector3.Dot(forward, val15) < 0f)) { val11 = Vector3.Cross(forward, val15); float sqrMagnitude3 = ((Vector3)(ref val11)).sqrMagnitude; if (!(sqrMagnitude3 >= num3)) { num3 = sqrMagnitude3; val2 = val14; val7 = center2; } } } } int num6 = Physics.RaycastNonAlloc(position, forward, _pierceHits, range, _pierceMask, (QueryTriggerInteraction)1); if (num6 > 0) { Array.Sort(_pierceHits, 0, num6, _byDistance); 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 enemy = componentInParent.Enemy; EnemyRigidbody val16 = (((Object)(object)enemy != (Object)null) ? enemy.Rigidbody : null); if ((Object)(object)val16 != (Object)null) { Rigidbody rb = val16.rb; Vector3 val17 = (((Object)(object)rb != (Object)null && ((Component)val16).gameObject.activeSelf) ? rb.worldCenterOfMass : (val16.followTarget.position + Vector3.up * val16.yOffset)); PhysGrabObject val18 = ((Component)val16).GetComponent<PhysGrabObject>(); if ((Object)(object)val18 == (Object)null) { val18 = ((Component)val16).gameObject.AddComponent<PhysGrabObject>(); Object.Destroy((Object)(object)val18, cfgDuration.Value + 5f); } Vector3 val19 = ((RaycastHit)(ref _pierceHits[i])).point - position; val11 = Vector3.Cross(forward, val19); num4 = ((Vector3)(ref val11)).sqrMagnitude; val3 = val18; enemyRb = val16; position2 = val17; } 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 center3 = GetCenter(physGrab); Vector3 val20 = ((RaycastHit)(ref _pierceHits[i])).point - position; val11 = Vector3.Cross(forward, val20); num5 = ((Vector3)(ref val11)).sqrMagnitude; val4 = physGrab; val8 = center3; } break; } PhysGrabObject componentInParent3 = ((Component)collider).GetComponentInParent<PhysGrabObject>(); if ((Object)(object)componentInParent3 != (Object)null) { if ((Object)(object)val5 == (Object)null) { val5 = componentInParent3; } continue; } 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 val21 = (flag ? val2 : val); Vector3 val22 = (flag ? val7 : val6); float num7 = (flag ? num3 : num2); if ((Object)(object)val5 != (Object)null && (Object)(object)val21 != (Object)(object)val5) { Vector3 center4 = GetCenter(val5); Vector3 val23 = center4 - position; if (((Vector3)(ref val23)).sqrMagnitude <= num && Vector3.Dot(forward, val23) >= 0f) { val11 = Vector3.Cross(forward, val23); float sqrMagnitude4 = ((Vector3)(ref val11)).sqrMagnitude; if (sqrMagnitude4 < num7 * 1.5f) { ValuableObject component2 = ((Component)val5).GetComponent<ValuableObject>(); ItemAttributes component3 = ((Component)val5).GetComponent<ItemAttributes>(); if ((Object)(object)component2 != (Object)null) { pingTarget = PingTarget.Valuable; val21 = val5; val22 = center4; num7 = sqrMagnitude4; } else if ((Object)(object)component3 != (Object)null) { pingTarget = (((Object)(object)((Component)val5).GetComponent<PhysGrabCart>() != (Object)null) ? PingTarget.Cart : PingTarget.Item); val21 = val5; val22 = center4; num7 = sqrMagnitude4; } } } } if ((Object)(object)val4 != (Object)null && ((Object)(object)val21 == (Object)null || num5 < num7)) { pingTarget = PingTarget.Cosmetic; val21 = val4; val22 = val8; num7 = num5; } if ((Object)(object)val3 != (Object)null && pingTarget != PingTarget.Cart && ((Object)(object)val21 == (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)val21 != (Object)null) { if (pingTarget != PingTarget.Cosmetic && !LOSClear(position, val22, ((Component)val21).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 = val21; result.Position = val22; 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_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) 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, _byDistance); 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 && component.closed) { 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 (componentInParent2.closed) { 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0076: 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_0079: 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) 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 physGrabObject = item.physGrabObject; Vector3 val = (((Object)(object)physGrabObject != (Object)null) ? GetCenter(physGrabObject) : ((Component)item).transform.position); Vector3 val2 = val - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = item; } } } return result; } private static PlayerDeathHead? FindClosestDeathHead(Vector3 pos, float maxSqDist) { //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_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) PlayerDeathHead result = null; float num = maxSqDist; for (int i = 0; i < _deathHeads.Count; i++) { PlayerDeathHead val = _deathHeads[i]; 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 ItemAttributes? FindClosestItem(Vector3 pos, float sqRange) { //IL_006a: 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_006f: 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) 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 physGrabObject = val.physGrabObject; Vector3 val2 = (((Object)(object)physGrabObject != (Object)null) ? GetCenter(physGrabObject) : ((Component)val).transform.position) - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private static CosmeticWorldObject? FindClosestCosmetic(Vector3 pos, float maxSqDist) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (_cosmeticCache == null || (_cosmeticCache.Length != 0 && (Object)(object)_cosmeticCache[0] == (Object)null)) { _cosmeticCache = Object.FindObjectsOfType<CosmeticWorldObject>(); } CosmeticWorldObject result = null; float num = maxSqDist; CosmeticWorldObject[] cosmeticCache = _cosmeticCache; foreach (CosmeticWorldObject val in cosmeticCache) { 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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 enemy = item.Enemy; if ((Object)(object)enemy == (Object)null) { continue; } EnemyRigidbody rigidbody = enemy.Rigidbody; if (!((Object)(object)rigidbody == (Object)null) && ((Component)rigidbody).gameObject.activeSelf) { Vector3 val = rigidbody.followTarget.position - pos; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = rigidbody; } } } return result; } } [HarmonyPatch(typeof(PlayerDeathHead))] internal static class DeathHeadTracker { [HarmonyPatch("Start")] [HarmonyPostfix] private static void OnStart(PlayerDeathHead __instance) { PingIt._deathHeads.Add(__instance); } [HarmonyPatch("OnDestroy")] [HarmonyPostfix] private static void OnDestroy(PlayerDeathHead __instance) { PingIt._deathHeads.Remove(__instance); } } [HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")] internal static class UpgradeCap { private static readonly string[] _ours = new string[2] { "PingAnywhere", "PingInfoUpgrade" }; [HarmonyPrefix] private static void Prefix() { if ((Object)(object)StatsManager.instance == (Object)null) { return; } int maxPurchaseAmount = (PingIt.HasSharedUpgradesPlus() ? 1 : (GameDirector.instance?.PlayerList?.Count).GetValueOrDefault(1)); string[] ours = _ours; foreach (string key in ours) { if (StatsManager.instance.itemDictionary.TryGetValue(key, out var value) && !((Object)(object)value == (Object)null)) { value.maxPurchase = true; value.maxPurchaseAmount = maxPurchaseAmount; } } } } [HarmonyPatch(typeof(StatsManager), "Start")] internal static class NameFix { [HarmonyPostfix] private static void Postfix(StatsManager __instance) { Add(__instance, "playerUpgradePingAnywhere", "Ping Anywhere"); Add(__instance, "playerUpgradePingInfo", "Ping Info"); } private static void Add(StatsManager sm, string key, string name) { //IL_001a: 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_002b: Expected O, but got Unknown if (!sm.upgradesInfo.ContainsKey(key)) { sm.upgradesInfo[key] = new UpgradeInfo { displayName = name }; } } } internal class PingLabel : MonoBehaviour { private static readonly List<PingLabel> _active = new List<PingLabel>(); 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 PingLabel 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) WorldSpaceUIValue instance = WorldSpaceUIValue.instance; GameObject val = new GameObject("PingIt_ValueLabel"); RectTransform rect = HUDCanvas.instance.rect; val.transform.SetParent((Transform)(object)rect, false); TextMeshProUGUI val2 = 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)val2).font = ((TMP_Text)component).font; ((TMP_Text)val2).fontSharedMaterial = ((TMP_Text)component).fontSharedMaterial; ((TMP_Text)val2).fontSize = instance.textSizeValue; } colorValue = instance.colorValue; } else { ((TMP_Text)val2).fontSize = 36f; ((Color)(ref colorValue))..ctor(0.4f, 0.85f, 0.3f); } ((TMP_Text)val2).fontSize = ((TMP_Text)val2).fontSize * PingIt.cfgTextSize.Value; ((TMP_Text)val2).text = ""; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((Graphic)val2).raycastTarget = false; ((Graphic)val2).color = PingIt.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); } } PingLabel pingLabel = val.AddComponent<PingLabel>(); pingLabel._target = target; pingLabel._renderers = ((Component)target).GetComponentsInChildren<MeshRenderer>(); pingLabel._text = val2; pingLabel._rect = val.GetComponent<RectTransform>(); pingLabel._fullText = label; pingLabel._timer = duration; pingLabel._baseColor = color.GetValueOrDefault(colorValue); pingLabel._lookAngle = lookAngle; pingLabel._aboveBracket = above; _active.Add(pingLabel); return pingLabel; } 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) : PingIt.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) : PingIt.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 = PingIt.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: