Decompiled source of Dotoo Lobby Dummy v0.2.0

BepInEx/plugins/dotoo_lobby_dummy.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon;
using Pigeon.Movement;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;

[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("dotoo_lobby_dummy")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("dotoo_lobby_dummy")]
[assembly: AssemblyTitle("dotoo_lobby_dummy")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 LobbyDummy
{
	[HarmonyPatch(typeof(PlayerLook), "SendTextChatMessage")]
	internal static class ChatCommandPatch
	{
		private static bool Prefix(PlayerLook __instance)
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Traverse val = Traverse.Create((object)__instance);
				int value = val.Field("textChatInputLength").GetValue<int>();
				if (value <= 0)
				{
					return true;
				}
				char[] value2 = Traverse.Create(typeof(PlayerLook)).Field("textChatInputBuffer").GetValue<char[]>();
				string text = new string(value2, 0, value);
				List<string> list = new List<string>();
				if (!ChatCommands.TryHandle(text, list))
				{
					return true;
				}
				Plugin.DevLog("[dev] chat command: " + text);
				val.Method("CloseTextChat", Array.Empty<object>()).GetValue();
				Traverse.Create(typeof(PlayerLook)).Field("lastSentMessage").SetValue((object)text);
				val.Field("textChatInputLength").SetValue((object)0);
				Player value3 = val.Field("playerMovement").GetValue<Player>();
				foreach (string item in list)
				{
					val.Method("AddTextChatMessage", new object[2] { item, value3 }).GetValue();
					GameManager.Instance.SendTextChatMessage_Rpc(new FixedString128Bytes(item), ((NetworkBehaviour)value3).OwnerClientId);
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
				return true;
			}
		}
	}
	internal static class ChatCommands
	{
		private const string Tag = "⚠\ufe0f";

		private const string Arrow = "➡\ufe0f";

		internal static int SimPlayers;

		internal static int SimThreat;

		internal static float GetHealthMultiplier(int enemyType)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			if (SimPlayers <= 0 || GameManager.ThreatLevel != SimThreat)
			{
				return 1f;
			}
			if (enemyType < 0 || enemyType >= Global.Instance.EnemyHealthScaling.Length)
			{
				return 1f;
			}
			ThreatModifier<PlayerModifier<float>> val = Global.Instance.EnemyHealthScaling[enemyType];
			float num = val[GameManager.ThreatLevel][SimPlayers - 1];
			float num2 = PlayerModifier<float>.op_Implicit(val.Value);
			Plugin.DevLog($"[dev] hpMul: want={num:0.00} cur={num2:0.00} players={SimPlayers}");
			return (num2 > 0f) ? (num / num2) : 1f;
		}

		private static string Msg(string key, string value)
		{
			return "⚠\ufe0f" + key + "➡\ufe0f" + value;
		}

		private static string BossLabel(string name)
		{
			return (name == "random") ? "Random" : name.Replace(' ', '_');
		}

		internal static bool TryHandle(string message, List<string> replies)
		{
			if (string.IsNullOrEmpty(message) || message[0] != '/')
			{
				return false;
			}
			string[] array = message.Trim().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			if (array.Length == 0 || array[0].ToLowerInvariant() != "/dld")
			{
				return false;
			}
			if (!Plugin.CanRunServerSide())
			{
				return false;
			}
			if (!LevelData.IsHub)
			{
				return false;
			}
			if (array.Length < 2)
			{
				replies.Add(Msg("Threat", GameManager.ThreatLevel.ToString()));
				replies.Add(Msg("Players", (SimPlayers == 0) ? "Auto" : SimPlayers.ToString()));
				replies.Add(Msg("Boss", BossLabel(Plugin.CurrentBoss)));
				return true;
			}
			if (array[1].ToLowerInvariant() == "boss")
			{
				if (array.Length < 3)
				{
					replies.Add(Msg("Boss", BossLabel(Plugin.CurrentBoss)));
					return true;
				}
				string text = string.Join(" ", array, 2, array.Length - 2);
				string text2 = null;
				int result;
				if (text.Equals("random", StringComparison.OrdinalIgnoreCase))
				{
					text2 = "random";
				}
				else if (int.TryParse(text, out result) && result >= 1 && result <= Plugin.BossNames.Length)
				{
					text2 = Plugin.BossNames[result - 1];
				}
				else
				{
					string value = text.Replace(' ', '_');
					string[] bossNames = Plugin.BossNames;
					foreach (string text3 in bossNames)
					{
						if (text3.Replace(' ', '_').Equals(value, StringComparison.OrdinalIgnoreCase))
						{
							text2 = text3;
							break;
						}
					}
				}
				if (text2 == null)
				{
					replies.Add(Msg("Boss", "Unknown(1-" + Plugin.BossNames.Length + ")"));
					return true;
				}
				Plugin.CurrentBoss = text2;
				replies.Add(Msg("Boss", BossLabel(text2)));
				return true;
			}
			int result2 = 0;
			if (!int.TryParse(array[1], out var result3) || result3 < 1 || result3 > 8)
			{
				replies.Add(Msg("Threat", "Use_1-8"));
				return true;
			}
			if (array.Length >= 3 && (!int.TryParse(array[2], out result2) || result2 < 1 || result2 > 4))
			{
				replies.Add(Msg("Players", "Use_1-4"));
				return true;
			}
			GameManager.SetThreatLevel(result3);
			SimPlayers = result2;
			SimThreat = result3;
			replies.Add(Msg("Threat", result3.ToString()));
			if (array.Length >= 3)
			{
				replies.Add(Msg("Players", result2.ToString()));
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GameManager), "SendTextChatMessage_Rpc", new Type[]
	{
		typeof(FixedString128Bytes),
		typeof(ulong)
	})]
	internal static class ClientChatPatch
	{
		private unsafe static void Postfix(FixedString128Bytes message, ulong clientID)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!Plugin.AllowClientCommands.Value || !Plugin.CanRunServerSide())
				{
					return;
				}
				Player localPlayer = Player.LocalPlayer;
				if (!((Object)(object)localPlayer == (Object)null) && clientID != ((NetworkBehaviour)localPlayer).OwnerClientId)
				{
					List<string> replies = new List<string>();
					if (ChatCommands.TryHandle(((object)(*(FixedString128Bytes*)(&message))/*cast due to .constrained prefix*/).ToString(), replies))
					{
						Plugin.DevLog($"[dev] client chat command from {clientID}: {message}");
						((MonoBehaviour)Plugin.Instance).StartCoroutine(SayNextFrame(replies));
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
		}

		private static IEnumerator SayNextFrame(List<string> replies)
		{
			yield return null;
			Player player = Player.LocalPlayer;
			foreach (string r in replies)
			{
				PlayerLook.Instance.AddTextChatMessage(r, player);
				GameManager.Instance.SendTextChatMessage_Rpc(new FixedString128Bytes(r), ((NetworkBehaviour)player).OwnerClientId);
			}
		}
	}
	[MycoMod(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("dotoo.mycopunk.lobby_dummy", "lobby_dummy", "0.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		internal static Plugin Instance;

		private EnemyBrain _last;

		private EnemyClass _boss;

		internal static ConfigEntry<bool> DevMode;

		internal static ConfigEntry<bool> DisableOverclockExplosion;

		internal static ConfigEntry<bool> AllowClientCommands;

		internal static readonly string[] BossNames = new string[9] { "GrenadeAbom", "B_LaserAbom", "Abomination", "Amalgamation1", "Laser Abomination", "Devastator", "B_Devastator", "Sniper Abomination", "ShieldAbomination" };

		private static readonly string[] RandomExcluded = new string[1] { "Amalgamation1" };

		internal static string CurrentBoss = "random";

		private string _lastBossName;

		private int _origThreat = -1;

		internal static bool Dev => DevMode != null && DevMode.Value;

		internal static void DevLog(string s)
		{
			if (Dev)
			{
				Log.LogInfo((object)s);
			}
		}

		private void Awake()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			DevMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "DevMode", false, "For mod developers. When true, logs spawn positions, part lists and other details, and enables the Alt+key debug hotkeys.");
			DisableOverclockExplosion = ((BaseUnityPlugin)this).Config.Bind<bool>("Dummy", "DisableOverclockExplosion", true, "When true, the lobby dummy does not do the overclock self-destruct (its core just despawns). Enemies in real missions are not affected.");
			AllowClientCommands = ((BaseUnityPlugin)this).Config.Bind<bool>("Chat", "AllowClientCommands", true, "When true, other players in the lobby can also use the /dld commands (the host's mod runs them). Set to false for host-only.");
			SceneManager.activeSceneChanged += delegate(Scene from, Scene to)
			{
				Log.LogInfo((object)("scene: " + ((Scene)(ref from)).name + " -> " + ((Scene)(ref to)).name));
				_origThreat = -1;
			};
			new Harmony("dotoo.mycopunk.lobby_dummy").PatchAll(typeof(Plugin).Assembly);
			Log.LogInfo((object)"lobby_dummy loaded");
		}

		private string PickBossName()
		{
			if (CurrentBoss != "random")
			{
				return CurrentBoss;
			}
			string[] array = BossNames.Where((string n) => !RandomExcluded.Contains(n)).ToArray();
			return array[Random.Range(0, array.Length)];
		}

		private EnemyClass FindBoss(string name)
		{
			if ((Object)(object)_boss == (Object)null || ((Object)_boss).name != name)
			{
				_boss = ((IEnumerable<EnemyClass>)Resources.FindObjectsOfTypeAll<EnemyClass>()).FirstOrDefault((Func<EnemyClass, bool>)((EnemyClass e) => ((Object)e).name == name));
			}
			return _boss;
		}

		private void Update()
		{
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			if (!Dev)
			{
				return;
			}
			Keyboard current = Keyboard.current;
			if (current != null && ((ButtonControl)current.leftAltKey).isPressed)
			{
				if (((ButtonControl)current.bKey).wasPressedThisFrame)
				{
					SpawnTest();
				}
				if (((ButtonControl)current.vKey).wasPressedThisFrame)
				{
					StopBrain(_last);
				}
				if (((ButtonControl)current.pKey).wasPressedThisFrame)
				{
					LogPos();
				}
				if (((ButtonControl)current.cKey).wasPressedThisFrame)
				{
					StopParts(_last);
				}
				if (((ButtonControl)current.periodKey).wasPressedThisFrame)
				{
					ChangeThreat(1);
				}
				if (((ButtonControl)current.commaKey).wasPressedThisFrame)
				{
					ChangeThreat(-1);
				}
				if (((ButtonControl)current.slashKey).wasPressedThisFrame)
				{
					RestoreThreat();
				}
				if (((ButtonControl)current.tKey).wasPressedThisFrame)
				{
					EnemyClass val = ((_lastBossName != null) ? FindBoss(_lastBossName) : null);
					float num = (((Object)(object)val != (Object)null) ? PlayerModifier<float>.op_Implicit(Global.Instance.EnemyHealthScaling[val.config.enemyType].Value) : 0f);
					Log.LogInfo((object)$"boss={_lastBossName} Threat={GameManager.ThreatLevel} hpMul={EnemyManager.EnemyHealthMultiplier} dmgMul={EnemyManager.EnemyDamageMultiplier} bossScale={num:0.00}");
				}
				if (((ButtonControl)current.hKey).wasPressedThisFrame)
				{
					DumpHealth();
				}
				if (((ButtonControl)current.gKey).wasPressedThisFrame)
				{
					DumpScaling();
				}
			}
		}

		internal static bool CanRunServerSide()
		{
			NetworkManager singleton = NetworkManager.Singleton;
			return (Object)(object)singleton == (Object)null || !singleton.IsListening || singleton.IsServer;
		}

		private void ChangeThreat(int d)
		{
			if (!CanRunServerSide())
			{
				Log.LogInfo((object)"host only");
				return;
			}
			if (_origThreat < 0)
			{
				_origThreat = GameManager.ThreatLevel;
			}
			int num = Mathf.Clamp(GameManager.ThreatLevel + d, 1, 8);
			GameManager.SetThreatLevel(num);
			Log.LogInfo((object)$"ThreatLevel -> {num} (original {_origThreat})");
		}

		private void RestoreThreat()
		{
			if (_origThreat < 0)
			{
				Log.LogInfo((object)"threat not changed");
				return;
			}
			if (!CanRunServerSide())
			{
				Log.LogInfo((object)"host only");
				return;
			}
			GameManager.SetThreatLevel(_origThreat);
			Log.LogInfo((object)$"ThreatLevel restored -> {_origThreat}");
			_origThreat = -1;
		}

		private void SpawnTest()
		{
			//IL_004b: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if (!CanRunServerSide())
			{
				Log.LogInfo((object)"host only");
				return;
			}
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				Log.LogInfo((object)"no camera");
			}
			else
			{
				SpawnDummyAt(((Component)main).transform.position + ((Component)main).transform.forward * 5f);
			}
		}

		internal EnemyBrain SpawnDummyAt(Vector3 pos)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected I4, but got Unknown
			//IL_0054: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected I4, but got Unknown
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			string text = PickBossName();
			EnemyClass val = FindBoss(text);
			if ((Object)(object)val == (Object)null)
			{
				Log.LogInfo((object)(text + " not found"));
				return null;
			}
			_lastBossName = text;
			int num = (int)val.config.enemyType;
			EnemyBrain val2 = EnemyManager.Instance.SpawnEnemy_Server(pos, val, (WeightedArray<EnemyClassGroup>)null, false, (CustomWave)null, default(SpawnParams), ChatCommands.GetHealthMultiplier(num));
			if ((Object)(object)val2 == (Object)null)
			{
				Log.LogInfo((object)"SpawnEnemy_Server returned null");
				return null;
			}
			_last = val2;
			Log.LogInfo((object)$"spawned {((Object)val).name} (EnemyType={num}) at {pos} threat={GameManager.ThreatLevel}");
			if (Dev)
			{
				Log.LogInfo((object)$"[dev] brain={((Object)val2).name} EnemyType={(int)val2.EnemyType} ({val2.EnemyType})");
				ShootingRangeActivity val3 = Object.FindFirstObjectByType<ShootingRangeActivity>();
				if ((Object)(object)val3 != (Object)null)
				{
					Log.LogInfo((object)$"[dev]   local to ShootingRange = {((Component)val3).transform.InverseTransformPoint(pos)}");
				}
			}
			StopBrain(val2);
			StopParts(val2);
			LockAttacks(val2);
			DisableOverclock(val2);
			return val2;
		}

		private void StopParts(EnemyBrain brain)
		{
			if ((Object)(object)brain == (Object)null)
			{
				Log.LogInfo((object)"no brain");
				return;
			}
			int num = 0;
			MonoBehaviour[] componentsInChildren = ((Component)brain).GetComponentsInChildren<MonoBehaviour>(true);
			foreach (MonoBehaviour val in componentsInChildren)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Type type = ((object)val).GetType();
				if (Dev)
				{
					Log.LogInfo((object)$"[dev]   part: {type.Name} : {type.BaseType?.Name} enabled={((Behaviour)val).enabled} on={((Object)((Component)val).gameObject).name}");
				}
				if (val is GunArmTip || val is IArmTip)
				{
					((Behaviour)val).enabled = false;
					num++;
					if (Dev)
					{
						Log.LogInfo((object)("[dev]   armtip disabled: " + type.Name));
					}
				}
			}
			if (Dev)
			{
				Log.LogInfo((object)$"[dev] parts disabled: {num}");
			}
		}

		private void LogPos()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_last == (Object)null)
			{
				Log.LogInfo((object)"no brain");
				return;
			}
			Vector3 position = ((Component)_last).transform.position;
			ShootingRangeActivity val = Object.FindFirstObjectByType<ShootingRangeActivity>();
			Log.LogInfo((object)($"brain pos = {position}" + (((Object)(object)val != (Object)null) ? $" local = {((Component)val).transform.InverseTransformPoint(position)}" : "")));
		}

		private void LockAttacks(EnemyBrain brain)
		{
			try
			{
				Traverse val = Traverse.Create((object)brain).Field("_attackLocks");
				val.SetValue((object)(val.GetValue<int>() + 1));
				DevLog($"[dev] attack locks -> {val.GetValue<int>()}, CanAttack={brain.CanAttack}");
			}
			catch (Exception ex)
			{
				Log.LogError((object)ex);
			}
		}

		private void DisableOverclock(EnemyBrain brain)
		{
			if (!DisableOverclockExplosion.Value)
			{
				return;
			}
			try
			{
				int num = 0;
				EnemyCore[] componentsInChildren = ((Component)brain).GetComponentsInChildren<EnemyCore>(true);
				foreach (EnemyCore val in componentsInChildren)
				{
					Traverse val2 = Traverse.Create((object)val).Field("despawnWhenKilled");
					val2.SetValue((object)true);
					DevLog($"[dev] overclock off: {((Object)val).name} despawnWhenKilled={val2.GetValue<bool>()}");
					num++;
				}
				DevLog($"[dev] cores patched: {num}");
			}
			catch (Exception ex)
			{
				Log.LogError((object)ex);
			}
		}

		private void StopBrain(EnemyBrain brain)
		{
			if ((Object)(object)brain == (Object)null)
			{
				Log.LogInfo((object)"no brain");
				return;
			}
			((Behaviour)brain).enabled = false;
			DevLog("[dev] brain disabled: " + ((Object)brain).name);
		}

		private void DumpHealth()
		{
			if ((Object)(object)_last == (Object)null)
			{
				Log.LogInfo((object)"no brain");
				return;
			}
			BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
			MonoBehaviour[] componentsInChildren = ((Component)_last).GetComponentsInChildren<MonoBehaviour>(true);
			foreach (MonoBehaviour val in componentsInChildren)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Type type = ((object)val).GetType();
				while (type != null && type != typeof(MonoBehaviour))
				{
					FieldInfo[] fields = type.GetFields(bindingAttr);
					foreach (FieldInfo fieldInfo in fields)
					{
						if (fieldInfo.Name.IndexOf("health", StringComparison.OrdinalIgnoreCase) >= 0 && (!(fieldInfo.FieldType != typeof(float)) || !(fieldInfo.FieldType != typeof(int))))
						{
							Log.LogInfo((object)$"  hp: {((object)val).GetType().Name}.{fieldInfo.Name} = {fieldInfo.GetValue(val)}");
						}
					}
					type = type.BaseType;
				}
			}
		}

		private void DumpScaling()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			ThreatModifier<PlayerModifier<float>>[] enemyHealthScaling = Global.Instance.EnemyHealthScaling;
			if (enemyHealthScaling == null)
			{
				Log.LogInfo((object)"EnemyHealthScaling is null");
				return;
			}
			for (int i = 0; i < enemyHealthScaling.Length; i++)
			{
				StringBuilder stringBuilder = new StringBuilder();
				for (int j = 1; j <= 8; j++)
				{
					stringBuilder.Append(PlayerModifier<float>.op_Implicit(enemyHealthScaling[i][j]).ToString("0.00")).Append(' ');
				}
				Log.LogInfo((object)$"hpScale type={i}: {stringBuilder}");
			}
		}
	}
	[HarmonyPatch(typeof(ShootingRangeActivity), "SpawnGrunt_Server")]
	internal static class ShootingRangePatch
	{
		private static readonly Vector3? DummyLocalPos = new Vector3(0f, 10f, 0f);

		private static bool Prefix(ShootingRangeActivity __instance, PositionList ___enemySpawnPositions)
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource log = Plugin.Log;
			try
			{
				int livingEnemies = EnemyManager.Instance.LivingEnemies;
				if (Plugin.Dev)
				{
					log.LogInfo((object)$"[dev] lever: SpawnGrunt_Server positions={((PositionList)(ref ___enemySpawnPositions)).Length} living={livingEnemies} threat={GameManager.ThreatLevel}");
					for (int i = 0; i < ((PositionList)(ref ___enemySpawnPositions)).Length; i++)
					{
						log.LogInfo((object)$"[dev]   spawn pos[{i}] = {((Component)__instance).transform.TransformPoint(((PositionList)(ref ___enemySpawnPositions))[i])}");
					}
				}
				if (((PositionList)(ref ___enemySpawnPositions)).Length == 0)
				{
					return false;
				}
				if (livingEnemies > 0)
				{
					Plugin.DevLog("[dev] dummy still alive, skip");
					return false;
				}
				Vector3 pos = (DummyLocalPos.HasValue ? ((Component)__instance).transform.TransformPoint(DummyLocalPos.Value) : ((Component)__instance).transform.TransformPoint(((PositionList)(ref ___enemySpawnPositions))[0]));
				Plugin.Instance.SpawnDummyAt(pos);
			}
			catch (Exception ex)
			{
				log.LogError((object)ex);
			}
			return false;
		}
	}
}