Decompiled source of DeadPowers v0.2.1

plugins/Thraac.DeadPowers.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Thraac.DeadPowers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.1.0")]
[assembly: AssemblyInformationalVersion("0.2.1+96cdadf33a669efcac678f6a330a1fc0a427d870")]
[assembly: AssemblyProduct("Thraac.DeadPowers")]
[assembly: AssemblyTitle("DeadPowers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace DeadPowers
{
	internal static class GhostCarry
	{
		public const float PickRange = 6f;

		public const float FeedRange = 4f;

		public const int FeedsToRevive = 4;

		public const int MaxCarry = 3;

		public static readonly List<Item> Carried = new List<Item>();

		public static int Selected;

		public static int FedCount;

		public static bool TryPick()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
			if (Carried.Count >= 3)
			{
				return false;
			}
			Transform transform = ((Component)MainCamera.instance.cam).transform;
			Item val = null;
			float num = 25f;
			foreach (Item aLL_ITEM in Item.ALL_ITEMS)
			{
				if (!((Object)(object)aLL_ITEM == (Object)null) && (int)aLL_ITEM.itemState == 0 && !((Object)(object)aLL_ITEM.holderCharacter != (Object)null) && !Carried.Contains(aLL_ITEM) && !(Vector3.Distance(aLL_ITEM.transform.position, GhostState.Position) > 6f))
				{
					float num2 = Vector3.Angle(aLL_ITEM.transform.position - transform.position, transform.forward);
					if (num2 < num)
					{
						num = num2;
						val = aLL_ITEM;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			if (!((MonoBehaviourPun)val).photonView.IsMine)
			{
				((MonoBehaviourPun)val).photonView.RequestOwnership();
			}
			val.rig.isKinematic = true;
			Carried.Add(val);
			Plugin.Log.LogInfo((object)$"[carry] picked {val.GetItemName((ItemInstanceData)null)} ({Carried.Count}/{3})");
			return true;
		}

		public static void Drop(int i)
		{
			if (i >= 0 && i < Carried.Count)
			{
				if ((Object)(object)Carried[i] != (Object)null)
				{
					Carried[i].rig.isKinematic = false;
				}
				Carried.RemoveAt(i);
				ClampSelected();
			}
		}

		public static void DropAll()
		{
			for (int num = Carried.Count - 1; num >= 0; num--)
			{
				Drop(num);
			}
		}

		private static void ClampSelected()
		{
			if (Selected >= Carried.Count)
			{
				Selected = Mathf.Max(0, Carried.Count - 1);
			}
		}

		public static void Use()
		{
			if (!TryFeed() && !TryPick())
			{
				Drop(Selected);
			}
		}

		public static void Tick()
		{
			//IL_0052: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			if (Carried.Count == 0)
			{
				return;
			}
			if (!GhostState.FreeFly)
			{
				DropAll();
				return;
			}
			Transform transform = ((Component)MainCamera.instance.cam).transform;
			for (int num = Carried.Count - 1; num >= 0; num--)
			{
				Item val = Carried[num];
				if ((Object)(object)val == (Object)null || (int)val.itemState != 0)
				{
					Carried.RemoveAt(num);
				}
				else
				{
					float num2 = ((float)num - (float)(Carried.Count - 1) / 2f) * 0.6f;
					float num3 = ((num == Selected) ? 1.2f : 1.5f);
					float num4 = Mathf.Sin(Time.time * 2f + (float)num * 1.3f) * 0.08f;
					Vector3 position = GhostState.Position + transform.forward * num3 + transform.right * num2 + Vector3.up * num4;
					val.transform.position = position;
					val.rig.position = position;
					ItemPhysicsSyncer component = ((Component)val).GetComponent<ItemPhysicsSyncer>();
					if ((Object)(object)component != (Object)null)
					{
						component.ForceSyncForFrames(10);
					}
					if (num == 0 && Time.frameCount % 120 == 0)
					{
						ManualLogSource log = Plugin.Log;
						string itemName = val.GetItemName((ItemInstanceData)null);
						object arg = ((MonoBehaviourPun)val).photonView.IsMine;
						Player owner = ((MonoBehaviourPun)val).photonView.Owner;
						log.LogInfo((object)$"[carry] {itemName} IsMine={arg} owner={((owner != null) ? owner.NickName : null)}");
					}
				}
			}
			ClampSelected();
		}

		public static bool TryFeed()
		{
			//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)
			if (Carried.Count == 0)
			{
				return false;
			}
			Item val = Carried[Selected];
			if (!val.canUseOnFriend)
			{
				Plugin.Log.LogInfo((object)"[carry] can't give that to someone");
				return false;
			}
			Character val2 = null;
			float num = 4f;
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (!((Object)(object)allCharacter == (Object)null) && !allCharacter.data.dead && !allCharacter.IsLocal)
				{
					float num2 = Vector3.Distance(allCharacter.Center, GhostState.Position);
					if (num2 < num)
					{
						num = num2;
						val2 = allCharacter;
					}
				}
			}
			if ((Object)(object)val2 == (Object)null)
			{
				Plugin.Log.LogInfo((object)"[carry] nobody in range");
				return false;
			}
			bool flag = (Object)(object)((Component)val).GetComponent<Action_RestoreHunger>() != (Object)null;
			Drop(Selected);
			val2.FeedItem(val);
			if (flag)
			{
				FedCount++;
				Plugin.Log.LogInfo((object)$"[carry] fed {val2.characterName} ({FedCount}/{4})");
				if (FedCount >= 4)
				{
					Revive();
				}
			}
			else
			{
				Plugin.Log.LogInfo((object)("[carry] gave " + val.GetItemName((ItemInstanceData)null) + " to " + val2.characterName));
			}
			return true;
		}

		public static void Cycle(int dir)
		{
			if (Carried.Count != 0)
			{
				Selected = (Selected + dir + Carried.Count) % Carried.Count;
			}
		}

		public static void Select(int i)
		{
			if (i < Carried.Count)
			{
				Selected = i;
			}
		}

		private static void Revive()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			DropAll();
			FedCount = 0;
			GhostScan.ClearHighlights();
			((MonoBehaviourPun)Character.localCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3]
			{
				GhostState.Position,
				false,
				-1
			});
		}
	}
	internal static class GhostState
	{
		public static bool Active;

		public static Vector3 Position;

		public static Vector3 Velocity;

		public const float Force = 35f;

		public const float Drag = 3f;

		public const float SprintMultiplier = 1.5f;

		public static bool FreeFly;
	}
	[HarmonyPatch(typeof(MainCameraMovement), "Spectate")]
	internal static class Patch_GhostCamera
	{
		private static void Postfix(MainCameraMovement __instance)
		{
			//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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0077: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || !localCharacter.data.dead)
			{
				GhostState.Active = false;
				GhostState.FreeFly = false;
				GhostCarry.FedCount = 0;
				return;
			}
			if (localCharacter.CanDoInput() && Input.GetKeyDown((KeyCode)120))
			{
				GhostState.FreeFly = !GhostState.FreeFly;
				GhostState.Active = false;
			}
			if (!GhostState.FreeFly)
			{
				return;
			}
			if (!GhostState.Active)
			{
				GhostState.Position = ((Component)__instance).transform.position;
				GhostState.Velocity = Vector3.zero;
				GhostState.Active = true;
			}
			Vector3 zero = Vector3.zero;
			zero.x = localCharacter.input.movementInput.x;
			zero.z = localCharacter.input.movementInput.y;
			if (localCharacter.input.jumpIsPressed)
			{
				zero.y += 1f;
			}
			if (localCharacter.input.crouchIsPressed)
			{
				zero.y -= 1f;
			}
			float num = (localCharacter.input.sprintIsPressed ? 52.5f : 35f);
			GhostState.Velocity += ((Component)__instance).transform.TransformDirection(zero) * num * Time.deltaTime;
			GhostState.Velocity = FRILerp.Lerp(GhostState.Velocity, Vector3.zero, 3f, true);
			GhostState.Position += GhostState.Velocity * Time.deltaTime;
			((Component)__instance).transform.position = GhostState.Position;
			if (localCharacter.CanDoInput() && Input.GetKeyDown((KeyCode)113))
			{
				GhostScan.Scan();
			}
			if (localCharacter.CanDoInput() && Input.GetKeyDown((KeyCode)101))
			{
				GhostCarry.Use();
			}
			if (!localCharacter.CanDoInput())
			{
				return;
			}
			float y = Input.mouseScrollDelta.y;
			if (y > 0f)
			{
				GhostCarry.Cycle(1);
			}
			if (y < 0f)
			{
				GhostCarry.Cycle(-1);
			}
			for (int i = 0; i < 3; i++)
			{
				if (Input.GetKeyDown((KeyCode)(49 + i)))
				{
					GhostCarry.Select(i);
				}
			}
		}
	}
	internal static class GhostOutline
	{
		private static Material _mat;

		private static Material _playerMat;

		private static readonly Dictionary<SkinnedMeshRenderer, Mesh> _baked = new Dictionary<SkinnedMeshRenderer, Mesh>();

		private static readonly Dictionary<Character, SkinnedMeshRenderer[]> _renderers = new Dictionary<Character, SkinnedMeshRenderer[]>();

		public static Color Neon = new Color(0f, 1f, 0.6f);

		public static Color PlayerColor = new Color(0.224f, 1f, 0.078f);

		private static Material Mat()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)(object)_mat == (Object)null)
			{
				_mat = new Material(Shader.Find("Hidden/Internal-Colored"));
				((Object)_mat).hideFlags = (HideFlags)61;
				_mat.SetInt("_ZTest", 8);
				_mat.SetInt("_ZWrite", 0);
				_mat.SetInt("_Cull", 0);
				_mat.SetInt("_SrcBlend", 5);
				_mat.SetInt("_DstBlend", 10);
				_mat.renderQueue = 5000;
			}
			return _mat;
		}

		private static Material PlayerMat()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			if ((Object)(object)_playerMat == (Object)null)
			{
				_playerMat = new Material(Shader.Find("Hidden/Internal-Colored"));
				((Object)_playerMat).hideFlags = (HideFlags)61;
				_playerMat.SetInt("_ZTest", 8);
				_playerMat.SetInt("_ZWrite", 0);
				_playerMat.SetInt("_Cull", 0);
				_playerMat.SetInt("_SrcBlend", 5);
				_playerMat.SetInt("_DstBlend", 10);
				_playerMat.renderQueue = 5000;
			}
			return _playerMat;
		}

		public static void DrawAll(List<Item> items, float alpha)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			Material val = Mat();
			val.SetColor("_Color", new Color(Neon.r, Neon.g, Neon.b, alpha));
			foreach (Item item in items)
			{
				if (!((Object)(object)item == (Object)null))
				{
					MeshFilter componentInChildren = ((Component)item).GetComponentInChildren<MeshFilter>();
					if (!((Object)(object)componentInChildren == (Object)null) && !((Object)(object)componentInChildren.sharedMesh == (Object)null))
					{
						Transform transform = ((Component)componentInChildren).transform;
						Matrix4x4 val2 = Matrix4x4.TRS(transform.position, transform.rotation, transform.lossyScale * 1.05f);
						Graphics.DrawMesh(componentInChildren.sharedMesh, val2, val, ((Component)componentInChildren).gameObject.layer);
					}
				}
			}
		}

		public static void DrawPlayers(List<Character> players, float alpha)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_0162: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			Material val = PlayerMat();
			val.SetColor("_Color", new Color(PlayerColor.r, PlayerColor.g, PlayerColor.b, alpha));
			foreach (Character player in players)
			{
				if ((Object)(object)player == (Object)null)
				{
					continue;
				}
				if (!_renderers.TryGetValue(player, out SkinnedMeshRenderer[] value))
				{
					value = ((Component)player).GetComponentsInChildren<SkinnedMeshRenderer>();
					_renderers[player] = value;
					Plugin.Log.LogInfo((object)$"[outline] {player.characterName}: {value.Length} skinned renderers");
				}
				SkinnedMeshRenderer[] array = value;
				foreach (SkinnedMeshRenderer val2 in array)
				{
					if (!((Object)(object)val2 == (Object)null) && ((Renderer)val2).enabled && ((Component)val2).gameObject.activeInHierarchy)
					{
						if (!_baked.TryGetValue(val2, out Mesh value2))
						{
							value2 = new Mesh();
							_baked[val2] = value2;
						}
						val2.BakeMesh(value2, true);
						Matrix4x4 localToWorldMatrix = ((Component)val2).transform.localToWorldMatrix;
						Bounds bounds = value2.bounds;
						Vector3 val3 = ((Matrix4x4)(ref localToWorldMatrix)).MultiplyPoint3x4(((Bounds)(ref bounds)).center);
						Matrix4x4 val4 = Matrix4x4.Translate(val3) * Matrix4x4.Scale(Vector3.one * 1.05f) * Matrix4x4.Translate(-val3);
						Matrix4x4 val5 = val4 * localToWorldMatrix;
						for (int j = 0; j < value2.subMeshCount; j++)
						{
							Graphics.DrawMesh(value2, val5, val, ((Component)val2).gameObject.layer, (Camera)null, j);
						}
					}
				}
			}
		}
	}
	internal static class GhostScan
	{
		public const float Radius = 150f;

		public const float ShowSeconds = 8f;

		public static readonly List<Item> Results = new List<Item>();

		public static readonly List<Character> Players = new List<Character>();

		public static float ExpiresAt;

		public static float Alpha => Mathf.Clamp01((ExpiresAt - Time.time) / 8f);

		public static void Scan()
		{
			//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_0036: Unknown result type (might be due to invalid IL or missing references)
			ClearHighlights();
			foreach (Item aLL_ITEM in Item.ALL_ITEMS)
			{
				if (!((Object)(object)aLL_ITEM == (Object)null) && (int)aLL_ITEM.itemState == 0 && !(Vector3.Distance(aLL_ITEM.transform.position, GhostState.Position) > 150f))
				{
					Results.Add(aLL_ITEM);
					aLL_ITEM.HoverEnter();
				}
			}
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if (!((Object)(object)allCharacter == (Object)null) && !allCharacter.IsLocal && !allCharacter.data.dead)
				{
					Players.Add(allCharacter);
				}
			}
			ExpiresAt = Time.time + 8f;
			Plugin.Log.LogInfo((object)$"[scan] {Results.Count} items within {150f}m");
			Plugin.Log.LogInfo((object)$"[scan] {Players.Count} players within game");
			string[] array = new string[5] { "Hidden/Internal-Colored", "UI/Default", "Sprites/Default", "Universal Render Pipeline/Unlit", "Unlit/Color" };
			foreach (string text in array)
			{
				Plugin.Log.LogInfo((object)("[shader-find] " + text + " = " + (((Object)(object)Shader.Find(text) != (Object)null) ? "OK" : "null")));
			}
		}

		public static void ClearHighlights()
		{
			foreach (Item result in Results)
			{
				if ((Object)(object)result != (Object)null)
				{
					result.HoverExit();
				}
			}
			Results.Clear();
			Players.Clear();
		}

		public static void Tick()
		{
			if ((Results.Count > 0 || Players.Count > 0) && Time.time > ExpiresAt)
			{
				ClearHighlights();
			}
		}
	}
	[BepInPlugin("Thraac.DeadPowers", "DeadPowers", "0.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public const string Id = "Thraac.DeadPowers";

		internal static ManualLogSource Log { get; private set; }

		public static string Name => "DeadPowers";

		public static string Version => "0.2.1";

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			_harmony = new Harmony("Thraac.DeadPowers");
			_harmony.PatchAll();
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}

		private void Update()
		{
			GhostScan.Tick();
			GhostCarry.Tick();
			if (GhostScan.Results.Count > 0)
			{
				GhostOutline.DrawAll(GhostScan.Results, GhostScan.Alpha);
			}
			if (GhostScan.Players.Count > 0)
			{
				GhostOutline.DrawPlayers(GhostScan.Players, GhostScan.Alpha);
			}
		}

		private static void OutlinedLabel(Rect rect, string text, GUIStyle style, Color fill, Color outline, int size = 2)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			Color textColor = style.normal.textColor;
			style.normal.textColor = outline;
			for (int i = -size; i <= size; i++)
			{
				for (int j = -size; j <= size; j++)
				{
					if (i != 0 || j != 0)
					{
						GUI.Label(new Rect(((Rect)(ref rect)).x + (float)i, ((Rect)(ref rect)).y + (float)j, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style);
					}
				}
			}
			style.normal.textColor = fill;
			GUI.Label(rect, text, style);
			style.normal.textColor = textColor;
		}

		private void OnGUI()
		{
			//IL_0034: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			//IL_0049: 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)
			//IL_00bf: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			if (!GhostState.Active)
			{
				return;
			}
			Rect rect = default(Rect);
			((Rect)(ref rect))..ctor((float)Screen.width - 220f, 10f, 200f, 30f);
			GUIStyle style = new GUIStyle(GUI.skin.label)
			{
				alignment = (TextAnchor)2,
				fontSize = 20
			};
			OutlinedLabel(rect, $"Feeds: {GhostCarry.FedCount} / {4}", style, Color.black, Color.white);
			if (Time.time > GhostScan.ExpiresAt)
			{
				return;
			}
			Camera val = (((Object)(object)MainCamera.instance != (Object)null) ? MainCamera.instance.cam : Camera.main);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GUI.color = new Color(1f, 1f, 1f, 1f);
			foreach (Item result in GhostScan.Results)
			{
				if (!((Object)(object)result == (Object)null))
				{
					Vector3 val2 = val.WorldToScreenPoint(result.transform.position);
					if (Time.frameCount % 60 == 0)
					{
						Log.LogInfo((object)$"[gui] {GhostScan.Results.Count} results, sp={val2}, alpha={GUI.color.a}");
					}
					if (!(val2.z <= 0f))
					{
						float num = Vector3.Distance(result.transform.position, GhostState.Position);
						GUI.Label(new Rect(val2.x - 60f, (float)Screen.height - val2.y - 10f, 200f, 20f), $"{result.GetItemName((ItemInstanceData)null)}  {num:F0}m");
					}
				}
			}
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}