Decompiled source of TheBadOnes v0.5.0

plugins/Thraac.TheBadOnes.dll

Decompiled 3 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 BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Thraac.TheBadOnes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.5.0.0")]
[assembly: AssemblyInformationalVersion("0.5.0+ca3c5d5ea383112ab64a1c36475a21f16d66cc71")]
[assembly: AssemblyProduct("Thraac.TheBadOnes")]
[assembly: AssemblyTitle("TheBadOnes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.5.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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")]
	[Embedded]
	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")]
	[Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace TheBadOnes
{
	public class EffectManager : MonoBehaviour
	{
		internal static readonly Dictionary<int, Character> TornadoTargets = new Dictionary<int, Character>();

		private float _timer;

		private float _nextInterval;

		private static Vector3 _cannonEntryOffset;

		private static bool _cannonOffsetKnown;

		public static EffectManager Instance { get; private set; } = null;

		private void Awake()
		{
			Instance = this;
			_nextInterval = PickInterval();
		}

		private static float PickInterval()
		{
			float num = Mathf.Min(Plugin.MinInterval.Value, Plugin.MaxInterval.Value);
			float num2 = Mathf.Max(Plugin.MinInterval.Value, Plugin.MaxInterval.Value);
			return Random.Range(num, num2);
		}

		private static int PickCount(int min, int max)
		{
			int num = Mathf.Min(min, max);
			int num2 = Mathf.Max(min, max);
			return Random.Range(num, num2 + 1);
		}

		private void Update()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.IsMasterClient || !PhotonNetwork.InRoom)
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			if (name.Contains("Island") || name.Contains("Level_"))
			{
				_timer += Time.deltaTime;
				if (!(_timer < _nextInterval))
				{
					_timer = 0f;
					_nextInterval = PickInterval();
					SpawnWave();
				}
			}
		}

		private void TriggerWind(float yComponent = 0.2f, float duration = 4f)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			WindChillZone instance = WindChillZone.instance;
			if ((Object)(object)instance == (Object)null)
			{
				Plugin.Log.LogWarning((object)"No WindChillZone here; skipping wind.");
				return;
			}
			Vector3 val = new Vector3(Random.Range(-1f, 1f), yComponent, Random.Range(-1f, 1f));
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			((Component)instance).GetComponent<PhotonView>().RPC("RPCA_ToggleWind", (RpcTarget)0, new object[3] { true, normalized, duration });
			Plugin.Log.LogInfo((object)"Summoned extreme wind.");
		}

		private void TriggerEmotes(List<Character> players)
		{
			string[] array = new string[2] { "A_Scout_Emote_PlayDead", "A_Scout_Emote_BackFlip" };
			foreach (Character player in players)
			{
				string text = array[Random.Range(0, array.Length)];
				player.refs.view.RPC("RPCA_PlayRemove", (RpcTarget)0, new object[2] { text, true });
			}
		}

		private void TriggerHotSun(List<Character> players)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			PhotonNetwork.RaiseEvent((byte)72, (object)null, new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			}, SendOptions.SendReliable);
		}

		private void TriggerBlizzard(List<Character> players)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			PhotonNetwork.RaiseEvent((byte)73, (object)null, new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			}, SendOptions.SendReliable);
		}

		public void RunHotSunLocal()
		{
			((MonoBehaviour)this).StartCoroutine(HotSunRoutine());
		}

		public void RunBlizzardLocal()
		{
			((MonoBehaviour)this).StartCoroutine(BlizzardRoutine());
		}

		private IEnumerator HotSunRoutine()
		{
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				Patch_DayNight_ForceSun.ForceBlazing = true;
				GameObject go = new GameObject("BadSun");
				go.transform.position = localCharacter.Center;
				go.transform.localScale = Vector3.one * 1000f;
				go.AddComponent<HotSun>();
				ManualLogSource log = Plugin.Log;
				DayNightManager instance = DayNightManager.instance;
				float? obj;
				if (instance == null)
				{
					obj = null;
				}
				else
				{
					Light sun = instance.sun;
					obj = ((sun != null) ? new float?(sun.intensity) : ((float?)null));
				}
				log.LogInfo((object)$"[hotsun] spawned. sun.intensity = {obj:0.0}");
				yield return (object)new WaitForSeconds(15f);
				Object.Destroy((Object)(object)go);
				Plugin.Log.LogInfo((object)"[hotsun] removed.");
				Patch_DayNight_ForceSun.ForceBlazing = false;
				NotificationsManager.Broadcast("The Hot Sun Sets.");
			}
		}

		private IEnumerator BlizzardRoutine()
		{
			Character me = Character.localCharacter;
			if ((Object)(object)me == (Object)null)
			{
				yield break;
			}
			float duration = 15f;
			float t = 0f;
			while (t < duration)
			{
				RaycastHit val = HelperFunctions.LineCheck(me.Center, me.Center + Vector3.up * 15f, (LayerType)0, 0f, (QueryTriggerInteraction)1);
				if (!((Object)(object)((RaycastHit)(ref val)).transform != (Object)null) || !((Object)(object)((RaycastHit)(ref val)).transform.root != (Object)(object)((Component)me).transform.root))
				{
					me.refs.afflictions.AddStatus((STATUSTYPE)2, 0.1f * Time.deltaTime, false, true, true, false);
				}
				t += Time.deltaTime;
				yield return null;
			}
			NotificationsManager.Broadcast("No Blizzard rules forever my son.");
		}

		private void SpawnWave()
		{
			List<Character> list = Character.AllCharacters.Where((Character c) => ((Component)c).gameObject.activeInHierarchy && !c.data.dead).ToList();
			if (list.Count == 0)
			{
				Plugin.Log.LogWarning((object)"No players found; skipping wave.");
				return;
			}
			List<string> list2 = new List<string>();
			if (Plugin.TornadoesEnabled.Value)
			{
				list2.Add("Tornado");
			}
			if (Plugin.DynamiteEnabled.Value)
			{
				list2.Add("Dynamite");
			}
			if (Plugin.ZombiesEnabled.Value)
			{
				list2.Add("Zombie");
			}
			if (Plugin.WindEnabled.Value)
			{
				list2.Add("Wind");
			}
			if (Plugin.BugsEnabled.Value)
			{
				list2.Add("Bugs");
			}
			if (Plugin.EmotesEnabled.Value)
			{
				list2.Add("Emotes");
			}
			if (Plugin.HotSunEnabled.Value)
			{
				list2.Add("Sun");
			}
			if (Plugin.FrogsEnabled.Value)
			{
				list2.Add("Frogs");
			}
			if (Plugin.CannonsEnabled.Value)
			{
				list2.Add("Cannons");
			}
			if (Plugin.BigGhostEnabled.Value)
			{
				list2.Add("BigGhosts");
			}
			if (Plugin.TumbleweedsEnabled.Value)
			{
				list2.Add("Tumbleweeds");
			}
			if (list2.Count == 0)
			{
				Plugin.Log.LogInfo((object)"No Effects Enabled. Skipping Wave.");
				return;
			}
			string text = list2[Random.Range(0, list2.Count)];
			int num;
			switch (text)
			{
			case "Wind":
				NotificationsManager.Broadcast("It Heckin Wimdy!");
				TriggerWind();
				return;
			case "Emotes":
				NotificationsManager.Broadcast("Do a flip!");
				((MonoBehaviour)this).StartCoroutine(EmoteRoutine(list));
				return;
			case "Sun":
			{
				float num2 = (((Object)(object)DayNightManager.instance?.sun != (Object)null) ? DayNightManager.instance.sun.intensity : (-1f));
				Plugin.Log.LogInfo((object)$"[sun] intensity = {num2:0.00} (need >= 5 for HotSun)");
				if ((Object)(object)DayNightManager.instance != (Object)null && DayNightManager.instance.isDay > 0.5f)
				{
					NotificationsManager.Broadcast("Hot Sun Out!");
					TriggerHotSun(list);
				}
				else
				{
					NotificationsManager.Broadcast("Cold Winds Blow!");
					TriggerWind();
				}
				return;
			}
			case "Blizzards":
				NotificationsManager.Broadcast("A blizzard rolls in!");
				TriggerBlizzard(list);
				return;
			case "Tornado":
				num = PickCount(Plugin.MinCount.Value, Plugin.MaxCount.Value);
				break;
			case "Dynamite":
				num = PickCount(Plugin.DynamiteMinCount.Value, Plugin.DynamiteMaxCount.Value);
				break;
			case "Bugs":
				num = list.Count * 3;
				break;
			case "BigGhosts":
				num = Mathf.Max(1, list.Count / 2);
				break;
			case "Tumbleweeds":
				num = list.Count * 4;
				break;
			default:
				num = list.Count;
				break;
			}
			Plugin.Log.LogInfo((object)$"Spawning {num} {text}(s); next wave in {_nextInterval:0.0}s.");
			switch (text)
			{
			case "Tornado":
				NotificationsManager.Broadcast("Tornado incoming!");
				break;
			case "Dynamite":
				NotificationsManager.Broadcast("Dynamite lit!");
				break;
			case "Zombie":
				NotificationsManager.Broadcast("They're coming to get you Scout!");
				break;
			case "Bugs":
				NotificationsManager.Broadcast("MY BUGS!");
				break;
			case "Frogs":
				NotificationsManager.Broadcast("Ribbit!");
				break;
			case "Cannons":
				NotificationsManager.Broadcast("FIRING THE CANNONS!");
				break;
			case "BigGhosts":
				NotificationsManager.Broadcast("Boo Buddies!");
				break;
			case "Tumbleweeds":
				NotificationsManager.Broadcast("Its Highnoon!");
				break;
			}
			for (int num3 = 0; num3 < num; num3++)
			{
				Character target = list[Random.Range(0, list.Count)];
				List<Character> list3 = list.Where((Character p) => (Object)(object)p != (Object)(object)target).ToList();
				Character spawnNear = ((list3.Count > 0) ? list3[Random.Range(0, list3.Count)] : target);
				switch (text)
				{
				case "Tornado":
					((MonoBehaviour)this).StartCoroutine(SpawnTornado(target, spawnNear));
					break;
				case "Dynamite":
					((MonoBehaviour)this).StartCoroutine(SpawnDynamite(spawnNear));
					break;
				case "Zombie":
					((MonoBehaviour)this).StartCoroutine(SpawnZombie(spawnNear));
					break;
				case "Bugs":
					((MonoBehaviour)this).StartCoroutine(SpawnBugs(spawnNear));
					break;
				case "Frogs":
					((MonoBehaviour)this).StartCoroutine(SpawnFrogs(spawnNear));
					break;
				case "Cannons":
					((MonoBehaviour)this).StartCoroutine(SpawnCannon(spawnNear));
					break;
				case "BigGhosts":
					((MonoBehaviour)this).StartCoroutine(SpawnBigGhost(spawnNear));
					break;
				case "Tumbleweeds":
					((MonoBehaviour)this).StartCoroutine(SpawnTumbleweeds(spawnNear));
					break;
				}
			}
		}

		private IEnumerator SpawnTornado(Character target, Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 center = spawnNear.Center;
			GameObject val = PhotonNetwork.Instantiate("Tornado", center, Quaternion.identity, (byte)0, (object[])null);
			int viewID = val.GetComponent<PhotonView>().ViewID;
			TornadoTargets[viewID] = target;
			Plugin.Log.LogInfo((object)$"Tornado {viewID} spawned near {((Object)spawnNear).name}, chasing {((Object)target).name}.");
		}

		private IEnumerator SpawnZombie(Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 center = spawnNear.Center;
			PhotonNetwork.Instantiate("MushroomZombie", center, Quaternion.identity, (byte)0, (object[])null);
			Plugin.Log.LogInfo((object)$"Zombie spawned near {((Object)spawnNear).name} at {center}.");
		}

		private IEnumerator SpawnBugs(Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(Random.Range(-2f, 2f), 0f, Random.Range(-2f, 2f));
			Vector3 val2 = spawnNear.Center + val;
			GameObject bugObj = null;
			int randomBug = Random.Range(1, 4);
			switch (randomBug)
			{
			case 1:
				bugObj = PhotonNetwork.InstantiateItemRoom("Scorpion", val2, Quaternion.identity);
				break;
			case 2:
				bugObj = PhotonNetwork.InstantiateItemRoom("Beetle", val2, Quaternion.identity);
				break;
			case 3:
				bugObj = PhotonNetwork.InstantiateItemRoom("Beehive", val2, Quaternion.identity);
				break;
			}
			if ((Object)(object)bugObj == (Object)null)
			{
				Plugin.Log.LogWarning((object)"Spawned object has no Bug component");
				yield break;
			}
			Plugin.Log.LogInfo((object)$"Bug spawned near {((Object)spawnNear).name} at {val2}");
			yield return (object)new WaitForSeconds(30f);
			if (randomBug == 3)
			{
				Beehive component = bugObj.GetComponent<Beehive>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.currentBees != (Object)null)
				{
					PhotonNetwork.Destroy(((Component)component.currentBees).gameObject);
				}
				if ((Object)(object)bugObj != (Object)null)
				{
					PhotonNetwork.Destroy(bugObj);
				}
			}
			else if ((Object)(object)bugObj != (Object)null)
			{
				PhotonNetwork.Destroy(bugObj);
			}
		}

		private IEnumerator SpawnFrogs(Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(Random.Range(-5f, 5f), 0f, Random.Range(-5f, 5f));
			Vector3 val2 = spawnNear.Center + val;
			GameObject frogObj;
			try
			{
				frogObj = PhotonNetwork.InstantiateItemRoom("Frog", val2, Quaternion.identity);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[frog] spawn failed: " + ex.GetType().Name + ": " + ex.Message));
				yield break;
			}
			Plugin.Log.LogInfo((object)$"Frog spawned near {((Object)spawnNear).name} at {val2}");
			yield return (object)new WaitForSeconds(45f);
			if ((Object)(object)frogObj != (Object)null)
			{
				PhotonNetwork.Destroy(frogObj);
			}
		}

		private IEnumerator EmoteRoutine(List<Character> players)
		{
			TriggerEmotes(players);
			yield return (object)new WaitForSeconds(15f);
			TriggerEmotes(players);
		}

		private IEnumerator SpawnCannon(Character spawnNear)
		{
			spawnNear.refs.view.RPC("RPCA_Fall", (RpcTarget)0, new object[2] { 4f, 0f });
			yield return (object)new WaitForSeconds(0.5f);
			Quaternion val = Quaternion.Euler(-55f, Random.Range(0f, 360f), 0f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(0f, 0.5f, 0f);
			GameObject cannon;
			try
			{
				cannon = PhotonNetwork.Instantiate("ScoutCannon_Placed", spawnNear.Center - val2, val, (byte)0, (object[])null);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[cannon] spawn failed: " + ex.GetType().Name + ": " + ex.Message));
				yield break;
			}
			if (!((Object)(object)cannon == (Object)null))
			{
				Transform val3 = cannon.transform.Find("Cannon/Entry");
				if ((Object)(object)val3 != (Object)null)
				{
					Transform transform = cannon.transform;
					transform.position += spawnNear.Center - val3.position;
				}
				cannon.GetComponent<ScoutCannon>().Light();
				yield return (object)new WaitForSeconds(15f);
				if ((Object)(object)cannon != (Object)null)
				{
					PhotonNetwork.Destroy(cannon);
				}
			}
		}

		private IEnumerator SpawnDynamite(Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(Random.Range(-2f, 2f), Random.Range(0.5f, 1.5f), Random.Range(-2f, 2f));
			Vector3 val2 = spawnNear.Center + val;
			GameObject val3;
			try
			{
				val3 = PhotonNetwork.InstantiateItemRoom("Dynamite", val2, Quaternion.identity);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("Dynamite spawn failed: " + ex.Message));
				yield break;
			}
			Dynamite component = val3.GetComponent<Dynamite>();
			if ((Object)(object)component == (Object)null)
			{
				Plugin.Log.LogWarning((object)"Spawned object has no Dynamite component.");
				yield break;
			}
			component.LightFlare();
			Plugin.Log.LogInfo((object)$"Dynamite spawnewd and lit near {((Object)spawnNear).name} at {val2}.");
		}

		private IEnumerator SpawnBigGhost(Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 center = spawnNear.Center;
			float num = (float)Random.Range(1, 3) * 5f;
			float num2 = ((Random.Range(0, 2) == 0) ? (-1f) : 1f);
			float num3 = (float)Random.Range(1, 3) * 5f;
			float num4 = ((Random.Range(0, 2) == 0) ? (-1f) : 1f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(num * num2, 0f, num3 * num4);
			GameObject val2;
			try
			{
				val2 = PhotonNetwork.Instantiate("GhostBall", center + val, Quaternion.identity, (byte)0, (object[])null);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[ghost] spawn failed: " + ex.GetType().Name + ": " + ex.Message));
				yield break;
			}
			if (!((Object)(object)val2 == (Object)null))
			{
				Plugin.Log.LogInfo((object)("[ghost] spawned near " + ((Object)spawnNear).name));
			}
		}

		private IEnumerator SpawnTumbleweeds(Character spawnNear)
		{
			yield return (object)new WaitForSeconds(0.5f);
			Vector3 center = spawnNear.Center;
			float num = (float)Random.Range(0, 3) * 3f;
			float num2 = ((Random.Range(0, 2) == 0) ? (-1f) : 1f);
			float num3 = (float)Random.Range(0, 3) * 3f;
			float num4 = ((Random.Range(0, 2) == 0) ? (-1f) : 1f);
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(num * num2, 0f, num3 * num4);
			GameObject tumbleweedObj;
			try
			{
				tumbleweedObj = PhotonNetwork.Instantiate("TumbleWeed", center + val, Quaternion.identity, (byte)0, (object[])null);
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)("[tumbleweed] spawn failed: " + ex.GetType().Name + ": " + ex.Message));
				yield break;
			}
			if (!((Object)(object)tumbleweedObj == (Object)null))
			{
				Plugin.Log.LogInfo((object)("[tumbleweed] spawned near " + ((Object)spawnNear).name));
				yield return (object)new WaitForSeconds(25f);
				if ((Object)(object)tumbleweedObj != (Object)null)
				{
					PhotonNetwork.Destroy(tumbleweedObj);
				}
			}
		}
	}
	public class FollowTarget : MonoBehaviour
	{
		public Character? Target;

		private void Update()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Target != (Object)null)
			{
				((Component)this).transform.position = Target.Center;
			}
		}
	}
	[HarmonyPatch(typeof(Tornado), "Start")]
	public static class Patch_Tornado_Start
	{
		private static void Postfix(Tornado __instance)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("TornadoTarget");
			val.transform.position = ((Component)__instance).transform.position;
			GameObject val2 = new GameObject("TornadoPoints");
			val2.transform.SetParent(val.transform);
			GameObject val3 = new GameObject("Target0");
			val3.transform.SetParent(val2.transform);
			val3.transform.position = ((Component)__instance).transform.position;
			int viewID = ((Component)__instance).GetComponent<PhotonView>().ViewID;
			if (EffectManager.TornadoTargets.TryGetValue(viewID, out Character value))
			{
				FollowTarget followTarget = val3.AddComponent<FollowTarget>();
				followTarget.Target = value;
				EffectManager.TornadoTargets.Remove(viewID);
			}
			typeof(Tornado).GetField("targetParent", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, val2.transform);
			ApplyTornadoColor(__instance, viewID);
			if (PhotonNetwork.IsMasterClient)
			{
				typeof(Tornado).GetField("lifeTime", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, Random.Range(15f, 25f));
			}
			static void ApplyTornadoColor(Tornado tornado, int num)
			{
				//IL_008b: 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_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: 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)
				//IL_010a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				Color[] array = (Color[])(object)new Color[7];
				ColorUtility.TryParseHtmlString("#ffe552", ref array[0]);
				ColorUtility.TryParseHtmlString("#FF69B4", ref array[1]);
				ColorUtility.TryParseHtmlString("#1900ff", ref array[2]);
				ColorUtility.TryParseHtmlString("#48ff00", ref array[3]);
				ColorUtility.TryParseHtmlString("#9400D3", ref array[4]);
				ColorUtility.TryParseHtmlString("#e70f0f", ref array[5]);
				ColorUtility.TryParseHtmlString("#FF800D", ref array[6]);
				Color val4 = array[num % array.Length];
				Color val5 = val4 * 0.6f;
				Renderer[] componentsInChildren = ((Component)tornado).GetComponentsInChildren<Renderer>();
				Renderer[] array2 = componentsInChildren;
				foreach (Renderer val6 in array2)
				{
					if (((Object)val6).name == "Smoke")
					{
						val6.material.SetColor("_Color", val4);
						val6.material.SetColor("_Color2", val5);
					}
					else
					{
						val6.material.SetColor("_Color1", val4);
						val6.material.SetColor("_Color2", val5);
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(Dynamite), "EnableFlareVisuals")]
	public static class Patch_Dynamite_EnableFlareVisuals
	{
		private static void Postfix(Dynamite __instance)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			int viewID = ((Component)__instance).GetComponent<PhotonView>().ViewID;
			Color[] array = (Color[])(object)new Color[7];
			ColorUtility.TryParseHtmlString("#ffe552", ref array[0]);
			ColorUtility.TryParseHtmlString("#FF69B4", ref array[1]);
			ColorUtility.TryParseHtmlString("#1900ff", ref array[2]);
			ColorUtility.TryParseHtmlString("#48ff00", ref array[3]);
			ColorUtility.TryParseHtmlString("#9400D3", ref array[4]);
			ColorUtility.TryParseHtmlString("#e70f0f", ref array[5]);
			ColorUtility.TryParseHtmlString("#FF800D", ref array[6]);
			Color chosen = array[viewID % array.Length];
			ColorParticles((Component)(object)__instance, chosen);
			TrackNetworkedObject[] array2 = Object.FindObjectsByType<TrackNetworkedObject>((FindObjectsSortMode)0);
			foreach (TrackNetworkedObject val in array2)
			{
				if (!(Vector3.Distance(((Component)val).transform.position, ((Component)__instance).transform.position) > 2f))
				{
					ColorParticles((Component)(object)val, chosen);
					ColorRenderers((Component)(object)val, chosen);
				}
			}
			static void ColorParticles(Component root, Color val3)
			{
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: 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_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)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				ParticleSystem[] componentsInChildren = root.GetComponentsInChildren<ParticleSystem>(true);
				foreach (ParticleSystem val2 in componentsInChildren)
				{
					MainModule main = val2.main;
					((MainModule)(ref main)).startColor = new MinMaxGradient(val3);
					ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime;
					if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
					{
						((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val3);
					}
				}
			}
			static void ColorRenderers(Component root, Color val3)
			{
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val2 in componentsInChildren)
				{
					Material material = val2.material;
					Shader shader = material.shader;
					for (int k = 0; k < shader.GetPropertyCount(); k++)
					{
						if ((int)shader.GetPropertyType(k) == 0)
						{
							Plugin.Log.LogInfo((object)("[smoke] color prop: " + shader.GetPropertyName(k)));
						}
					}
				}
			}
		}
	}
	[HarmonyPatch(typeof(Dynamite), "RPC_Explode")]
	public static class Patch_Dynamite_RPC_Explode
	{
		private static void Postfix(Dynamite __instance)
		{
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			int viewID = ((Component)__instance).GetComponent<PhotonView>().ViewID;
			Color[] array = (Color[])(object)new Color[7];
			ColorUtility.TryParseHtmlString("#ffe552", ref array[0]);
			ColorUtility.TryParseHtmlString("#FF69B4", ref array[1]);
			ColorUtility.TryParseHtmlString("#1900ff", ref array[2]);
			ColorUtility.TryParseHtmlString("#48ff00", ref array[3]);
			ColorUtility.TryParseHtmlString("#9400D3", ref array[4]);
			ColorUtility.TryParseHtmlString("#e70f0f", ref array[5]);
			ColorUtility.TryParseHtmlString("#FF800D", ref array[6]);
			Color val = array[viewID % array.Length];
			Vector3 position = ((Component)__instance).transform.position;
			ExplosionEffect[] array2 = Object.FindObjectsByType<ExplosionEffect>((FindObjectsSortMode)0);
			foreach (ExplosionEffect val2 in array2)
			{
				if (Vector3.Distance(((Component)val2).transform.position, position) > 0.5f)
				{
					continue;
				}
				ParticleSystem[] componentsInChildren = ((Component)val2).GetComponentsInChildren<ParticleSystem>(true);
				foreach (ParticleSystem val3 in componentsInChildren)
				{
					MainModule main = val3.main;
					((MainModule)(ref main)).startColor = new MinMaxGradient(val);
					ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime;
					if (((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled)
					{
						((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val);
					}
				}
				Renderer[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Renderer>(true);
				foreach (Renderer val4 in componentsInChildren2)
				{
					Material material = val4.material;
					Shader shader = material.shader;
					for (int l = 0; l < shader.GetPropertyCount(); l++)
					{
						if ((int)shader.GetPropertyType(l) == 0)
						{
							material.SetColor(shader.GetPropertyName(l), val);
						}
					}
					Plugin.Log.LogInfo((object)("[boom] '" + ((Object)val4).name + "' shader '" + ((Object)shader).name + "'"));
				}
			}
		}
	}
	[HarmonyPatch(typeof(WindChillZone), "RPCA_ToggleWind")]
	public static class Patch_WindChillZone_ToggleWind
	{
		private static float _origForce;

		private static Bounds _origBounds;

		private static bool _boosted;

		private static void Postfix(WindChillZone __instance, bool set, Vector3 windDir)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Mathf.Abs(windDir.y) > 0.001f;
			if (set && flag)
			{
				if (!_boosted)
				{
					_origForce = __instance.windForce;
					_origBounds = __instance.windZoneBounds;
					_boosted = true;
				}
				__instance.windForce = 80f;
				__instance.windZoneBounds = new Bounds(Vector3.zero, Vector3.one * 100000f);
			}
			else if (_boosted)
			{
				__instance.windForce = _origForce;
				__instance.windZoneBounds = _origBounds;
				_boosted = false;
			}
		}
	}
	[HarmonyPatch(typeof(DayNightManager), "UpdateCycle")]
	public static class Patch_DayNight_ForceSun
	{
		public static bool ForceBlazing;

		private static void Postfix(DayNightManager __instance)
		{
			if (ForceBlazing && (Object)(object)__instance.sun != (Object)null)
			{
				__instance.sun.intensity = 6f;
			}
		}
	}
	[HarmonyPatch(typeof(TumbleWeed), "Start")]
	public static class Patch_TumbleWeed_Start
	{
		private static void Postfix(TumbleWeed __instance)
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			int viewID = ((Component)__instance).GetComponent<PhotonView>().ViewID;
			float rollForce = ((Random.Range(0, 2) == 0) ? 10f : 20f);
			__instance.rollForce = rollForce;
			Color[] array = (Color[])(object)new Color[7];
			ColorUtility.TryParseHtmlString("#ffe552", ref array[0]);
			ColorUtility.TryParseHtmlString("#FF69B4", ref array[1]);
			ColorUtility.TryParseHtmlString("#1900ff", ref array[2]);
			ColorUtility.TryParseHtmlString("#48ff00", ref array[3]);
			ColorUtility.TryParseHtmlString("#9400D3", ref array[4]);
			ColorUtility.TryParseHtmlString("#e70f0f", ref array[5]);
			ColorUtility.TryParseHtmlString("#FF800D", ref array[6]);
			Color val = array[viewID % array.Length];
			Color val2 = val * 0.3f;
			Renderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Renderer>();
			foreach (Renderer val3 in componentsInChildren)
			{
				val3.material.SetColor("_BaseColor", val);
				val3.material.SetColor("_Tint", val2);
			}
		}
	}
	internal static class NotificationsManager
	{
		internal class NotificationRelay : MonoBehaviour, IOnEventCallback
		{
			private void OnEnable()
			{
				PhotonNetwork.AddCallbackTarget((object)this);
			}

			private void OnDisable()
			{
				PhotonNetwork.RemoveCallbackTarget((object)this);
			}

			public void OnEvent(EventData photonEvent)
			{
				if (photonEvent.Code == 71)
				{
					Show((string)photonEvent.CustomData);
				}
				else if (photonEvent.Code == 72)
				{
					EffectManager.Instance.RunHotSunLocal();
				}
				else if (photonEvent.Code == 73)
				{
					EffectManager.Instance.RunBlizzardLocal();
				}
			}
		}

		private static PlayerConnectionLog? _log;

		private static MethodInfo? _addMessage;

		private const string Size = "150%";

		private static readonly string[] Colors = new string[6] { "FF800D", "f9275e", "f3bd10", "FF4444", "44CCFF", "44DD44" };

		internal const byte EventCode = 71;

		internal const byte HotSunCode = 72;

		internal const byte BlizzardCode = 73;

		public static void Show(string text)
		{
			if ((Object)(object)_log == (Object)null)
			{
				_log = Object.FindFirstObjectByType<PlayerConnectionLog>((FindObjectsInactive)1);
				_addMessage = AccessTools.Method(typeof(PlayerConnectionLog), "AddMessage", (Type[])null, (Type[])null);
			}
			if ((Object)(object)_log == (Object)null || _addMessage == null)
			{
				Plugin.Log.LogWarning((object)"[notif] PlayerConnectionLog not found");
				return;
			}
			string text2 = Colors[Random.Range(0, Colors.Length)];
			string text3 = "<size=150%><color=#" + text2 + ">" + text + "</color></size>";
			_addMessage.Invoke(_log, new object[1] { text3 });
		}

		public static void Broadcast(string text)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			PhotonNetwork.RaiseEvent((byte)71, (object)text, new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)1
			}, SendOptions.SendReliable);
		}
	}
	[BepInPlugin("Thraac.TheBadOnes", "TheBadOnes", "0.5.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigEntry<float> MinInterval;

		internal static ConfigEntry<float> MaxInterval;

		internal static ConfigEntry<int> MinCount;

		internal static ConfigEntry<int> MaxCount;

		internal static ConfigEntry<KeyCode> ToggleMenuKey;

		internal static ConfigEntry<bool> TornadoesEnabled;

		internal static ConfigEntry<bool> DynamiteEnabled;

		internal static ConfigEntry<bool> ZombiesEnabled;

		internal static ConfigEntry<int> DynamiteMinCount;

		internal static ConfigEntry<int> DynamiteMaxCount;

		internal static ConfigEntry<bool> WindEnabled;

		internal static ConfigEntry<bool> BugsEnabled;

		internal static ConfigEntry<bool> EmotesEnabled;

		internal static ConfigEntry<bool> HotSunEnabled;

		internal static ConfigEntry<bool> FrogsEnabled;

		internal static ConfigEntry<bool> CannonsEnabled;

		internal static ConfigEntry<bool> BigGhostEnabled;

		internal static ConfigEntry<bool> TumbleweedsEnabled;

		internal static ConfigEntry<bool> BlizzardsEnabled;

		private Harmony _harmony;

		public const string Id = "Thraac.TheBadOnes";

		internal static ManualLogSource Log { get; private set; }

		internal static ConfigFile Conf { get; private set; }

		public static string Name => "TheBadOnes";

		public static string Version => "0.5.0";

		private void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Expected O, but got Unknown
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Expected O, but got Unknown
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Conf = ((BaseUnityPlugin)this).Config;
			MinInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Timing", "MinIntervalSeconds", 30f, new ConfigDescription("Shortest possible wait between tornado waves.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f), Array.Empty<object>()));
			MaxInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Timing", "MaxIntervalSeconds", 90f, new ConfigDescription("Longest possible wait between tornado waves.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f), Array.Empty<object>()));
			MinCount = ((BaseUnityPlugin)this).Config.Bind<int>("Amount", "MinTornadoes", 1, new ConfigDescription("Fewest tornadoes to spawn in a wave.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			MaxCount = ((BaseUnityPlugin)this).Config.Bind<int>("Amount", "MaxTornadoes", 3, new ConfigDescription("Most tornadoes to spawn in a wave.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			ToggleMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("UI", "ToggleMenuKey", (KeyCode)283, "Key to open/close the in-game settings menu.");
			TornadoesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Tornadoes", true, "Enable tornado spawns.");
			DynamiteEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Dynamite", true, "Enable Dynamite spawns.");
			ZombiesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Zombies", true, "Enable zombie spawns (one per player).");
			DynamiteMinCount = ((BaseUnityPlugin)this).Config.Bind<int>("Amount", "MinDynamite", 1, new ConfigDescription("Fewest dynamite to spawn in a wave.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			DynamiteMaxCount = ((BaseUnityPlugin)this).Config.Bind<int>("Amount", "MaxDynamite", 20, new ConfigDescription("Most dynamite to spawn in a wave.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>()));
			WindEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Wind", true, "Enable Wind Spawning.");
			BugsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Bugs", true, "Enable Bugs Spawning.");
			EmotesEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Emotes", true, "Enable forced emotes going off.");
			HotSunEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Sun", true, "Enable Hot Sun.");
			FrogsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Frogs", true, "Enable Frogs.");
			CannonsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Cannons", true, "Enable Cannons.");
			BigGhostEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "BigGhosts", true, "Enable Big Friendly Ghosts.");
			TumbleweedsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Tumbleweeds", true, "Enable an onslaught of tumbleweeds.");
			BlizzardsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Blizzards", true, "Enable a harsh frigid wind.");
			((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
			_harmony = new Harmony("Thraac.TheBadOnes");
			_harmony.PatchAll();
			GameObject val = new GameObject("TheBadOnes");
			val.AddComponent<EffectManager>();
			val.AddComponent<TornadoConfigUI>();
			val.AddComponent<NotificationsManager.NotificationRelay>();
			Object.DontDestroyOnLoad((Object)(object)val);
			Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
		}
	}
	public class TornadoConfigUI : MonoBehaviour
	{
		private bool _open;

		private Rect _window = new Rect(150f, 40f, 340f, 700f);

		private GUIStyle? _titleStyle;

		private GUIStyle? _thumbStyle;

		private GUIStyle? _sliderStyle;

		private GUIStyle? _windowStyle;

		private Texture2D? _bgTex;

		private void Update()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Plugin.ToggleMenuKey.Value))
			{
				ToggleMenu();
			}
			if (_open)
			{
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
			}
		}

		private void ToggleMenu()
		{
			_open = !_open;
			if (!_open)
			{
				Plugin.Conf.Save();
			}
		}

		private void ScanNearby()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			Vector3 center = localCharacter.Center;
			Transform[] array = Object.FindObjectsByType<Transform>((FindObjectsSortMode)0);
			foreach (Transform val in array)
			{
				float num = Vector3.Distance(val.position, center);
				if (!(num > 4f))
				{
					string[] value = Array.ConvertAll(((Component)val).GetComponents<Component>(), (Component c) => ((object)c).GetType().Name);
					Plugin.Log.LogInfo((object)string.Format("[near] {0} @ {1:0.0}m :: {2}", ((Object)val).name, num, string.Join(", ", value)));
				}
			}
		}

		private void OnGUI()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (_open)
			{
				GUI.skin.window.fontSize = 18;
				GUI.skin.window.fontStyle = (FontStyle)1;
				_window = GUI.Window(((Object)this).GetInstanceID(), _window, new WindowFunction(DrawWindow), "The Bad Ones: Controls", _windowStyle);
			}
		}

		private void EnsureStyles()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Expected O, but got Unknown
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			if (_titleStyle == null)
			{
				_bgTex = MakeRoundedTex(Color32.op_Implicit(new Color32((byte)156, (byte)154, (byte)95, byte.MaxValue)), 32, 10);
				_windowStyle = new GUIStyle(GUI.skin.window);
				_windowStyle.normal.background = _bgTex;
				_windowStyle.onNormal.background = _bgTex;
				_windowStyle.border = new RectOffset(10, 10, 10, 10);
				GUI.skin.label.fontSize = 15;
				GUI.skin.toggle.fontSize = 15;
				GUI.skin.button.fontSize = 15;
				SetTextColor(GUI.skin.label, Color.white);
				SetTextColor(GUI.skin.button, Color.white);
				SetTextColor(GUI.skin.toggle, Color.white);
				SetTextColor(GUI.skin.window, Color.white);
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 16,
					fontStyle = (FontStyle)1
				};
				val.normal.textColor = Color.white;
				_titleStyle = val;
				_sliderStyle = new GUIStyle(GUI.skin.horizontalSlider)
				{
					fixedHeight = 18f
				};
				_thumbStyle = new GUIStyle(GUI.skin.horizontalSliderThumb)
				{
					fixedHeight = 24f,
					fixedWidth = 24f
				};
			}
		}

		private void DrawWindow(int id)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			EnsureStyles();
			GUI.backgroundColor = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
			GUI.contentColor = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
			GUILayout.Space(24f);
			GUILayout.Label($"Wave interval: {Plugin.MinInterval.Value:0} - {Plugin.MaxInterval.Value:0} sec", _titleStyle, Array.Empty<GUILayoutOption>());
			FloatSlider("Min secs", Plugin.MinInterval, 5f, Plugin.MaxInterval.Value);
			FloatSlider("Max secs", Plugin.MaxInterval, Plugin.MinInterval.Value, 300f);
			GUILayout.Space(12f);
			GUILayout.Label($"Tornadoes per wave: {Plugin.MinCount.Value} - {Plugin.MaxCount.Value}", Array.Empty<GUILayoutOption>());
			IntSlider("Min count", Plugin.MinCount, 1, Plugin.MaxCount.Value);
			IntSlider("Max count", Plugin.MaxCount, Plugin.MinCount.Value, 20);
			GUILayout.Space(12f);
			GUILayout.Label($"Dynamite per wave: {Plugin.DynamiteMinCount.Value} - {Plugin.DynamiteMaxCount.Value}", Array.Empty<GUILayoutOption>());
			IntSlider("Min count", Plugin.DynamiteMinCount, 1, Plugin.DynamiteMaxCount.Value);
			IntSlider("Max count", Plugin.DynamiteMaxCount, Plugin.DynamiteMinCount.Value, 20);
			GUILayout.Space(12f);
			GUILayout.Label("Spawning Options:", Array.Empty<GUILayoutOption>());
			Plugin.TornadoesEnabled.Value = GUILayout.Toggle(Plugin.TornadoesEnabled.Value, " Tornadoes", Array.Empty<GUILayoutOption>());
			Plugin.DynamiteEnabled.Value = GUILayout.Toggle(Plugin.DynamiteEnabled.Value, " Dynamite", Array.Empty<GUILayoutOption>());
			Plugin.ZombiesEnabled.Value = GUILayout.Toggle(Plugin.ZombiesEnabled.Value, " Zombies", Array.Empty<GUILayoutOption>());
			Plugin.WindEnabled.Value = GUILayout.Toggle(Plugin.WindEnabled.Value, " Wind", Array.Empty<GUILayoutOption>());
			Plugin.BugsEnabled.Value = GUILayout.Toggle(Plugin.BugsEnabled.Value, " Bugs", Array.Empty<GUILayoutOption>());
			Plugin.EmotesEnabled.Value = GUILayout.Toggle(Plugin.EmotesEnabled.Value, " Emotes", Array.Empty<GUILayoutOption>());
			Plugin.HotSunEnabled.Value = GUILayout.Toggle(Plugin.HotSunEnabled.Value, " Hot Sun", Array.Empty<GUILayoutOption>());
			Plugin.FrogsEnabled.Value = GUILayout.Toggle(Plugin.FrogsEnabled.Value, " Frogs", Array.Empty<GUILayoutOption>());
			Plugin.CannonsEnabled.Value = GUILayout.Toggle(Plugin.CannonsEnabled.Value, " Cannons", Array.Empty<GUILayoutOption>());
			Plugin.BigGhostEnabled.Value = GUILayout.Toggle(Plugin.BigGhostEnabled.Value, " Big Ghosts", Array.Empty<GUILayoutOption>());
			Plugin.TumbleweedsEnabled.Value = GUILayout.Toggle(Plugin.TumbleweedsEnabled.Value, " Tumbleweeds", Array.Empty<GUILayoutOption>());
			GUILayout.Space(12f);
			if (GUILayout.Button("Close", Array.Empty<GUILayoutOption>()))
			{
				ToggleMenu();
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f));
		}

		private void FloatSlider(string label, ConfigEntry<float> entry, float min, float max)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			entry.Value = Mathf.Round(GUILayout.HorizontalSlider(entry.Value, min, max, _sliderStyle, _thumbStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }));
			GUILayout.Label(entry.Value.ToString("0"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.EndHorizontal();
		}

		private void IntSlider(string label, ConfigEntry<int> entry, int min, int max)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			entry.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)entry.Value, (float)min, (float)max, _sliderStyle, _thumbStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) }));
			GUILayout.Label(entry.Value.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(35f) });
			GUILayout.EndHorizontal();
		}

		private static void SetTextColor(GUIStyle s, Color c)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0057: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			GUIStyleState normal = s.normal;
			GUIStyleState hover = s.hover;
			GUIStyleState active = s.active;
			Color val = (s.focused.textColor = c);
			Color val3 = (active.textColor = val);
			Color textColor = (hover.textColor = val3);
			normal.textColor = textColor;
			GUIStyleState onNormal = s.onNormal;
			GUIStyleState onHover = s.onHover;
			GUIStyleState onActive = s.onActive;
			val = (s.onFocused.textColor = c);
			val3 = (onActive.textColor = val);
			textColor = (onHover.textColor = val3);
			onNormal.textColor = textColor;
		}

		private static Texture2D MakeTex(Color c)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, c);
			val.Apply();
			return val;
		}

		private static Texture2D MakeRoundedTex(Color col, int size, int radius)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					int num = Mathf.Min(j, size - 1 - j);
					int num2 = Mathf.Min(i, size - 1 - i);
					Color val2 = col;
					if (num < radius && num2 < radius)
					{
						float num3 = Mathf.Sqrt((float)((radius - num) * (radius - num) + (radius - num2) * (radius - num2)));
						if (num3 > (float)radius)
						{
							val2.a = 0f;
						}
					}
					val.SetPixel(j, i, val2);
				}
			}
			val.Apply();
			return val;
		}
	}
}
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
	{
	}
}