Decompiled source of CrabletRemover v1.0.0

CrabletRemover.dll

Decompiled 10 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppSystem;
using MelonLoader;
using PuppetMasta;
using StressLevelZero.AI;
using UnhollowerBaseLib;
using UnityEngine;
using YOWC.CrabletRemover;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Crablet Remover")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany(null)]
[assembly: AssemblyProduct("Crablet Remover")]
[assembly: AssemblyCopyright("Created by YeOldWarChap")]
[assembly: AssemblyTrademark(null)]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("1.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: MelonModInfo(typeof(CrabletRemoverMain), "Crablet Remover", "1.0", "YeOldWarChap", null)]
[assembly: MelonModGame("Stress Level Zero", "BONEWORKS")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace YOWC.CrabletRemover;

public static class BuildInfo
{
	public const string Name = "Crablet Remover";

	public const string Author = "YeOldWarChap";

	public const string Company = null;

	public const string Version = "1.0";

	public const string DownloadLink = null;
}
public class CrabletRemoverMain : MelonMod
{
	public class CrabletData
	{
		public AIBrain brain;

		public Renderer[] renderers;

		public bool areRenderersActive = true;

		public CrabletData(AIBrain brain, Renderer[] renderers)
		{
			this.brain = brain;
			this.renderers = renderers;
		}
	}

	private float dfjKJASlkAJSFHlksf = 0.33f;

	private float kjsdhfLjkHLSIDuyASD;

	private float liuadsfhliuASDF = 0.1f;

	private float isdkFJHLKbilds;

	private float dfhH8FDASo = 0.5f;

	private int iosdhF87BI = Convert.ToInt32("11111111111111111110111111111111", 2);

	private List<AIBrain> isdfuH89OFB = new List<AIBrain>();

	private List<CrabletData> iudfshOP7FDUh = new List<CrabletData>();

	public override void OnUpdate()
	{
		if (Time.time >= kjsdhfLjkHLSIDuyASD)
		{
			IFUH987hAUSJFH();
			kjsdhfLjkHLSIDuyASD = Time.time + dfjKJASlkAJSFHlksf;
		}
		if (Time.time >= isdkFJHLKbilds)
		{
			AIdsounsdf8hndfsO();
			isdkFJHLKbilds = Time.time + liuadsfhliuASDF;
		}
	}

	private void AIdsounsdf8hndfsO()
	{
		//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_00a3: Unknown result type (might be due to invalid IL or missing references)
		Ray val = default(Ray);
		for (int num = iudfshOP7FDUh.Count - 1; num >= 0; num--)
		{
			if (iudfshOP7FDUh[num].brain.isDead)
			{
				Renderer[] renderers = iudfshOP7FDUh[num].renderers;
				IUh98sadjndafsH(num, renderers, enabled: true);
				iudfshOP7FDUh.RemoveAt(num);
			}
			else
			{
				Transform child = ((Component)iudfshOP7FDUh[num].brain).transform.GetChild(0);
				Renderer[] renderers2 = iudfshOP7FDUh[num].renderers;
				((Ray)(ref val))..ctor(child.position, Vector3.down);
				if (Physics.Raycast(val, dfhH8FDASo, iosdhF87BI, (QueryTriggerInteraction)1))
				{
					if (iudfshOP7FDUh[num].areRenderersActive)
					{
						IUh98sadjndafsH(num, renderers2, enabled: false);
					}
				}
				else if (!iudfshOP7FDUh[num].areRenderersActive)
				{
					IUh98sadjndafsH(num, renderers2, enabled: true);
				}
			}
		}
	}

	private void IUh98sadjndafsH(int i, Renderer[] renderers, bool enabled)
	{
		for (int j = 0; j < renderers.Length; j++)
		{
			if (!Object.op_Implicit((Object)(object)((Component)renderers[j]).GetComponent<SlotPosition>()))
			{
				renderers[j].enabled = enabled;
			}
		}
		iudfshOP7FDUh[i].areRenderersActive = enabled;
	}

	private void IFUH987hAUSJFH()
	{
		AIBrain[] array = Il2CppArrayBase<AIBrain>.op_Implicit(Object.FindObjectsOfType<AIBrain>());
		for (int i = 0; i < array.Length; i++)
		{
			if (((Object)array[i].behaviour).GetIl2CppType().ToString() == typeof(BehaviourCrablet).FullName && !isdfuH89OFB.Contains(array[i]) && !array[i].isDead)
			{
				isdfuH89OFB.Add(array[i]);
				Renderer[] array2 = Il2CppArrayBase<Renderer>.op_Implicit(((Component)array[i]).GetComponents<Renderer>());
				Renderer[] array3 = Il2CppArrayBase<Renderer>.op_Implicit(((Component)array[i]).GetComponentsInChildren<Renderer>());
				Renderer[] array4 = (Renderer[])(object)new Renderer[array2.Length + array3.Length];
				array2.CopyTo(array4, 0);
				array3.CopyTo(array4, array2.Length);
				iudfshOP7FDUh.Add(new CrabletData(array[i], array4));
			}
		}
	}
}