Decompiled source of HighItemVizabilityClient v1.0.0

HighItemVizabilityClient.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;

[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("HighItemVizabilityClient")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HighItemVizabilityClient")]
[assembly: AssemblyTitle("HighItemVizabilityClient")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 HighItemVizabilityClient
{
	[BepInPlugin("Mokura.HighItemVizabilityClient", "HighItemVizability Client", "1.0.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private sealed class LocalBeam : MonoBehaviour
		{
			private LineRenderer line;

			public void Initialize(Color color, Material material)
			{
				//IL_0054: 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_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Unknown result type (might be due to invalid IL or missing references)
				line = ((Component)this).gameObject.AddComponent<LineRenderer>();
				line.useWorldSpace = false;
				line.positionCount = 2;
				line.startWidth = 0.18f;
				line.endWidth = 0.015f;
				line.startColor = color;
				line.endColor = color;
				((Renderer)line).material = material;
				line.SetPosition(0, Vector3.zero);
				line.SetPosition(1, new Vector3(0f, 100f, 0f));
			}

			private void OnDestroy()
			{
				if ((Object)(object)line != (Object)null)
				{
					Object.Destroy((Object)(object)line);
				}
			}
		}

		public const string PluginGuid = "Mokura.HighItemVizabilityClient";

		public const string PluginName = "HighItemVizability Client";

		public const string PluginVersion = "1.0.0";

		private static ManualLogSource Log;

		private static Material BeamMaterial;

		private void Awake()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Shader val = Shader.Find("Hopoo Games/FX/Vertex Colors Only");
			if ((Object)(object)val == (Object)null)
			{
				val = Shader.Find("Sprites/Default");
			}
			if ((Object)(object)val != (Object)null)
			{
				BeamMaterial = new Material(val);
			}
			PickupDisplay.Start += new hook_Start(OnPickupDisplayStart);
			Log.LogInfo((object)"HighItemVizability Client loaded.");
		}

		private void OnDestroy()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			PickupDisplay.Start -= new hook_Start(OnPickupDisplayStart);
			if ((Object)(object)BeamMaterial != (Object)null)
			{
				Object.Destroy((Object)(object)BeamMaterial);
			}
		}

		private void OnPickupDisplayStart(orig_Start orig, PickupDisplay self)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!((Object)(object)self == (Object)null) && !((Object)(object)BeamMaterial == (Object)null))
			{
				LocalBeam component = ((Component)self).GetComponent<LocalBeam>();
				if (!((Object)(object)component != (Object)null) && TryGetColor(self, out var color))
				{
					component = ((Component)self).gameObject.AddComponent<LocalBeam>();
					component.Initialize(color, BeamMaterial);
				}
			}
		}

		private static bool TryGetColor(PickupDisplay display, out Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			if (IsActive(display.tier1ParticleEffect))
			{
				color = Color.white;
			}
			else if (IsActive(display.tier2ParticleEffect))
			{
				color = Color.green;
			}
			else if (IsActive(display.tier3ParticleEffect))
			{
				color = Color.red;
			}
			else if (IsActive(display.equipmentParticleEffect))
			{
				color = new Color(1f, 0.58f, 0f);
			}
			else if (IsActive(display.lunarParticleEffect))
			{
				color = Color.blue;
			}
			else
			{
				if (!IsActive(display.bossParticleEffect))
				{
					color = Color.magenta;
					return false;
				}
				color = Color.yellow;
			}
			return true;
		}

		private static bool IsActive(GameObject obj)
		{
			return (Object)(object)obj != (Object)null && obj.activeInHierarchy;
		}
	}
}