Decompiled source of ZombieSpawner v1.0.0

plugins/sinik.zombiespawner.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.InputSystem;

[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: AssemblyCompany("ZombieSpawner")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ZombieSpawner")]
[assembly: AssemblyTitle("ZombieSpawner")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
		}
	}
}
namespace ZombieSpawner
{
	[BepInPlugin("sinik.zombiespawner", "Zombie Spawner", "1.0.0")]
	public class ZombieSpawner : BaseUnityPlugin
	{
		private InputAction? _spawnAction;

		private void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			_spawnAction = new InputAction("SpawnZombie", (InputActionType)1, "<Keyboard>/j", (string)null, (string)null, (string)null);
			_spawnAction.performed += delegate
			{
				SpawnZombie();
			};
			_spawnAction.Enable();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"ZombieSpawner");
		}

		private void OnDestroy()
		{
			InputAction? spawnAction = _spawnAction;
			if (spawnAction != null)
			{
				spawnAction.Disable();
			}
			InputAction? spawnAction2 = _spawnAction;
			if (spawnAction2 != null)
			{
				spawnAction2.Dispose();
			}
		}

		private void SpawnZombie()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				Vector3 head = localCharacter.Head;
				Vector3 lookDirection = localCharacter.data.lookDirection;
				RaycastHit val = default(RaycastHit);
				if (Physics.Raycast(head, lookDirection, ref val, 200f))
				{
					Vector3 val2 = ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.5f;
					GameObject val3 = PhotonNetwork.Instantiate("MushroomZombie", val2, Quaternion.identity, (byte)0, (object[])null);
					((BaseUnityPlugin)this).Logger.LogInfo((object)$"Zombie spawned {val2}");
				}
			}
		}
	}
}