Decompiled source of BetterBioTags v0.0.4

plugins/BettterBioTags.dll

Decompiled 2 months 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 Agents;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using Enemies;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using SuperBio;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("BettterBioTags")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BettterBioTags")]
[assembly: AssemblyTitle("BettterBioTags")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
		}
	}
}
namespace BetterBioTags
{
	[BepInPlugin("Caera.BetterBioTags", "BetterBioTags", "0.0.4")]
	internal sealed class EntryPoint : BasePlugin
	{
		public const string MODNAME = "BetterBioTags";

		public override void Load()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			((BasePlugin)this).Log.LogMessage((object)"Loading BetterBioTags");
			ClassInjector.RegisterTypeInIl2Cpp<CaerabioMono>();
			new Harmony("BetterBioTags").PatchAll();
			((BasePlugin)this).Log.LogMessage((object)"Loaded BetterBioTags");
		}
	}
}
namespace SuperBio
{
	internal class CaerabioMono : MonoBehaviour
	{
		private bool charging = false;

		private EnemyScanner scanner = null;

		private bool started = false;

		private void Awake()
		{
			scanner = ((Component)this).GetComponent<EnemyScanner>();
			if ((Object)(object)scanner != (Object)null)
			{
				started = true;
			}
		}

		private void FixedUpdate()
		{
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Invalid comparison between Unknown and I4
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Invalid comparison between Unknown and I4
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Invalid comparison between Unknown and I4
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)scanner == (Object)null || !started)
			{
				return;
			}
			if (!scanner.m_recharging && charging)
			{
				charging = false;
			}
			if (!scanner.m_recharging || (scanner.m_recharging && charging) || !scanner.m_recharging || charging)
			{
				return;
			}
			Debug.Log(Object.op_Implicit("CaeraBio - ping"));
			Enumerator<LG_Zone> enumerator = Builder.CurrentFloor.allZones.GetEnumerator();
			while (enumerator.MoveNext())
			{
				LG_Zone current = enumerator.Current;
				Enumerator<LG_Area> enumerator2 = current.m_areas.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					LG_Area current2 = enumerator2.Current;
					Enumerator<EnemyAgent> enumerator3 = current2.m_courseNode.m_enemiesInNode.GetEnumerator();
					while (enumerator3.MoveNext())
					{
						EnemyAgent current3 = enumerator3.Current;
						if ((((int)((AgentAI)current3.AI).Mode == 1) | ((int)((AgentAI)current3.AI).Mode == 2) | ((int)((AgentAI)current3.AI).Mode == 3)) && Vector3.Distance(current3.Position, ((Agent)((Item)scanner).Owner).Position) < 60f)
						{
							ToolSyncManager.WantToTagEnemy(current3);
							charging = true;
						}
					}
				}
			}
		}
	}
	[HarmonyPatch]
	internal class CaeraBioPatches
	{
		[HarmonyPatch(typeof(EnemyScanner), "Setup")]
		[HarmonyPostfix]
		private static void Postfix(EnemyScanner __instance)
		{
			if ((Object)(object)__instance != (Object)null)
			{
				((Component)__instance).gameObject.AddComponent<CaerabioMono>();
			}
		}
	}
}