Decompiled source of Lethal Chaos v1.2.2

LethalChaos.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
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 System.Threading.Tasks;
using ArtifactGroup;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using LethalChaos;
using LethalChaos.EntropySystem.Hook_Sources;
using LethalChaos.EntropySystem.Networking;
using LethalChaos.EntropySystem.Util;
using LethalChaos.NetcodePatcher;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using On;
using On.GameNetcodeStuff;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[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("LethalChaos")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A horrifying plugin that randomizes aspects of each planet, causing actions to be linked to a set of game events, with a probability to trigger")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+47b7122209fa7d564e60c8a60cee2d4f0d75de20")]
[assembly: AssemblyProduct("LethalChaos")]
[assembly: AssemblyTitle("LethalChaos")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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;
		}
	}
}
public class ClockHook
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_MoveGlobalTime <>9__0_0;

		internal void <.ctor>b__0_0(orig_MoveGlobalTime orig, TimeOfDay self)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			RoundManager instance = RoundManager.Instance;
			GameObject val = new GameObject();
			val.transform.position = instance.insideAINodes[EntropyEngine.rnd.Next(0, instance.insideAINodes.Length)].transform.position;
			EntropyEngine.getMoonHost().queueHook("ClockIn", val, isSelective: true, targetIsPlayer: true);
			Object.Destroy((Object)(object)val);
			GameObject val2 = new GameObject();
			val2.transform.position = instance.outsideAINodes[EntropyEngine.rnd.Next(0, instance.outsideAINodes.Length)].transform.position;
			EntropyEngine.getMoonHost().queueHook("ClockOut", val2, isSelective: true, targetIsPlayer: true);
			Object.Destroy((Object)(object)val2);
		}
	}

	public ClockHook()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		Debug.Log((object)"Lethal Chaos: Hooking  World Modifiers... ");
		object obj = <>c.<>9__0_0;
		if (obj == null)
		{
			hook_MoveGlobalTime val = delegate(orig_MoveGlobalTime orig, TimeOfDay self)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Expected O, but got Unknown
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0065: Expected O, but got Unknown
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				RoundManager instance = RoundManager.Instance;
				GameObject val2 = new GameObject();
				val2.transform.position = instance.insideAINodes[EntropyEngine.rnd.Next(0, instance.insideAINodes.Length)].transform.position;
				EntropyEngine.getMoonHost().queueHook("ClockIn", val2, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val2);
				GameObject val3 = new GameObject();
				val3.transform.position = instance.outsideAINodes[EntropyEngine.rnd.Next(0, instance.outsideAINodes.Length)].transform.position;
				EntropyEngine.getMoonHost().queueHook("ClockOut", val3, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val3);
			};
			<>c.<>9__0_0 = val;
			obj = (object)val;
		}
		TimeOfDay.MoveGlobalTime += (hook_MoveGlobalTime)obj;
	}
}
public class Ball : MonoBehaviour
{
	private Transform myTransform;

	public Transform parent;

	public GameObject Player1;

	public PlayerControllerB playerTarget;

	public GameObject NPC;

	public GameObject game;

	public CanvasScaler scaler;

	public float ballSpeed;

	public float vertSpeed = 0f;

	private Vector3 direction = Vector3.left;

	private Vector3 directionUp = Vector3.up;

	public static int Player1Score;

	public static int Player2Score;

	private void Start()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = ((Component)parent).transform.position + new Vector3(0f, 0.5f, 0f);
	}

	private void Update()
	{
		//IL_003a: 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_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: 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_006c: 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)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		float num = ballSpeed * (scaler.scaleFactor / 20f);
		float num2 = vertSpeed * (scaler.scaleFactor / 20f);
		myTransform.Translate(direction * num * Time.deltaTime);
		myTransform.Translate(directionUp * num2 * Time.deltaTime);
		if ((double)myTransform.localPosition.x < -10.5)
		{
			Player2Score++;
			myTransform.localPosition = new Vector3(0f, 0.5f, 0f);
			ballSpeed = 100f;
			entropyBlaster.pongExecute(playerTarget);
		}
		if ((double)myTransform.localPosition.x > 10.5)
		{
			Player1Score++;
			myTransform.localPosition = new Vector3(0f, 0.5f, 0f);
			ballSpeed = 100f;
			Object.Destroy((Object)(object)game);
		}
	}

	private void OnTriggerEnter2D(Collider2D collider)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: 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)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		if (((Object)collider).name.Equals("Player1Middle") || ((Object)collider).name.Equals("Player"))
		{
			direction = Vector3.right;
			vertSpeed = Random.Range((0f - ballSpeed) * 2f, ballSpeed * 2f);
			ballSpeed += 25f;
		}
		if (((Object)collider).name.Equals("NPC"))
		{
			direction = Vector3.left;
			vertSpeed = Random.Range((0f - ballSpeed) * 2f, ballSpeed * 2f);
			NPC.GetComponent<NPC>().skill -= 3;
			ballSpeed += 25f;
		}
		if (((Object)collider).name.Equals("TopBoundary"))
		{
			Debug.Log((object)"TopBoundaryCollide");
			vertSpeed = Math.Abs(vertSpeed) * -1f;
		}
		if (((Object)collider).name.Equals("BottomBoundary"))
		{
			Debug.Log((object)"BottomBoundaryCollide");
			vertSpeed = Math.Abs(vertSpeed);
		}
	}
}
public class InputMap : LcInputActions
{
	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction pongUp { get; set; }

	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction pongUpAlt { get; set; }

	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction pongDown { get; set; }

	[InputAction(/*Could not decode attribute arguments.*/)]
	public InputAction pongDownAlt { get; set; }
}
public class myGUI : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}

	private void OnGUI()
	{
	}
}
public class NPC : MonoBehaviour
{
	private Transform myTransform;

	public Transform parent;

	public GameObject Ball;

	private float vert;

	public int skill = 34;

	public CanvasScaler scaler;

	public GameObject DeadNPC;

	private void Start()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = new Vector3(8f, vert, 0f) + ((Component)parent).transform.position;
	}

	private void Update()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: 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)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		float num = scaler.scaleFactor / 20f;
		vert = Ball.transform.position.y;
		myTransform.localPosition = new Vector3(8f, Mathf.Lerp(myTransform.localPosition.y, Ball.transform.localPosition.y, Time.deltaTime * num * ((float)skill / 10f) * 4f), 0f);
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(myTransform.localPosition.x, myTransform.localPosition.y, myTransform.localPosition.z);
		if (skill < 1)
		{
			Object.Instantiate<GameObject>(DeadNPC, val, Quaternion.identity);
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
	}

	private void OnTriggerEnter(Collider collider)
	{
		if (((Component)collider).CompareTag("Ball"))
		{
			skill -= 4;
		}
	}
}
public class Player1Bottom : MonoBehaviour
{
	private Transform myTransform;

	public Transform parent;

	public int playerSpeed = 10;

	private void Start()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = ((Component)parent).transform.position + new Vector3(-8f, -0.5f, 0f);
	}

	private void Update()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_006f: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKey((KeyCode)119))
		{
			myTransform.Translate(Vector3.up * (float)playerSpeed * Time.deltaTime);
		}
		if (Input.GetKey((KeyCode)115))
		{
			myTransform.Translate(Vector3.down * (float)playerSpeed * Time.deltaTime);
		}
		if (myTransform.localPosition.y > 5f)
		{
			myTransform.localPosition = new Vector3(-8f, 5f, 0f);
		}
		if (myTransform.localPosition.y < -5f)
		{
			myTransform.localPosition = new Vector3(-8f, -5f, 0f);
		}
	}
}
public class Player1Middle : MonoBehaviour
{
	private Transform myTransform;

	public Transform parent;

	public CanvasScaler scaler;

	public int playerSpeed;

	private void Start()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = ((Component)parent).transform.position + new Vector3(-8f, 0.5f, 0f);
	}

	private void Update()
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: 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)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: 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: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		float num = scaler.scaleFactor / 20f;
		if (Plugin.controls.pongUp.IsPressed() || Plugin.controls.pongUpAlt.IsPressed())
		{
			myTransform.Translate(Vector3.up * (float)playerSpeed * num * Time.deltaTime);
		}
		if (Plugin.controls.pongDown.IsPressed() || Plugin.controls.pongDownAlt.IsPressed())
		{
			myTransform.Translate(Vector3.down * (float)playerSpeed * num * Time.deltaTime);
		}
		if (myTransform.localPosition.y > 7f)
		{
			myTransform.localPosition = new Vector3(myTransform.localPosition.x, 6f, myTransform.localPosition.z);
		}
		if (myTransform.localPosition.y < -8f)
		{
			myTransform.localPosition = new Vector3(myTransform.localPosition.x, -6f, myTransform.localPosition.z);
		}
	}
}
public class Player1Top : MonoBehaviour
{
	private Transform myTransform;

	public Transform parent;

	public int playerSpeed = 10;

	private void Start()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = ((Component)parent).transform.position + new Vector3(-8f, 1.5f, 0f);
	}

	private void Update()
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_006f: 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_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKey((KeyCode)119))
		{
			myTransform.Translate(Vector3.up * (float)playerSpeed * Time.deltaTime);
		}
		if (Input.GetKey((KeyCode)115))
		{
			myTransform.Translate(Vector3.down * (float)playerSpeed * Time.deltaTime);
		}
		if (myTransform.localPosition.y > 7f)
		{
			myTransform.localPosition = new Vector3(-8f, 7f, 0f);
		}
		if (myTransform.localPosition.y < -3f)
		{
			myTransform.localPosition = new Vector3(-8f, -3f, 0f);
		}
	}
}
public class Player2Bottom : MonoBehaviour
{
	private Transform myTransform;

	public int playerSpeed = 10;

	private void Start()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = new Vector3(8f, -0.5f, 0f);
	}

	private void Update()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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)
		if (Input.GetKey((KeyCode)273))
		{
			myTransform.Translate(Vector3.up * (float)playerSpeed * Time.deltaTime);
		}
		if (Input.GetKey((KeyCode)274))
		{
			myTransform.Translate(Vector3.down * (float)playerSpeed * Time.deltaTime);
		}
		if (myTransform.position.y > 5f)
		{
			myTransform.position = new Vector3(8f, 5f, 0f);
		}
		if (myTransform.position.y < -5f)
		{
			myTransform.position = new Vector3(8f, -5f, 0f);
		}
	}
}
public class Player2Middle : MonoBehaviour
{
	private Transform myTransform;

	public int playerSpeed = 10;

	private void Start()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = new Vector3(8f, 0.5f, 0f);
	}

	private void Update()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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)
		if (Input.GetKey((KeyCode)273))
		{
			myTransform.Translate(Vector3.up * (float)playerSpeed * Time.deltaTime);
		}
		if (Input.GetKey((KeyCode)274))
		{
			myTransform.Translate(Vector3.down * (float)playerSpeed * Time.deltaTime);
		}
		if (myTransform.position.y > 7f)
		{
			myTransform.position = new Vector3(8f, 6f, 0f);
		}
		if (myTransform.position.y < -5f)
		{
			myTransform.position = new Vector3(8f, -4f, 0f);
		}
	}
}
public class Player2Top : MonoBehaviour
{
	private Transform myTransform;

	public int playerSpeed = 10;

	private void Start()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		myTransform = ((Component)this).transform;
		myTransform.position = new Vector3(8f, 1.5f, 0f);
	}

	private void Update()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: 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)
		if (Input.GetKey((KeyCode)273))
		{
			myTransform.Translate(Vector3.up * (float)playerSpeed * Time.deltaTime);
		}
		if (Input.GetKey((KeyCode)274))
		{
			myTransform.Translate(Vector3.down * (float)playerSpeed * Time.deltaTime);
		}
		if (myTransform.position.y > 7f)
		{
			myTransform.position = new Vector3(8f, 7f, 0f);
		}
		if (myTransform.position.y < -3f)
		{
			myTransform.position = new Vector3(8f, -3f, 0f);
		}
	}
}
public class Score : MonoBehaviour
{
	private void Start()
	{
	}

	private void Update()
	{
	}

	private void OnGUI()
	{
	}
}
namespace ArtifactGroup
{
	public class entropyBlaster
	{
		public static Random r = new Random();

		public static Transform btransform = new GameObject().transform;

		public static GameObject spoderRef;

		public static bool oneOrMorePlayersInFactory()
		{
			try
			{
				GameObject[] players = getPlayers();
				GameObject[] array = players;
				foreach (GameObject val in array)
				{
					PlayerControllerB component = val.GetComponent<PlayerControllerB>();
					if ((Object)(object)component != (Object)null && component.isInsideFactory)
					{
						return true;
					}
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Lethal Chaos: oneOrMorePlayersInFactory method failure -> " + ex.ToString()));
			}
			return false;
		}

		public static bool playerInFactory(GameObject player)
		{
			PlayerControllerB component = player.GetComponent<PlayerControllerB>();
			return component.isInsideFactory;
		}

		public static float nearestPlayerToCoordDistance(Vector3 position)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject[] players = getPlayers();
				float num = float.PositiveInfinity;
				GameObject[] array = players;
				foreach (GameObject val in array)
				{
					Vector3 val2 = val.transform.position - position;
					float magnitude = ((Vector3)(ref val2)).magnitude;
					if (magnitude < num)
					{
						num = magnitude;
					}
				}
				return num;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Lethal Chaos: nearestPlayerToCoordDistance method failure -> " + ex.ToString()));
			}
			return 0f;
		}

		public static GameObject nearestPlayerToCoord(Vector3 position)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			GameObject result = null;
			try
			{
				GameObject[] players = getPlayers();
				float num = float.PositiveInfinity;
				GameObject[] array = players;
				foreach (GameObject val in array)
				{
					Vector3 val2 = val.transform.position - position;
					float magnitude = ((Vector3)(ref val2)).magnitude;
					if (magnitude < num)
					{
						num = magnitude;
						result = val;
					}
				}
				return result;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Lethal Chaos: nearestPlayerToCoord method failure -> " + ex.ToString()));
			}
			return result;
		}

		public static GameObject[] getPlayers()
		{
			return GameObject.FindGameObjectsWithTag("Player");
		}

		public static Vector3 safeNodePosition(GameObject target, float inner_threshold, float outer_threshold, int areaCode)
		{
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameObject val = nearestPlayerToCoord(target.transform.position);
				PlayerControllerB component = val.GetComponent<PlayerControllerB>();
				GameObject[] array = null;
				RoundManager instance = RoundManager.Instance;
				if (component.isInsideFactory && areaCode == 2)
				{
					return Vector3.zero;
				}
				if (!component.isInsideFactory && areaCode == 1)
				{
					return Vector3.zero;
				}
				array = ((!component.isInsideFactory) ? instance.outsideAINodes : instance.insideAINodes);
				List<GameObject> list = new List<GameObject>();
				GameObject[] array2 = array;
				foreach (GameObject val2 in array2)
				{
					float num = nearestPlayerToCoordDistance(val2.transform.position);
					if (num > inner_threshold && num < outer_threshold)
					{
						list.Add(val2);
					}
				}
				if (list.Count != 0)
				{
					return list[EntropyEngine.rnd.Next(0, list.Count)].transform.position;
				}
				return Vector3.zero;
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
				return Vector3.zero;
			}
		}

		public static Vector3 safeRandomizedPositionFlex(GameObject target, float inner_threshold, float outer_threshold, int areaCode, NavMeshHit navHit = default(NavMeshHit))
		{
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Vector3 val2 = default(Vector3);
				for (int i = 0; i < 5; i++)
				{
					RoundManager instance = RoundManager.Instance;
					GameObject val = nearestPlayerToCoord(target.transform.position);
					PlayerControllerB component = val.GetComponent<PlayerControllerB>();
					if (component.isInsideFactory && areaCode == 2)
					{
						return Vector3.zero;
					}
					if (!component.isInsideFactory && areaCode == 1)
					{
						return Vector3.zero;
					}
					int num = 1;
					int num2 = 1;
					if (EntropyEngine.rnd.NextDouble() < 0.5)
					{
						num = -1;
					}
					if (EntropyEngine.rnd.NextDouble() < 0.5)
					{
						num2 = -1;
					}
					outer_threshold -= inner_threshold;
					float num3 = val.transform.position.x + (inner_threshold + outer_threshold * (float)EntropyEngine.rnd.NextDouble()) * (float)num;
					float num4 = val.transform.position.z + (inner_threshold + outer_threshold * (float)EntropyEngine.rnd.NextDouble()) * (float)num2;
					((Vector3)(ref val2))..ctor(num3, val.transform.position.y, num4);
					if (NavMesh.SamplePosition(val2, ref navHit, outer_threshold, -1))
					{
						return ((NavMeshHit)(ref navHit)).position;
					}
					Debug.Log((object)"Lethal Chaos: Position Flex failed, trying safeRandomizedPosition");
				}
				return safeNodePosition(target, inner_threshold, outer_threshold, areaCode);
			}
			catch (Exception ex)
			{
				Debug.LogError((object)ex);
				return Vector3.zero;
			}
		}

		public static void bomb(GameObject target, bool targetIsPlayer)
		{
			//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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Bomb Trigger");
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 8f * Accumulators.explosionSafetyMult + 5f, 30f, 0);
				Accumulators.explosionSafetyMult *= 0.9f;
			}
			else
			{
				zero = target.transform.position;
			}
			if (zero != Vector3.zero)
			{
				Plugin.rpcCalls.spawnExplosionClientRpc(zero);
			}
		}

		public static void SpawnRandomOutsideEnemyNear(GameObject target, bool targetIsPlayer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Random Outside EnemyTrigger");
			RoundManager instance = RoundManager.Instance;
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 3f, 25f, 2);
				if (zero != Vector3.zero && EntropyEngine.rnd.NextDouble() < (double)Accumulators.enemySpawnMult)
				{
					int index = EntropyEngine.rnd.Next(0, instance.currentLevel.OutsideEnemies.Count);
					GameObject val = Object.Instantiate<GameObject>(instance.currentLevel.OutsideEnemies[index].enemyType.enemyPrefab, zero, Quaternion.Euler(Vector3.zero));
					val.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
					instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
					EnemyType enemyType = val.GetComponent<EnemyAI>().enemyType;
					enemyType.numberSpawned++;
					EntityDestructionManager.destroyOnLeave.Add(val);
					Accumulators.enemySpawnMult *= 0.95f;
				}
				else
				{
					EventThrottler.summons -= 1f;
					EventThrottler.triggerTotals[1]--;
				}
			}
			else
			{
				EventThrottler.summons -= 1f;
				EventThrottler.triggerTotals[1]--;
			}
		}

		public static void SpawnRandomInsideEnemyNear(GameObject target, bool targetIsPlayer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Random Inside EnemyTrigger");
			RoundManager instance = RoundManager.Instance;
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 3f, 15f, 1);
				if (zero != Vector3.zero && EntropyEngine.rnd.NextDouble() < (double)Accumulators.enemySpawnMult)
				{
					int index = EntropyEngine.rnd.Next(0, instance.currentLevel.OutsideEnemies.Count);
					GameObject val = Object.Instantiate<GameObject>(instance.currentLevel.Enemies[index].enemyType.enemyPrefab, zero, Quaternion.Euler(Vector3.zero));
					val.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
					instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
					EnemyType enemyType = val.GetComponent<EnemyAI>().enemyType;
					enemyType.numberSpawned++;
					EntityDestructionManager.destroyOnLeave.Add(val);
					Accumulators.enemySpawnMult *= 0.9f;
				}
				else
				{
					EventThrottler.summons -= 1f;
					EventThrottler.triggerTotals[5]--;
				}
			}
			else
			{
				EventThrottler.summons -= 1f;
				EventThrottler.triggerTotals[5]--;
			}
		}

		public static void spawnRandomEnemy(GameObject target)
		{
		}

		public static void spawnRandomHazard(GameObject target, bool targetIsPlayer)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0036: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Spawn Random Hazard Trigger");
			Vector3 zero = Vector3.zero;
			Quaternion rotation = Random.rotation;
			zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 12f, 20f, 0));
			if (!(zero == Vector3.zero))
			{
				RoundManager instance = RoundManager.Instance;
				int num = EntropyEngine.rnd.Next(0, instance.currentLevel.spawnableMapObjects.Length);
				GameObject val = Object.Instantiate<GameObject>(instance.currentLevel.spawnableMapObjects[num].prefabToSpawn, zero, Quaternion.identity, btransform);
				val.GetComponent<NetworkObject>().Spawn(true);
				EntityDestructionManager.destroyOnLeave.Add(val);
			}
		}

		public static void spawnTurret(GameObject target, bool targetIsPlayer)
		{
			//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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0036: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Spawn Turret Trigger");
			Quaternion rotation = Random.rotation;
			Vector3 zero = Vector3.zero;
			zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 12f, 40f, 0));
			if (!(zero == Vector3.zero))
			{
				RoundManager instance = RoundManager.Instance;
				GameObject val = Object.Instantiate<GameObject>(instance.currentLevel.spawnableMapObjects[1].prefabToSpawn, zero, Quaternion.identity, btransform);
				val.GetComponent<NetworkObject>().Spawn(true);
				EntityDestructionManager.destroyOnLeave.Add(val);
			}
		}

		public static void spawnMine(GameObject target, bool targetIsPlayer)
		{
			//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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Spawn Mine Trigger");
			Vector3 zero = Vector3.zero;
			zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 10f, 20f, 0));
			if (!(zero == Vector3.zero))
			{
				RoundManager instance = RoundManager.Instance;
				GameObject val = Object.Instantiate<GameObject>(instance.currentLevel.spawnableMapObjects[0].prefabToSpawn, zero, Quaternion.identity, btransform);
				val.GetComponent<NetworkObject>().Spawn(true);
				EntityDestructionManager.destroyOnLeave.Add(val);
			}
		}

		public GameObject[] FindGameObjectsWithLayer(int layer)
		{
			GameObject[] array = Object.FindObjectsOfType<GameObject>();
			List<GameObject> list = new List<GameObject>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].layer == layer)
				{
					list.Add(array[i]);
				}
			}
			if (list.Count == 0)
			{
				return null;
			}
			return list.ToArray();
		}

		public static void spawnHive(GameObject target, bool targetIsPlayer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			Quaternion rotation = Random.rotation;
			Debug.Log((object)"Lethal Chaos: Spawn Hive Trigger");
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 12f, 60f, 2);
				if (!(zero == Vector3.zero))
				{
					RedLocustBees[] array = Resources.FindObjectsOfTypeAll<RedLocustBees>();
					RedLocustBees val = array[0];
					Debug.Log((object)("bee obj: " + ((Object)val).name + " - " + ((object)val).GetType()?.ToString() + " - " + ((object)val).ToString()));
					GameObject gameObject = ((Component)val).gameObject;
					GameObject val2 = Object.Instantiate<GameObject>(gameObject, zero, Quaternion.identity, new GameObject().transform);
					val2.GetComponentInChildren<NetworkObject>().Spawn(true);
					instance.SpawnedEnemies.Add(val2.GetComponent<EnemyAI>());
					val2.SetActive(true);
				}
			}
		}

		public static void spawnRandomPropInside(GameObject target, bool targetIsPlayer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			Vector3 zero = Vector3.zero;
			zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 7f, 15f, 0));
			if (zero == Vector3.zero)
			{
				return;
			}
			try
			{
				SpawnSyncedObject[] array = Object.FindObjectsOfType<SpawnSyncedObject>();
				if (array != null)
				{
					instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer");
					Debug.Log((object)$"Lethal Chaos: Spawning synced inside prop on server. Choices Length: {array.Length}");
					int num = EntropyEngine.rnd.Next(0, array.Length);
					GameObject val = Object.Instantiate<GameObject>(array[num].spawnPrefab, zero, target.transform.rotation, new GameObject().transform);
					if ((Object)(object)val != (Object)null)
					{
						val.GetComponent<NetworkObject>().Spawn(true);
						instance.spawnedSyncedObjects.Add(val);
						EntityDestructionManager.destroyOnLeave.Add(val);
					}
				}
			}
			catch (Exception arg)
			{
				Debug.Log((object)$"Exception! Unable to sync spawned objects on host; {arg}");
			}
		}

		public static void spawnRandomPropOutside(GameObject target, bool targetIsPlayer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			Vector3 zero = Vector3.zero;
			zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 7f, 40f, 0));
			if (zero == Vector3.zero)
			{
				return;
			}
			try
			{
				SpawnSyncedObject[] array = Object.FindObjectsOfType<SpawnSyncedObject>();
				if (array != null)
				{
					instance.mapPropsContainer = GameObject.FindGameObjectWithTag("MapPropsContainer");
					Debug.Log((object)$"Lethal Chaos: Spawning synced outside prop on server. Choices Length: {array.Length}");
					int num = EntropyEngine.rnd.Next(0, array.Length);
					GameObject val = Object.Instantiate<GameObject>(array[num].spawnPrefab, zero, target.transform.rotation, new GameObject().transform);
					if ((Object)(object)val != (Object)null)
					{
						val.GetComponent<NetworkObject>().Spawn(true);
						instance.spawnedSyncedObjects.Add(val);
						EntityDestructionManager.destroyOnLeave.Add(val);
					}
				}
			}
			catch (Exception arg)
			{
				Debug.Log((object)$"Exception! Unable to sync spawned objects on host; {arg}");
			}
		}

		public static void spawnRandomItem(GameObject target, int id, bool targetIsPlayer)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			try
			{
				Debug.Log((object)"Lethal Chaos: Spawning synced item on server.");
				Vector3 zero = Vector3.zero;
				Quaternion rotation = Random.rotation;
				zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 3f, 20f, 0));
				if (!(zero == Vector3.zero) && EntropyEngine.rnd.NextDouble() < (double)Accumulators.itemGetMult)
				{
					Item spawnableItem = instance.currentLevel.spawnableScrap[id].spawnableItem;
					GameObject val = Object.Instantiate<GameObject>(spawnableItem.spawnPrefab, zero, Quaternion.identity, new GameObject().transform);
					GrabbableObject component = val.GetComponent<GrabbableObject>();
					((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
					component.fallTime = 0f;
					component.scrapValue = (int)((float)EntropyEngine.rnd.Next(spawnableItem.minValue, spawnableItem.maxValue) * instance.scrapValueMultiplier);
					NetworkObject component2 = val.GetComponent<NetworkObject>();
					component2.Spawn(false);
					int[] array = new int[1] { component.scrapValue };
					NetworkObjectReference[] array2 = (NetworkObjectReference[])(object)new NetworkObjectReference[1] { NetworkObjectReference.op_Implicit(component2) };
					Accumulators.itemGetMult *= 0.7f;
					EntityDestructionManager.destroyOnFail.Add(val);
				}
			}
			catch (Exception arg)
			{
				Debug.Log((object)$"Exception! Unable to sync spawned objects on host; {arg}");
			}
		}

		public static void teleportPlayer(GameObject target, bool targetIsPlayer)
		{
			//IL_0018: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (targetIsPlayer)
			{
				Debug.Log((object)"Lethal Chaos: Teleporting Player.");
				GameObject val = nearestPlayerToCoord(target.transform.position);
				PlayerControllerB component = val.GetComponent<PlayerControllerB>();
				Vector3 zero = Vector3.zero;
				zero = safeRandomizedPositionFlex(target, 0f, 25f, 0);
				Plugin.rpcCalls.teleportPlayerClientRpc(((NetworkBehaviour)component).NetworkObjectId, zero);
			}
		}

		public static void LBolt(GameObject target, bool targetIsPlayer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			RoundManager instance = RoundManager.Instance;
			Debug.Log((object)"Lethal Chaos: Spawning LBolt");
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				Accumulators.lightningSafetyMult *= 0.96f;
				zero = safeRandomizedPositionFlex(target, 4f, 40f * Accumulators.lightningSafetyMult + 15f, 0);
			}
			else
			{
				zero = target.transform.position;
			}
			if (!(zero == Vector3.zero))
			{
				Plugin.rpcCalls.lightningStrikeClientRpc(zero);
			}
		}

		public static void drunk(GameObject target, bool targetIsPlayer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Making Player Drunk.");
			GameObject val = nearestPlayerToCoord(target.transform.position);
			PlayerControllerB component = val.GetComponent<PlayerControllerB>();
			Plugin.rpcCalls.makePlayerDrunkClientRpc(((NetworkBehaviour)component).NetworkObjectId);
		}

		public static async void lightFlicker()
		{
			Debug.Log((object)"Flickering Player Lights");
			Plugin.rpcCalls.lightFlickerClientRpc();
		}

		public static void timeJumpForward()
		{
			Debug.Log((object)"Lethal Chaos: Jumping Time Forward");
			Plugin.rpcCalls.timeJumpForwardClientRpc();
		}

		public static void timeJumpBackward()
		{
			Debug.Log((object)"Lethal Chaos: Jumping Time Backward");
			Plugin.rpcCalls.timeJumpBackwardClientRpc();
		}

		public static void qsand(GameObject target, bool targetIsPlayer)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_005a: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Adding Quicksand.");
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 0f, 120f, 0);
				if (!(zero == Vector3.zero))
				{
					RoundManager instance = RoundManager.Instance;
					GameObject item = Object.Instantiate<GameObject>(instance.quicksandPrefab, zero, Quaternion.identity, new GameObject().transform);
					EntityDestructionManager.destroyOnFail.Add(item);
				}
			}
		}

		public static void playSoundInsane(GameObject target, bool targetIsPlayer)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Insanity Sound.");
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 0f, 1f, 0);
				SoundManager.Instance.PlayAudio1AtPositionClientRpc(zero, EntropyEngine.rnd.Next(0, 2));
			}
		}

		public static void indoorJumpscare(GameObject target, bool targetIsPlayer)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Indoor Spook.");
			Vector3 zero = Vector3.zero;
			if (targetIsPlayer)
			{
				zero = safeRandomizedPositionFlex(target, 15f, 120f, 1);
				if (!(zero == Vector3.zero))
				{
					RoundManager.PlayRandomClip(StartOfRound.Instance.shipAmbianceAudio, StartOfRound.Instance.shipCreakSFX, false, 1f, 0, 1000);
				}
			}
		}

		public static async void wormFromHell(GameObject target, bool targetIsPlayer)
		{
			Debug.Log((object)"Lethal Chaos: Worm From Hell.");
			_ = Vector3.zero;
			Vector3 position = safeRandomizedPositionFlex(target, 0f, 45f, 0);
			Quaternion randRot = Random.rotation;
			GameObject WORMBASE = ((Component)Resources.FindObjectsOfTypeAll<SandWormAI>()[0]).gameObject;
			Debug.Log((object)("worm obj: " + (object)WORMBASE.gameObject));
			GameObject worm = Object.Instantiate<GameObject>(WORMBASE, position, randRot, new GameObject().transform);
			Debug.Log((object)("worm init: " + (object)worm));
			worm.SetActive(true);
			SandWormAI AI = worm.GetComponent<SandWormAI>();
			GameObject gameObject = Object.Instantiate<GameObject>(((EnemyAI)AI).enemyType.enemyPrefab, position, randRot);
			gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
			RoundManager.Instance.SpawnedEnemies.Add(gameObject.GetComponent<EnemyAI>());
			Debug.Log((object)("AI: " + (object)AI));
			((Object)AI).name = "gamer";
			((Object)gameObject).name = "true gamer";
			SandWormAI AI2 = gameObject.GetComponent<SandWormAI>();
			Debug.Log((object)("AI2 Comp " + (object)AI2));
			Debug.Log((object)"Lethal Chaos: Worm Emerge");
			await Task.Delay(500);
			AI2.EmergeServerRpc(0);
			await Task.Delay(10000);
			Object.Destroy((Object)(object)gameObject);
			Object.Destroy((Object)(object)worm);
		}

		public static async void funnyLadder(GameObject target, bool targetIsPlayer)
		{
			Debug.Log((object)"Lethal Chaos: Funny Ladder.");
			_ = Vector3.zero;
			Vector3 position = safeRandomizedPositionFlex(target, 5f, 25f, 0);
			Quaternion randRot = Random.rotation;
			if (!(position == Vector3.zero))
			{
				GameObject ladderbase = ((Component)Resources.FindObjectsOfTypeAll<ExtensionLadderItem>()[0]).gameObject;
				GameObject ladder = Object.Instantiate<GameObject>(ladderbase, position, randRot, new GameObject().transform);
				ExtensionLadderItem ITEM = ladder.GetComponent<ExtensionLadderItem>();
				ladder.GetComponentInChildren<NetworkObject>().Spawn(true);
				_ = ((Component)Resources.FindObjectsOfTypeAll<ExtensionLadderItem>()[0]).gameObject;
				GameObject ladder2 = Object.Instantiate<GameObject>(ladderbase, position, randRot, new GameObject().transform);
				ExtensionLadderItem ITEM2 = ladder.GetComponent<ExtensionLadderItem>();
				ladder2.GetComponentInChildren<NetworkObject>().Spawn(true);
				try
				{
					((GrabbableObject)ITEM2).ItemActivate(true, true);
					((GrabbableObject)ITEM2).UseItemOnClient(true);
				}
				catch (Exception)
				{
					Debug.Log((object)"bruh");
				}
				await Task.Delay(25000);
				if (!((GrabbableObject)ITEM).hasBeenHeld && !((GrabbableObject)ITEM).isHeld)
				{
					Object.Destroy((Object)(object)ladder);
					Object.Destroy((Object)(object)ladder2);
				}
				else
				{
					EntityDestructionManager.destroyOnFail.Add(ladderbase);
				}
			}
		}

		public static async void funnyRadio(GameObject target, bool targetIsPlayer)
		{
			Debug.Log((object)"Lethal Chaos: Funny Radio.");
			_ = Vector3.zero;
			Quaternion randRot = Random.rotation;
			Vector3 position = safeRandomizedPositionFlex(target, 5f, 25f, 0);
			if (!(position == Vector3.zero))
			{
				GameObject ladderbase = ((Component)Resources.FindObjectsOfTypeAll<BoomboxItem>()[0]).gameObject;
				GameObject ladder = Object.Instantiate<GameObject>(ladderbase, position, randRot, new GameObject().transform);
				ExtensionLadderItem ITEM = ladder.GetComponent<ExtensionLadderItem>();
				ladder.GetComponentInChildren<NetworkObject>().Spawn(true);
				((GrabbableObject)ladder.GetComponentInChildren<BoomboxItem>()).Start();
				((GrabbableObject)ladder.GetComponent<BoomboxItem>()).ItemActivate(true, true);
				((GrabbableObject)ladder.GetComponent<BoomboxItem>()).UseItemOnClient(true);
				await Task.Delay(25000);
				if (!((GrabbableObject)ITEM).hasBeenHeld && !((GrabbableObject)ITEM).isHeld)
				{
					Object.Destroy((Object)(object)ladder);
				}
				else
				{
					EntityDestructionManager.destroyOnFail.Add(ladderbase);
				}
			}
		}

		public static async void bigBalls(GameObject target, bool targetIsPlayer)
		{
			Debug.Log((object)"Lethal Chaos: Big Balls.");
			_ = Vector3.zero;
			Vector3 position = safeRandomizedPositionFlex(target, 5f, 25f, 0);
			_ = Random.rotation;
			if (!(position == Vector3.zero))
			{
				GameObject ladderbase = ((Component)Resources.FindObjectsOfTypeAll<SoccerBallProp>()[0]).gameObject;
				GameObject ladder = Object.Instantiate<GameObject>(ladderbase, position, Quaternion.identity, new GameObject().transform);
				SoccerBallProp ITEM = ladder.GetComponent<SoccerBallProp>();
				ladder.GetComponentInChildren<NetworkObject>().Spawn(true);
				((GrabbableObject)ladder.GetComponentInChildren<SoccerBallProp>()).Start();
				Plugin.rpcCalls.bigBallsClientRpc(((NetworkBehaviour)ITEM).NetworkObjectId);
				await Task.Delay(25000);
				if (!((GrabbableObject)ITEM).hasBeenHeld && !((GrabbableObject)ITEM).isHeld)
				{
					Object.Destroy((Object)(object)ladder);
				}
				else
				{
					EntityDestructionManager.destroyOnFail.Add(ladderbase);
				}
			}
		}

		public static void fard(GameObject target, bool targetIsPlayer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: fard");
			GameObject val = nearestPlayerToCoord(target.transform.position);
			PlayerControllerB component = val.GetComponent<PlayerControllerB>();
			Plugin.rpcCalls.fardClientRpc(((NetworkBehaviour)component).NetworkObjectId);
		}

		public static void stunPlayer(GameObject target, bool targetIsPlayer)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: stun");
			GameObject val = nearestPlayerToCoord(target.transform.position);
			PlayerControllerB component = val.GetComponent<PlayerControllerB>();
			Plugin.rpcCalls.stunClientRpc(((NetworkBehaviour)component).NetworkObjectId);
		}

		public static void spawnCar(GameObject target, bool targetIsPlayer)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Spawn Car Trigger");
			Quaternion rotation = Random.rotation;
			Vector3 zero = Vector3.zero;
			zero = ((!targetIsPlayer) ? target.transform.position : safeRandomizedPositionFlex(target, 10f, 20f, 0));
			if (!(zero == Vector3.zero))
			{
				RoundManager instance = RoundManager.Instance;
				Object obj = Object.FindObjectsOfTypeAll(typeof(VehicleController))[0];
				VehicleController val = (VehicleController)(object)((obj is VehicleController) ? obj : null);
				GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, zero, rotation, new GameObject().transform);
				val2.GetComponent<NetworkObject>().Spawn(true);
				EntityDestructionManager.destroyOnLeave.Add(val2);
			}
		}

		public static void createFrontCanvas()
		{
		}

		public static void pong(GameObject target, bool targetIsPlayer)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = nearestPlayerToCoord(target.transform.position);
			if ((Object)(object)val == (Object)null)
			{
				Debug.Log((object)"Lethal Chaos: P O N G Blocked: player is null");
			}
			Plugin.rpcCalls.startPongGameClientRpc(((NetworkBehaviour)val.GetComponent<PlayerControllerB>()).NetworkObjectId);
		}

		public static void pongExecute(PlayerControllerB player)
		{
			//IL_0016: 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)
			Debug.Log((object)"Lethal Chaos: Pong Game lost (get rekt)");
			player.DamagePlayer(90, true, true, (CauseOfDeath)6, 2, false, default(Vector3));
		}

		public static async void shipSuck()
		{
			StartOfRound.Instance.suckingPlayersOutOfShip = true;
			Plugin.rpcCalls.startSuckClipClientRpc();
			await Task.Delay(EntropyEngine.rnd.Next(50, 1500));
			StartOfRound.Instance.suckingPlayersOutOfShip = false;
		}

		public static void spawnWeb(GameObject target, bool targetIsPlayer)
		{
			//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_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_0035: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Lethal Chaos: Spoder Web.");
			Vector3 zero = Vector3.zero;
			zero = safeRandomizedPositionFlex(target, 5f, 25f, 0);
			Quaternion rotation = Random.rotation;
			if (zero == Vector3.zero)
			{
				return;
			}
			SandSpiderAI val = Resources.FindObjectsOfTypeAll<SandSpiderAI>()[0];
			GameObject gameObject = ((Component)val).gameObject;
			GameObject val2 = null;
			if ((Object)(object)spoderRef == (Object)null)
			{
				val2 = (spoderRef = Object.Instantiate<GameObject>(gameObject, zero, rotation, new GameObject().transform));
				if (Object.op_Implicit((Object)(object)val2.GetComponentInChildren<NetworkObject>()))
				{
					val2.GetComponentInChildren<NetworkObject>().Spawn(true);
				}
				val2.gameObject.SetActive(true);
			}
			else
			{
				val2 = spoderRef;
			}
			spoderRef = val2;
			SandSpiderAI component = val2.GetComponent<SandSpiderAI>();
			component.SpawnWebTrapClientRpc(zero, zero + new Vector3((float)(25.0 - EntropyEngine.rnd.NextDouble() * 50.0), zero.y, (float)(25.0 - EntropyEngine.rnd.NextDouble() * 50.0)));
		}

		public void switchRandomItem()
		{
		}
	}
	internal class EntropyEngine
	{
		public static Random rnd = new Random();

		public static bool SimultaneousOutcomes = false;

		public static float EventHookMultiplier = 1f;

		public static float EventChanceMultiplier = 1f;

		public static float EventChanceOffset = 0f;

		public static EntropyHost entropyHost;

		public static LightningHook lightninghook;

		public static ItemHooks itemhooks;

		public static PlayerHooks playerhooks;

		public static EnemyHooks enemyhooks;

		public static ClockHook modifierhook;

		public static PlanetResetHook resetHooks;

		public static EntityDestructionManager destructionManager = new EntityDestructionManager();

		public static SelectableLevel[] moons = (SelectableLevel[])(object)new SelectableLevel[0];

		public static List<EntropyHost> hosts = new List<EntropyHost>();

		public EntropyEngine()
		{
			Hooks();
		}

		public static void LaunchEngine()
		{
			Debug.Log((object)"Lethal Chaos: Launching Entropy Engine...");
			hosts.Clear();
			if (moons.Length == 0)
			{
				moons = Resources.FindObjectsOfTypeAll(typeof(SelectableLevel)) as SelectableLevel[];
			}
			for (int i = 0; i < moons.Length; i++)
			{
				hosts.Add(new EntropyHost(moons[i].PlanetName));
			}
		}

		public static EntropyHost getMoonHost()
		{
			RoundManager instance = RoundManager.Instance;
			string planetName = instance.currentLevel.PlanetName;
			for (int i = 0; i < moons.Length; i++)
			{
				if (planetName.Equals(moons[i].PlanetName))
				{
					return hosts[i];
				}
			}
			Debug.Log((object)"Lethal Chaos: Failed to find planet. Returning None Planet.");
			return new EntropyHost("None");
		}

		public void Hooks()
		{
			lightninghook = new LightningHook();
			itemhooks = new ItemHooks();
			playerhooks = new PlayerHooks();
			enemyhooks = new EnemyHooks();
			modifierhook = new ClockHook();
			resetHooks = new PlanetResetHook();
			WorldModifiers.Hooks();
		}
	}
	public class EntropyHost
	{
		public static int eventTotal = 31;

		private List<Event> events;

		private ItemSubsetRandomizer it_randomizer;

		public string planet;

		public WorldModifiers modifiers = new WorldModifiers();

		private int it_randomizer_seed = EntropyEngine.rnd.Next();

		public EventThrottler throttler = new EventThrottler();

		public EntropyHost(string planet)
		{
			Debug.Log((object)"Lethal Chaos: New Entropy Host Launched.");
			events = new List<Event>();
			for (int i = 0; i < eventTotal; i++)
			{
				Event @event = new Event(i);
				@event.printData(planet);
				this.planet = planet;
				events.Add(@event);
			}
			throttler = new EventThrottler();
		}

		public void queueHook(string hookID, GameObject obj, bool isSelective, bool targetIsPlayer)
		{
			RoundManager instance = RoundManager.Instance;
			if (it_randomizer == null)
			{
				Debug.Log((object)"Lethal Chaos: Starting Up Subset Randomizers For This Planet");
				it_randomizer = new ItemSubsetRandomizer(instance.currentLevel.spawnableScrap, it_randomizer_seed);
			}
			for (int i = 0; i < events.Count; i++)
			{
				Event @event = events[i];
				if (!@event.hooksAttached.Contains(hookID) || !@event.runOutcome(hookID))
				{
					continue;
				}
				if (EntropyEngine.SimultaneousOutcomes)
				{
					for (int j = 0; j < events.Count; j++)
					{
						Event event2 = events[j];
						if (event2.hooksAttached.Contains(hookID))
						{
							runEvent(event2.eventID, obj, isSelective, targetIsPlayer);
						}
					}
				}
				else
				{
					runEvent(events[i].eventID, obj, isSelective, targetIsPlayer);
				}
			}
		}

		public void runEvent(int method, GameObject obj, bool isSelective, bool playerOrigin)
		{
			try
			{
				RoundManager instance = RoundManager.Instance;
				Debug.Log((object)("running event: " + method + " to " + planet));
				if (!GameNetworkManager.Instance.isHostingGame)
				{
					Debug.Log((object)"block: is not hosting... Returning...");
				}
				else if (EntropyEngine.getMoonHost().planet.Equals("None"))
				{
					Debug.Log((object)"block: host is none. Returning...");
				}
				else if (instance.elevatorUp || instance.totalScrapValueInLevel == 0f)
				{
					Debug.Log((object)"block: Elevator is up. Returning...");
				}
				else if (instance.playersManager.allPlayersDead)
				{
					Debug.Log((object)"block: all players dead. Returning...");
				}
				else
				{
					if ((Object)(object)instance.dungeonGenerator == (Object)null)
					{
						return;
					}
					switch (method)
					{
					case 0:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(0, 15, 0f, 0f))
							{
								return;
							}
							entropyBlaster.bomb(obj, playerOrigin);
						}
						break;
					case 1:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(1, 4, 0f, 1f))
							{
								return;
							}
							entropyBlaster.SpawnRandomOutsideEnemyNear(obj, playerOrigin);
						}
						break;
					case 2:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(2, 12, 0.3f, 0.7f))
							{
								return;
							}
							entropyBlaster.spawnRandomHazard(obj, playerOrigin);
						}
						break;
					case 3:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(3, 10, 0f, 1f))
							{
								return;
							}
							entropyBlaster.spawnTurret(obj, playerOrigin);
						}
						break;
					case 4:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(4, 40, 1f, 0f))
							{
								return;
							}
							entropyBlaster.spawnMine(obj, playerOrigin);
						}
						break;
					case 5:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(5, 4, 0f, 1f))
							{
								return;
							}
							entropyBlaster.SpawnRandomInsideEnemyNear(obj, playerOrigin);
						}
						break;
					case 6:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(6, 10, 0f, 1f))
							{
								return;
							}
							entropyBlaster.spawnHive(obj, playerOrigin);
						}
						break;
					case 7:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(7, 30, 1f, 0f))
							{
								return;
							}
							entropyBlaster.spawnRandomPropOutside(obj, playerOrigin);
						}
						break;
					case 8:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(8, 30, 1f, 0f))
							{
								return;
							}
							entropyBlaster.spawnRandomPropInside(obj, playerOrigin);
						}
						break;
					case 9:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(9, 10, 1f, 0f))
							{
								return;
							}
							entropyBlaster.spawnRandomItem(obj, it_randomizer.provideItemID(), playerOrigin);
						}
						break;
					case 10:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(10, 10, 0f, 0f))
							{
								return;
							}
							entropyBlaster.teleportPlayer(obj, playerOrigin);
						}
						break;
					case 11:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(11, 15, 0f, 0f))
							{
								return;
							}
							entropyBlaster.LBolt(obj, playerOrigin);
						}
						break;
					case 12:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(12, 8, 0f, 0f))
							{
								return;
							}
							entropyBlaster.drunk(obj, playerOrigin);
						}
						break;
					case 13:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(13, 50, 0f, 0f))
						{
							return;
						}
						entropyBlaster.lightFlicker();
						break;
					case 14:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(14, 1000, 0f, 0f))
						{
							return;
						}
						entropyBlaster.timeJumpForward();
						break;
					case 15:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(15, 30, 0f, 0f))
						{
							return;
						}
						entropyBlaster.timeJumpBackward();
						break;
					case 16:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(16, 15, 1f, 0f))
							{
								return;
							}
							entropyBlaster.qsand(obj, playerOrigin);
						}
						break;
					case 17:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(17, 15, 0f, 0f))
						{
							return;
						}
						entropyBlaster.playSoundInsane(obj, playerOrigin);
						break;
					case 18:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(18, 15, 0f, 0f))
							{
								return;
							}
							entropyBlaster.indoorJumpscare(obj, playerOrigin);
						}
						break;
					case 19:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(19, 15, 0f, 0f))
							{
								return;
							}
							entropyBlaster.wormFromHell(obj, playerOrigin);
						}
						break;
					case 20:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(20, 40, 0f, 0f))
							{
								return;
							}
							entropyBlaster.funnyLadder(obj, playerOrigin);
						}
						break;
					case 21:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(21, 60, 0f, 0f))
							{
								return;
							}
							entropyBlaster.fard(obj, playerOrigin);
						}
						break;
					case 22:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(22, 10, 0f, 0f))
							{
								return;
							}
							entropyBlaster.stunPlayer(obj, playerOrigin);
						}
						break;
					case 23:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(23, 100, 0f, 0f))
						{
							return;
						}
						Plugin.rpcCalls.glitchHudClientRpc();
						break;
					case 24:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(24, 20, 0f, 0f))
							{
								return;
							}
							Plugin.rpcCalls.shakeScreenClientRpc();
						}
						break;
					case 25:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(25, 10, 0f, 0f))
						{
							return;
						}
						Plugin.rpcCalls.radiationWarningHudClientRpc();
						break;
					case 26:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(26, 5, 1f, 0f))
							{
								return;
							}
							entropyBlaster.spawnCar(obj, playerOrigin);
						}
						break;
					case 27:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(27, 15, 1f, 0f))
							{
								return;
							}
							entropyBlaster.funnyRadio(obj, playerOrigin);
						}
						break;
					case 28:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(28, 10, 0f, 0f))
							{
								return;
							}
							entropyBlaster.bigBalls(obj, playerOrigin);
						}
						break;
					case 29:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(29, 6, 0f, 0f))
							{
								return;
							}
							entropyBlaster.pong(obj, playerOrigin);
						}
						break;
					case 30:
						if (EntropyEngine.getMoonHost().throttler.throttleGate(30, 2, 0f, 0f))
						{
							return;
						}
						entropyBlaster.shipSuck();
						break;
					case 31:
						if (isSelective)
						{
							if (EntropyEngine.getMoonHost().throttler.throttleGate(31, 25, 1f, 0f))
							{
								return;
							}
							entropyBlaster.spawnWeb(obj, playerOrigin);
						}
						break;
					}
					Object.Destroy((Object)(object)obj);
				}
			}
			catch (Exception ex)
			{
				Debug.LogError((object)("Lethal Chaos: " + ex.ToString()));
				try
				{
					Object.Destroy((Object)(object)obj);
				}
				catch (Exception)
				{
				}
			}
		}

		public void addRandomOutcome()
		{
			Random random = new Random();
			int index = random.Next(0, events.Count);
			Event @event = events[index];
			int num = random.Next(0, @event.availableHooks.Length);
			@event.hooksAttached.Add(@event.availableHooks[num]);
			double num2 = random.NextDouble();
			double num3 = random.NextDouble();
			double num4 = random.NextDouble();
			double num5 = random.NextDouble() + @event.implicitWeights[num];
			@event.hookChances.Add(100.0 * num2 * num3 * num4 * num5);
		}
	}
	internal class Event
	{
		public int eventID;

		public string[] availableHooks = new string[26]
		{
			"LightningBoltTargeted", "GrabItem", "PlayerHurt", "PlayerLand", "ChargeBatteries", "Teleport", "KillEnemy", "HitEnemy", "PlayerCrouch", "ClockIn",
			"ClockOut", "SwitchItem", "PlayerDeath", "Sprint", "DogInvestigate", "DogRage", "UnlockDoor", "PlayerUnderWater", "GiantEat", "GiantGrab",
			"BugDrop", "BeeZap", "LocustLeave", "MineExplode", "TurretOn", "WebTrip"
		};

		public double[] implicitWeights = new double[26]
		{
			2.0, 1.0, 1.5, 1.1, 4.0, 10.0, 10.0, 2.0, 2.0, 0.002,
			0.002, 1.0, 1000.0, 1.0, 1.5, 4.0, 10.0, 1.4, 100.0, 100.0,
			1.0, 1.0, 1.4, 1000.0, 1.0, 1000.0
		};

		public List<string> hooksAttached = new List<string>();

		public List<double> hookChances = new List<double>();

		private bool forceEvent = false;

		private int forceValue = 28;

		private Random rnd = EntropyEngine.rnd;

		public Event(int eventID)
		{
			this.eventID = eventID;
			double num = 5.0;
			try
			{
				num *= (double)EntropyEngine.EventHookMultiplier;
			}
			catch
			{
				Debug.LogError((object)"LethalChaos: error parsing EventHookMultiplier setting! Check to see if the setting is a decimal value!");
			}
			for (int i = 0; i < availableHooks.Length; i++)
			{
				double num2 = rnd.NextDouble() * 100.0;
				if (num2 < num)
				{
					hooksAttached.Add(availableHooks[i]);
					double num3 = rnd.NextDouble();
					double num4 = implicitWeights[i];
					float eventChanceMultiplier = EntropyEngine.EventChanceMultiplier;
					float eventChanceOffset = EntropyEngine.EventChanceOffset;
					hookChances.Add(Math.Min(Math.Min(100.0 * num3 * num4, 100.0) * (double)eventChanceMultiplier, 100.0) + (double)eventChanceOffset);
				}
			}
			if (forceEvent && this.eventID == forceValue)
			{
				int num5 = 0;
				try
				{
					num5 = (int)Math.Round(rnd.NextDouble() * (double)availableHooks.Length) - 1;
					hooksAttached.Add(availableHooks[num5]);
				}
				catch
				{
					return;
				}
				double num6 = rnd.NextDouble();
				double num7 = implicitWeights[num5];
				float eventChanceMultiplier2 = EntropyEngine.EventChanceMultiplier;
				float eventChanceOffset2 = EntropyEngine.EventChanceOffset;
				hookChances.Add(Math.Min(Math.Min(100.0 * num6 * num7, 100.0) * (double)eventChanceMultiplier2, 100.0) + (double)eventChanceOffset2);
			}
		}

		public bool runOutcome(string hook)
		{
			int num = -1;
			for (int i = 0; i < hooksAttached.Count; i++)
			{
				if (hooksAttached[i].Equals(hook))
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				return false;
			}
			double num2 = hookChances[num];
			return rnd.NextDouble() * 100.0 < num2;
		}

		public void printData(string planet)
		{
			Debug.Log((object)("Data for ID: " + eventID + " :: " + planet));
			Debug.Log((object)"Hooks - ");
			for (int i = 0; i < hooksAttached.Count; i++)
			{
				Debug.Log((object)("-> " + hooksAttached[i] + "  -- Chance: " + hookChances[i]));
			}
		}
	}
	public class EnemyHooks
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_KillEnemy <>9__0_0;

			public static hook_HitEnemy <>9__0_1;

			public static hook_SearchForPreviouslyHeardSound <>9__0_2;

			public static hook_EnrageDogOnLocalClient <>9__0_3;

			public static hook_GrabPlayerServerRpc <>9__0_4;

			public static hook_BeginEatPlayer <>9__0_5;

			public static hook_DropItem <>9__0_6;

			public static hook_BeesZap <>9__0_7;

			public static hook_bugsLeave <>9__0_8;

			public static hook_ExplodeMineServerRpc <>9__0_9;

			public static hook_ToggleTurretEnabled <>9__0_10;

			public static hook_PlayerTripWebServerRpc <>9__0_11;

			internal void <.ctor>b__0_0(orig_KillEnemy orig, EnemyAI self, bool destroy)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Expected O, but got Unknown
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				if (!destroy)
				{
					GameObject val = new GameObject();
					val.transform.position = self.serverPosition;
					orig.Invoke(self, destroy);
					EntropyEngine.getMoonHost().queueHook("KillEnemy", val, isSelective: true, targetIsPlayer: true);
					Object.Destroy((Object)(object)val);
				}
			}

			internal void <.ctor>b__0_1(orig_HitEnemy orig, EnemyAI self, int force, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, force, playerWhoHit, playHitSFX, hitID);
				GameObject val = new GameObject();
				val.transform.position = self.serverPosition;
				EntropyEngine.getMoonHost().queueHook("HitEnemy", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_2(orig_SearchForPreviouslyHeardSound orig, MouthDogAI self)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Expected O, but got Unknown
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				GameObject val = new GameObject();
				val.transform.position = ((EnemyAI)self).serverPosition;
				EntropyEngine.getMoonHost().queueHook("DogInvestigate", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_3(orig_EnrageDogOnLocalClient orig, MouthDogAI self, Vector3 targetPosition, float distanceToNoise, bool approximatePosition, bool fullyEnrage)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				//IL_001d: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, targetPosition, distanceToNoise, approximatePosition, fullyEnrage);
				GameObject val = new GameObject();
				val.transform.position = ((EnemyAI)self).serverPosition;
				EntropyEngine.getMoonHost().queueHook("DogRage", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_4(orig_GrabPlayerServerRpc orig, ForestGiantAI self, int playerId)
			{
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Expected O, but got Unknown
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, playerId);
				GameObject val = new GameObject();
				val.transform.position = ((Component)self).transform.position;
				EntropyEngine.getMoonHost().queueHook("GiantGrab", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_5(orig_BeginEatPlayer orig, ForestGiantAI self, PlayerControllerB playerBeingEaten, Vector3 enemyPosition, int enemyYRot)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, playerBeingEaten, enemyPosition, enemyYRot);
				GameObject val = new GameObject();
				val.transform.position = ((Component)self).transform.position;
				EntropyEngine.getMoonHost().queueHook("GiantEat", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_6(orig_DropItem orig, HoarderBugAI self, NetworkObject item, Vector3 targetFloorPosition, bool droppingInNest)
			{
				//IL_0004: Unknown result type (might be due to invalid IL or missing references)
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, item, targetFloorPosition, droppingInNest);
				GameObject val = new GameObject();
				val.transform.position = ((Component)self).transform.position;
				EntropyEngine.getMoonHost().queueHook("BugDrop", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_7(orig_BeesZap orig, RedLocustBees self)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Expected O, but got Unknown
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				GameObject val = new GameObject();
				val.transform.position = ((Component)self).transform.position;
				EntropyEngine.getMoonHost().queueHook("BeeZap", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal IEnumerator <.ctor>b__0_8(orig_bugsLeave orig, DocileLocustBeesAI self)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					GameObject val = new GameObject();
					val.transform.position = ((Component)self).transform.position;
					EntropyEngine.getMoonHost().queueHook("LocustLeave", val, isSelective: true, targetIsPlayer: true);
					Object.Destroy((Object)(object)val);
				}
				catch (Exception ex)
				{
					Debug.LogException(ex);
				}
				return orig.Invoke(self);
			}

			internal void <.ctor>b__0_9(orig_ExplodeMineServerRpc orig, Landmine self)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Expected O, but got Unknown
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				GameObject val = new GameObject();
				val.transform.position = ((Component)self).transform.position;
				EntropyEngine.getMoonHost().queueHook("MineExplode", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}

			internal void <.ctor>b__0_10(orig_ToggleTurretEnabled orig, Turret self, bool enabled)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self, enabled);
				if (enabled)
				{
					GameObject val = new GameObject();
					val.transform.position = ((Component)self).transform.position;
					EntropyEngine.getMoonHost().queueHook("TurretOn", val, isSelective: true, targetIsPlayer: true);
					Object.Destroy((Object)(object)val);
				}
			}

			internal void <.ctor>b__0_11(orig_PlayerTripWebServerRpc orig, SandSpiderAI self, int trapID, int playerNum)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject();
				val.transform.position = ((Component)self).transform.position;
				EntropyEngine.getMoonHost().queueHook("WebTrip", val, isSelective: true, targetIsPlayer: true);
				Object.Destroy((Object)(object)val);
			}
		}

		public EnemyHooks()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_004c: 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_0057: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00bb: 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_00c6: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Expected O, but got Unknown
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Expected O, but got Unknown
			Debug.Log((object)"Lethal Chaos: Hooking Enemy Interactions...");
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_KillEnemy val = delegate(orig_KillEnemy orig, EnemyAI self, bool destroy)
				{
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Expected O, but got Unknown
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					if (!destroy)
					{
						GameObject val24 = new GameObject();
						val24.transform.position = self.serverPosition;
						orig.Invoke(self, destroy);
						EntropyEngine.getMoonHost().queueHook("KillEnemy", val24, isSelective: true, targetIsPlayer: true);
						Object.Destroy((Object)(object)val24);
					}
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			EnemyAI.KillEnemy += (hook_KillEnemy)obj;
			object obj2 = <>c.<>9__0_1;
			if (obj2 == null)
			{
				hook_HitEnemy val2 = delegate(orig_HitEnemy orig, EnemyAI self, int force, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID)
				{
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Expected O, but got Unknown
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, force, playerWhoHit, playHitSFX, hitID);
					GameObject val23 = new GameObject();
					val23.transform.position = self.serverPosition;
					EntropyEngine.getMoonHost().queueHook("HitEnemy", val23, isSelective: true, targetIsPlayer: true);
					Object.Destroy((Object)(object)val23);
				};
				<>c.<>9__0_1 = val2;
				obj2 = (object)val2;
			}
			EnemyAI.HitEnemy += (hook_HitEnemy)obj2;
			object obj3 = <>c.<>9__0_2;
			if (obj3 == null)
			{
				hook_SearchForPreviouslyHeardSound val3 = delegate(orig_SearchForPreviouslyHeardSound orig, MouthDogAI self)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					//IL_000f: Expected O, but got Unknown
					//IL_0016: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					GameObject val22 = new GameObject();
					val22.transform.position = ((EnemyAI)self).serverPosition;
					EntropyEngine.getMoonHost().queueHook("DogInvestigate", val22, isSelective: true, targetIsPlayer: true);
					Object.Destroy((Object)(object)val22);
				};
				<>c.<>9__0_2 = val3;
				obj3 = (object)val3;
			}
			MouthDogAI.SearchForPreviouslyHeardSound += (hook_SearchForPreviouslyHeardSound)obj3;
			object obj4 = <>c.<>9__0_3;
			if (obj4 == null)
			{
				hook_EnrageDogOnLocalClient val4 = delegate(orig_EnrageDogOnLocalClient orig, MouthDogAI self, Vector3 targetPosition, float distanceToNoise, bool approximatePosition, bool fullyEnrage)
				{
					//IL_0003: Unknown result type (might be due to invalid IL or missing references)
					//IL_0010: Unknown result type (might be due to invalid IL or missing references)
					//IL_0016: Expected O, but got Unknown
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self, targetPosition, distanceToNoise, approximatePosition, fullyEnrage);
					GameObject val21 = new GameObject();
					val21.transform.position = ((EnemyAI)self).serverPosition;
					EntropyEngine.getMoonHost().queueHook("DogRage", val21, isSelective: true, targetIsPlayer: true);
					Object.Destroy((Object)(object)val21);
				};
				<>c.<>9__0_3 = val4;
				obj4 = (object)val4;
			}
			MouthDogAI.EnrageDogOnLocalClient