Decompiled source of Level Events v1.0.3

com.Omniscye.EmpressEvents.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
using UnityEngine.AI;
using YAPYAP;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.Omniscye.EmpressEvents")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8e5ff4cd9f66d409db9cafc4b16a431998692295")]
[assembly: AssemblyProduct("com.Omniscye.EmpressEvents")]
[assembly: AssemblyTitle("EmpressEvents")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace EmpressEvents
{
	public class EmpressEventsManager : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <EventRoutine>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EmpressEventsManager <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <EventRoutine>d__9(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Expected O, but got Unknown
				int num = <>1__state;
				EmpressEventsManager empressEventsManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					if (!NetworkServer.active)
					{
						return false;
					}
					float num9 = (EmpressEventsMod.DevMode.Value ? 20f : Random.Range(EmpressEventsMod.MinEventTime.Value, EmpressEventsMod.MaxEventTime.Value));
					<>2__current = (object)new WaitForSeconds(num9);
					<>1__state = 1;
					return true;
				}
				case 1:
				{
					<>1__state = -1;
					if (Random.value > EmpressEventsMod.EventChance.Value)
					{
						return false;
					}
					List<Pawn> list = GameManager.Instance.playersByPlayerId.Values.Where((Pawn p) => (Object)(object)p != (Object)null && p.IsDead && !p.IsExtracted).ToList();
					bool num2 = list.Count > 0;
					int num3 = (EmpressEventsMod.EnableFrogs.Value ? EmpressEventsMod.WeightFrogs.Value : 0);
					int num4 = (EmpressEventsMod.EnableWands.Value ? EmpressEventsMod.WeightWands.Value : 0);
					int num5 = (EmpressEventsMod.EnablePotions.Value ? EmpressEventsMod.WeightPotions.Value : 0);
					int num6 = ((num2 && EmpressEventsMod.EnableRevive.Value) ? EmpressEventsMod.WeightRevive.Value : 0);
					int num7 = num3 + num4 + num5 + num6;
					if (num7 <= 0)
					{
						return false;
					}
					int num8 = Random.Range(0, num7);
					List<Pawn> list2 = GameManager.Instance.playersByPlayerId.Values.Where((Pawn p) => (Object)(object)p != (Object)null && !p.IsDead && !p.IsExtracted).ToList();
					Pawn val = null;
					if (list2.Count > 0)
					{
						val = list2[Random.Range(0, list2.Count)];
					}
					if (num8 < num3 && (Object)(object)val != (Object)null)
					{
						empressEventsManager.SendUiNotification(88801);
						<>2__current = ((MonoBehaviour)empressEventsManager).StartCoroutine(empressEventsManager.SpawnFrogs(val));
						<>1__state = 2;
						return true;
					}
					if (num8 < num3 + num4 && (Object)(object)val != (Object)null)
					{
						empressEventsManager.SendUiNotification(88802);
						<>2__current = ((MonoBehaviour)empressEventsManager).StartCoroutine(empressEventsManager.SpawnWands(val));
						<>1__state = 3;
						return true;
					}
					if (num8 < num3 + num4 + num5 && (Object)(object)val != (Object)null)
					{
						empressEventsManager.SendUiNotification(88803);
						<>2__current = ((MonoBehaviour)empressEventsManager).StartCoroutine(empressEventsManager.SpawnPotions(val));
						<>1__state = 4;
						return true;
					}
					if (num6 > 0)
					{
						Pawn val2 = list[Random.Range(0, list.Count)];
						Pawn livingTarget = val ?? val2;
						empressEventsManager.SendUiNotification(88804);
						<>2__current = ((MonoBehaviour)empressEventsManager).StartCoroutine(empressEventsManager.ReviveRandomPlayer(val2, livingTarget));
						<>1__state = 5;
						return true;
					}
					break;
				}
				case 2:
					<>1__state = -1;
					break;
				case 3:
					<>1__state = -1;
					break;
				case 4:
					<>1__state = -1;
					break;
				case 5:
					<>1__state = -1;
					break;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <ReviveRandomPlayer>d__11 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public Pawn deadPlayer;

			public Pawn livingTarget;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <ReviveRandomPlayer>d__11(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					if ((Object)(object)deadPlayer == (Object)null)
					{
						return false;
					}
					deadPlayer.SvTeleport(((Component)livingTarget).transform.position + Vector3.up, true, false);
					if ((Object)(object)deadPlayer.Hurtbox != (Object)null)
					{
						deadPlayer.Hurtbox.SvDoRevive();
					}
					else
					{
						deadPlayer.IsDead = false;
					}
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SpawnFrogs>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EmpressEventsManager <>4__this;

			public Pawn target;

			private GameObject <prefab>5__2;

			private int <count>5__3;

			private int <i>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SpawnFrogs>d__12(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<prefab>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Expected O, but got Unknown
				int num = <>1__state;
				EmpressEventsManager empressEventsManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<prefab>5__2 = empressEventsManager.FindPrefab("Frog");
					if (!Object.op_Implicit((Object)(object)<prefab>5__2))
					{
						return false;
					}
					<count>5__3 = EmpressEventsMod.CountFrogs.Value;
					<i>5__4 = 0;
					break;
				case 1:
					<>1__state = -1;
					<i>5__4++;
					break;
				}
				if (<i>5__4 < <count>5__3)
				{
					empressEventsManager.SpawnObject(<prefab>5__2, ((Component)target).transform.position, useFallHandler: true);
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SpawnPotions>d__14 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EmpressEventsManager <>4__this;

			public Pawn target;

			private List<GameObject> <prefabs>5__2;

			private int <count>5__3;

			private int <i>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SpawnPotions>d__14(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<prefabs>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Expected O, but got Unknown
				int num = <>1__state;
				EmpressEventsManager empressEventsManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<prefabs>5__2 = (from p in empressEventsManager.FindPrefabs("Potion")
						where ((Object)p).name.Contains("Health") || ((Object)p).name.Contains("Heal")
						select p).ToList();
					if (<prefabs>5__2.Count == 0)
					{
						return false;
					}
					<count>5__3 = EmpressEventsMod.CountPotions.Value;
					<i>5__4 = 0;
					break;
				case 1:
					<>1__state = -1;
					<i>5__4++;
					break;
				}
				if (<i>5__4 < <count>5__3)
				{
					empressEventsManager.SpawnObject(<prefabs>5__2[Random.Range(0, <prefabs>5__2.Count)], ((Component)target).transform.position, useFallHandler: false);
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <SpawnWands>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public EmpressEventsManager <>4__this;

			public Pawn target;

			private List<GameObject> <prefabs>5__2;

			private int <count>5__3;

			private int <i>5__4;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <SpawnWands>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<prefabs>5__2 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0082: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				//IL_009d: Expected O, but got Unknown
				int num = <>1__state;
				EmpressEventsManager empressEventsManager = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<prefabs>5__2 = empressEventsManager.FindPrefabs("Wand");
					if (<prefabs>5__2.Count == 0)
					{
						return false;
					}
					<count>5__3 = EmpressEventsMod.CountWands.Value;
					<i>5__4 = 0;
					break;
				case 1:
					<>1__state = -1;
					<i>5__4++;
					break;
				}
				if (<i>5__4 < <count>5__3)
				{
					empressEventsManager.SpawnObject(<prefabs>5__2[Random.Range(0, <prefabs>5__2.Count)], ((Component)target).transform.position, useFallHandler: false);
					<>2__current = (object)new WaitForSeconds(0.2f);
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static EmpressEventsManager _instance;

		public const int ID_FROG_RAIN = 88801;

		public const int ID_WAND_SHOWER = 88802;

		public const int ID_HEALTH_DROP = 88803;

		public const int ID_PLAYER_REVIVE = 88804;

		public static EmpressEventsManager Instance => _instance;

		public static void Initialize()
		{
			//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_001e: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_instance != (Object)null))
			{
				GameObject val = new GameObject("EmpressEventsManager");
				Object.DontDestroyOnLoad((Object)val);
				((Object)val).hideFlags = (HideFlags)61;
				_instance = val.AddComponent<EmpressEventsManager>();
			}
		}

		public void TriggerEventRoutine()
		{
			((MonoBehaviour)this).StartCoroutine(EventRoutine());
		}

		[IteratorStateMachine(typeof(<EventRoutine>d__9))]
		private IEnumerator EventRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <EventRoutine>d__9(0)
			{
				<>4__this = this
			};
		}

		private void SendUiNotification(int eventId)
		{
			foreach (Pawn value in GameManager.Instance.playersByPlayerId.Values)
			{
				if ((Object)(object)value != (Object)null)
				{
					value.RpcPlayAnimation(eventId);
				}
			}
		}

		[IteratorStateMachine(typeof(<ReviveRandomPlayer>d__11))]
		private IEnumerator ReviveRandomPlayer(Pawn deadPlayer, Pawn livingTarget)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <ReviveRandomPlayer>d__11(0)
			{
				deadPlayer = deadPlayer,
				livingTarget = livingTarget
			};
		}

		[IteratorStateMachine(typeof(<SpawnFrogs>d__12))]
		private IEnumerator SpawnFrogs(Pawn target)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SpawnFrogs>d__12(0)
			{
				<>4__this = this,
				target = target
			};
		}

		[IteratorStateMachine(typeof(<SpawnWands>d__13))]
		private IEnumerator SpawnWands(Pawn target)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SpawnWands>d__13(0)
			{
				<>4__this = this,
				target = target
			};
		}

		[IteratorStateMachine(typeof(<SpawnPotions>d__14))]
		private IEnumerator SpawnPotions(Pawn target)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SpawnPotions>d__14(0)
			{
				<>4__this = this,
				target = target
			};
		}

		private void SpawnObject(GameObject prefab, Vector3 centerPos, bool useFallHandler)
		{
			//IL_0016: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			float value = EmpressEventsMod.SpawnHeight.Value;
			float value2 = EmpressEventsMod.SpawnRadius.Value;
			Vector3 val = centerPos + Vector3.up * value + Random.insideUnitSphere * value2;
			val.y = centerPos.y + value;
			GameObject val2 = Object.Instantiate<GameObject>(prefab, val, Quaternion.identity);
			NavMeshAgent component = val2.GetComponent<NavMeshAgent>();
			if ((Object)(object)component != (Object)null)
			{
				((Behaviour)component).enabled = false;
			}
			NpcBehaviour component2 = val2.GetComponent<NpcBehaviour>();
			if ((Object)(object)component2 != (Object)null)
			{
				((Behaviour)component2).enabled = false;
			}
			Rigidbody component3 = val2.GetComponent<Rigidbody>();
			if ((Object)(object)component3 != (Object)null)
			{
				component3.isKinematic = false;
				component3.useGravity = true;
				component3.linearVelocity = Vector3.zero;
			}
			if (useFallHandler)
			{
				val2.AddComponent<FrogFallHandler>().Setup(component2, component, component3);
			}
			NetworkServer.Spawn(val2, (NetworkConnectionToClient)null);
		}

		private GameObject FindPrefab(string name)
		{
			string name2 = name;
			return ((IEnumerable<GameObject>)NetworkManager.singleton.spawnPrefabs).FirstOrDefault((Func<GameObject, bool>)((GameObject p) => ((Object)p).name.IndexOf(name2, StringComparison.OrdinalIgnoreCase) >= 0));
		}

		private List<GameObject> FindPrefabs(string name)
		{
			string name2 = name;
			return NetworkManager.singleton.spawnPrefabs.Where((GameObject p) => ((Object)p).name.IndexOf(name2, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
		}
	}
	[BepInPlugin("com.omniscye.empressevents", "EmpressEvents", "1.5.0")]
	public class EmpressEventsMod : BaseUnityPlugin
	{
		public const string PluginGuid = "com.omniscye.empressevents";

		public const string PluginName = "EmpressEvents";

		public const string PluginVersion = "1.5.0";

		public static ConfigEntry<bool> DevMode;

		public static ConfigEntry<float> EventChance;

		public static ConfigEntry<float> MinEventTime;

		public static ConfigEntry<float> MaxEventTime;

		public static ConfigEntry<float> SpawnHeight;

		public static ConfigEntry<float> SpawnRadius;

		public static ConfigEntry<bool> EnableFrogs;

		public static ConfigEntry<bool> EnableWands;

		public static ConfigEntry<bool> EnablePotions;

		public static ConfigEntry<bool> EnableRevive;

		public static ConfigEntry<int> WeightFrogs;

		public static ConfigEntry<int> WeightWands;

		public static ConfigEntry<int> WeightPotions;

		public static ConfigEntry<int> WeightRevive;

		public static ConfigEntry<int> CountFrogs;

		public static ConfigEntry<int> CountWands;

		public static ConfigEntry<int> CountPotions;

		private void Awake()
		{
			DevMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Development", "DevMode", false, "Force event to start at 20 seconds for testing.");
			EventChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "EventChance", 0.1f, "Probability (0.0 to 1.0) of ANY event happening.");
			MinEventTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MinEventTime", 40f, "Minimum seconds to wait after round start.");
			MaxEventTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxEventTime", 480f, "Maximum seconds to wait after round start.");
			SpawnHeight = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SpawnHeight", 2f, "Height above player to spawn.");
			SpawnRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SpawnRadius", 3f, "Spread radius.");
			EnableFrogs = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "EnableFrogs", true, "Enable Frog Rain event.");
			EnableWands = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "EnableWands", true, "Enable Wand Shower event.");
			EnablePotions = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "EnablePotions", true, "Enable Health Drop event.");
			EnableRevive = ((BaseUnityPlugin)this).Config.Bind<bool>("Toggles", "EnableRevive", true, "Enable Player Revive event.");
			WeightFrogs = ((BaseUnityPlugin)this).Config.Bind<int>("Weights", "WeightFrogs", 25, "Chance weight for Frogs.");
			WeightWands = ((BaseUnityPlugin)this).Config.Bind<int>("Weights", "WeightWands", 25, "Chance weight for Wands.");
			WeightPotions = ((BaseUnityPlugin)this).Config.Bind<int>("Weights", "WeightPotions", 25, "Chance weight for Potions.");
			WeightRevive = ((BaseUnityPlugin)this).Config.Bind<int>("Weights", "WeightRevive", 25, "Chance weight for Reviving a dead player.");
			CountFrogs = ((BaseUnityPlugin)this).Config.Bind<int>("Counts", "CountFrogs", 20, "Number of Frogs.");
			CountWands = ((BaseUnityPlugin)this).Config.Bind<int>("Counts", "CountWands", 3, "Number of Wands.");
			CountPotions = ((BaseUnityPlugin)this).Config.Bind<int>("Counts", "CountPotions", 5, "Number of Potions.");
			Harmony.CreateAndPatchAll(typeof(EmpressEventsPatches), (string)null);
			Harmony.CreateAndPatchAll(typeof(ClientUiPatches), (string)null);
			EmpressEventsManager.Initialize();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin EmpressEvents loaded!");
		}
	}
	public class FrogFallHandler : MonoBehaviour
	{
		private NpcBehaviour _npc;

		private NavMeshAgent _agent;

		private Rigidbody _rb;

		private bool _hasLanded;

		private float _spawnTime;

		public void Setup(NpcBehaviour npc, NavMeshAgent agent, Rigidbody rb)
		{
			_npc = npc;
			_agent = agent;
			_rb = rb;
		}

		private void Start()
		{
			_spawnTime = Time.time;
		}

		private void OnCollisionEnter(Collision collision)
		{
			if (!_hasLanded && !collision.collider.isTrigger)
			{
				Activate();
			}
		}

		private void Update()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (_hasLanded)
			{
				return;
			}
			if (!(Time.time - _spawnTime > 5f))
			{
				if (!((Object)(object)_rb != (Object)null))
				{
					return;
				}
				Vector3 linearVelocity = _rb.linearVelocity;
				if (!(((Vector3)(ref linearVelocity)).sqrMagnitude < 0.05f) || !(Time.time - _spawnTime > 0.5f))
				{
					return;
				}
			}
			Activate();
		}

		private void Activate()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			_hasLanded = true;
			NavMeshHit val = default(NavMeshHit);
			if ((Object)(object)_agent != (Object)null && NavMesh.SamplePosition(((Component)this).transform.position, ref val, 5f, -1))
			{
				_agent.Warp(((NavMeshHit)(ref val)).position);
				((Behaviour)_agent).enabled = true;
				if ((Object)(object)_npc != (Object)null)
				{
					((Behaviour)_npc).enabled = true;
					_npc.IsKinematic = false;
				}
			}
			Object.Destroy((Object)(object)this);
		}
	}
	[HarmonyPatch(typeof(DungeonManager))]
	public static class EmpressEventsPatches
	{
		[HarmonyPatch("SvStartRound")]
		[HarmonyPostfix]
		public static void OnRoundStartedPostfix()
		{
			if (NetworkServer.active)
			{
				EmpressEventsManager.Instance?.TriggerEventRoutine();
			}
		}
	}
	[HarmonyPatch(typeof(Pawn))]
	public static class ClientUiPatches
	{
		[HarmonyPatch("UserCode_RpcPlayAnimation__Int32")]
		[HarmonyPrefix]
		public static bool InterceptAnimationRpc(Pawn __instance, int animHash)
		{
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			string text = null;
			switch (animHash)
			{
			case 88801:
				text = "Frog Rain";
				break;
			case 88802:
				text = "Mystic Shower";
				break;
			case 88803:
				text = "Health Drop";
				break;
			case 88804:
				text = "Divine Intervention";
				break;
			}
			if (text != null)
			{
				if ((Object)(object)UIManager.Instance != (Object)null && (Object)(object)UIManager.Instance.uiGame != (Object)null)
				{
					UIManager.Instance.uiGame.OnGameMessage("Incoming Event: " + text, Color.red);
				}
				return false;
			}
			return true;
		}
	}
}
namespace System.Diagnostics.CodeAnalysis
{
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ConstantExpectedAttribute : Attribute
	{
		public object? Min { get; set; }

		public object? Max { get; set; }
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ExperimentalAttribute : Attribute
	{
		public string DiagnosticId { get; }

		public string? UrlFormat { get; set; }

		public ExperimentalAttribute(string diagnosticId)
		{
			DiagnosticId = diagnosticId;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullAttribute : Attribute
	{
		public string[] Members { get; }

		public MemberNotNullAttribute(string member)
		{
			Members = new string[1] { member };
		}

		public MemberNotNullAttribute(params string[] members)
		{
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
	[ExcludeFromCodeCoverage]
	internal sealed class MemberNotNullWhenAttribute : Attribute
	{
		public bool ReturnValue { get; }

		public string[] Members { get; }

		public MemberNotNullWhenAttribute(bool returnValue, string member)
		{
			ReturnValue = returnValue;
			Members = new string[1] { member };
		}

		public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
		{
			ReturnValue = returnValue;
			Members = members;
		}
	}
	[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SetsRequiredMembersAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class StringSyntaxAttribute : Attribute
	{
		public const string CompositeFormat = "CompositeFormat";

		public const string DateOnlyFormat = "DateOnlyFormat";

		public const string DateTimeFormat = "DateTimeFormat";

		public const string EnumFormat = "EnumFormat";

		public const string GuidFormat = "GuidFormat";

		public const string Json = "Json";

		public const string NumericFormat = "NumericFormat";

		public const string Regex = "Regex";

		public const string TimeOnlyFormat = "TimeOnlyFormat";

		public const string TimeSpanFormat = "TimeSpanFormat";

		public const string Uri = "Uri";

		public const string Xml = "Xml";

		public string Syntax { get; }

		public object?[] Arguments { get; }

		public StringSyntaxAttribute(string syntax)
		{
			Syntax = syntax;
			Arguments = new object[0];
		}

		public StringSyntaxAttribute(string syntax, params object?[] arguments)
		{
			Syntax = syntax;
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class UnscopedRefAttribute : Attribute
	{
	}
}
namespace System.Runtime.Versioning
{
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresPreviewFeaturesAttribute : Attribute
	{
		public string? Message { get; }

		public string? Url { get; set; }

		public RequiresPreviewFeaturesAttribute()
		{
		}

		public RequiresPreviewFeaturesAttribute(string? message)
		{
			Message = message;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CallerArgumentExpressionAttribute : Attribute
	{
		public string ParameterName { get; }

		public CallerArgumentExpressionAttribute(string parameterName)
		{
			ParameterName = parameterName;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CollectionBuilderAttribute : Attribute
	{
		public Type BuilderType { get; }

		public string MethodName { get; }

		public CollectionBuilderAttribute(Type builderType, string methodName)
		{
			BuilderType = builderType;
			MethodName = methodName;
		}
	}
	[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class CompilerFeatureRequiredAttribute : Attribute
	{
		public const string RefStructs = "RefStructs";

		public const string RequiredMembers = "RequiredMembers";

		public string FeatureName { get; }

		public bool IsOptional { get; set; }

		public CompilerFeatureRequiredAttribute(string featureName)
		{
			FeatureName = featureName;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
	{
		public string[] Arguments { get; }

		public InterpolatedStringHandlerArgumentAttribute(string argument)
		{
			Arguments = new string[1] { argument };
		}

		public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
		{
			Arguments = arguments;
		}
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class InterpolatedStringHandlerAttribute : Attribute
	{
	}
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal static class IsExternalInit
	{
	}
	[AttributeUsage(AttributeTargets.Method, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ModuleInitializerAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class OverloadResolutionPriorityAttribute : Attribute
	{
		public int Priority { get; }

		public OverloadResolutionPriorityAttribute(int priority)
		{
			Priority = priority;
		}
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class ParamCollectionAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiredMemberAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
	[EditorBrowsable(EditorBrowsableState.Never)]
	[ExcludeFromCodeCoverage]
	internal sealed class RequiresLocationAttribute : Attribute
	{
	}
	[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
	[ExcludeFromCodeCoverage]
	internal sealed class SkipLocalsInitAttribute : Attribute
	{
	}
}