Decompiled source of ColorfulPoint v1.0.1

ColorfulPoint.dll

Decompiled 2 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using FishNet.Object;
using HarmonyLib;
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: AssemblyTitle("HTF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HTF")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5208ed49-769e-472d-8164-a43d8313e78b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace HTF_ColorfulPoint;

[BepInPlugin("HTF.kr.ColorfulPoint", "ColorfulPoint", "1.0.1")]
public class ModBehaviour : BaseUnityPlugin
{
	[HarmonyPatch(typeof(CloseItemsUI))]
	public class CloseItemsUI_path
	{
		private static bool My_ShouldHideItem(Item item)
		{
			return !Object.op_Implicit((Object)(object)item) || Object.op_Implicit((Object)(object)item.Holder) || ((NetworkBehaviour)item).IsDeinitializing || (Object.op_Implicit((Object)(object)item.Bird) && !((Creature)item.Bird).IsDead) || item.IgnoredByCloseDots;
		}

		[HarmonyPrefix]
		[HarmonyPatch("LateUpdate")]
		private static bool LateUpdate_Prefix(CloseItemsUI __instance, ref List<Image> ____closeItemsDots, Item[] ____closestItems, bool ____dotsEnabled, float ____nextClosestItemsRefreshTime)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Player.LocalPlayer) || !Object.op_Implicit((Object)(object)GameInfo.CurCamera) || !____dotsEnabled)
			{
				for (int i = 0; i < ____closeItemsDots.Count; i++)
				{
					((Graphic)____closeItemsDots[i]).color = Color.clear;
				}
				return false;
			}
			if (Time.unscaledTime >= ____nextClosestItemsRefreshTime)
			{
				MethodInfo method = typeof(CloseItemsUI).GetMethod("RefreshClosestItems", BindingFlags.Instance | BindingFlags.NonPublic);
				method.Invoke(__instance, null);
			}
			Camera curCamera = GameInfo.CurCamera;
			int num = Mathf.Min(____closeItemsDots.Count, ____closestItems.Length);
			for (int j = 0; j < num; j++)
			{
				Item val = ____closestItems[j];
				if (My_ShouldHideItem(val))
				{
					((Graphic)____closeItemsDots[j]).color = Color.clear;
					continue;
				}
				Vector3 val2 = curCamera.WorldToScreenPoint(((Component)val).transform.position);
				bool flag = val2.z > 0f && val2.x >= 0f && val2.x <= (float)curCamera.pixelWidth && val2.y >= 0f && val2.y <= (float)curCamera.pixelHeight;
				Color val3 = ((Object.op_Implicit((Object)(object)val.Creature) && !val.Creature.IsDead) ? Color.indianRed : (Object.op_Implicit((Object)(object)val.DeadPlayer) ? Color.green : ((Object.op_Implicit((Object)(object)val.Weapon) || Object.op_Implicit((Object)(object)val.Melee)) ? Color.red : (Object.op_Implicit((Object)(object)val.Creature) ? Color.white : Color.blue))));
				((Graphic)____closeItemsDots[j]).color = (flag ? val3 : Color.clear);
				if (flag)
				{
					((Component)____closeItemsDots[j]).transform.position = val2;
				}
			}
			for (int k = num; k < ____closeItemsDots.Count; k++)
			{
				((Graphic)____closeItemsDots[k]).color = Color.clear;
			}
			return false;
		}
	}

	private Harmony harmony;

	private static ManualLogSource Log;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		harmony = new Harmony("HTF.kr.ColorfulPoint");
		harmony.PatchAll();
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"ColorfulPoint enble");
	}
}