Decompiled source of Emergency Dice Updated Experimental v1.7.2

MysteryDice.dll

Decompiled 3 weeks ago
using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BombCollar;
using CodeRebirth.src.Content.Maps;
using CodeRebirth.src.Util.Extensions;
using DiversityRemastered;
using DiversityRemastered.Misc;
using GameNetcodeStuff;
using HarmonyLib;
using KaimiraGames;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MysteryDice;
using MysteryDice.Dice;
using MysteryDice.Effects;
using MysteryDice.Patches;
using MysteryDice.Visual;
using Surfaced;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Rendering;
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: AssemblyTitle("MysteryDice")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MysteryDice")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c247d947-5d1a-411b-8d87-6f0bc33e5234")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
public class ColorGradient : MonoBehaviour
{
	public Renderer CubeRenderer;

	public Renderer MoonRenderer;

	public Renderer SunRenderer;

	public Color NightColor = new Color(0.40392157f, 33f / 85f, 0.8862745f);

	public Color DayColor = new Color(1f, 0.81960785f, 0f);

	private float ColorTimer = 0f;

	private void Start()
	{
		CubeRenderer = ((Component)this).GetComponent<Renderer>();
		SunRenderer = ((Component)((Component)this).transform.Find("Sun")).GetComponent<Renderer>();
		MoonRenderer = ((Component)((Component)this).transform.Find("Moon")).GetComponent<Renderer>();
	}

	private void Update()
	{
		//IL_0038: 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_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: 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_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: 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_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		ColorTimer -= Time.deltaTime;
		if (!(ColorTimer >= 0f))
		{
			ColorTimer = 1f;
			Color val = DayColor + (NightColor - DayColor) * TimeOfDay.Instance.normalizedTimeOfDay;
			CubeRenderer.material.SetColor("_BaseColor", val);
			CubeRenderer.material.SetColor("_EmissiveColor", val * 3f);
			float normalizedTimeOfDay = TimeOfDay.Instance.normalizedTimeOfDay;
			float num = 1f - normalizedTimeOfDay;
			MoonRenderer.material.SetColor("_BaseColor", new Color(1f, 1f, 1f, normalizedTimeOfDay));
			SunRenderer.material.SetColor("_BaseColor", new Color(1f, 1f, 1f, num));
			MoonRenderer.material.SetColor("_UnlitColor", new Color(1f, 1f, 1f, normalizedTimeOfDay));
			SunRenderer.material.SetColor("_UnlitColor", new Color(1f, 1f, 1f, num));
			MoonRenderer.material.SetColor("_MainColor", new Color(1f, 1f, 1f, normalizedTimeOfDay));
			SunRenderer.material.SetColor("_MainColor", new Color(1f, 1f, 1f, num));
		}
	}
}
public class CycleSigns : MonoBehaviour
{
	private class DiceVisuals
	{
		public Sprite Sprite;

		public Color ModelColor;

		public Color EmissionColor;

		public float Emission;

		public DiceVisuals(Sprite sprite, Color color, Color emissionColor, float emission)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			Sprite = sprite;
			ModelColor = color;
			EmissionColor = emissionColor;
			Emission = emission;
		}
	}

	public float CycleTime = 1f;

	private float CurrentTimer = 0f;

	private int CurrentSprite = 0;

	private bool Stop = false;

	private SpriteRenderer SignSpriteRenderer;

	private Renderer DiceRenderer;

	private List<DiceVisuals> Visuals = new List<DiceVisuals>();

	private void Start()
	{
		//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_0031: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningJester, Color.yellow, Color.yellow, 100f));
		Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningBracken, Color.yellow, Color.yellow, 100f));
		Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningDeath, Color.red, Color.red, 100f));
		Visuals.Add(new DiceVisuals(global::MysteryDice.MysteryDice.WarningLuck, Color.green, Color.green, 300f));
		SignSpriteRenderer = ((Component)((Component)this).transform.Find("Emergency Sign")).gameObject.GetComponent<SpriteRenderer>();
		DiceRenderer = ((Component)this).gameObject.GetComponent<Renderer>();
	}

	private void Update()
	{
		if (!Stop)
		{
			CurrentTimer -= Time.deltaTime;
			if (CurrentTimer <= 0f)
			{
				CurrentTimer = CycleTime;
				CycleSprite();
			}
		}
	}

	private void CycleSprite()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		CurrentSprite++;
		if (CurrentSprite >= Visuals.Count)
		{
			CurrentSprite = 0;
		}
		SignSpriteRenderer.sprite = Visuals[CurrentSprite].Sprite;
		DiceRenderer.material.SetColor("_BaseColor", Visuals[CurrentSprite].ModelColor);
		DiceRenderer.material.SetColor("_EmissiveColor", Visuals[CurrentSprite].EmissionColor * Visuals[CurrentSprite].Emission);
	}

	public void HideSigns()
	{
		Stop = true;
		((Component)SignSpriteRenderer).gameObject.SetActive(false);
	}
}
public class Blinking : MonoBehaviour
{
	public float BlinkingTime;

	private float BlinkingTimer = 0f;

	private GameObject GlowSign;

	private GameObject NormalSign;

	private bool Stop = false;

	public bool Glow { get; private set; }

	private void Start()
	{
		BlinkingTime = 0.5f;
		Glow = false;
		NormalSign = ((Component)((Component)this).transform.Find("Emergency Sign")).gameObject;
		GlowSign = ((Component)((Component)this).transform.Find("Emergency Sign Glowing")).gameObject;
	}

	public void HideSigns()
	{
		Stop = true;
		NormalSign.SetActive(false);
		GlowSign.SetActive(false);
	}

	private void Update()
	{
		if (Stop)
		{
			return;
		}
		BlinkingTimer -= Time.deltaTime;
		if (BlinkingTimer <= 0f)
		{
			BlinkingTimer = BlinkingTime;
			if (Glow)
			{
				Glow = false;
				NormalSign.SetActive(true);
				GlowSign.SetActive(false);
			}
			else
			{
				Glow = true;
				NormalSign.SetActive(false);
				GlowSign.SetActive(true);
			}
		}
	}
}
public class Spinner : MonoBehaviour
{
	public bool IsBeingUsed = false;

	private float SpinVelocity = 0f;

	private float SpinAcceleration = 100f;

	private float NormalSpinVelocity = 90f;

	private float CurrentTimer = 0f;

	private float SpinningTime = 3f;

	private Quaternion InitialRotation;

	private Quaternion FromRotation;

	private void Start()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		InitialRotation = ((Component)this).transform.rotation;
	}

	public void StartHyperSpinning(float spinTime)
	{
		IsBeingUsed = true;
		SpinVelocity = NormalSpinVelocity;
		SpinAcceleration = 1000f;
		SpinningTime = spinTime;
	}

	public void StopHyperSpinning()
	{
		//IL_0025: 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)
		IsBeingUsed = false;
		SpinVelocity = 0f;
		SpinAcceleration = 0f;
		FromRotation = ((Component)this).transform.rotation;
	}

	private void Update()
	{
		//IL_0087: 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_00c1: 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)
		if (IsBeingUsed)
		{
			CurrentTimer += Time.deltaTime;
			if (CurrentTimer >= SpinningTime)
			{
				StopHyperSpinning();
			}
		}
		if (!IsBeingUsed)
		{
			((Component)this).transform.Rotate(Vector3.up, NormalSpinVelocity * Time.deltaTime);
			return;
		}
		SpinVelocity += SpinAcceleration * Time.deltaTime;
		((Component)this).transform.Rotate(Vector3.up, SpinVelocity * Time.deltaTime);
		((Component)this).transform.Rotate(Vector3.forward, SpinVelocity * Time.deltaTime);
		((Component)this).transform.Rotate(Vector3.right, SpinVelocity * Time.deltaTime);
	}
}
namespace KaimiraGames
{
	public class WeightedList<T> : IEnumerable<T>, IEnumerable
	{
		private readonly List<T> _list = new List<T>();

		private readonly List<int> _weights = new List<int>();

		private readonly List<int> _probabilities = new List<int>();

		private readonly List<int> _alias = new List<int>();

		private readonly Random _rand;

		private int _totalWeight;

		private bool _areAllProbabilitiesIdentical = false;

		private int _minWeight;

		private int _maxWeight;

		public WeightErrorHandlingType BadWeightErrorHandling { get; set; } = WeightErrorHandlingType.SetWeightToOne;


		public int TotalWeight => _totalWeight;

		public int MinWeight => _minWeight;

		public int MaxWeight => _maxWeight;

		public IReadOnlyList<T> Items => _list.AsReadOnly();

		public T this[int index] => _list[index];

		public int Count => _list.Count;

		public WeightedList(Random rand = null)
		{
			_rand = rand ?? new Random();
		}

		public WeightedList(ICollection<WeightedListItem<T>> listItems, Random rand = null)
		{
			_rand = rand ?? new Random();
			foreach (WeightedListItem<T> listItem in listItems)
			{
				_list.Add(listItem._item);
				_weights.Add(listItem._weight);
			}
			Recalculate();
		}

		public T Next()
		{
			if (Count == 0)
			{
				return default(T);
			}
			int index = _rand.Next(Count);
			if (_areAllProbabilitiesIdentical)
			{
				return _list[index];
			}
			int num = _rand.Next(_totalWeight);
			return (num < _probabilities[index]) ? _list[index] : _list[_alias[index]];
		}

		public void AddWeightToAll(int weight)
		{
			if (weight + _minWeight <= 0 && BadWeightErrorHandling == WeightErrorHandlingType.ThrowExceptionOnAdd)
			{
				throw new ArgumentException($"Subtracting {-1 * weight} from all items would set weight to non-positive for at least one element.");
			}
			for (int i = 0; i < Count; i++)
			{
				_weights[i] = FixWeight(_weights[i] + weight);
			}
			Recalculate();
		}

		public void SubtractWeightFromAll(int weight)
		{
			AddWeightToAll(weight * -1);
		}

		public void SetWeightOfAll(int weight)
		{
			if (weight <= 0 && BadWeightErrorHandling == WeightErrorHandlingType.ThrowExceptionOnAdd)
			{
				throw new ArgumentException("Weight cannot be non-positive.");
			}
			for (int i = 0; i < Count; i++)
			{
				_weights[i] = FixWeight(weight);
			}
			Recalculate();
		}

		public IEnumerator<T> GetEnumerator()
		{
			return _list.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return _list.GetEnumerator();
		}

		public void Add(T item, int weight)
		{
			_list.Add(item);
			_weights.Add(FixWeight(weight));
			Recalculate();
		}

		public void Add(ICollection<WeightedListItem<T>> listItems)
		{
			foreach (WeightedListItem<T> listItem in listItems)
			{
				_list.Add(listItem._item);
				_weights.Add(FixWeight(listItem._weight));
			}
			Recalculate();
		}

		public void Clear()
		{
			_list.Clear();
			_weights.Clear();
			Recalculate();
		}

		public void Contains(T item)
		{
			_list.Contains(item);
		}

		public int IndexOf(T item)
		{
			return _list.IndexOf(item);
		}

		public void Insert(int index, T item, int weight)
		{
			_list.Insert(index, item);
			_weights.Insert(index, FixWeight(weight));
			Recalculate();
		}

		public void Remove(T item)
		{
			int index = IndexOf(item);
			RemoveAt(index);
			Recalculate();
		}

		public void RemoveAt(int index)
		{
			_list.RemoveAt(index);
			_weights.RemoveAt(index);
			Recalculate();
		}

		public void SetWeight(T item, int newWeight)
		{
			SetWeightAtIndex(IndexOf(item), FixWeight(newWeight));
		}

		public int GetWeightOf(T item)
		{
			return GetWeightAtIndex(IndexOf(item));
		}

		public void SetWeightAtIndex(int index, int newWeight)
		{
			_weights[index] = FixWeight(newWeight);
			Recalculate();
		}

		public int GetWeightAtIndex(int index)
		{
			return _weights[index];
		}

		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("WeightedList<");
			stringBuilder.Append(typeof(T).Name);
			stringBuilder.Append(">: TotalWeight:");
			stringBuilder.Append(TotalWeight);
			stringBuilder.Append(", Min:");
			stringBuilder.Append(_minWeight);
			stringBuilder.Append(", Max:");
			stringBuilder.Append(_maxWeight);
			stringBuilder.Append(", Count:");
			stringBuilder.Append(Count);
			stringBuilder.Append(", {");
			for (int i = 0; i < _list.Count; i++)
			{
				stringBuilder.Append(_list[i].ToString());
				stringBuilder.Append(":");
				stringBuilder.Append(_weights[i].ToString());
				if (i < _list.Count - 1)
				{
					stringBuilder.Append(", ");
				}
			}
			stringBuilder.Append("}");
			return stringBuilder.ToString();
		}

		private void Recalculate()
		{
			_totalWeight = 0;
			_areAllProbabilitiesIdentical = false;
			_minWeight = 0;
			_maxWeight = 0;
			bool flag = true;
			_alias.Clear();
			_probabilities.Clear();
			List<int> list = new List<int>(Count);
			List<int> list2 = new List<int>(Count);
			List<int> list3 = new List<int>(Count);
			foreach (int weight in _weights)
			{
				if (flag)
				{
					_minWeight = (_maxWeight = weight);
					flag = false;
				}
				_minWeight = ((weight < _minWeight) ? weight : _minWeight);
				_maxWeight = ((_maxWeight < weight) ? weight : _maxWeight);
				_totalWeight += weight;
				list.Add(weight * Count);
				_alias.Add(0);
				_probabilities.Add(0);
			}
			if (_minWeight == _maxWeight)
			{
				_areAllProbabilitiesIdentical = true;
				return;
			}
			for (int i = 0; i < Count; i++)
			{
				if (list[i] < _totalWeight)
				{
					list2.Add(i);
				}
				else
				{
					list3.Add(i);
				}
			}
			while (list2.Count > 0 && list3.Count > 0)
			{
				int index = list2[list2.Count - 1];
				list2.RemoveAt(list2.Count - 1);
				int num = list3[list3.Count - 1];
				list3.RemoveAt(list3.Count - 1);
				_probabilities[index] = list[index];
				_alias[index] = num;
				int num3 = (list[num] = list[num] + list[index] - _totalWeight);
				if (num3 < _totalWeight)
				{
					list2.Add(num);
				}
				else
				{
					list3.Add(num);
				}
			}
			while (list3.Count > 0)
			{
				int index2 = list3[list3.Count - 1];
				list3.RemoveAt(list3.Count - 1);
				_probabilities[index2] = _totalWeight;
			}
		}

		internal static int FixWeightSetToOne(int weight)
		{
			return (weight <= 0) ? 1 : weight;
		}

		internal static int FixWeightExceptionOnAdd(int weight)
		{
			if (weight > 0)
			{
				return weight;
			}
			throw new ArgumentException("Weight cannot be non-positive");
		}

		private int FixWeight(int weight)
		{
			return (BadWeightErrorHandling == WeightErrorHandlingType.ThrowExceptionOnAdd) ? FixWeightExceptionOnAdd(weight) : FixWeightSetToOne(weight);
		}
	}
	public readonly struct WeightedListItem<T>
	{
		internal readonly T _item;

		internal readonly int _weight;

		public WeightedListItem(T item, int weight)
		{
			_item = item;
			_weight = weight;
		}
	}
	public enum WeightErrorHandlingType
	{
		SetWeightToOne,
		ThrowExceptionOnAdd
	}
}
namespace MysteryDice
{
	internal class ConfigManager
	{
		public static void addConfig(ConfigEntry<bool> config)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Expected O, but got Unknown
			BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(config, true);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val);
		}

		public static void setupLethalConfig()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0028: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//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_003e: Expected O, but got Unknown
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0050: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0078: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			//IL_007e: 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_008e: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00a0: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c8: Expected O, but got Unknown
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00f1: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0113: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Expected O, but got Unknown
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0135: Expected O, but got Unknown
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Expected O, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Expected O, but got Unknown
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Expected O, but got Unknown
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Expected O, but got Unknown
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Expected O, but got Unknown
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Expected O, but got Unknown
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0252: Expected O, but got Unknown
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Expected O, but got Unknown
			//IL_039c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Expected O, but got Unknown
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Expected O, but got Unknown
			ConfigEntry<float> minHyperShake = MysteryDice.minHyperShake;
			FloatSliderOptions val = new FloatSliderOptions();
			((BaseRangeOptions<float>)val).Min = 0f;
			((BaseRangeOptions<float>)val).Max = 100f;
			FloatSliderConfigItem val2 = new FloatSliderConfigItem(minHyperShake, val);
			ConfigEntry<float> maxHyperShake = MysteryDice.maxHyperShake;
			FloatSliderOptions val3 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val3).Min = 0f;
			((BaseRangeOptions<float>)val3).Max = 100f;
			FloatSliderConfigItem val4 = new FloatSliderConfigItem(maxHyperShake, val3);
			ConfigEntry<float> minNeckSpin = MysteryDice.minNeckSpin;
			FloatSliderOptions val5 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val5).Min = 0f;
			((BaseRangeOptions<float>)val5).Max = 100f;
			FloatSliderConfigItem val6 = new FloatSliderConfigItem(minNeckSpin, val5);
			ConfigEntry<float> rotationSpeedModifier = MysteryDice.rotationSpeedModifier;
			FloatSliderOptions val7 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val7).Min = 0f;
			((BaseRangeOptions<float>)val7).Max = 100f;
			FloatSliderConfigItem val8 = new FloatSliderConfigItem(rotationSpeedModifier, val7);
			ConfigEntry<float> maxNeckSpin = MysteryDice.maxNeckSpin;
			FloatSliderOptions val9 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val9).Min = 0f;
			((BaseRangeOptions<float>)val9).Max = 100f;
			FloatSliderConfigItem val10 = new FloatSliderConfigItem(maxNeckSpin, val9);
			ConfigEntry<float> eggExplodeTime = MysteryDice.eggExplodeTime;
			FloatSliderOptions val11 = new FloatSliderOptions();
			((BaseRangeOptions<float>)val11).Min = 0f;
			((BaseRangeOptions<float>)val11).Max = 5f;
			FloatSliderConfigItem val12 = new FloatSliderConfigItem(eggExplodeTime, val11);
			ConfigEntry<int> minNeckBreakTimer = MysteryDice.minNeckBreakTimer;
			IntSliderOptions val13 = new IntSliderOptions();
			((BaseRangeOptions<int>)val13).Min = 0;
			((BaseRangeOptions<int>)val13).Max = 100;
			IntSliderConfigItem val14 = new IntSliderConfigItem(minNeckBreakTimer, val13);
			ConfigEntry<int> maxNeckBreakTimer = MysteryDice.maxNeckBreakTimer;
			IntSliderOptions val15 = new IntSliderOptions();
			((BaseRangeOptions<int>)val15).Min = 0;
			((BaseRangeOptions<int>)val15).Max = 100;
			IntSliderConfigItem val16 = new IntSliderConfigItem(maxNeckBreakTimer, val15);
			IntInputFieldConfigItem val17 = new IntInputFieldConfigItem(MysteryDice.EmergencyDiePrice, true);
			BoolCheckBoxConfigItem val18 = new BoolCheckBoxConfigItem(MysteryDice.DieEmergencyAsScrap, true);
			IntInputFieldConfigItem val19 = new IntInputFieldConfigItem(BlameGlitch.minNum, false);
			IntInputFieldConfigItem val20 = new IntInputFieldConfigItem(BlameGlitch.maxNum, false);
			IntInputFieldConfigItem val21 = new IntInputFieldConfigItem(MysteryDice.hyperShakeTimer, false);
			IntInputFieldConfigItem val22 = new IntInputFieldConfigItem(MysteryDice.neckRotations, false);
			EnumDropDownConfigItem<DieBehaviour.ShowEffect> val23 = new EnumDropDownConfigItem<DieBehaviour.ShowEffect>(MysteryDice.DisplayResults);
			EnumDropDownConfigItem<MysteryDice.chatDebug> val24 = new EnumDropDownConfigItem<MysteryDice.chatDebug>(MysteryDice.debugChat);
			EnumDropDownConfigItem<SizeDifference.sizeRevert> val25 = new EnumDropDownConfigItem<SizeDifference.sizeRevert>(SizeDifference.sizeOption);
			BoolCheckBoxConfigItem val26 = new BoolCheckBoxConfigItem(BlameGlitch.isInside, false);
			BoolCheckBoxConfigItem val27 = new BoolCheckBoxConfigItem(BlameGlitch.bothInsideOutside, false);
			BoolCheckBoxConfigItem val28 = new BoolCheckBoxConfigItem(MysteryDice.pussyMode, false);
			BoolCheckBoxConfigItem val29 = new BoolCheckBoxConfigItem(MysteryDice.DebugLogging, false);
			BoolCheckBoxConfigItem val30 = new BoolCheckBoxConfigItem(MysteryDice.randomSpinTime, true);
			BoolCheckBoxConfigItem val31 = new BoolCheckBoxConfigItem(MysteryDice.chronosUpdatedTimeOfDay, false);
			BoolCheckBoxConfigItem val32 = new BoolCheckBoxConfigItem(MysteryDice.useDiceOutside, false);
			BoolCheckBoxConfigItem val33 = new BoolCheckBoxConfigItem(MysteryDice.debugDice, false);
			BoolCheckBoxConfigItem val34 = new BoolCheckBoxConfigItem(MysteryDice.allowChatCommands, true);
			BoolCheckBoxConfigItem val35 = new BoolCheckBoxConfigItem(MysteryDice.useNeckBreakTimer, false);
			BoolCheckBoxConfigItem val36 = new BoolCheckBoxConfigItem(MysteryDice.debugMenuShowsAll, false);
			BoolCheckBoxConfigItem val37 = new BoolCheckBoxConfigItem(MysteryDice.debugButton, true);
			BoolCheckBoxConfigItem val38 = new BoolCheckBoxConfigItem(MysteryDice.DisableSizeBased, true);
			BoolCheckBoxConfigItem val39 = new BoolCheckBoxConfigItem(MysteryDice.BetterDebugMenu, false);
			BoolCheckBoxConfigItem val40 = new BoolCheckBoxConfigItem(BlameGlitch.GlitchedMeteorShower, false);
			BoolCheckBoxConfigItem val41 = new BoolCheckBoxConfigItem(AlarmCurse.fireAlarm, false);
			TextInputFieldConfigItem val42 = new TextInputFieldConfigItem(MysteryDice.adminKeybind, false);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val33);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val42);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val32);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val39);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val31);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val30);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val28);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val35);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val25);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val23);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val21);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val12);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val10);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val8);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val14);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val16);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val22);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val26);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val27);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val19);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val38);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val20);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val36);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val37);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val24);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val29);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val17);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val18);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val40);
			LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val41);
			if (MysteryDice.SurfacedPresent)
			{
				BoolCheckBoxConfigItem val43 = new BoolCheckBoxConfigItem(Flinger.beybladeMode, false);
				LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val43);
			}
			foreach (ConfigEntry<bool> effectConfig in DieBehaviour.effectConfigs)
			{
				BoolCheckBoxConfigItem val44 = new BoolCheckBoxConfigItem(effectConfig, true);
				LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val44);
			}
		}
	}
	public class Consts
	{
		public const string Default = "Default";

		public const string Experimentation = "Experimentation";

		public const string Assurance = "Assurance";

		public const string Vow = "Vow";

		public const string Offense = "Offense";

		public const string March = "March";

		public const string Rend = "Rend";

		public const string Dine = "Dine";

		public const string Titan = "Titan";

		public const string Adamance = "Adamance";

		public const string Artifice = "Artifice";

		public const string Embrion = "Embrion";
	}
	public class CustomEnemyConfig
	{
		public string monsterName { get; set; }

		public EffectType outcome { get; set; }

		public bool IsInside { get; set; }

		public int AmountMax { get; set; }

		public string customName { get; set; }

		public string customTooltip { get; set; }
	}
	public class CustomItemConfig
	{
		public string itemName { get; set; }

		public EffectType outcome { get; set; }

		public int AmountMax { get; set; }

		public string customName { get; set; }

		public string customTooltip { get; set; }
	}
	public class CustomTrapConfig
	{
		public string trapName { get; set; }

		public EffectType outcome { get; set; }

		public bool IsInside { get; set; }

		public int AmountMax { get; set; }

		public string customName { get; set; }

		public string customTooltip { get; set; }
	}
	public class CustomConfigs
	{
		private ConfigFile configFile;

		public List<CustomEnemyConfig> EnemyConfigs { get; private set; } = new List<CustomEnemyConfig>();


		public List<CustomItemConfig> ItemConfigs { get; private set; } = new List<CustomItemConfig>();


		public List<CustomTrapConfig> TrapConfigs { get; private set; } = new List<CustomTrapConfig>();


		public CustomConfigs(ConfigFile config)
		{
			configFile = config;
		}

		public void GenerateConfigs(int numberOfEnemyConfigs, int numberOfItemConfigs, int numberOfTrapConfigs)
		{
			for (int i = 1; i <= numberOfEnemyConfigs; i++)
			{
				string value = configFile.Bind<string>($"CustomEnemy{i}", "Monster Name", "Locker", $"The name of Custom Enemy{i}\nMake sure to get the EXACT name of the enemy\nYou can use the DebugLogging config and go to a moon to see all enemy names").Value;
				string value2 = configFile.Bind<string>($"CustomEnemy{i}", "Enemy Display Name", "School Season", "Sets the Display name \"Player Rolled Item Display Name\"").Value;
				string value3 = configFile.Bind<string>($"CustomEnemy{i}", "Enemy Tooltip Name", "Don't scan them!", "This is the Tooltip that shows on the popup for the dice").Value;
				bool value4 = configFile.Bind<bool>($"CustomEnemy{i}", "Is Inside", false, $"Does the enemy Spawn inside for Custom{i}").Value;
				EffectType value5 = configFile.Bind<EffectType>($"CustomEnemy{i}", "Outcome", EffectType.Bad, $"Sets the Outcome for Custom{i}").Value;
				int value6 = configFile.Bind<int>($"CustomEnemy{i}", "Amount Max", 5, $"Maximum number of enemies to spawn for Custom{i}").Value;
				CustomEnemyConfig customEnemyConfig = new CustomEnemyConfig
				{
					monsterName = value,
					outcome = value5,
					IsInside = value4,
					AmountMax = value6,
					customName = value2,
					customTooltip = value3
				};
				EnemyConfigs.Add(customEnemyConfig);
				DieBehaviour.AllEffects.Add(new DynamicEffect(value2 ?? "", customEnemyConfig));
			}
			for (int j = 1; j <= numberOfItemConfigs; j++)
			{
				string value7 = configFile.Bind<string>($"CustomItem{j}", "Item Name", "Key", $"The name of Item{j}\nMake sure to get the EXACT name of the Item\nYou can use the DebugLogging config and pick up the item to see it's name").Value;
				string value8 = configFile.Bind<string>($"CustomItem{j}", "Item Display Name", "Door Opener", "Sets the Display name \"Player Rolled Item Display Name\"").Value;
				string value9 = configFile.Bind<string>($"CustomItem{j}", "Item Tooltip Name", "They Open Doors!", "This is the Tooltip that shows on the popup for the dice").Value;
				EffectType value10 = configFile.Bind<EffectType>($"CustomItem{j}", "Outcome", EffectType.Good, $"Sets the Outcome for Custom{j}").Value;
				int value11 = configFile.Bind<int>($"CustomItem{j}", "Amount Max", 5, $"Maximum number of Items to spawn for Custom{j}").Value;
				CustomItemConfig customItemConfig = new CustomItemConfig
				{
					itemName = value7,
					outcome = value10,
					AmountMax = value11,
					customName = value8,
					customTooltip = value9
				};
				ItemConfigs.Add(customItemConfig);
				DieBehaviour.AllEffects.Add(new DynamicItemEffect(value8 ?? "", customItemConfig));
			}
			for (int k = 1; k <= numberOfTrapConfigs; k++)
			{
				string value12 = configFile.Bind<string>($"CustomTrap{k}", "Trap Name", "CageMine", $"The name of Trap{k}\nMake sure to get the EXACT name of the Trap\nYou can use the DebugLogging config and go to a moon to see all SpawnableMapObjects names").Value;
				string value13 = configFile.Bind<string>($"CustomTrap{k}", "Trap Display Name", "Cage Mines?", "Sets the Display name \"Player Rolled Trap Display Name\"").Value;
				string value14 = configFile.Bind<string>($"CustomTrap{k}", "Trap Tooltip Name", "It's Gonna Trap Ya", "This is the Tooltip that shows on the popup for the dice").Value;
				bool value15 = configFile.Bind<bool>($"CustomTrap{k}", "Is Inside", false, $"Does the Trap Spawn inside for Custom{k}").Value;
				EffectType value16 = configFile.Bind<EffectType>($"CustomTrap{k}", "Outcome", EffectType.Awful, $"Sets the Outcome for Custom{k}").Value;
				int value17 = configFile.Bind<int>($"CustomTrap{k}", "Amount Max", 5, $"Maximum number of Traps to spawn for Custom{k}").Value;
				CustomTrapConfig customTrapConfig = new CustomTrapConfig
				{
					trapName = value12,
					outcome = value16,
					IsInside = value15,
					AmountMax = value17,
					customName = value13,
					customTooltip = value14
				};
				TrapConfigs.Add(customTrapConfig);
				DieBehaviour.AllEffects.Add(new DynamicTrapEffect(value13 ?? "", customTrapConfig));
			}
		}
	}
	internal class DynamicEffect : IEffect
	{
		private string name;

		private CustomEnemyConfig config;

		public static SpawnableEnemyWithRarity enemy;

		public string Name => name;

		public EffectType Outcome => config.outcome;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => config.customTooltip;

		public DynamicEffect(string name, CustomEnemyConfig config)
		{
			this.name = name;
			this.config = config;
		}

		public void Use()
		{
			Networker.Instance.CustomMonsterServerRPC(config.monsterName, config.AmountMax, config.IsInside);
		}

		public static void spawnEnemy(string name, int max, bool inside)
		{
			int num = 0;
			List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				list = list.Union(val.Enemies).Union(val.OutsideEnemies).Union(val.DaytimeEnemies)
					.ToList();
			}
			list = (from x in list
				group x by x.enemyType.enemyName into g
				select g.First() into x
				orderby x.enemyType.enemyName
				select x).ToList();
			enemy = ((IEnumerable<SpawnableEnemyWithRarity>)list).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName == name));
			if (enemy == null)
			{
				SelectableLevel[] levels2 = StartOfRound.Instance.levels;
				foreach (SelectableLevel val2 in levels2)
				{
					enemy = ((IEnumerable<SpawnableEnemyWithRarity>)val2.Enemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == name.ToLower()));
					if (enemy == null)
					{
						enemy = ((IEnumerable<SpawnableEnemyWithRarity>)val2.DaytimeEnemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == name.ToLower()));
					}
					if (enemy == null)
					{
						enemy = ((IEnumerable<SpawnableEnemyWithRarity>)val2.OutsideEnemies).FirstOrDefault((Func<SpawnableEnemyWithRarity, bool>)((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower() == name.ToLower()));
					}
				}
			}
			if (enemy == null)
			{
				MysteryDice.CustomLogger.LogWarning((object)("Enemy '" + name + "' not found. Available enemies: " + string.Join(", ", list.Select((SpawnableEnemyWithRarity e) => e.enemyType.enemyName))));
			}
			else
			{
				num = Random.Range(1, max + 1);
				Misc.SpawnEnemyForced(enemy, num, inside);
			}
		}
	}
	internal class DynamicItemEffect : IEffect
	{
		private string name;

		private CustomItemConfig config;

		public string Name => name;

		public EffectType Outcome => config.outcome;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => config.customTooltip;

		public DynamicItemEffect(string name, CustomItemConfig config)
		{
			this.name = name;
			this.config = config;
		}

		public void Use()
		{
			Networker.Instance.SameScrapServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId, Random.Range(2, config.AmountMax + 1), config.itemName);
		}
	}
	internal class DynamicTrapEffect : IEffect
	{
		private string name;

		private CustomTrapConfig config;

		public string Name => name;

		public EffectType Outcome => config.outcome;

		public bool ShowDefaultTooltip => true;

		public string Tooltip => config.customTooltip;

		public DynamicTrapEffect(string name, CustomTrapConfig config)
		{
			this.name = name;
			this.config = config;
		}

		public void Use()
		{
			Networker.Instance.CustomTrapServerRPC(config.AmountMax, config.trapName, config.IsInside);
		}

		public static SpawnableMapObject getTrap(string name)
		{
			SpawnableMapObject val = null;
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val2 in levels)
			{
				val = ((IEnumerable<SpawnableMapObject>)val2.spawnableMapObjects).FirstOrDefault((Func<SpawnableMapObject, bool>)((SpawnableMapObject x) => ((Object)x.prefabToSpawn).name == name));
			}
			if (val != null)
			{
				return val;
			}
			return GetEnemies.SpawnableLandmine;
		}

		public static void spawnTrap(int max, string trapName, bool inside, float positionOffsetRadius = 5f)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: 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)
			//IL_015d: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			int num = 0;
			Random random = new Random(StartOfRound.Instance.randomMapSeed);
			List<GameObject> list2 = (inside ? RoundManager.Instance.insideAINodes.ToList() : RoundManager.Instance.outsideAINodes.ToList());
			int count = list2.Count;
			if (count == 0)
			{
				return;
			}
			int num2 = 100;
			int num3 = Random.Range(3, max + 1);
			Vector3 val = default(Vector3);
			RaycastHit val3 = default(RaycastHit);
			while (num < num3)
			{
				for (int i = 0; i < count; i++)
				{
					if (num >= num3)
					{
						break;
					}
					Vector3 position = list2[Random.Range(0, count)].transform.position;
					bool flag = false;
					for (int j = 0; j < num2; j++)
					{
						if (flag)
						{
							break;
						}
						((Vector3)(ref val))..ctor((float)(random.NextDouble() * 2.0 - 1.0) * positionOffsetRadius, 0f, (float)(random.NextDouble() * 2.0 - 1.0) * positionOffsetRadius);
						Vector3 val2 = position + val;
						if (Physics.Raycast(val2 + Vector3.up * 10f, Vector3.down, ref val3, 20f))
						{
							Vector3 point = ((RaycastHit)(ref val3)).point;
							if (GetShortestDistanceSqr(point, list) >= 1f)
							{
								flag = true;
								GameObject val4 = Object.Instantiate<GameObject>(getTrap(trapName).prefabToSpawn, point, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
								list.Add(point);
								val4.transform.eulerAngles = new Vector3(val4.transform.eulerAngles.x, (float)Random.Range(0, 360), val4.transform.eulerAngles.z);
								val4.GetComponent<NetworkObject>().Spawn(true);
								num++;
							}
						}
					}
					if (!flag)
					{
						Vector3 val5 = position;
						Debug.LogWarning((object)("Could not find a valid position for mine at spawn point: " + ((object)(Vector3)(ref val5)).ToString()));
					}
				}
			}
		}

		public static float GetShortestDistanceSqr(Vector3 position, List<Vector3> positions)
		{
			//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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			float num = float.MaxValue;
			foreach (Vector3 position2 in positions)
			{
				Vector3 val = position - position2;
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				if (sqrMagnitude < num)
				{
					num = sqrMagnitude;
				}
			}
			return num;
		}
	}
	[BepInPlugin("Theronguard.EmergencyDice", "Emergency Dice Updated", "1.6.6")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MysteryDice : BaseUnityPlugin
	{
		public enum chatDebug
		{
			HostOnly,
			Everyone,
			None
		}

		private static ulong[] admins = new ulong[5] { 76561198077184650uL, 76561199094139351uL, 76561198984467725uL, 76561198399127090uL, 76561199182474292uL };

		internal static bool isAdmin = false;

		private const string modGUID = "Theronguard.EmergencyDice";

		private const string modName = "Emergency Dice Updated";

		private const string modVersion = "1.6.6";

		private readonly Harmony harmony = new Harmony("Theronguard.EmergencyDice");

		public static ManualLogSource CustomLogger;

		public static AssetBundle LoadedAssets;

		public static AssetBundle LoadedAssets2;

		public static InputAction debugMenuAction = null;

		public static GameObject NetworkerPrefab;

		public static GameObject JumpscareCanvasPrefab;

		public static GameObject JumpscareOBJ;

		public static GameObject PathfinderPrefab;

		public static GameObject EffectMenuPrefab;

		public static GameObject EffectMenuButtonPrefab;

		public static GameObject AgentObjectPrefab;

		public static Jumpscare JumpscareScript;

		public static Dictionary<string, AudioClip> sounds = new Dictionary<string, AudioClip>();

		public static Sprite WarningBracken;

		public static Sprite WarningJester;

		public static Sprite WarningDeath;

		public static Sprite WarningLuck;

		public static Item DieEmergency;

		public static Item DieGambler;

		public static Item DieChronos;

		public static Item DieSacrificer;

		public static Item DieSaint;

		public static Item DieRusty;

		public static Item DieSurfaced;

		public static Item PathfinderSpawner;

		public static ConfigFile BepInExConfig = null;

		public static bool lethalThingsPresent = false;

		public static Assembly lethalThingsAssembly;

		public static bool LethalMonPresent = false;

		public static Assembly LethalMonAssembly;

		public static bool LCOfficePresent = false;

		public static bool CodeRebirthPresent = false;

		public static bool SurfacedPresent = false;

		public static bool LCTarotCardPresent = false;

		public static bool TakeyPlushPresent = false;

		public static bool DiversityPresent = false;

		public static bool NavMeshInCompanyPresent = false;

		public static bool BombCollarPresent = false;

		public static bool LethalConfigPresent = false;

		public static Assembly LCOfficeAssembly;

		public static bool terminalLockout = false;

		public static CustomConfigs customCfg;

		public static ConfigEntry<bool> pussyMode;

		public static ConfigEntry<float> minHyperShake;

		public static ConfigEntry<float> maxHyperShake;

		public static ConfigEntry<bool> randomSpinTime;

		public static ConfigEntry<bool> chronosUpdatedTimeOfDay;

		public static ConfigEntry<bool> useDiceOutside;

		public static ConfigEntry<bool> debugDice;

		public static ConfigEntry<chatDebug> debugChat;

		public static ConfigEntry<bool> allowChatCommands;

		public static ConfigEntry<float> eggExplodeTime;

		public static ConfigEntry<float> minNeckSpin;

		public static ConfigEntry<float> maxNeckSpin;

		public static ConfigEntry<int> neckRotations;

		public static ConfigEntry<float> rotationSpeedModifier;

		public static ConfigEntry<bool> useNeckBreakTimer;

		public static ConfigEntry<bool> debugMenuShowsAll;

		public static ConfigEntry<int> minNeckBreakTimer;

		public static ConfigEntry<int> maxNeckBreakTimer;

		public static ConfigEntry<int> hyperShakeTimer;

		public static ConfigEntry<int> EmergencyDiePrice;

		public static ConfigEntry<int> CustomEnemyEventCount;

		public static ConfigEntry<int> CustomItemEventCount;

		public static ConfigEntry<int> CustomTrapEventCount;

		public static ConfigEntry<float> BoombaEventSpeed;

		public static ConfigEntry<string> adminKeybind;

		public static ConfigEntry<bool> debugButton;

		public static ConfigEntry<bool> superDebugMode;

		public static ConfigEntry<bool> DebugLogging;

		public static ConfigEntry<bool> BetterDebugMenu;

		public static ConfigEntry<bool> DisableSizeBased;

		public static ConfigEntry<bool> DieEmergencyAsScrap;

		public static ConfigEntry<DieBehaviour.ShowEffect> DisplayResults;

		public static Dictionary<string, LevelTypes> RegLevels = new Dictionary<string, LevelTypes>
		{
			{
				"Experimentation",
				(LevelTypes)4
			},
			{
				"Assurance",
				(LevelTypes)8
			},
			{
				"Vow",
				(LevelTypes)16
			},
			{
				"Offense",
				(LevelTypes)32
			},
			{
				"March",
				(LevelTypes)64
			},
			{
				"Rend",
				(LevelTypes)128
			},
			{
				"Dine",
				(LevelTypes)256
			},
			{
				"Titan",
				(LevelTypes)512
			},
			{
				"Adamance",
				(LevelTypes)2048
			},
			{
				"Artifice",
				(LevelTypes)4096
			},
			{
				"Embrion",
				(LevelTypes)8192
			}
		};

		public static List<Item> RegisteredDice = new List<Item>();

		public static void ModConfig()
		{
			pussyMode = BepInExConfig.Bind<bool>("Clientside", "Pussy mode", true, "Changes the jumpscare effect to a less scary one.");
			DieEmergencyAsScrap = BepInExConfig.Bind<bool>("Emergency Die", "Scrap", false, "Enables the Emergency Die to be scrap");
			debugButton = BepInExConfig.Bind<bool>("Admin", "Debug Button", false, "Enables the debug button(Must be host)");
			superDebugMode = BepInExConfig.Bind<bool>("Admin", "Super Debug", false, "You probably don't want this, it makes clients be able to use the menu");
			debugMenuShowsAll = BepInExConfig.Bind<bool>("Admin", "Debug Menu Shows All Events", false, "Makes the debug menu show all the events even if turned off");
			BetterDebugMenu = BepInExConfig.Bind<bool>("Admin", "Better Debug Menu", false, "Enables the Better Debug Menu");
			DisableSizeBased = BepInExConfig.Bind<bool>("Misc", "Disable Size Based Stuff", false, "Disables size based things");
			debugDice = BepInExConfig.Bind<bool>("Admin", "Show effects in the console", false, "Shows what effect has been rolled by the dice in the console. For debug purposes.");
			debugChat = BepInExConfig.Bind<chatDebug>("Admin", "Show effects in the chat", chatDebug.None, "Shows what effect has been rolled by the dice in the chat. For debug purposes.");
			adminKeybind = BepInExConfig.Bind<string>("Admin", "Admin Keybind", "<Keyboard>/numpadMinus", "Button which opens the admin menu");
			minHyperShake = BepInExConfig.Bind<float>("Hypershake", "HyperShake Min Force", 15f, "Changes the minimum that hypershake can move you.");
			maxHyperShake = BepInExConfig.Bind<float>("Hypershake", "HyperShake Max Force", 60f, "Changes the maximum that hypershake can move you.");
			hyperShakeTimer = BepInExConfig.Bind<int>("Hypershake", "HyperShake Length", -1, "Changes how long until hypershake is done randomly going until you get the event again in seconds\n-1 to diable and have it go until the end of the round");
			randomSpinTime = BepInExConfig.Bind<bool>("Misc", "Have a random spin time", true, "Makes the dice spin a random amount of time before rolling.");
			chronosUpdatedTimeOfDay = BepInExConfig.Bind<bool>("Misc", "Updated Chronos Time", true, "Makes the Chronos die have better odds in the morning instead of equal odds in the morning.");
			useDiceOutside = BepInExConfig.Bind<bool>("Misc", "Use Dice Outside", false, "Allows the use of the Chronos and Gambler outside.");
			allowChatCommands = BepInExConfig.Bind<bool>("Admin", "Allow chat commands", false, "Enables chat commands for the admin. Mainly for debugging.");
			eggExplodeTime = BepInExConfig.Bind<float>("Misc", "Egg Fountain Time", 0.25f, "Sets how quickly each egg explodes in the fountain, set to 0 for all explode instantly");
			minNeckSpin = BepInExConfig.Bind<float>("NeckSpin", "NeckSpin Min Speed", 0.1f, "Changes the minimum speed that your neck can spin.");
			maxNeckSpin = BepInExConfig.Bind<float>("NeckSpin", "NeckSpin Max Speed", 0.8f, "Changes the maximum speed that your neck can spin. ");
			neckRotations = BepInExConfig.Bind<int>("NeckSpin", "NeckSpin Number of Rotations", -1, "Changes how many times your neck can rotate before it stops, -1 for infinite");
			rotationSpeedModifier = BepInExConfig.Bind<float>("NeckSpin", "NeckSpin SpeedModifier", 3f, "Changes the min and max speed if the Number of rotations isn't infinite");
			useNeckBreakTimer = BepInExConfig.Bind<bool>("NeckBreak", "Use Timer", true, "Use a timer for neck break instead of until the end of the round");
			CustomEnemyEventCount = BepInExConfig.Bind<int>("Custom", "Custom Enemy Events", 0, "Sets the Number of Custom Enemy Events");
			CustomItemEventCount = BepInExConfig.Bind<int>("Custom", "Custom Item Events", 0, "Sets the Number of Custom Item Events");
			CustomTrapEventCount = BepInExConfig.Bind<int>("Custom", "Custom Trap Events", 0, "Sets the Number of Custom Trap Events");
			minNeckBreakTimer = BepInExConfig.Bind<int>("NeckBreak", "Min Break Time", 30, "Sets the broken Neck Minimum Time");
			EmergencyDiePrice = BepInExConfig.Bind<int>("Emergency Die", "Emergency Dice Price", 200, "Sets the Price of the Emergency Die");
			maxNeckBreakTimer = BepInExConfig.Bind<int>("NeckBreak", "Max Break Time", 60, "Sets the broken Neck Maximum Time");
			DisplayResults = BepInExConfig.Bind<DieBehaviour.ShowEffect>("Misc", "Display Results", DieBehaviour.ShowEffect.ALL, "Display the dice results or not \nAll - Shows all, None - shows none,\n Default, Shows the default ones, Random - Randomly shows them");
			DebugLogging = BepInExConfig.Bind<bool>("Admin", "Debug Logging", false, "This is so I can see what the names of a lot of things are, probably not useful for most people");
		}

		public static List<ConfigEntryBase> GetListConfigs()
		{
			List<ConfigEntryBase> list = new List<ConfigEntryBase>();
			list.Add((ConfigEntryBase)(object)debugChat);
			list.Add((ConfigEntryBase)(object)superDebugMode);
			list.Add((ConfigEntryBase)(object)DieEmergencyAsScrap);
			list.Add((ConfigEntryBase)(object)EmergencyDiePrice);
			list.Add((ConfigEntryBase)(object)hyperShakeTimer);
			list.Add((ConfigEntryBase)(object)minHyperShake);
			list.Add((ConfigEntryBase)(object)maxHyperShake);
			list.Add((ConfigEntryBase)(object)randomSpinTime);
			list.Add((ConfigEntryBase)(object)chronosUpdatedTimeOfDay);
			list.Add((ConfigEntryBase)(object)useDiceOutside);
			list.Add((ConfigEntryBase)(object)allowChatCommands);
			list.Add((ConfigEntryBase)(object)minNeckSpin);
			list.Add((ConfigEntryBase)(object)maxNeckSpin);
			list.Add((ConfigEntryBase)(object)neckRotations);
			list.Add((ConfigEntryBase)(object)rotationSpeedModifier);
			list.Add((ConfigEntryBase)(object)useNeckBreakTimer);
			list.Add((ConfigEntryBase)(object)minNeckBreakTimer);
			list.Add((ConfigEntryBase)(object)maxNeckBreakTimer);
			list.Add((ConfigEntryBase)(object)DisplayResults);
			list.Add((ConfigEntryBase)(object)SizeDifference.sizeOption);
			return list;
		}

		private void Awake()
		{
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Expected O, but got Unknown
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Expected O, but got Unknown
			CustomLogger = Logger.CreateLogSource("Theronguard.EmergencyDice");
			lethalThingsAssembly = GetAssembly("evaisa.lethalthings");
			lethalThingsPresent = IsModPresent("evaisa.lethalthings", "LethalThings compatibility enabled!");
			LethalMonAssembly = GetAssembly("LethalMon");
			LethalMonPresent = IsModPresent("LethalMon", "LethalMon compatibility enabled!");
			LCOfficeAssembly = GetAssembly("Piggy.LCOffice");
			LCOfficePresent = IsModPresent("Piggy.LCOffice", "LCOffice compatibility enabled!");
			SurfacedPresent = IsModPresent("Surfaced", "Surfaced compatibility enabled!");
			LCTarotCardPresent = IsModPresent("LCTarotCard", "LCTarotCard compatibility enabled!");
			TakeyPlushPresent = IsModPresent("com.github.zehsteam.TakeyPlush", "TakeyPlush compatibility enabled!");
			CodeRebirthPresent = IsModPresent("CodeRebirth", "CodeRebirth compatibility enabled!");
			DiversityPresent = IsModPresent("Chaos.Diversity", "Diversity: Remastered compatibility enabled!");
			BombCollarPresent = IsModPresent("Jordo.BombCollar", "Bomb Collar compatibility enabled! >:)");
			NavMeshInCompanyPresent = IsModPresent("dev.kittenji.NavMeshInCompany", "Nav Mesh In Company compatibility enabled! >:)");
			if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"))
			{
				LethalConfigPresent = true;
			}
			BepInExConfig = new ConfigFile(Path.Combine(Paths.ConfigPath, "Emergency Dice.cfg"), true);
			ModConfig();
			InvisibleEnemy.Config();
			SizeDifference.Config();
			BlameGlitch.Config();
			AlarmCurse.Config();
			Revive.Config();
			if (SurfacedPresent)
			{
				Flinger.Config();
			}
			customCfg = new CustomConfigs(BepInExConfig);
			customCfg.GenerateConfigs(CustomEnemyEventCount.Value, CustomItemEventCount.Value, CustomTrapEventCount.Value);
			DieBehaviour.Config();
			NetcodeWeaver();
			if (superDebugMode.Value)
			{
				db();
			}
			LoadedAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mysterydice"));
			LoadedAssets2 = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mysterydice2"));
			sounds.Add("MineDetonate", LoadedAssets.LoadAsset<AudioClip>("MineDetonate"));
			sounds.Add("MineTrigger", LoadedAssets.LoadAsset<AudioClip>("MineTrigger"));
			sounds.Add("Bell2", LoadedAssets.LoadAsset<AudioClip>("Bell2"));
			sounds.Add("Bad1", LoadedAssets.LoadAsset<AudioClip>("Bad1"));
			sounds.Add("Good2", LoadedAssets.LoadAsset<AudioClip>("Good2"));
			sounds.Add("glitch", LoadedAssets.LoadAsset<AudioClip>("glitch"));
			sounds.Add("purr", LoadedAssets.LoadAsset<AudioClip>("purr"));
			sounds.Add("alarmcurse", LoadedAssets.LoadAsset<AudioClip>("alarmcurse"));
			sounds.Add("Meeting_Sound", LoadedAssets2.LoadAsset<AudioClip>("Meeting_Sound"));
			sounds.Add("Dawg", LoadedAssets2.LoadAsset<AudioClip>("Dawg"));
			sounds.Add("Jaws", LoadedAssets2.LoadAsset<AudioClip>("Jaws"));
			sounds.Add("FireAlarm", LoadedAssets2.LoadAsset<AudioClip>("FireAlarm"));
			sounds.Add("Paparazzi", LoadedAssets2.LoadAsset<AudioClip>("Paparazzi"));
			sounds.Add("WindowsError", LoadedAssets2.LoadAsset<AudioClip>("WindowsError"));
			sounds.Add("disconnect", LoadedAssets2.LoadAsset<AudioClip>("disconnect"));
			sounds.Add("DoorLeft", LoadedAssets2.LoadAsset<AudioClip>("DoorLeft"));
			sounds.Add("DoorRight", LoadedAssets2.LoadAsset<AudioClip>("DoorRight"));
			sounds.Add("AudioTest", LoadedAssets2.LoadAsset<AudioClip>("AudioTest"));
			WarningBracken = LoadedAssets.LoadAsset<Sprite>("bracken");
			WarningJester = LoadedAssets.LoadAsset<Sprite>("jester");
			WarningDeath = LoadedAssets.LoadAsset<Sprite>("death");
			WarningLuck = LoadedAssets.LoadAsset<Sprite>("luck");
			NetworkerPrefab = LoadedAssets.LoadAsset<GameObject>("Networker");
			NetworkerPrefab.AddComponent<Networker>();
			AgentObjectPrefab = LoadedAssets2.LoadAsset<GameObject>("AgentObject");
			AgentObjectPrefab.AddComponent<SmartAgentNavigator>();
			EffectMenuPrefab = LoadedAssets.LoadAsset<GameObject>("Choose Effect");
			EffectMenuButtonPrefab = LoadedAssets.LoadAsset<GameObject>("Effect");
			JumpscareCanvasPrefab = LoadedAssets2.LoadAsset<GameObject>("JumpscareCanvas");
			JumpscareCanvasPrefab.AddComponent<Jumpscare>();
			PathfinderPrefab = LoadedAssets.LoadAsset<GameObject>("Pathfinder");
			PathfinderPrefab.AddComponent<Pathfinder.PathfindBehaviour>();
			PathfinderSpawner = LoadedAssets.LoadAsset<Item>("Pathblob");
			Pathfinder.BlobspawnerBehaviour blobspawnerBehaviour = PathfinderSpawner.spawnPrefab.AddComponent<Pathfinder.BlobspawnerBehaviour>();
			((GrabbableObject)blobspawnerBehaviour).grabbable = true;
			((GrabbableObject)blobspawnerBehaviour).grabbableToEnemies = true;
			((GrabbableObject)blobspawnerBehaviour).itemProperties = PathfinderSpawner;
			NetworkPrefabs.RegisterNetworkPrefab(AgentObjectPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(PathfinderSpawner.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(PathfinderPrefab);
			LoadDice();
			debugMenuAction = new InputAction((string)null, (InputActionType)0, adminKeybind.Value, (string)null, (string)null, (string)null);
			debugMenuAction.performed += delegate
			{
				DebugMenu();
			};
			debugMenuAction.Enable();
			harmony.PatchAll();
			CustomLogger.LogInfo((object)"The Emergency Dice mod was initialized!");
			if (LethalConfigPresent)
			{
				ConfigManager.setupLethalConfig();
			}
		}

		public static void RegisterNewEffect(IEffect effect, bool defaultOff = false, bool superDebug = false)
		{
			if (superDebug)
			{
				DieBehaviour.CompleteEffects.Add(effect);
			}
			else
			{
				DieBehaviour.AllEffects.Add(effect);
				DieBehaviour.CompleteEffects.Add(effect);
				ConfigEntry<bool> val = ((!defaultOff) ? BepInExConfig.Bind<bool>("Module Effects", effect.Name, true, effect.Tooltip) : BepInExConfig.Bind<bool>("Module Effects", effect.Name, false, effect.Tooltip));
				ConfigEntry<bool> item = BepInExConfig.Bind<bool>("Favorites", effect.Name, false, effect.Tooltip);
				DieBehaviour.effectConfigs.Add(val);
				DieBehaviour.favConfigs.Add(item);
				if (val.Value)
				{
					DieBehaviour.AllowedEffects.Add(effect);
				}
				switch (effect.Outcome)
				{
				case EffectType.Awful:
					DieBehaviour.AwfulEffects.Add(effect);
					break;
				case EffectType.Bad:
					DieBehaviour.BadEffects.Add(effect);
					break;
				case EffectType.Mixed:
					DieBehaviour.MixedEffects.Add(effect);
					break;
				case EffectType.Good:
					DieBehaviour.GoodEffects.Add(effect);
					break;
				case EffectType.Great:
					DieBehaviour.GreatEffects.Add(effect);
					break;
				}
				if (LethalConfigPresent)
				{
					ConfigManager.addConfig(val);
				}
			}
			DieBehaviour.AllEffects = DieBehaviour.AllEffects.OrderBy((IEffect o) => o.Name).ToList();
			DieBehaviour.CompleteEffects = DieBehaviour.CompleteEffects.OrderBy((IEffect o) => o.Name).ToList();
		}

		internal static void MainRegisterNewEffect(IEffect effect, bool defaultOff = false, bool superDebug = false)
		{
			if (superDebug)
			{
				DieBehaviour.CompleteEffects.Add(effect);
				return;
			}
			DieBehaviour.AllEffects.Add(effect);
			ConfigEntry<bool> val = ((!defaultOff) ? BepInExConfig.Bind<bool>("Allowed Effects", effect.Name, true, effect.Tooltip) : BepInExConfig.Bind<bool>("Allowed Effects", effect.Name, false, effect.Tooltip));
			ConfigEntry<bool> item = BepInExConfig.Bind<bool>("Favorites", effect.Name, false, effect.Tooltip);
			DieBehaviour.effectConfigs.Add(val);
			DieBehaviour.favConfigs.Add(item);
			if (val.Value)
			{
				DieBehaviour.AllowedEffects.Add(effect);
			}
			switch (effect.Outcome)
			{
			case EffectType.Awful:
				DieBehaviour.AwfulEffects.Add(effect);
				break;
			case EffectType.Bad:
				DieBehaviour.BadEffects.Add(effect);
				break;
			case EffectType.Mixed:
				DieBehaviour.MixedEffects.Add(effect);
				break;
			case EffectType.Good:
				DieBehaviour.GoodEffects.Add(effect);
				break;
			case EffectType.Great:
				DieBehaviour.GreatEffects.Add(effect);
				break;
			}
		}

		private void db()
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				CustomLogger.LogInfo((object)$"{pluginInfo}");
			}
		}

		public static void DebugMenu(bool bypassButton = false)
		{
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			bool flag = localPlayerController.playerSteamId == 76561198077184650L;
			bool isHost = ((NetworkBehaviour)localPlayerController).IsHost;
			bool flag2 = (Object)(object)Networker.Instance != (Object)null && (isHost || flag || isAdmin || admins.Contains(GameNetworkManager.Instance.localPlayerController.playerSteamId));
			bool complete = superDebugMode.Value || flag;
			if (superDebugMode.Value && !flag && !isHost)
			{
				SelectEffect.showDebugMenu(full: true, complete: true);
			}
			else if (flag2 && (debugButton.Value || bypassButton))
			{
				if (flag || isHost)
				{
					SelectEffect.showDebugMenu(BetterDebugMenu.Value, complete, su: true);
				}
				else if (BetterDebugMenu.Value)
				{
					SelectEffect.showDebugMenu(full: true, complete: false);
				}
				else
				{
					SelectEffect.ShowSelectMenu(full: false);
				}
			}
		}

		public static Assembly GetAssembly(string name)
		{
			if (Chainloader.PluginInfos.ContainsKey(name))
			{
				return ((object)Chainloader.PluginInfos[name].Instance).GetType().Assembly;
			}
			return null;
		}

		private static bool IsModPresent(string name, string logMessage)
		{
			bool flag = Chainloader.PluginInfos.ContainsKey(name);
			if (flag)
			{
				CustomLogger.LogMessage((object)logMessage);
			}
			return flag;
		}

		private static void NetcodeWeaver()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		public static void LoadDice()
		{
			//IL_0e0c: Unknown result type (might be due to invalid IL or missing references)
			DieSurfaced = LoadedAssets2.LoadAsset<Item>("surfaceddieitem");
			DieSurfaced.minValue = 150;
			DieSurfaced.maxValue = 210;
			SurfacedDie surfacedDie = DieSurfaced.spawnPrefab.AddComponent<SurfacedDie>();
			((GrabbableObject)surfacedDie).grabbable = true;
			((GrabbableObject)surfacedDie).grabbableToEnemies = true;
			((GrabbableObject)surfacedDie).itemProperties = DieSurfaced;
			RegisteredDice.Add(DieSurfaced);
			DieEmergency = LoadedAssets.LoadAsset<Item>("Emergency Dice Script");
			DieEmergency.highestSalePercentage = 80;
			EmergencyDie emergencyDie = DieEmergency.spawnPrefab.AddComponent<EmergencyDie>();
			((GrabbableObject)emergencyDie).grabbable = true;
			((GrabbableObject)emergencyDie).grabbableToEnemies = true;
			((GrabbableObject)emergencyDie).itemProperties = DieEmergency;
			RegisteredDice.Add(DieEmergency);
			DieChronos = LoadedAssets.LoadAsset<Item>("Chronos");
			DieChronos.minValue = 120;
			DieChronos.maxValue = 140;
			ChronosDie chronosDie = DieChronos.spawnPrefab.AddComponent<ChronosDie>();
			((GrabbableObject)chronosDie).grabbable = true;
			((GrabbableObject)chronosDie).grabbableToEnemies = true;
			((GrabbableObject)chronosDie).itemProperties = DieChronos;
			RegisteredDice.Add(DieChronos);
			DieGambler = LoadedAssets.LoadAsset<Item>("MysteryDiceItem");
			DieGambler.minValue = 100;
			DieGambler.maxValue = 130;
			GamblerDie gamblerDie = DieGambler.spawnPrefab.AddComponent<GamblerDie>();
			((GrabbableObject)gamblerDie).grabbable = true;
			((GrabbableObject)gamblerDie).grabbableToEnemies = true;
			((GrabbableObject)gamblerDie).itemProperties = DieGambler;
			RegisteredDice.Add(DieGambler);
			DieSacrificer = LoadedAssets.LoadAsset<Item>("Sacrificer");
			DieSacrificer.minValue = 170;
			DieSacrificer.maxValue = 230;
			SacrificerDie sacrificerDie = DieSacrificer.spawnPrefab.AddComponent<SacrificerDie>();
			((GrabbableObject)sacrificerDie).grabbable = true;
			((GrabbableObject)sacrificerDie).grabbableToEnemies = true;
			((GrabbableObject)sacrificerDie).itemProperties = DieSacrificer;
			RegisteredDice.Add(DieSacrificer);
			DieSaint = LoadedAssets.LoadAsset<Item>("Saint");
			DieSaint.minValue = 210;
			DieSaint.maxValue = 280;
			SaintDie saintDie = DieSaint.spawnPrefab.AddComponent<SaintDie>();
			((GrabbableObject)saintDie).grabbable = true;
			((GrabbableObject)saintDie).grabbableToEnemies = true;
			((GrabbableObject)saintDie).itemProperties = DieSaint;
			RegisteredDice.Add(DieSaint);
			DieRusty = LoadedAssets.LoadAsset<Item>("Rusty");
			DieRusty.minValue = 90;
			DieRusty.maxValue = 160;
			RustyDie rustyDie = DieRusty.spawnPrefab.AddComponent<RustyDie>();
			((GrabbableObject)rustyDie).grabbable = true;
			((GrabbableObject)rustyDie).grabbableToEnemies = true;
			((GrabbableObject)rustyDie).itemProperties = DieRusty;
			RegisteredDice.Add(DieRusty);
			if (EmergencyDiePrice.Value >= 0)
			{
				TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
				val.clearPreviousText = true;
				val.displayText = "This handy, unstable device might be your last chance to save yourself.\n\nRolls a number from 1 to 6:\n-Rolling 6 teleports you and players standing closely near you to the ship with all your items.\n-Rolling 4 or 5 teleports you to the ship with all your items.\n-Rolling 3 might be bad, or might be good. You decide? \n-Rolling 2 will causes some problems\n-You dont want to roll a 1\n";
				Items.RegisterShopItem(DieEmergency, (TerminalNode)null, (TerminalNode)null, val, EmergencyDiePrice.Value);
			}
			Dictionary<(string, string), int> dictionary = new Dictionary<(string, string), int>
			{
				{
					(DieSurfaced.itemName, "Default"),
					25
				},
				{
					(DieSurfaced.itemName, "Experimentation"),
					16
				},
				{
					(DieSurfaced.itemName, "Assurance"),
					26
				},
				{
					(DieSurfaced.itemName, "Vow"),
					25
				},
				{
					(DieSurfaced.itemName, "Offense"),
					17
				},
				{
					(DieSurfaced.itemName, "March"),
					27
				},
				{
					(DieSurfaced.itemName, "Rend"),
					26
				},
				{
					(DieSurfaced.itemName, "Dine"),
					36
				},
				{
					(DieSurfaced.itemName, "Titan"),
					25
				},
				{
					(DieSurfaced.itemName, "Adamance"),
					15
				},
				{
					(DieSurfaced.itemName, "Artifice"),
					28
				},
				{
					(DieSurfaced.itemName, "Embrion"),
					45
				},
				{
					(DieGambler.itemName, "Default"),
					25
				},
				{
					(DieGambler.itemName, "Experimentation"),
					13
				},
				{
					(DieGambler.itemName, "Assurance"),
					13
				},
				{
					(DieGambler.itemName, "Vow"),
					15
				},
				{
					(DieGambler.itemName, "Offense"),
					17
				},
				{
					(DieGambler.itemName, "March"),
					17
				},
				{
					(DieGambler.itemName, "Rend"),
					33
				},
				{
					(DieGambler.itemName, "Dine"),
					46
				},
				{
					(DieGambler.itemName, "Titan"),
					30
				},
				{
					(DieGambler.itemName, "Adamance"),
					21
				},
				{
					(DieGambler.itemName, "Artifice"),
					43
				},
				{
					(DieGambler.itemName, "Embrion"),
					60
				},
				{
					(DieChronos.itemName, "Default"),
					23
				},
				{
					(DieChronos.itemName, "Experimentation"),
					17
				},
				{
					(DieChronos.itemName, "Assurance"),
					17
				},
				{
					(DieChronos.itemName, "Vow"),
					17
				},
				{
					(DieChronos.itemName, "Offense"),
					25
				},
				{
					(DieChronos.itemName, "March"),
					25
				},
				{
					(DieChronos.itemName, "Rend"),
					22
				},
				{
					(DieChronos.itemName, "Dine"),
					41
				},
				{
					(DieChronos.itemName, "Titan"),
					33
				},
				{
					(DieChronos.itemName, "Adamance"),
					19
				},
				{
					(DieChronos.itemName, "Artifice"),
					40
				},
				{
					(DieChronos.itemName, "Embrion"),
					58
				},
				{
					(DieSacrificer.itemName, "Default"),
					20
				},
				{
					(DieSacrificer.itemName, "Experimentation"),
					20
				},
				{
					(DieSacrificer.itemName, "Assurance"),
					20
				},
				{
					(DieSacrificer.itemName, "Vow"),
					20
				},
				{
					(DieSacrificer.itemName, "Offense"),
					20
				},
				{
					(DieSacrificer.itemName, "March"),
					20
				},
				{
					(DieSacrificer.itemName, "Rend"),
					35
				},
				{
					(DieSacrificer.itemName, "Dine"),
					38
				},
				{
					(DieSacrificer.itemName, "Titan"),
					23
				},
				{
					(DieSacrificer.itemName, "Adamance"),
					20
				},
				{
					(DieSacrificer.itemName, "Artifice"),
					35
				},
				{
					(DieSacrificer.itemName, "Embrion"),
					41
				},
				{
					(DieSaint.itemName, "Default"),
					10
				},
				{
					(DieSaint.itemName, "Experimentation"),
					10
				},
				{
					(DieSaint.itemName, "Assurance"),
					10
				},
				{
					(DieSaint.itemName, "Vow"),
					10
				},
				{
					(DieSaint.itemName, "Offense"),
					10
				},
				{
					(DieSaint.itemName, "March"),
					10
				},
				{
					(DieSaint.itemName, "Rend"),
					12
				},
				{
					(DieSaint.itemName, "Dine"),
					15
				},
				{
					(DieSaint.itemName, "Titan"),
					12
				},
				{
					(DieSaint.itemName, "Adamance"),
					10
				},
				{
					(DieSaint.itemName, "Artifice"),
					15
				},
				{
					(DieSaint.itemName, "Embrion"),
					21
				},
				{
					(DieRusty.itemName, "Default"),
					18
				},
				{
					(DieRusty.itemName, "Experimentation"),
					15
				},
				{
					(DieRusty.itemName, "Assurance"),
					15
				},
				{
					(DieRusty.itemName, "Vow"),
					5
				},
				{
					(DieRusty.itemName, "Offense"),
					18
				},
				{
					(DieRusty.itemName, "March"),
					5
				},
				{
					(DieRusty.itemName, "Rend"),
					16
				},
				{
					(DieRusty.itemName, "Dine"),
					26
				},
				{
					(DieRusty.itemName, "Titan"),
					14
				},
				{
					(DieRusty.itemName, "Adamance"),
					16
				},
				{
					(DieRusty.itemName, "Artifice"),
					21
				},
				{
					(DieRusty.itemName, "Embrion"),
					38
				}
			};
			if (DieEmergencyAsScrap.Value)
			{
				dictionary.Add((DieEmergency.itemName, "Default"), 18);
				dictionary.Add((DieEmergency.itemName, "Experimentation"), 15);
				dictionary.Add((DieEmergency.itemName, "Assurance"), 15);
				dictionary.Add((DieEmergency.itemName, "Vow"), 5);
				dictionary.Add((DieEmergency.itemName, "Offense"), 18);
				dictionary.Add((DieEmergency.itemName, "March"), 5);
				dictionary.Add((DieEmergency.itemName, "Rend"), 16);
				dictionary.Add((DieEmergency.itemName, "Dine"), 26);
				dictionary.Add((DieEmergency.itemName, "Titan"), 14);
				dictionary.Add((DieEmergency.itemName, "Adamance"), 16);
				dictionary.Add((DieEmergency.itemName, "Artifice"), 21);
				dictionary.Add((DieEmergency.itemName, "Embrion"), 38);
			}
			foreach (Item registeredDie in RegisteredDice)
			{
				NetworkPrefabs.RegisterNetworkPrefab(registeredDie.spawnPrefab);
				Utilities.FixMixerGroups(registeredDie.spawnPrefab);
			}
			foreach (Item registeredDie2 in RegisteredDice)
			{
				if ((Object)(object)registeredDie2 == (Object)(object)DieEmergency && !DieEmergencyAsScrap.Value)
				{
					continue;
				}
				ConfigEntry<int> val2 = BepInExConfig.Bind<int>(registeredDie2.itemName + " Spawn rates", "Default", dictionary[(registeredDie2.itemName, "Default")], "Default spawn rate for all levels. Mainly for setting up spawn rates for either new beta moons or modded ones.");
				foreach (KeyValuePair<string, LevelTypes> regLevel in RegLevels)
				{
					ConfigEntry<int> val3 = BepInExConfig.Bind<int>(registeredDie2.itemName + " Spawn rates", regLevel.Key, dictionary[(registeredDie2.itemName, regLevel.Key)], "Sets how often this item spawns on this level. 0-10 is very rare, 10-25 is rare, 25+ is common. This is only from my observations. -Theronguard (These numbers are with no modded scrap from my observations - Slayer)");
					Items.RegisterScrap(registeredDie2, val3.Value, regLevel.Value);
				}
				Items.RegisterScrap(registeredDie2, val2.Value, (LevelTypes)(-1));
			}
		}
	}
	public class Networker : NetworkBehaviour
	{
		public static Networker Instance;

		public static float RebelTimer = 0f;

		public static bool CoilheadIgnoreStares = false;

		private static Vector2 TimerRange = new Vector2(3f, 6f);

		private static ulong PlayerIDToExplode;

		private static float ExplosionTimer = 0f;

		private Coroutine DoorMalfunctioning = null;

		public override void OnNetworkSpawn()
		{
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (!((NetworkBehaviour)this).IsServer)
			{
				DieBehaviour.AllowedEffects.Clear();
				((MonoBehaviour)this).StartCoroutine(SyncRequest());
			}
		}

		public IEnumerator SyncRequest()
		{
			while (!((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().IsConnectedClient)
			{
				yield return (object)new WaitForSeconds(0.5f);
			}
			while ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
			{
				yield return (object)new WaitForSeconds(0.5f);
			}
			RequestEffectConfigServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId);
			RequestConfigSyncServerRPC(GameNetworkManager.Instance.localPlayerController.playerClientId);
		}

		public override void OnNetworkDespawn()
		{
			StartOfRoundPatch.ResetSettingsShared();
			((NetworkBehaviour)this).OnNetworkDespawn();
		}

		private void FixedUpdate()
		{
			UpdateMineTimers();
			if (Armageddon.IsEnabled)
			{
				Armageddon.BoomTimer();
			}
			HyperShake.FixedUpdate();
			LeverShake.FixedUpdate();
			Drunk.FixedUpdate();
		}

		private void Update()
		{
			ModifyPitch.PitchFluctuate();
			RebelCoilheads();
			AlarmCurse.TimerUpdate();
		}

		[ServerRpc(RequireOwnership = false)]
		public void LogEffectsToOwnerServerRPC(string playerName, string effectName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2928804663u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				bool flag2 = effectName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(effectName, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2928804663u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (MysteryDice.debugDice.Value)
				{
					MysteryDice.CustomLogger.LogInfo((object)("[Debug] Player: " + playerName + " rolled " + effectName));
				}
				if (MysteryDice.debugChat.Value == MysteryDice.chatDebug.HostOnly)
				{
					LogEffectsToHostClientRPC(playerName, effectName);
				}
				if (MysteryDice.debugChat.Value == MysteryDice.chatDebug.Everyone)
				{
					LogEffectsToEveryoneClientRPC(playerName, effectName);
				}
			}
		}

		[ClientRpc]
		public void LogEffectsToHostClientRPC(string playerName, string effectName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1090747521u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				bool flag2 = effectName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(effectName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1090747521u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost || GameNetworkManager.Instance.localPlayerController.playerSteamId == 76561198077184650L))
			{
				Misc.ChatWrite("Player: " + playerName + " rolled " + effectName);
			}
		}

		[ClientRpc]
		public void LogEffectsToEveryoneClientRPC(string playerName, string effectName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1041501872u, val, (RpcDelivery)0);
				bool flag = playerName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerName, false);
				}
				bool flag2 = effectName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(effectName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1041501872u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				Misc.ChatWrite("Player: " + playerName + " rolled " + effectName);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestEffectConfigServerRPC(ulong playerID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(275565411u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 275565411u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			foreach (IEffect allowedEffect in DieBehaviour.AllowedEffects)
			{
				SendConfigClientRPC(playerID, allowedEffect.Name);
			}
		}

		[ClientRpc]
		public void SendConfigClientRPC(ulong playerID, string effectName)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0095: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1079890651u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				bool flag = effectName != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(effectName, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1079890651u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			string effectName2 = effectName;
			if (!((NetworkBehaviour)this).IsServer && GameNetworkManager.Instance.localPlayerController.playerClientId == playerID)
			{
				DieBehaviour.AllowedEffects.Add(DieBehaviour.AllEffects.Where((IEffect x) => x.Name == effectName2).First());
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RequestConfigSyncServerRPC(ulong playerID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(142178933u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 142178933u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			List<ConfigEntryBase> listConfigs = MysteryDice.GetListConfigs();
			foreach (ConfigEntryBase item in listConfigs)
			{
				string key = item.Definition.Key;
				string section = item.Definition.Section;
				int typeCode = (int)Type.GetTypeCode(item.SettingType);
				if (item.BoxedValue is int ival)
				{
					SendConfigsClientRPC(playerID, key, section, typeCode, ival);
				}
				else if (item.BoxedValue is bool bval)
				{
					SendConfigsClientRPC(playerID, key, section, typeCode, 0, bval);
				}
				else if (item.BoxedValue is string sval)
				{
					SendConfigsClientRPC(playerID, key, section, typeCode, 0, bval: false, sval);
				}
				else if (item.BoxedValue is Enum @enum)
				{
					SendConfigsClientRPC(playerID, key, section, typeCode, 0, bval: false, "", @enum.ToString());
				}
			}
		}

		[ClientRpc]
		public void SendConfigsClientRPC(ulong playerID, string key, string section, int type, int ival = 0, bool bval = false, string sval = "", string enumVal = "")
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0095: 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_00d3: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(332728130u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerID);
				bool flag = key != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(key, false);
				}
				bool flag2 = section != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(section, false);
				}
				BytePacker.WriteValueBitPacked(val2, type);
				BytePacker.WriteValueBitPacked(val2, ival);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref bval, default(ForPrimitives));
				bool flag3 = sval != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives));
				if (flag3)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(sval, false);
				}
				bool flag4 = enumVal != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag4, default(ForPrimitives));
				if (flag4)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(enumVal, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 332728130u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || ((NetworkBehaviour)this).IsServer || GameNetworkManager.Instance.localPlayerController.playerClientId != playerID)
			{
				return;
			}
			try
			{
				List<ConfigEntryBase> listConfigs = MysteryDice.GetListConfigs();
				foreach (ConfigEntryBase item in listConfigs)
				{
					if (!(item.Definition.Key == key) || !(item.Definition.Section == section))
					{
						continue;
					}
					switch ((TypeCode)type)
					{
					case TypeCode.Int32:
						item.BoxedValue = ival;
						break;
					case TypeCode.Boolean:
						item.BoxedValue = bval;
						break;
					case TypeCode.String:
						item.BoxedValue = sval;
						break;
					case TypeCode.Object:
						if (item.SettingType.IsEnum)
						{
							item.BoxedValue = Enum.Parse(item.SettingType, enumVal);
						}
						break;
					}
				}
			}
			catch
			{
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void doPenaltyServerRPC(int amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient