Decompiled source of v40Arachnophobia v1.0.0

40Arachnophobia.dll

Decompiled 2 days ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using _40Arachnophobia.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ArlenFreii.40Arachnophobia")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8f62d49759b73c8364016c5bf84a819951bb21b6")]
[assembly: AssemblyProduct("_40Arachnophobia")]
[assembly: AssemblyTitle("ArlenFreii.40Arachnophobia")]
[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.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;
		}
	}
	[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 _40Arachnophobia
{
	[BepInPlugin("ArlenFreii.40Arachnophobia", "_40Arachnophobia", "1.0.0")]
	public class _40Arachnophobia : BaseUnityPlugin
	{
		public static GameObject? SpiderTextPrefab;

		public static _40Arachnophobia Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "assets/40arachnophobia"));
			Logger.LogInfo((object)string.Join("\n", val.GetAllAssetNames()));
			SpiderTextPrefab = val.LoadAsset<GameObject>("Assets/LethalCompany/Game/Meshes/SpiderText.prefab");
			val.Unload(false);
			Patch();
			Logger.LogInfo((object)"ArlenFreii.40Arachnophobia v1.0.0 has loaded!");
		}

		internal static void Patch()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("ArlenFreii.40Arachnophobia");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll(typeof(_40Arachnophobia));
			Harmony.PatchAll(typeof(SandSpiderAIPatches));
			Logger.LogDebug((object)"Finished patching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ArlenFreii.40Arachnophobia";

		public const string PLUGIN_NAME = "_40Arachnophobia";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace _40Arachnophobia.Patches
{
	[HarmonyPatch(typeof(SandSpiderAI))]
	public class SandSpiderAIPatches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Start_Postfix(SandSpiderAI __instance)
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)((Component)__instance).transform.GetChild(0)).gameObject;
			GameObject gameObject2 = ((Component)gameObject.transform.GetChild(0)).gameObject;
			SkinnedMeshRenderer component = gameObject2.GetComponent<SkinnedMeshRenderer>();
			((Renderer)component).enabled = false;
			GameObject gameObject3 = ((Component)gameObject.transform.GetChild(1)).gameObject;
			GameObject gameObject4 = ((Component)gameObject3.transform.GetChild(0)).gameObject;
			GameObject gameObject5 = ((Component)gameObject4.transform.GetChild(0)).gameObject;
			if (!((Object)(object)_40Arachnophobia.SpiderTextPrefab == (Object)null))
			{
				GameObject val = Object.Instantiate<GameObject>(_40Arachnophobia.SpiderTextPrefab);
				((Object)val).name = "NewSpiderText";
				val.transform.SetParent(gameObject5.transform);
				val.transform.localScale = new Vector3(1.86f, 1.86f, 1.86f);
				val.transform.localRotation = new Quaternion(-0.70711f, 8E-05f, 8E-05f, -0.70711f);
				val.transform.localPosition = new Vector3(0.1000419f, -0.8036421f, -0.1765117f);
				((Renderer)val.GetComponent<MeshRenderer>()).enabled = true;
			}
		}
	}
}