Decompiled source of HighItemVizability v1.5.0

HighItemVizability.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HighItemVizability")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HighItemVizability")]
[assembly: AssemblyTitle("HighItemVizability")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HighItemVizability
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("VizMod.HighItemVizability", "HighItemVizability", "1.5.0")]
	public class HIVClass : BaseUnityPlugin
	{
		public const string PluginGUID = "VizMod.HighItemVizability";

		public const string PluginAuthor = "VizMod";

		public const string PluginName = "HighItemVizability";

		public const string PluginVersion = "1.5.0";

		public GameObject lineStart;

		public Vector3 lineStartPos;

		public Vector3 lineEndPos;

		public LineRenderer lineRender;

		internal static GameObject bossItemIndicator;

		internal static GameObject greenIndicator;

		internal static GameObject redIndicator;

		internal static GameObject utilityIndicator;

		internal static GameObject whiteIndicator;

		public void Awake()
		{
			CreatePrefabs();
		}

		public void Start()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PickupDisplay.Start += (hook_Start)delegate(orig_Start orig, PickupDisplay self)
			{
				//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_0028: 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_0046: 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_0083: Expected O, but got Unknown
				//IL_009e: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_021e: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: Unknown result type (might be due to invalid IL or missing references)
				//IL_029a: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_025e: Unknown result type (might be due to invalid IL or missing references)
				//IL_026f: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				lineStart = ((Component)self).gameObject;
				lineStartPos = ((Component)self).transform.position;
				lineEndPos = lineStartPos + new Vector3(0f, 100f, 0f);
				lineRender = lineStart.AddComponent<LineRenderer>();
				lineRender.positionCount = 2;
				((Renderer)lineRender).material = new Material(LegacyShaderAPI.Find("Hopoo Games/FX/Vertex Colors Only"));
				if (self.tier1ParticleEffect.activeSelf)
				{
					lineRender.startColor = Color.white;
					lineRender.endColor = Color.white;
					InstantiateIndicator(((Component)self).gameObject.transform, whiteIndicator);
				}
				else if (self.tier2ParticleEffect.activeSelf)
				{
					lineRender.startColor = Color.green;
					lineRender.endColor = Color.green;
					InstantiateIndicator(((Component)self).gameObject.transform, greenIndicator);
				}
				else if (self.tier3ParticleEffect.activeSelf)
				{
					lineRender.startColor = Color.red;
					lineRender.endColor = Color.red;
					InstantiateIndicator(((Component)self).gameObject.transform, redIndicator);
				}
				else if (self.equipmentParticleEffect.activeSelf)
				{
					lineRender.startColor = new Color(1f, 0.58f, 0f);
					lineRender.endColor = new Color(1f, 0.58f, 0f);
					InstantiateIndicator(((Component)self).gameObject.transform, utilityIndicator);
				}
				else if (self.lunarParticleEffect.activeSelf)
				{
					lineRender.startColor = Color.blue;
					lineRender.endColor = Color.blue;
				}
				else if (self.bossParticleEffect.activeSelf)
				{
					lineRender.startColor = Color.yellow;
					lineRender.endColor = Color.yellow;
					InstantiateIndicator(((Component)self).gameObject.transform, bossItemIndicator);
				}
				else
				{
					lineRender.startColor = Color.magenta;
					lineRender.endColor = Color.magenta;
				}
				lineRender.startWidth = 0.2f;
				lineRender.endWidth = 0f;
				lineRender.SetPosition(0, lineStartPos);
				lineRender.SetPosition(1, lineEndPos);
			};
		}

		internal static void InstantiateIndicator(Transform t, GameObject indicator)
		{
			if (Object.op_Implicit((Object)(object)t))
			{
				Object.Instantiate<GameObject>(indicator, t).GetComponent<PositionIndicator>().targetTransform = t;
			}
		}

		internal static void DestroyIndicator(Transform t, string name)
		{
			PositionIndicator[] componentsInChildren = ((Component)t).GetComponentsInChildren<PositionIndicator>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && ((Object)((Component)componentsInChildren[i]).gameObject).name.Contains(name))
				{
					Object.Destroy((Object)(object)((Component)componentsInChildren[i]).gameObject);
				}
			}
		}

		internal static void CreatePrefabs()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			whiteIndicator = CreateIndicator(whiteIndicator, "whiteIndicator", Color.white);
			greenIndicator = CreateIndicator(greenIndicator, "greenIndicator", Color.green);
			redIndicator = CreateIndicator(redIndicator, "redIndicator", Color.red);
			utilityIndicator = CreateIndicator(utilityIndicator, "utilityIndicator", new Color(1f, 0.58f, 0f));
			bossItemIndicator = CreateIndicator(bossItemIndicator, "bossItemIndicator", Color.yellow);
		}

		private static GameObject CreateIndicator(GameObject obj, string objName, Color color)
		{
			//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_005c: Unknown result type (might be due to invalid IL or missing references)
			obj = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/BossPositionIndicator.prefab").WaitForCompletion(), objName, false);
			Transform[] componentsInChildren = obj.GetComponentsInChildren<Transform>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)componentsInChildren[i]) && ((Object)componentsInChildren[i]).name == "Sprite")
				{
					((Component)componentsInChildren[i]).GetComponent<SpriteRenderer>().color = color;
				}
			}
			return obj;
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}