Decompiled source of Round Modifiers v1.0.3

RoundModifiers.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using InControl;
using SFQoL;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyCompany("RoundModifiers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+562f2a5697c435654782039a6e570db5445afc1f")]
[assembly: AssemblyProduct("RoundModifiers")]
[assembly: AssemblyTitle("RoundModifiers")]
[assembly: AssemblyVersion("1.0.2.0")]
namespace SFQoL
{
	internal static class Compat
	{
		private static bool searched;

		private static FieldInfo roundsActive;

		private static PropertyInfo roundsArmed;

		private static FieldInfo cardPicking;

		private static bool cardSearched;

		public static bool Rounds
		{
			get
			{
				Find();
				try
				{
					if ((object)roundsArmed != null && (bool)roundsArmed.GetValue(null, null))
					{
						return true;
					}
					if ((object)roundsActive != null && (bool)roundsActive.GetValue(null))
					{
						return true;
					}
				}
				catch
				{
				}
				return false;
			}
		}

		public static bool CardScreen
		{
			get
			{
				if (!cardSearched)
				{
					Type type = RoundsType("StickRounds.CardPick");
					cardSearched = (object)type != null || Time.frameCount > 1;
					if ((object)type != null)
					{
						cardPicking = type.GetField("Picking", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					}
				}
				try
				{
					return (object)cardPicking != null && (bool)cardPicking.GetValue(null);
				}
				catch
				{
					return false;
				}
			}
		}

		public static bool RoundsMatch
		{
			get
			{
				Find();
				try
				{
					return (object)roundsActive != null && (bool)roundsActive.GetValue(null) && !GameManager.stillInMenu;
				}
				catch
				{
					return false;
				}
			}
		}

		private static Type RoundsType(string name)
		{
			if (!Chainloader.PluginInfos.TryGetValue("stickfight.stickrounds", out var value) || (Object)(object)value.Instance == (Object)null)
			{
				return null;
			}
			return ((object)value.Instance).GetType().Assembly.GetType(name, throwOnError: false);
		}

		private static void Find()
		{
			if (!searched)
			{
				Type type = RoundsType("StickRounds.RoundsMode");
				searched = (object)type != null || Time.frameCount > 1;
				if ((object)type != null)
				{
					roundsActive = type.GetField("Active", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					roundsArmed = type.GetProperty("Armed", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				}
			}
		}

		public static bool IsBotDevice(InputDevice d)
		{
			if (d != null)
			{
				return ((object)d).GetType().Name == "BotDevice";
			}
			return false;
		}
	}
	internal static class QolConfig
	{
		public static ConfigEntry<bool> Enabled(ConfigFile config, string section, string description)
		{
			return config.Bind<bool>(section, "Enabled", true, description);
		}

		private static Dictionary<ConfigDefinition, string> Orphans(ConfigFile config)
		{
			return Traverse.Create((object)config).Property("OrphanedEntries", (object[])null).GetValue<Dictionary<ConfigDefinition, string>>();
		}

		public static string Old(ConfigFile config, string section, string key)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			Dictionary<ConfigDefinition, string> dictionary = Orphans(config);
			if (dictionary == null || !dictionary.TryGetValue(new ConfigDefinition(section, key), out var value))
			{
				return null;
			}
			return value;
		}

		public static void SetOld(ConfigFile config, string section, string key, string value)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			Dictionary<ConfigDefinition, string> dictionary = Orphans(config);
			if (dictionary != null)
			{
				dictionary[new ConfigDefinition(section, key)] = value;
			}
		}

		public static void DropOld(ConfigFile config)
		{
			Dictionary<ConfigDefinition, string> dictionary = Orphans(config);
			if (dictionary != null && dictionary.Count != 0)
			{
				dictionary.Clear();
				config.Save();
			}
		}
	}
	internal static class Ui
	{
		public static readonly Color Panel = new Color(0.176f, 0.176f, 0.176f);

		public static readonly Color Strip = new Color(0.147f, 0.147f, 0.147f);

		public static readonly Color Item = new Color(0.265f, 0.265f, 0.265f);

		public static readonly Color Grey = new Color(0.6f, 0.6f, 0.6f);

		private static TMP_FontAsset font;

		private static Sprite box;

		private static bool boxSearched;

		private static Camera menuCam;

		private static float menuCamSearchAt;

		public static TMP_FontAsset Font
		{
			get
			{
				if ((Object)(object)font == (Object)null)
				{
					GameManager instance = GameManager.Instance;
					if ((Object)(object)instance != (Object)null && (Object)(object)instance.winText != (Object)null)
					{
						font = ((TMP_Text)instance.winText).font;
					}
					if ((Object)(object)font == (Object)null)
					{
						TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
						foreach (TMP_FontAsset val in array)
						{
							if (((Object)val).name.StartsWith("Anton"))
							{
								font = val;
								break;
							}
						}
					}
				}
				return font;
			}
		}

		public static Sprite BoxSprite
		{
			get
			{
				if ((Object)(object)box == (Object)null && !boxSearched)
				{
					boxSearched = true;
					Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>();
					foreach (Sprite val in array)
					{
						if (((Object)val).name == "box")
						{
							box = val;
							break;
						}
					}
				}
				return box;
			}
		}

		public static int MenuLayer
		{
			get
			{
				int num = LayerMask.NameToLayer("MENU");
				if (num < 0)
				{
					return 31;
				}
				return num;
			}
		}

		public static void Attach(Canvas c)
		{
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Invalid comparison between Unknown and I4
			if ((Object)(object)c == (Object)null)
			{
				return;
			}
			if (((Object)(object)menuCam == (Object)null || !((Behaviour)menuCam).isActiveAndEnabled) && Time.unscaledTime >= menuCamSearchAt)
			{
				menuCamSearchAt = Time.unscaledTime + 1f;
				menuCam = null;
				Camera[] allCameras = Camera.allCameras;
				foreach (Camera val in allCameras)
				{
					if (((Object)val).name == "Camera_Pause" && (val.cullingMask & (1 << MenuLayer)) != 0)
					{
						menuCam = val;
						break;
					}
				}
			}
			if ((Object)(object)menuCam != (Object)null && ((Behaviour)menuCam).isActiveAndEnabled)
			{
				if ((int)c.renderMode != 1 || (Object)(object)c.worldCamera != (Object)(object)menuCam)
				{
					c.renderMode = (RenderMode)1;
					c.worldCamera = menuCam;
					c.planeDistance = 1f;
				}
			}
			else if ((int)c.renderMode != 0)
			{
				c.renderMode = (RenderMode)0;
			}
		}

		public static Canvas MakeCanvas(string name, int order)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0017: 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)
			GameObject val = new GameObject(name)
			{
				layer = MenuLayer
			};
			Object.DontDestroyOnLoad((Object)val);
			Canvas val2 = val.AddComponent<Canvas>();
			val2.renderMode = (RenderMode)0;
			val2.sortingOrder = order;
			Attach(val2);
			CanvasScaler obj = val.AddComponent<CanvasScaler>();
			obj.uiScaleMode = (ScaleMode)1;
			obj.referenceResolution = new Vector2(1920f, 1080f);
			obj.matchWidthOrHeight = 0.5f;
			return val2;
		}

		public static RectTransform Rect(Transform parent, string name)
		{
			//IL_0014: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) })
			{
				layer = ((Component)parent).gameObject.layer
			};
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0.5f, 0.5f);
			val2.anchorMax = val3;
			val2.anchorMin = val3;
			val2.pivot = new Vector2(0.5f, 0.5f);
			return val2;
		}

		public static Image Box(Transform parent, string name, Color color, Vector2 pos, Vector2 size, bool rounded = false)
		{
			//IL_0008: 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_0022: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			RectTransform obj = Rect(parent, name);
			obj.anchoredPosition = pos;
			obj.sizeDelta = size;
			Image val = ((Component)obj).gameObject.AddComponent<Image>();
			((Graphic)val).color = color;
			((Graphic)val).raycastTarget = false;
			if (rounded && (Object)(object)BoxSprite != (Object)null)
			{
				val.sprite = BoxSprite;
				Vector4 border = BoxSprite.border;
				if (((Vector4)(ref border)).sqrMagnitude > 0f)
				{
					val.type = (Type)1;
				}
			}
			return val;
		}

		public static void Fill(RectTransform rt, float inset)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			rt.offsetMin = new Vector2(inset, inset);
			rt.offsetMax = new Vector2(0f - inset, 0f - inset);
		}

		public static TextMeshProUGUI Text(Transform parent, string name, string text, float size, Color color, TextAlignmentOptions align)
		{
			//IL_0032: 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)
			TextMeshProUGUI val = ((Component)Rect(parent, name)).gameObject.AddComponent<TextMeshProUGUI>();
			if ((Object)(object)Font != (Object)null)
			{
				((TMP_Text)val).font = Font;
			}
			((TMP_Text)val).fontSize = size;
			((Graphic)val).color = color;
			((TMP_Text)val).alignment = align;
			((TMP_Text)val).enableWordWrapping = false;
			((TMP_Text)val).richText = true;
			((Graphic)val).raycastTarget = false;
			((TMP_Text)val).text = text;
			return val;
		}

		public static Color PlayerColor(Controller c)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)c != (Object)null)
			{
				SpriteRenderer componentInChildren = ((Component)c).GetComponentInChildren<SpriteRenderer>();
				SetColorWhenDamaged val = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).GetComponent<SetColorWhenDamaged>() : null);
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)c).GetComponentInChildren<SetColorWhenDamaged>(true);
				}
				if ((Object)(object)val != (Object)null && val.startColor.a > 0f)
				{
					Color startColor = val.startColor;
					startColor.a = 1f;
					return startColor;
				}
				ControllerHandler instance = ControllerHandler.Instance;
				if ((Object)(object)instance != (Object)null && instance.colors != null && c.playerID >= 0 && c.playerID < instance.colors.Length && (Object)(object)instance.colors[c.playerID] != (Object)null)
				{
					return instance.colors[c.playerID].color;
				}
			}
			return Color.white;
		}

		public static Color SlotColor(int id)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			ControllerHandler instance = ControllerHandler.Instance;
			if ((Object)(object)instance != (Object)null && instance.colors != null && id >= 0 && id < instance.colors.Length && (Object)(object)instance.colors[id] != (Object)null)
			{
				Color color = instance.colors[id].color;
				color.a = 1f;
				return color;
			}
			return Color.white;
		}

		public static string Hex(Color c)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: 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)
			return "#" + ((int)(Mathf.Clamp01(c.r) * 255f)).ToString("X2") + ((int)(Mathf.Clamp01(c.g) * 255f)).ToString("X2") + ((int)(Mathf.Clamp01(c.b) * 255f)).ToString("X2");
		}

		public static string Colored(string text, Color c)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return "<color=" + Hex(c) + ">" + text + "</color>";
		}

		public static Color WithAlpha(Color c, float a)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			c.a = a;
			return c;
		}
	}
}
namespace RoundModifiers
{
	internal static class Flight
	{
		private sealed class Saved
		{
			public bool CanFly;

			public float Speed;
		}

		private static readonly Dictionary<Controller, Saved> saved = new Dictionary<Controller, Saved>();

		public static void Start()
		{
			Stop();
			ControllerHandler instance = ControllerHandler.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (Controller player in instance.players)
			{
				if (!((Object)(object)player == (Object)null))
				{
					Saved value = new Saved
					{
						CanFly = player.canFly,
						Speed = player.flySpeed
					};
					saved[player] = value;
					player.canFly = true;
					player.flySpeed = 1f;
				}
			}
		}

		public static void Stop()
		{
			foreach (KeyValuePair<Controller, Saved> item in saved)
			{
				if (!((Object)(object)item.Key == (Object)null))
				{
					item.Key.canFly = item.Value.CanFly;
					item.Key.flySpeed = item.Value.Speed;
				}
			}
			saved.Clear();
		}

		public static void Tick()
		{
			foreach (KeyValuePair<Controller, Saved> item in saved)
			{
				Controller key = item.Key;
				if (!((Object)(object)key == (Object)null) && key.canFly && key.HasControl && key.PlayerActions != null && ((OneAxisInputControl)key.PlayerActions.Throw).WasPressed)
				{
					key.Throw();
				}
			}
		}

		public static bool Flying(Controller c)
		{
			if ((Object)(object)c != (Object)null)
			{
				return saved.ContainsKey(c);
			}
			return false;
		}
	}
	[HarmonyPatch(typeof(BodyPart), "OnCollisionEnter")]
	internal static class FlightPickupPatch
	{
		private static void Prefix(BodyPart __instance, out Controller __state)
		{
			__state = null;
			if (Director.Has(Modifier.Flight))
			{
				Controller component = ((Component)((Component)__instance).transform.root).GetComponent<Controller>();
				if (Flight.Flying(component) && component.canFly)
				{
					component.canFly = false;
					__state = component;
				}
			}
		}

		private static void Postfix(Controller __state)
		{
			if ((Object)(object)__state != (Object)null)
			{
				__state.canFly = true;
			}
		}
	}
	internal class Hud : MonoBehaviour
	{
		private const float Hold = 1.4f;

		private const float Fly = 0.55f;

		private const float DockScale = 0.32f;

		private const float Gap = 4f;

		private static Hud inst;

		private Canvas canvas;

		private RectTransform root;

		private CanvasGroup group;

		private TextMeshProUGUI title;

		private TextMeshProUGUI sub;

		private float shownAt = -1f;

		private float windUntil;

		private float windDir;

		private string baseTitle = "";

		private readonly Vector3[] corners = (Vector3[])(object)new Vector3[4];

		private void Awake()
		{
			inst = this;
		}

		public static void Show(List<Modifier> mods)
		{
			if ((Object)(object)inst == (Object)null)
			{
				return;
			}
			if ((Object)(object)inst.canvas == (Object)null)
			{
				inst.Build();
			}
			List<string> list = new List<string>();
			List<string> list2 = new List<string>();
			foreach (Modifier mod in mods)
			{
				list.Add(mod.Title);
				list2.Add(mod.Sub);
			}
			inst.baseTitle = string.Join("  +  ", list.ToArray());
			((TMP_Text)inst.title).text = inst.baseTitle;
			((TMP_Text)inst.sub).text = string.Join("   ", list2.ToArray());
			inst.shownAt = Time.unscaledTime;
		}

		public static void Hide()
		{
			if ((Object)(object)inst != (Object)null)
			{
				inst.shownAt = -1f;
			}
		}

		public static void Wind(float dir)
		{
			if ((Object)(object)inst != (Object)null)
			{
				inst.windDir = dir;
				inst.windUntil = float.MaxValue;
			}
		}

		private void LateUpdate()
		{
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)canvas == (Object)null)
			{
				Build();
			}
			Ui.Attach(canvas);
			if (shownAt < 0f || PauseManager.isPaused)
			{
				group.alpha = Mathf.MoveTowards(group.alpha, 0f, Time.unscaledDeltaTime * 6f);
				return;
			}
			if (Director.Has(Modifier.Wind))
			{
				string text = baseTitle.Replace(Modifier.Wind.Title, Modifier.Wind.Title + ((windDir > 0f) ? " <<<" : " >>>"));
				if (((TMP_Text)title).text != text)
				{
					((TMP_Text)title).text = text;
				}
			}
			float num = Time.unscaledTime - shownAt;
			float num2 = Mathf.Clamp01(num / 0.35f);
			float num3 = 1f + Mathf.Sin(num2 * (float)Math.PI) * 0.15f * (1f - num2);
			float num4 = Mathf.Clamp01((num - 1.4f) / 0.55f);
			num4 = num4 * num4 * (3f - 2f * num4);
			float preferredWidth = ((TMP_Text)title).preferredWidth;
			float num5 = Mathf.Lerp(Mathf.Lerp(0.6f, 1f, num2) * num3, 0.32f, num4);
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor((0f - preferredWidth) * num5 * 0.5f, 40f);
			Vector2 val2 = DockPos(preferredWidth * 0.32f);
			root.anchoredPosition = Vector2.Lerp(val, val2, num4);
			((Transform)root).localScale = new Vector3(num5, num5, 1f);
			((TMP_Text)sub).alpha = 1f - Mathf.Clamp01(num4 * 2f);
			((TMP_Text)sub).rectTransform.anchoredPosition = new Vector2(preferredWidth * 0.5f, -80f);
			group.alpha = Mathf.Min(1f, num / 0.15f);
		}

		private Vector2 DockPos(float width)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected O, but got Unknown
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			Rect rect = ((RectTransform)((Component)canvas).transform).rect;
			float num = ((Rect)(ref rect)).height * 0.5f - 60f;
			GameObject val = GameObject.Find("MatchTargetBar");
			if ((Object)(object)val != (Object)null)
			{
				Transform val2 = val.transform.Find("Bar/Area");
				CanvasGroup componentInChildren = val.GetComponentInChildren<CanvasGroup>();
				if ((Object)(object)val2 != (Object)null && (Object)(object)componentInChildren != (Object)null && componentInChildren.alpha > 0.05f)
				{
					((RectTransform)val2).GetWorldCorners(corners);
					Canvas component = val.GetComponent<Canvas>();
					Vector2 val3 = RectTransformUtility.WorldToScreenPoint(((int)component.renderMode == 0) ? null : component.worldCamera, (corners[2] + corners[3]) * 0.5f);
					Camera val4 = (((int)canvas.renderMode == 0) ? null : canvas.worldCamera);
					Vector2 val5 = default(Vector2);
					if (RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)((Component)canvas).transform, val3, val4, ref val5))
					{
						return new Vector2(val5.x + 4f, val5.y);
					}
				}
			}
			return new Vector2((0f - width) * 0.5f, num);
		}

		private void Build()
		{
			//IL_003c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			canvas = Ui.MakeCanvas("RoundModifiersHud", 6);
			root = Ui.Rect(((Component)canvas).transform, "Banner");
			root.pivot = new Vector2(0f, 0.5f);
			root.sizeDelta = new Vector2(10f, 10f);
			group = ((Component)root).gameObject.AddComponent<CanvasGroup>();
			group.alpha = 0f;
			group.blocksRaycasts = false;
			title = Ui.Text((Transform)(object)root, "Title", "", 110f, Color.white, (TextAlignmentOptions)513);
			RectTransform rectTransform = ((TMP_Text)title).rectTransform;
			Vector2 val = default(Vector2);
			((Vector2)(ref val))..ctor(0f, 0.5f);
			rectTransform.anchorMax = val;
			rectTransform.anchorMin = val;
			rectTransform.pivot = new Vector2(0f, 0.5f);
			rectTransform.sizeDelta = new Vector2(3000f, 130f);
			rectTransform.anchoredPosition = Vector2.zero;
			sub = Ui.Text((Transform)(object)root, "Sub", "", 36f, Ui.Grey, (TextAlignmentOptions)514);
			RectTransform rectTransform2 = ((TMP_Text)sub).rectTransform;
			((Vector2)(ref val))..ctor(0f, 0.5f);
			rectTransform2.anchorMax = val;
			rectTransform2.anchorMin = val;
			rectTransform2.sizeDelta = new Vector2(3000f, 50f);
		}
	}
	internal class Modifier
	{
		public string Id;

		public string Title;

		public string Sub;

		public int Group;

		public bool InRounds = true;

		public Action OnApply;

		public Action OnRevert;

		public Action OnTick;

		public Action OnFixedTick;

		public Func<bool> CanUse;

		private const int Gravity = 1;

		private const int Spawns = 2;

		private const int Damage = 3;

		private const int Speed = 4;

		private const int Time = 5;

		private const int Push = 6;

		public static readonly Modifier LowGravity = new Modifier
		{
			Id = "LowGravity",
			Title = "LOW GRAVITY",
			Sub = "Everything floats.",
			Group = 1,
			OnApply = delegate
			{
				Grav.Set(0.25f);
			},
			OnRevert = Grav.Reset
		};

		public static readonly Modifier HighGravity = new Modifier
		{
			Id = "HighGravity",
			Title = "HIGH GRAVITY",
			Sub = "Everything is heavy.",
			Group = 1,
			OnApply = delegate
			{
				Grav.Set(2.2f);
			},
			OnRevert = Grav.Reset
		};

		public static readonly Modifier FistsOnly = new Modifier
		{
			Id = "FistsOnly",
			Title = "FISTS ONLY",
			Sub = "No weapons spawn.",
			Group = 2,
			InRounds = false,
			CanUse = Spawn.MapUsesSpawns
		};

		public static readonly Modifier WeaponRain = new Modifier
		{
			Id = "WeaponRain",
			Title = "WEAPON RAIN",
			Sub = "Weapons fall all the time.",
			Group = 2,
			InRounds = false,
			CanUse = Spawn.MapUsesSpawns
		};

		public static readonly Modifier OneWeapon = new Modifier
		{
			Id = "OneWeapon",
			Title = "ONE WEAPON",
			Sub = "Every spawn is the same weapon.",
			Group = 2,
			InRounds = false,
			OnApply = Spawn.PickOne,
			CanUse = () => Spawn.MapUsesSpawns() && Spawn.HasBag()
		};

		public static readonly Modifier InfiniteAmmo = new Modifier
		{
			Id = "InfiniteAmmo",
			Title = "INFINITE AMMO",
			Sub = "Guns never run dry.",
			Group = 2,
			InRounds = false,
			OnTick = Ammo.Refill
		};

		public static readonly Modifier OneHit = new Modifier
		{
			Id = "OneHit",
			Title = "ONE HIT",
			Sub = "Any hit kills.",
			Group = 3
		};

		public static readonly Modifier Tanks = new Modifier
		{
			Id = "Tanks",
			Title = "TANKS",
			Sub = "Everyone takes a third of the damage.",
			Group = 3
		};

		public static readonly Modifier Vampire = new Modifier
		{
			Id = "Vampire",
			Title = "VAMPIRE",
			Sub = "Damage you deal heals you.",
			Group = 3
		};

		public static readonly Modifier Speedy = new Modifier
		{
			Id = "Speedy",
			Title = "SPEEDY",
			Sub = "Everyone runs faster.",
			Group = 4,
			OnApply = delegate
			{
				Move.Set(1.5f, 1f);
			},
			OnRevert = Move.Reset
		};

		public static readonly Modifier MoonJump = new Modifier
		{
			Id = "MoonJump",
			Title = "MOON JUMP",
			Sub = "Huge jumps.",
			Group = 4,
			OnApply = delegate
			{
				Move.Set(1f, 1.6f);
			},
			OnRevert = Move.Reset
		};

		public static readonly Modifier Turbo = new Modifier
		{
			Id = "Turbo",
			Title = "TURBO",
			Sub = "The whole round runs fast.",
			Group = 5,
			OnTick = delegate
			{
				Clock.Hold(1.3f);
			}
		};

		public static readonly Modifier SlowMo = new Modifier
		{
			Id = "SlowMo",
			Title = "SLOW MOTION",
			Sub = "The whole round runs slow.",
			Group = 5,
			OnTick = delegate
			{
				Clock.Hold(0.65f);
			}
		};

		public static readonly Modifier Wind = new Modifier
		{
			Id = "Wind",
			Title = "WIND",
			Sub = "A gale blows you sideways.",
			Group = 6,
			OnApply = Gale.Start,
			OnRevert = Gale.Stop,
			OnTick = WindFx.Tick,
			OnFixedTick = Gale.Blow
		};

		public static readonly Modifier Flight = new Modifier
		{
			Id = "Flight",
			Title = "FLIGHT",
			Sub = "Everyone can fly.",
			Group = 4,
			OnApply = RoundModifiers.Flight.Start,
			OnRevert = RoundModifiers.Flight.Stop,
			OnTick = RoundModifiers.Flight.Tick
		};

		public static readonly Modifier[] All = new Modifier[15]
		{
			LowGravity, HighGravity, FistsOnly, WeaponRain, OneWeapon, InfiniteAmmo, OneHit, Tanks, Vampire, Speedy,
			MoonJump, Turbo, SlowMo, Wind, Flight
		};

		public void Apply()
		{
			if (OnApply != null)
			{
				OnApply();
			}
		}

		public void Revert()
		{
			if (OnRevert != null)
			{
				OnRevert();
			}
		}

		public void Tick()
		{
			if (OnTick != null)
			{
				OnTick();
			}
		}

		public void FixedTick()
		{
			if (OnFixedTick != null)
			{
				OnFixedTick();
			}
		}

		public bool Usable()
		{
			if (CanUse != null)
			{
				return CanUse();
			}
			return true;
		}
	}
	internal static class Grav
	{
		private static Vector3? saved;

		public static void Set(float f)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if (!saved.HasValue)
			{
				saved = Physics.gravity;
			}
			Physics.gravity = saved.Value * f;
		}

		public static void Reset()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (saved.HasValue)
			{
				Physics.gravity = saved.Value;
			}
			saved = null;
		}
	}
	internal static class Clock
	{
		public static void Hold(float t)
		{
			if (GameManager.inFight && !PauseManager.isPaused)
			{
				TimeHandler.managerTime = t;
			}
		}
	}
	internal static class Move
	{
		private static readonly Dictionary<Movement, float[]> saved = new Dictionary<Movement, float[]>();

		public static void Set(float run, float jump)
		{
			Reset();
			Movement[] array = Object.FindObjectsOfType<Movement>();
			foreach (Movement val in array)
			{
				float[] array2 = new float[2 + ((val.rigsToMove != null) ? val.rigsToMove.Length : 0)];
				array2[0] = val.forceMultiplier;
				array2[1] = val.jumpForceMultiplier;
				val.forceMultiplier *= run;
				val.jumpForceMultiplier *= jump;
				for (int j = 2; j < array2.Length; j++)
				{
					array2[j] = val.rigsToMove[j - 2].forceMultiplier;
					RigidbodyMovement obj = val.rigsToMove[j - 2];
					obj.forceMultiplier *= run;
				}
				saved[val] = array2;
			}
		}

		public static void Reset()
		{
			foreach (KeyValuePair<Movement, float[]> item in saved)
			{
				Movement key = item.Key;
				if (!((Object)(object)key == (Object)null))
				{
					key.forceMultiplier = item.Value[0];
					key.jumpForceMultiplier = item.Value[1];
					for (int i = 2; i < item.Value.Length && i - 2 < key.rigsToMove.Length; i++)
					{
						key.rigsToMove[i - 2].forceMultiplier = item.Value[i];
					}
				}
			}
			saved.Clear();
		}
	}
	internal static class Ammo
	{
		private static readonly FieldRef<Fighting, int> left = AccessTools.FieldRefAccess<Fighting, int>("bulletsLeft");

		public static void Refill()
		{
			ControllerHandler instance = ControllerHandler.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (Controller player in instance.players)
			{
				Fighting val = (((Object)(object)player != (Object)null) ? ((Component)player).GetComponent<Fighting>() : null);
				if ((Object)(object)val != (Object)null && (Object)(object)val.weapon != (Object)null && left.Invoke(val) < val.weapon.startBullets)
				{
					left.Invoke(val) = val.weapon.startBullets;
				}
			}
		}
	}
	internal static class Gale
	{
		private static float dir = 1f;

		public static void Start()
		{
			dir = ((Random.value < 0.5f) ? (-1f) : 1f);
			Hud.Wind(dir);
			WindFx.Begin(dir);
		}

		public static void Stop()
		{
			WindFx.End();
		}

		public static void Blow()
		{
			//IL_0054: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			if (!GameManager.inFight)
			{
				return;
			}
			ControllerHandler instance = ControllerHandler.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				return;
			}
			foreach (Controller player in instance.players)
			{
				if ((Object)(object)player == (Object)null)
				{
					continue;
				}
				Rigidbody[] componentsInChildren = ((Component)player).GetComponentsInChildren<Rigidbody>();
				foreach (Rigidbody val in componentsInChildren)
				{
					if (!val.isKinematic)
					{
						val.AddForce(Vector3.forward * dir * 30f, (ForceMode)5);
					}
				}
			}
		}
	}
	internal static class Spawn
	{
		private static readonly FieldRef<WeaponSelectionHandler, List<byte>> bag = AccessTools.FieldRefAccess<WeaponSelectionHandler, List<byte>>("m_WeaponRaritiesArray");

		private static readonly FieldRef<WeaponSelectionHandler, GameObject[]> objects = AccessTools.FieldRefAccess<WeaponSelectionHandler, GameObject[]>("m_WeaponObjects");

		public static int Only = -1;

		private static WeaponSelectionHandler Handler => Object.FindObjectOfType<WeaponSelectionHandler>();

		public static bool MapUsesSpawns()
		{
			GameManager instance = GameManager.Instance;
			MapInfo val = (((Object)(object)instance != (Object)null) ? instance.currentMapInfo : null);
			if ((Object)(object)val == (Object)null)
			{
				return true;
			}
			if (val.dontSpawnItems)
			{
				return false;
			}
			return (Object)(object)((Component)val).GetComponentInChildren<WeaponPickUp>(true) == (Object)null;
		}

		public static bool HasBag()
		{
			WeaponSelectionHandler handler = Handler;
			if ((Object)(object)handler == (Object)null)
			{
				return false;
			}
			List<byte> list = bag.Invoke(handler);
			if (list == null || list.Count == 0)
			{
				AccessTools.Method(typeof(WeaponSelectionHandler), "GenerateWeaponRarityArray", (Type[])null, (Type[])null).Invoke(handler, null);
				list = bag.Invoke(handler);
			}
			if (list != null)
			{
				return list.Count > 0;
			}
			return false;
		}

		public static void PickOne()
		{
			WeaponSelectionHandler handler = Handler;
			List<byte> list = (((Object)(object)handler != (Object)null) ? bag.Invoke(handler) : null);
			if (list != null && list.Count != 0)
			{
				Only = list[Random.Range(0, list.Count)];
				Modifier.OneWeapon.Title = WeaponName(Only) + " ONLY";
				Modifier.OneWeapon.OnRevert = delegate
				{
					Only = -1;
					Modifier.OneWeapon.Title = "ONE WEAPON";
				};
			}
		}

		public static bool Override(WeaponSelectionHandler h, ref GameObject obj, ref int result)
		{
			if (Only < 0)
			{
				return false;
			}
			GameObject[] array = objects.Invoke(h);
			if (array == null || Only >= array.Length || (Object)(object)array[Only] == (Object)null)
			{
				return false;
			}
			obj = array[Only];
			result = Only;
			return true;
		}

		private static string WeaponName(int index)
		{
			ControllerHandler instance = ControllerHandler.Instance;
			if ((Object)(object)instance != (Object)null)
			{
				foreach (Controller player in instance.players)
				{
					if ((Object)(object)player == (Object)null)
					{
						continue;
					}
					Transform[] componentsInChildren = ((Component)player).GetComponentsInChildren<Transform>(true);
					foreach (Transform val in componentsInChildren)
					{
						if (((Object)val).name == "Weapons" && index < val.childCount)
						{
							string name = ((Object)val.GetChild(index)).name;
							int num = name.IndexOf(' ');
							return ((num >= 0) ? name.Substring(num + 1) : name).ToUpperInvariant();
						}
					}
				}
			}
			return "ONE WEAPON";
		}
	}
	[HarmonyPatch(typeof(WeaponSelectionHandler), "GetRandomWeaponIndex")]
	internal static class OneWeaponPatch
	{
		private static bool Prefix(WeaponSelectionHandler __instance, ref GameObject weaponObject, ref int __result)
		{
			if (!Director.Has(Modifier.OneWeapon))
			{
				return true;
			}
			return !Spawn.Override(__instance, ref weaponObject, ref __result);
		}
	}
	[HarmonyPatch(typeof(GameManager), "SpawnRandomWeapon")]
	internal static class SpawnPatch
	{
		private static readonly FieldRef<GameManager, float> counter = AccessTools.FieldRefAccess<GameManager, float>("randomWeaponCounter");

		private static bool Prefix()
		{
			return !Director.Has(Modifier.FistsOnly);
		}

		private static void Postfix(GameManager __instance)
		{
			if (Director.Has(Modifier.WeaponRain))
			{
				counter.Invoke(__instance) = Random.Range(0.6f, 1.1f);
			}
		}
	}
	[HarmonyPatch(typeof(HealthHandler), "TakeDamage", new Type[]
	{
		typeof(float),
		typeof(Controller),
		typeof(DamageType),
		typeof(bool),
		typeof(Vector3),
		typeof(Vector3)
	})]
	internal static class DamagePatch
	{
		private static void Prefix(HealthHandler __instance, ref float damage, out float __state)
		{
			__state = __instance.health;
			if (!(damage <= 0f))
			{
				if (Director.Has(Modifier.OneHit))
				{
					damage = Mathf.Max(damage, 1000f);
				}
				else if (Director.Has(Modifier.Tanks))
				{
					damage /= 3f;
				}
			}
		}

		private static void Postfix(HealthHandler __instance, Controller damager, float __state)
		{
			if (!Director.Has(Modifier.Vampire) || (Object)(object)damager == (Object)null)
			{
				return;
			}
			float num = __state - Mathf.Max(__instance.health, 0f);
			if (!(num <= 0f) && !((Object)(object)((Component)damager).gameObject == (Object)(object)((Component)__instance).gameObject))
			{
				HealthHandler component = ((Component)damager).GetComponent<HealthHandler>();
				if ((Object)(object)component != (Object)null && component.health > 0f)
				{
					component.health = Mathf.Min(component.maxHealth, component.health + num * 0.5f);
				}
			}
		}
	}
	[BepInPlugin("stickfight.roundmodifiers", "Round Modifiers", "1.0.3")]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "stickfight.roundmodifiers";

		public const string Name = "Round Modifiers";

		public const string Version = "1.0.3";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> InNormal;

		internal static ConfigEntry<int> Chance;

		internal static ConfigEntry<int> DoubleChance;

		private static readonly int[] Percents = new int[21]
		{
			0, 5, 10, 15, 20, 25, 30, 35, 40, 45,
			50, 55, 60, 65, 70, 75, 80, 85, 90, 95,
			100
		};

		internal static readonly Dictionary<string, ConfigEntry<Mode>> Modes = new Dictionary<string, ConfigEntry<Mode>>();

		private void Awake()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			InNormal = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "InNormalMatches", true, "Modifiers in normal matches.");
			Chance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Chance", 25, new ConfigDescription("Chance in percent that a round gets a random modifier (on top of the Always ones).", (AcceptableValueBase)(object)new AcceptableValueList<int>(Percents), new object[0]));
			DoubleChance = ((BaseUnityPlugin)this).Config.Bind<int>("General", "DoubleChance", 15, new ConfigDescription("Chance in percent that a modified round gets two modifiers at once.", (AcceptableValueBase)(object)new AcceptableValueList<int>(Percents), new object[0]));
			Modifier[] all = Modifier.All;
			foreach (Modifier modifier in all)
			{
				string text = QolConfig.Old(((BaseUnityPlugin)this).Config, "Modifiers", modifier.Id);
				Modes[modifier.Id] = ((BaseUnityPlugin)this).Config.Bind<Mode>("Pool", modifier.Id, Mode.Random, modifier.Sub + " Random = can be rolled; Always = every round; Off = never.");
				if (text != null && text.Trim().ToLowerInvariant() == "false")
				{
					Modes[modifier.Id].Value = Mode.Off;
				}
			}
			QolConfig.DropOld(((BaseUnityPlugin)this).Config);
			new Harmony("stickfight.roundmodifiers").PatchAll(typeof(Plugin).Assembly);
			GameObject val = new GameObject("RoundModifiers");
			Object.DontDestroyOnLoad((Object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<Director>();
			val.AddComponent<Hud>();
			SceneManager.sceneLoaded += delegate
			{
				Director.End();
			};
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Round Modifiers 1.0.3 loaded.");
		}
	}
	internal class Director : MonoBehaviour
	{
		public static readonly List<Modifier> Current = new List<Modifier>();

		private static bool wasFighting;

		private static bool Allowed
		{
			get
			{
				if (MatchmakingHandler.IsNetworkMatch || GameManager.stillInMenu)
				{
					return false;
				}
				return Plugin.InNormal.Value;
			}
		}

		public static bool Has(Modifier m)
		{
			return Current.Contains(m);
		}

		private void Update()
		{
			int num;
			if (GameManager.inFight)
			{
				num = ((!GameManager.stillInMenu) ? 1 : 0);
				if (num != 0 && !wasFighting)
				{
					Begin();
				}
			}
			else
			{
				num = 0;
			}
			if (num == 0 && wasFighting)
			{
				End();
			}
			wasFighting = (byte)num != 0;
			if (Current.Count > 0 && (MatchmakingHandler.IsNetworkMatch || GameManager.stillInMenu))
			{
				End();
			}
			for (int i = 0; i < Current.Count; i++)
			{
				Current[i].Tick();
			}
		}

		private void FixedUpdate()
		{
			for (int i = 0; i < Current.Count; i++)
			{
				Current[i].FixedTick();
			}
		}

		private static void Begin()
		{
			End();
			if (!Allowed)
			{
				return;
			}
			List<Modifier> list = Roll();
			if (list.Count == 0)
			{
				return;
			}
			foreach (Modifier item in list)
			{
				try
				{
					item.Apply();
					Current.Add(item);
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)(item.Id + " failed: " + ex));
				}
			}
			if (Current.Count != 0)
			{
				Plugin.Log.LogInfo((object)("Round modifier: " + string.Join(" + ", Current.ConvertAll((Modifier x) => x.Id).ToArray())));
				Hud.Show(Current);
			}
		}

		public static void End()
		{
			for (int num = Current.Count - 1; num >= 0; num--)
			{
				try
				{
					Current[num].Revert();
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)(Current[num].Id + " revert failed: " + ex));
				}
			}
			Current.Clear();
			Hud.Hide();
		}

		private static List<Modifier> Roll()
		{
			List<Modifier> result = new List<Modifier>();
			bool roundsMatch = Compat.RoundsMatch;
			List<Modifier> list = new List<Modifier>();
			Modifier[] all = Modifier.All;
			foreach (Modifier m in all)
			{
				if ((!roundsMatch || m.InRounds) && m.Usable())
				{
					Mode value = Plugin.Modes[m.Id].Value;
					if (value == Mode.Always && !result.Exists((Modifier x) => x.Group == m.Group))
					{
						result.Add(m);
					}
					else if (value == Mode.Random)
					{
						list.Add(m);
					}
				}
			}
			list.RemoveAll((Modifier modifier) => result.Exists((Modifier x) => x.Group == modifier.Group));
			if (list.Count == 0 || Random.Range(0, 100) >= Plugin.Chance.Value)
			{
				return result;
			}
			Modifier first = list[Random.Range(0, list.Count)];
			result.Add(first);
			if (Random.Range(0, 100) < Plugin.DoubleChance.Value)
			{
				list.RemoveAll((Modifier modifier) => modifier.Group == first.Group);
				if (list.Count > 0)
				{
					result.Add(list[Random.Range(0, list.Count)]);
				}
			}
			return result;
		}
	}
	internal enum Mode
	{
		Random,
		Always,
		Off
	}
	internal static class WindFx
	{
		private struct Saved
		{
			public bool enabled;

			public MinMaxCurve x;

			public MinMaxCurve y;

			public MinMaxCurve z;

			public ParticleSystemSimulationSpace space;
		}

		private const float StreakSpeed = 32f;

		private const float ParticlePush = 14f;

		private static readonly Dictionary<ParticleSystem, Saved> touched = new Dictionary<ParticleSystem, Saved>();

		private static ParticleSystem streaks;

		private static float dir;

		private static float nextScan;

		private static bool on;

		public static void Begin(float d)
		{
			dir = d;
			on = true;
			nextScan = 0f;
			MakeStreaks();
		}

		public static void End()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			on = false;
			foreach (KeyValuePair<ParticleSystem, Saved> item in touched)
			{
				if (!((Object)(object)item.Key == (Object)null))
				{
					ForceOverLifetimeModule forceOverLifetime = item.Key.forceOverLifetime;
					((ForceOverLifetimeModule)(ref forceOverLifetime)).x = item.Value.x;
					((ForceOverLifetimeModule)(ref forceOverLifetime)).y = item.Value.y;
					((ForceOverLifetimeModule)(ref forceOverLifetime)).z = item.Value.z;
					((ForceOverLifetimeModule)(ref forceOverLifetime)).space = item.Value.space;
					((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = item.Value.enabled;
				}
			}
			touched.Clear();
			if ((Object)(object)streaks != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)streaks).gameObject);
			}
			streaks = null;
		}

		public static void Tick()
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			if (!on)
			{
				return;
			}
			if ((Object)(object)streaks == (Object)null)
			{
				MakeStreaks();
			}
			if (Time.unscaledTime < nextScan)
			{
				return;
			}
			nextScan = Time.unscaledTime + 0.5f;
			ParticleSystem[] array = Object.FindObjectsOfType<ParticleSystem>();
			foreach (ParticleSystem val in array)
			{
				if (!((Object)(object)val == (Object)(object)streaks) && !touched.ContainsKey(val))
				{
					ForceOverLifetimeModule forceOverLifetime = val.forceOverLifetime;
					touched[val] = new Saved
					{
						enabled = ((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled,
						x = ((ForceOverLifetimeModule)(ref forceOverLifetime)).x,
						y = ((ForceOverLifetimeModule)(ref forceOverLifetime)).y,
						z = ((ForceOverLifetimeModule)(ref forceOverLifetime)).z,
						space = ((ForceOverLifetimeModule)(ref forceOverLifetime)).space
					};
					float num;
					if (!((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled)
					{
						num = 0f;
					}
					else
					{
						MinMaxCurve z = ((ForceOverLifetimeModule)(ref forceOverLifetime)).z;
						num = ((MinMaxCurve)(ref z)).constant;
					}
					float num2 = num;
					if (!((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled)
					{
						((ForceOverLifetimeModule)(ref forceOverLifetime)).x = new MinMaxCurve(0f);
						((ForceOverLifetimeModule)(ref forceOverLifetime)).y = new MinMaxCurve(0f);
					}
					((ForceOverLifetimeModule)(ref forceOverLifetime)).space = (ParticleSystemSimulationSpace)1;
					((ForceOverLifetimeModule)(ref forceOverLifetime)).z = new MinMaxCurve(num2 + dir * 14f);
					((ForceOverLifetimeModule)(ref forceOverLifetime)).enabled = true;
				}
			}
		}

		private static void MakeStreaks()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Expected O, but got Unknown
			GameObject val = new GameObject("RoundModifiersWind");
			val.transform.position = new Vector3(2f, 0f, (0f - dir) * 26f);
			streaks = val.AddComponent<ParticleSystem>();
			streaks.Stop();
			MainModule main = streaks.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).duration = 5f;
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(1.6f, 2.2f);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.09f);
			((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(1f, 1f, 1f, 0.1f), new Color(1f, 1f, 1f, 0.22f));
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).maxParticles = 300;
			((MainModule)(ref main)).prewarm = true;
			EmissionModule emission = streaks.emission;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(45f);
			ShapeModule shape = streaks.shape;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)5;
			((ShapeModule)(ref shape)).box = new Vector3(1f, 26f, 4f);
			VelocityOverLifetimeModule velocityOverLifetime = streaks.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(0f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(-1.5f, 1.5f);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(dir * 32f * 0.8f, dir * 32f * 1.2f);
			ColorOverLifetimeModule colorOverLifetime = streaks.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val2 = new Gradient();
			val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.2f),
				new GradientAlphaKey(1f, 0.75f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2);
			ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)1;
			component.velocityScale = 0.08f;
			component.lengthScale = 1f;
			((Renderer)component).material = new Material(Shader.Find("Sprites/Default"));
			streaks.Play();
		}
	}
}