Decompiled source of LeanutsOmpany v1.0.0

LeanutsOmpany.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using On;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("LeanutsOmpany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LeanutsOmpany")]
[assembly: AssemblyTitle("LeanutsOmpany")]
[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 LeanutsOmpany
{
	[BepInPlugin("com.kesomannen.leanutsompany", "LeanutsOmpany", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static GameObject _prefab;

		private void Awake()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			string location = Assembly.GetExecutingAssembly().Location;
			location = Path.GetDirectoryName(location);
			location = Path.Combine(location, "leanutsompany");
			AssetBundle val = AssetBundle.LoadFromFile(location);
			GameObject val2 = val.LoadAsset<GameObject>("Assets/LeanutsOmpany/Prefabs/Building.prefab");
			if ((Object)(object)val2 == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load prefab!");
			}
			else
			{
				_prefab = val2;
			}
			RoundManager.RefreshEnemiesList += (hook_RefreshEnemiesList)delegate(orig_RefreshEnemiesList orig, RoundManager self)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: 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_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)
				if (self.currentLevel.levelID == 3)
				{
					Transform transform = GameObject.Find("LEDHangingLight (4)").transform;
					Vector3 position = transform.position;
					position.z = -36.6f;
					transform.position = position;
					GameObject val3 = Object.Instantiate<GameObject>(_prefab);
					val3.transform.position = new Vector3(-17.26f, -2.67f, -5.26f);
					if (((NetworkBehaviour)self).IsServer)
					{
						val3.GetComponentInChildren<NetworkObject>().Spawn(false);
						IEnumerable<EnemyType> source = Resources.FindObjectsOfTypeAll<EnemyType>().Distinct();
						EnemyType val4 = source.First((EnemyType enemy) => ((Object)enemy).name == "ClaySurgeon");
						NavMeshHit val5 = default(NavMeshHit);
						if (NavMesh.SamplePosition(val3.transform.position, ref val5, float.MaxValue, -1))
						{
							GameObject val6 = Object.Instantiate<GameObject>(val4.enemyPrefab, ((NavMeshHit)(ref val5)).position, Quaternion.identity);
							val6.GetComponentInChildren<NetworkObject>().Spawn(false);
						}
						else
						{
							((BaseUnityPlugin)this).Logger.LogError((object)"Failed to find a point on navmesh!");
						}
					}
					((BaseUnityPlugin)this).Logger.LogInfo((object)$"Building spawned at {val3.transform.position}!");
				}
				orig.Invoke(self);
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin loaded!");
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}