Decompiled source of EffectsGB v1.2.1

Mods/EffectsGB.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using EffectMod;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(EffectsGB), "EffectsGB", "1.2.1", "Zooks", null)]
[assembly: MelonGame("Boneloaf", "Gang Beasts")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("EffectsGB")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EffectsGB")]
[assembly: AssemblyTitle("EffectsGB")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace EffectMod
{
	public class EffectsGB : MelonMod
	{
		private class EffectsUI
		{
			private GameObject canvasObj;

			private CanvasGroup cg;

			private RectTransform panel;

			private Text txt;

			private Image bgImg;

			private Image accImg;

			private string cur = "";

			private float dt;

			private bool on;

			private bool init;

			private bool cv;

			private bool err;

			private float slideProg;

			public float ShowT = 2f;

			public float FadeT = 0.5f;

			public float SlideT = 0.3f;

			public int FS = 26;

			public float PW = 300f;

			public float PH = 52f;

			public float MG = 14f;

			public float AW = 3f;

			public Color TC = new Color(1f, 1f, 1f, 1f);

			public Color EC = new Color(1f, 0.35f, 0.35f, 1f);

			public Color BC = new Color(0.04f, 0.04f, 0.08f, 0.85f);

			public Color AC = new Color(0.2f, 0.5f, 1f, 0.95f);

			public Color EAC = new Color(1f, 0.3f, 0.3f, 0.95f);

			public void Show(string t)
			{
				Show(t, e: false);
			}

			public void ShowError(string t)
			{
				Show(t, e: true);
			}

			private void Show(string t, bool e)
			{
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				if (!init)
				{
					Init();
				}
				cur = t ?? "";
				err = e;
				dt = 0f;
				on = true;
				slideProg = 0f;
				if (cv)
				{
					if ((Object)(object)txt != (Object)null)
					{
						txt.text = cur;
						((Graphic)txt).color = (err ? EC : TC);
					}
					if ((Object)(object)accImg != (Object)null)
					{
						((Graphic)accImg).color = (err ? EAC : AC);
					}
				}
			}

			public void Tick()
			{
				if (!on)
				{
					return;
				}
				dt += Time.unscaledDeltaTime;
				if (slideProg < 1f)
				{
					slideProg += Time.unscaledDeltaTime / SlideT;
					if (slideProg > 1f)
					{
						slideProg = 1f;
					}
				}
				float num = Alpha();
				if (num <= 0f)
				{
					on = false;
					cur = "";
					if ((Object)(object)txt != (Object)null)
					{
						txt.text = "";
					}
				}
				else if (cv)
				{
					UpdateCV(num);
				}
			}

			public void OnGUI()
			{
				//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d4: Expected O, but got Unknown
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0147: 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_015a: Expected O, but got Unknown
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: 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)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Expected O, but got Unknown
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0214: 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)
				if (cv || !on || string.IsNullOrEmpty(cur))
				{
					return;
				}
				try
				{
					float num = Alpha();
					if (!(num <= 0f))
					{
						float num2 = Mathf.Max((float)Screen.width / 1920f, 0.6f);
						int fontSize = Mathf.RoundToInt((float)FS * num2);
						float num3 = PW * num2;
						float num4 = PH * num2;
						float num5 = MG * num2;
						float num6 = 1f - (1f - slideProg) * (1f - slideProg) * (1f - slideProg);
						float num7 = Mathf.Lerp((float)Screen.width + num5, (float)Screen.width - num3 - num5, num6);
						float num8 = num5;
						GUIStyle val = new GUIStyle(GUI.skin.box);
						val.normal.background = Tex(2, 2, new Color(BC.r, BC.g, BC.b, BC.a * num));
						GUI.Box(new Rect(num7, num8, num3, num4), "", val);
						Color val2 = (err ? EAC : AC);
						GUIStyle val3 = new GUIStyle(GUI.skin.box);
						val3.normal.background = Tex(1, 1, new Color(val2.r, val2.g, val2.b, val2.a * num));
						GUI.Box(new Rect(num7, num8, AW * num2, num4), "", val3);
						Color val4 = (err ? EC : TC);
						GUIStyle val5 = new GUIStyle(GUI.skin.label);
						val5.fontSize = fontSize;
						val5.fontStyle = (FontStyle)1;
						val5.alignment = (TextAnchor)5;
						val5.normal.textColor = new Color(val4.r, val4.g, val4.b, val4.a * num);
						GUI.Label(new Rect(num7 + 12f * num2, num8, num3 - 24f * num2, num4), cur, val5);
					}
				}
				catch
				{
				}
			}

			public void Init()
			{
				if (!init)
				{
					TryCV();
					init = true;
				}
			}

			public void Destroy()
			{
				if ((Object)(object)canvasObj != (Object)null)
				{
					try
					{
						Object.Destroy((Object)(object)canvasObj);
					}
					catch
					{
					}
					canvasObj = null;
				}
				init = false;
				cv = false;
			}

			private float Alpha()
			{
				if (dt < ShowT)
				{
					return 1f;
				}
				if (dt < ShowT + FadeT)
				{
					float num = (dt - ShowT) / FadeT;
					float num2 = 1f - num;
					return num2 * num2;
				}
				return 0f;
			}

			private void UpdateCV(float a)
			{
				//IL_007d: 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_00bb: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)cg != (Object)null)
				{
					cg.alpha = a;
				}
				if (!((Object)(object)panel == (Object)null))
				{
					float num = 1f - (1f - slideProg) * (1f - slideProg) * (1f - slideProg);
					panel.anchoredPosition = new Vector2(Mathf.Lerp(PW + MG, 0f - MG, num), 0f - MG);
					if ((Object)(object)accImg != (Object)null)
					{
						float num2 = (Mathf.Sin(Time.unscaledTime * 3f) + 1f) * 0.5f;
						Color color = (err ? EAC : AC);
						color.a = Mathf.Lerp(0.6f, 1f, num2) * a;
						((Graphic)accImg).color = color;
					}
				}
			}

			private void TryCV()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Expected O, but got Unknown
				//IL_0054: 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_00b1: Expected O, but got Unknown
				//IL_00e4: 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_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_0152: 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_0171: Unknown result type (might be due to invalid IL or missing references)
				//IL_0177: Expected O, but got Unknown
				//IL_019c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: Expected O, but got Unknown
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_021a: Unknown result type (might be due to invalid IL or missing references)
				//IL_022f: 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_025a: Unknown result type (might be due to invalid IL or missing references)
				//IL_027b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0295: Unknown result type (might be due to invalid IL or missing references)
				//IL_029c: Expected O, but got Unknown
				//IL_0301: Unknown result type (might be due to invalid IL or missing references)
				//IL_032f: Unknown result type (might be due to invalid IL or missing references)
				//IL_033a: Unknown result type (might be due to invalid IL or missing references)
				//IL_033f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0354: Unknown result type (might be due to invalid IL or missing references)
				//IL_0368: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					canvasObj = new GameObject("FXUI");
					Object.DontDestroyOnLoad((Object)(object)canvasObj);
					Canvas obj = canvasObj.AddComponent<Canvas>();
					obj.renderMode = (RenderMode)0;
					obj.sortingOrder = 9999;
					try
					{
						CanvasScaler obj2 = canvasObj.AddComponent<CanvasScaler>();
						obj2.uiScaleMode = (ScaleMode)1;
						obj2.referenceResolution = new Vector2(1920f, 1080f);
						obj2.matchWidthOrHeight = 0.5f;
					}
					catch
					{
					}
					cg = canvasObj.AddComponent<CanvasGroup>();
					cg.alpha = 0f;
					cg.blocksRaycasts = false;
					cg.interactable = false;
					GameObject val = new GameObject("P");
					val.transform.SetParent(canvasObj.transform, false);
					panel = val.GetComponent<RectTransform>();
					panel.pivot = new Vector2(1f, 1f);
					panel.anchorMin = new Vector2(1f, 1f);
					panel.anchorMax = new Vector2(1f, 1f);
					panel.anchoredPosition = new Vector2(0f - MG, 0f - MG);
					panel.sizeDelta = new Vector2(PW, PH);
					((Transform)panel).localScale = Vector3.one;
					try
					{
						GameObject val2 = new GameObject("B");
						val2.transform.SetParent(val.transform, false);
						bgImg = val2.AddComponent<Image>();
						((Graphic)bgImg).color = BC;
						((Graphic)bgImg).raycastTarget = false;
						Fill(((Graphic)bgImg).rectTransform);
					}
					catch
					{
					}
					try
					{
						GameObject val3 = new GameObject("A");
						val3.transform.SetParent(val.transform, false);
						accImg = val3.AddComponent<Image>();
						((Graphic)accImg).color = AC;
						((Graphic)accImg).raycastTarget = false;
						RectTransform rectTransform = ((Graphic)accImg).rectTransform;
						rectTransform.anchorMin = Vector2.zero;
						rectTransform.anchorMax = new Vector2(0f, 1f);
						rectTransform.pivot = new Vector2(0.5f, 0.5f);
						rectTransform.sizeDelta = new Vector2(AW, 0f);
						rectTransform.anchoredPosition = new Vector2(AW / 2f + 2f, 0f);
					}
					catch
					{
					}
					Font font = GetFont();
					try
					{
						GameObject val4 = new GameObject("T");
						val4.transform.SetParent(val.transform, false);
						txt = val4.AddComponent<Text>();
						if ((Object)(object)font != (Object)null)
						{
							txt.font = font;
						}
						txt.fontSize = FS;
						txt.fontStyle = (FontStyle)1;
						txt.alignment = (TextAnchor)5;
						((Graphic)txt).color = TC;
						txt.text = "";
						((Graphic)txt).raycastTarget = false;
						RectTransform component = val4.GetComponent<RectTransform>();
						component.anchorMin = Vector2.zero;
						component.anchorMax = Vector2.op_Implicit(Vector3.one);
						component.offsetMin = new Vector2(12f, 0f);
						component.offsetMax = new Vector2(-12f, 0f);
					}
					catch
					{
					}
					cv = true;
				}
				catch
				{
					cv = false;
				}
			}

			private static void Fill(RectTransform r)
			{
				//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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				r.anchorMin = Vector2.zero;
				r.anchorMax = Vector2.op_Implicit(Vector3.one);
				r.offsetMin = Vector2.zero;
				r.offsetMax = Vector2.zero;
			}

			private static Font GetFont()
			{
				try
				{
					Font builtinResource = Resources.GetBuiltinResource<Font>("Arial.ttf");
					if ((Object)(object)builtinResource != (Object)null)
					{
						return builtinResource;
					}
				}
				catch
				{
				}
				try
				{
					Font builtinResource2 = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
					if ((Object)(object)builtinResource2 != (Object)null)
					{
						return builtinResource2;
					}
				}
				catch
				{
				}
				try
				{
					foreach (Font item in Resources.FindObjectsOfTypeAll<Font>())
					{
						if ((Object)(object)item != (Object)null)
						{
							return item;
						}
					}
				}
				catch
				{
				}
				return null;
			}

			private static Texture2D Tex(int w, int h, Color c)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				try
				{
					Texture2D val = new Texture2D(w, h);
					Color[] array = (Color[])(object)new Color[w * h];
					for (int i = 0; i < array.Length; i++)
					{
						array[i] = c;
					}
					val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
					val.Apply();
					return val;
				}
				catch
				{
					return null;
				}
			}
		}

		private const int TOTAL_EFFECTS = 32;

		private readonly string[] effectNames = new string[32]
		{
			"None", "Rainbow", "Ghost", "Neon", "Strobe", "ItzXngel", "Gold", "Pulse", "Chromatic", "Ice",
			"Infrared", "Matrix", "Bubblegum", "Static", "Toon", "Void", "Copper", "Hologram", "Lava", "Parallax",
			"Aurora", "Chrome", "Zombie", "Diamond", "Toxic", "Sunset", "Cyber", "Frostbite", "Solar", "Phantom",
			"Cosmo", "Orange"
		};

		private static readonly string[] ColorProps = new string[13]
		{
			"_Color", "_BaseColor", "_TintColor", "_MainColor", "_Albedo", "_Color0", "_Tint", "_DiffuseColor", "_SkinColor", "_BodyColor",
			"_TeamColor", "_PlayerColor", "_CharacterColor"
		};

		private static readonly string[] EmissionProps = new string[3] { "_EmissionColor", "_Emission", "_EmissiveColor" };

		private static readonly HashSet<int> MetallicEffects = new HashSet<int> { 5, 6, 16, 21, 23, 30 };

		private readonly string[] rigKeywords = new string[32]
		{
			"rig", "bone", "skeleton", "armature", "wire", "helper", "proxy", "joint", "effector", "locator",
			"gizmo", "debug", "handle", "widget", "target", "collider", "trigger", "volume", "zone", "phantom",
			"ghost", "outline", "silhouette", "shadow", "hitbox", "hurtbox", "collision", "physics", "ragdoll", "line",
			"trail", "beam"
		};

		private readonly HashSet<int> fixedRigIDs = new HashSet<int>();

		private float rigCheckTimer;

		private const float rigCheckInterval = 2f;

		private int currentEffect;

		private int savedEffect;

		private bool modActivated;

		private bool cursorSelected;

		private readonly List<GameObject> players = new List<GameObject>();

		private readonly List<Renderer> allRenderers = new List<Renderer>();

		private readonly Dictionary<Renderer, Material[]> origMats = new Dictionary<Renderer, Material[]>();

		private readonly Dictionary<Renderer, Color> origColors = new Dictionary<Renderer, Color>();

		private readonly Dictionary<Renderer, List<string>> cProps = new Dictionary<Renderer, List<string>>();

		private readonly Dictionary<Renderer, List<string>> eProps = new Dictionary<Renderer, List<string>>();

		private readonly Dictionary<Renderer, List<string>> fProps = new Dictionary<Renderer, List<string>>();

		private readonly Dictionary<Renderer, MaterialPropertyBlock[]> blocks = new Dictionary<Renderer, MaterialPropertyBlock[]>();

		private float timer;

		private bool searched;

		private bool applied;

		private float staticT;

		private float flickT;

		private float flickState = 1f;

		private readonly HashSet<int> physIDs = new HashSet<int>();

		private readonly HashSet<int> lastIDs = new HashSet<int>();

		private int respawnFrame;

		private float reSearchT;

		private GameObject probeHolder;

		private ReflectionProbe myProbe;

		private int probeTick;

		private bool reflectionsActive;

		private readonly EffectsUI ui = new EffectsUI();

		private bool slowmo;

		private float slowmoT;

		private AudioClip warpClip;

		private AudioSource warpSource;

		private bool cursorMode;

		private CursorLockMode prevLock;

		private bool prevVisible;

		private Texture2D crosshairTex;

		private Texture2D whiteTex;

		private Texture2D blackTex;

		private Texture2D bgTex;

		private Texture2D accTex;

		private bool IsAlreadySelected(GameObject go)
		{
			if ((Object)(object)go == (Object)null || !IsBeast(go))
			{
				return false;
			}
			int instanceID = ((Object)go).GetInstanceID();
			foreach (GameObject player in players)
			{
				if (!((Object)(object)player == (Object)null))
				{
					if (((Object)player).GetInstanceID() == instanceID)
					{
						return true;
					}
					if ((Object)(object)player.transform.root != (Object)null && (Object)(object)((Component)player.transform.root).gameObject == (Object)(object)((Component)go.transform.root).gameObject)
					{
						return true;
					}
				}
			}
			return false;
		}

		private bool IsBeast(GameObject go)
		{
			if ((Object)(object)go == (Object)null)
			{
				return false;
			}
			int num = 0;
			try
			{
				Il2CppArrayBase<SkinnedMeshRenderer> componentsInChildren = go.GetComponentsInChildren<SkinnedMeshRenderer>();
				if (componentsInChildren != null)
				{
					num = componentsInChildren.Length;
				}
			}
			catch
			{
			}
			if (num < 2)
			{
				return false;
			}
			int num2 = 0;
			try
			{
				Il2CppArrayBase<Rigidbody> componentsInChildren2 = go.GetComponentsInChildren<Rigidbody>();
				if (componentsInChildren2 != null)
				{
					num2 = ((IEnumerable<Rigidbody>)componentsInChildren2).Count((Rigidbody r) => !r.isKinematic);
				}
			}
			catch
			{
			}
			return num2 >= 2;
		}

		public override void OnInitializeMelon()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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)
			CreateWarpClip();
			whiteTex = MakeTex(Color.white);
			blackTex = MakeTex(Color.black);
			bgTex = MakeTex(new Color(0.04f, 0.04f, 0.08f, 0.88f));
			accTex = MakeTex(new Color(0.2f, 0.5f, 1f, 0.95f));
			crosshairTex = CreateCrosshairTexture();
		}

		private static Texture2D MakeTex(Color c)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, c);
			val.Apply();
			return val;
		}

		private Texture2D CreateCrosshairTexture()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			int num = 64;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new Color(0f, 0f, 0f, 0f);
			}
			int num2 = num / 2;
			int num3 = num / 2;
			int num4 = 14;
			int num5 = 5;
			int num6 = 3;
			for (int j = -num6; j <= num6; j++)
			{
				for (int k = num5; k < num4; k++)
				{
					array[(num3 + j) * num + (num2 + k)] = Color.white;
					array[(num3 + j) * num + (num2 - k)] = Color.white;
				}
			}
			for (int l = -num6; l <= num6; l++)
			{
				for (int m = num5; m < num4; m++)
				{
					array[(num3 + m) * num + (num2 + l)] = Color.white;
					array[(num3 - m) * num + (num2 + l)] = Color.white;
				}
			}
			for (int n = -2; n <= 2; n++)
			{
				for (int num7 = -2; num7 <= 2; num7++)
				{
					array[(num3 + n) * num + (num2 + num7)] = Color.white;
				}
			}
			val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			val.Apply();
			return val;
		}

		private void FixRigs()
		{
			try
			{
				foreach (GameObject player in players)
				{
					if ((Object)(object)player == (Object)null)
					{
						continue;
					}
					foreach (Transform componentsInChild in player.GetComponentsInChildren<Transform>(true))
					{
						if ((Object)(object)componentsInChild == (Object)null || !IsRigName(((Object)componentsInChild).name))
						{
							continue;
						}
						int instanceID = ((Object)componentsInChild).GetInstanceID();
						if (fixedRigIDs.Contains(instanceID))
						{
							continue;
						}
						foreach (Renderer component9 in ((Component)componentsInChild).GetComponents<Renderer>())
						{
							if (!((Object)(object)component9 == (Object)null) && !(component9 is SkinnedMeshRenderer))
							{
								component9.enabled = false;
							}
						}
						LineRenderer component = ((Component)componentsInChild).GetComponent<LineRenderer>();
						if ((Object)(object)component != (Object)null)
						{
							((Renderer)component).enabled = false;
						}
						TrailRenderer component2 = ((Component)componentsInChild).GetComponent<TrailRenderer>();
						if ((Object)(object)component2 != (Object)null)
						{
							((Renderer)component2).enabled = false;
						}
						MeshRenderer component3 = ((Component)componentsInChild).GetComponent<MeshRenderer>();
						if (component3 != null)
						{
							MeshFilter component4 = ((Component)componentsInChild).GetComponent<MeshFilter>();
							if ((Object)(object)component4 != (Object)null && (Object)(object)component4.sharedMesh != (Object)null && component4.sharedMesh.vertexCount <= 10)
							{
								((Renderer)component3).enabled = false;
							}
						}
						fixedRigIDs.Add(instanceID);
					}
				}
				foreach (SkinnedMeshRenderer item in Object.FindObjectsOfType<SkinnedMeshRenderer>())
				{
					if ((Object)(object)item == (Object)null)
					{
						continue;
					}
					Transform val = ((Component)item).transform;
					while ((Object)(object)val.parent != (Object)null)
					{
						string text = ((Object)val.parent).name.ToLower();
						if (text.Contains("scene") || text.Contains("manager") || text.Contains("world") || text.Contains("level") || text.Contains("environment") || text.Contains("arena") || text.Contains("map") || text.Contains("game") || text.Contains("instance") || text.Contains("actors") || text.Contains("characters") || text.Contains("players") || text.Contains("crowd") || text.Contains("spectators"))
						{
							break;
						}
						val = val.parent;
					}
					foreach (Transform componentsInChild2 in ((Component)val).GetComponentsInChildren<Transform>(true))
					{
						if ((Object)(object)componentsInChild2 == (Object)null || !IsRigName(((Object)componentsInChild2).name))
						{
							continue;
						}
						int instanceID2 = ((Object)componentsInChild2).GetInstanceID();
						if (fixedRigIDs.Contains(instanceID2))
						{
							continue;
						}
						foreach (Renderer component10 in ((Component)componentsInChild2).GetComponents<Renderer>())
						{
							if (!((Object)(object)component10 == (Object)null) && !(component10 is SkinnedMeshRenderer))
							{
								component10.enabled = false;
							}
						}
						LineRenderer component5 = ((Component)componentsInChild2).GetComponent<LineRenderer>();
						if ((Object)(object)component5 != (Object)null)
						{
							((Renderer)component5).enabled = false;
						}
						TrailRenderer component6 = ((Component)componentsInChild2).GetComponent<TrailRenderer>();
						if ((Object)(object)component6 != (Object)null)
						{
							((Renderer)component6).enabled = false;
						}
						MeshRenderer component7 = ((Component)componentsInChild2).GetComponent<MeshRenderer>();
						if (component7 != null)
						{
							MeshFilter component8 = ((Component)componentsInChild2).GetComponent<MeshFilter>();
							if ((Object)(object)component8 != (Object)null && (Object)(object)component8.sharedMesh != (Object)null && component8.sharedMesh.vertexCount <= 10)
							{
								((Renderer)component7).enabled = false;
							}
						}
						fixedRigIDs.Add(instanceID2);
					}
				}
			}
			catch
			{
			}
		}

		private bool IsRigName(string name)
		{
			if (string.IsNullOrEmpty(name))
			{
				return false;
			}
			string text = name.ToLower();
			if (!text.Contains("rig") && !text.Contains("bone") && !text.Contains("skeleton") && !text.Contains("armature") && !text.Contains("wire") && !text.Contains("helper") && !text.Contains("proxy") && !text.Contains("joint") && !text.Contains("effector") && !text.Contains("locator") && !text.Contains("gizmo") && !text.Contains("debug") && !text.Contains("handle") && !text.Contains("widget") && !text.Contains("target") && !text.Contains("collider") && !text.Contains("trigger") && !text.Contains("volume") && !text.Contains("zone") && !text.Contains("phantom") && !text.Contains("outline") && !text.Contains("silhouette") && !text.Contains("hitbox") && !text.Contains("hurtbox") && !text.Contains("ragdoll") && !text.Contains("line") && !text.Contains("trail") && !text.Contains("beam") && !text.Contains("ghost"))
			{
				return text.Contains("shadow");
			}
			return true;
		}

		private void CreateWarpClip()
		{
			try
			{
				int num = 44100;
				int num2 = (int)((float)num * 0.15f);
				float[] array = new float[num2];
				for (int i = 0; i < num2; i++)
				{
					float num3 = (float)i / (float)num;
					float num4 = Mathf.Sin((float)Math.PI * num3 / 0.15f);
					float num5 = Mathf.Lerp(600f, 1000f, num3 / 0.15f);
					array[i] = Mathf.Sin((float)Math.PI * 2f * num5 * num3) * num4 * 0.8f;
					array[i] += Mathf.Sin((float)Math.PI * 2f * num5 * 1.5f * num3) * num4 * 0.3f;
				}
				warpClip = AudioClip.Create("warp", num2, 1, num, false);
				warpClip.SetData(Il2CppStructArray<float>.op_Implicit(array), 0);
			}
			catch
			{
			}
		}

		private void PlayWarpSound()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if ((Object)(object)warpClip == (Object)null)
			{
				return;
			}
			try
			{
				if ((Object)(object)warpSource == (Object)null)
				{
					GameObject val = new GameObject("FXAudio");
					Object.DontDestroyOnLoad((Object)(object)val);
					warpSource = val.AddComponent<AudioSource>();
					warpSource.spatialBlend = 0f;
					warpSource.playOnAwake = false;
					warpSource.bypassEffects = true;
					warpSource.bypassListenerEffects = true;
					warpSource.bypassReverbZones = true;
				}
				warpSource.volume = 0.2f;
				warpSource.PlayOneShot(warpClip);
			}
			catch
			{
			}
		}

		private void ForceCursorFree()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Cursor.lockState = (CursorLockMode)0;
			}
			catch
			{
			}
			try
			{
				Cursor.visible = true;
			}
			catch
			{
			}
			try
			{
				if ((Object)(object)crosshairTex != (Object)null)
				{
					Cursor.SetCursor(crosshairTex, new Vector2(32f, 32f), (CursorMode)0);
				}
			}
			catch
			{
			}
		}

		private void RestoreCursor()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0);
			}
			catch
			{
			}
			try
			{
				Cursor.lockState = prevLock;
			}
			catch
			{
			}
			try
			{
				Cursor.visible = prevVisible;
			}
			catch
			{
			}
		}

		public override void OnDeinitializeMelon()
		{
			ui.Destroy();
			Time.timeScale = 1f;
			if ((Object)(object)probeHolder != (Object)null)
			{
				Object.Destroy((Object)(object)probeHolder);
				probeHolder = null;
				myProbe = null;
			}
			if ((Object)(object)warpSource != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)warpSource).gameObject);
				warpSource = null;
			}
			RestoreCursor();
		}

		public override void OnSceneWasLoaded(int buildIndex, string sceneName)
		{
			fixedRigIDs.Clear();
			rigCheckTimer = 0f;
			if (cursorMode)
			{
				cursorMode = false;
				RestoreCursor();
			}
			if (modActivated)
			{
				try
				{
					Restore();
				}
				catch
				{
				}
				ResetAll();
				Time.timeScale = 1f;
				reflectionsActive = false;
			}
		}

		public override void OnUpdate()
		{
			//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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (WasF9())
				{
					if (!modActivated)
					{
						modActivated = true;
					}
					Cycle();
				}
				if (WasP())
				{
					cursorMode = !cursorMode;
					if (cursorMode)
					{
						prevLock = Cursor.lockState;
						prevVisible = Cursor.visible;
					}
					else
					{
						RestoreCursor();
					}
				}
				if (cursorMode)
				{
					ForceCursorFree();
					if (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame)
					{
						Camera main = Camera.main;
						if ((Object)(object)main != (Object)null)
						{
							Vector2 val = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue();
							RaycastHit val2 = default(RaycastHit);
							if (Physics.Raycast(main.ScreenPointToRay(Vector2.op_Implicit(val)), ref val2, 200f))
							{
								GameObject val3 = FindTargetFromHit(((RaycastHit)(ref val2)).transform);
								if ((Object)(object)val3 != (Object)null)
								{
									SelectTarget(val3);
									cursorMode = false;
									RestoreCursor();
									PlayWarpSound();
								}
							}
						}
					}
				}
				if (!modActivated)
				{
					return;
				}
				ui.Tick();
				if (slowmo)
				{
					slowmoT += Time.unscaledDeltaTime;
					float num = Mathf.Clamp01(slowmoT / 0.5f);
					Time.timeScale = Mathf.Lerp(0.3f, 1f, 1f - (1f - num) * (1f - num));
					if (num >= 1f)
					{
						slowmo = false;
						Time.timeScale = 1f;
					}
				}
				if (players.Count == 0)
				{
					reSearchT += Time.deltaTime;
					if (reSearchT >= 1f || !searched)
					{
						reSearchT = 0f;
						searched = false;
						Find();
					}
				}
				else
				{
					reSearchT = 0f;
					if (Respawned())
					{
						Restore();
						ResetAll();
						return;
					}
					bool flag = false;
					foreach (GameObject player in players)
					{
						if ((Object)(object)player == (Object)null || ((Object)player).Equals((Object)null))
						{
							flag = true;
							break;
						}
					}
					if (flag)
					{
						Restore();
						ResetAll();
						return;
					}
					if (currentEffect > 0)
					{
						Apply();
					}
					else if (applied)
					{
						Restore();
					}
					rigCheckTimer += Time.deltaTime;
					if (rigCheckTimer >= 2f)
					{
						rigCheckTimer = 0f;
						FixRigs();
					}
				}
				if (reflectionsActive)
				{
					TickReflections();
				}
				timer += Time.deltaTime;
				if (!cursorMode)
				{
					return;
				}
				ForceCursorFree();
				if (Mouse.current == null || !Mouse.current.leftButton.wasPressedThisFrame)
				{
					return;
				}
				Camera main2 = Camera.main;
				if (!((Object)(object)main2 != (Object)null))
				{
					return;
				}
				Vector2 val4 = ((InputControl<Vector2>)(object)((Pointer)Mouse.current).position).ReadValue();
				RaycastHit val5 = default(RaycastHit);
				if (Physics.Raycast(main2.ScreenPointToRay(Vector2.op_Implicit(val4)), ref val5, 200f))
				{
					GameObject val6 = FindTargetFromHit(((RaycastHit)(ref val5)).transform);
					if ((Object)(object)val6 != (Object)null && !IsAlreadySelected(val6))
					{
						SelectTarget(val6);
						cursorMode = false;
						RestoreCursor();
						PlayWarpSound();
					}
				}
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[EffectsGB] Update: " + ex.Message);
			}
		}

		public override void OnGUI()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: 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_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Expected O, but got Unknown
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			if (cursorMode)
			{
				ForceCursorFree();
			}
			ui.OnGUI();
			if (!cursorMode)
			{
				return;
			}
			try
			{
				float num = Mathf.Max((float)Screen.width / 1920f, 0.6f);
				Vector2 val = Vector2.op_Implicit(Input.mousePosition);
				float x = val.x;
				float num2 = (float)Screen.height - val.y;
				if ((Object)(object)whiteTex != (Object)null && (Object)(object)blackTex != (Object)null)
				{
					float num3 = 22f * num;
					float num4 = 3.5f * num;
					float num5 = 5f * num;
					float num6 = 1.5f * num;
					GUI.DrawTexture(new Rect(x - num3 - num6, num2 - num4 / 2f - num6, num3 - num5 + num6 * 2f, num4 + num6 * 2f), (Texture)(object)blackTex);
					GUI.DrawTexture(new Rect(x + num5 - num6, num2 - num4 / 2f - num6, num3 - num5 + num6 * 2f, num4 + num6 * 2f), (Texture)(object)blackTex);
					GUI.DrawTexture(new Rect(x - num4 / 2f - num6, num2 - num3 - num6, num4 + num6 * 2f, num3 - num5 + num6 * 2f), (Texture)(object)blackTex);
					GUI.DrawTexture(new Rect(x - num4 / 2f - num6, num2 + num5 - num6, num4 + num6 * 2f, num3 - num5 + num6 * 2f), (Texture)(object)blackTex);
					GUI.DrawTexture(new Rect(x - num3, num2 - num4 / 2f, num3 - num5, num4), (Texture)(object)whiteTex);
					GUI.DrawTexture(new Rect(x + num5, num2 - num4 / 2f, num3 - num5, num4), (Texture)(object)whiteTex);
					GUI.DrawTexture(new Rect(x - num4 / 2f, num2 - num3, num4, num3 - num5), (Texture)(object)whiteTex);
					GUI.DrawTexture(new Rect(x - num4 / 2f, num2 + num5, num4, num3 - num5), (Texture)(object)whiteTex);
					float num7 = 3f * num;
					GUI.DrawTexture(new Rect(x - num7 - num6, num2 - num7 - num6, (num7 + num6) * 2f, (num7 + num6) * 2f), (Texture)(object)blackTex);
					GUI.DrawTexture(new Rect(x - num7, num2 - num7, num7 * 2f, num7 * 2f), (Texture)(object)whiteTex);
				}
				float num8 = 480f * num;
				float num9 = 48f * num;
				float num10 = ((float)Screen.width - num8) / 2f;
				float num11 = (float)Screen.height - 70f * num;
				if ((Object)(object)bgTex != (Object)null)
				{
					GUI.DrawTexture(new Rect(num10, num11, num8, num9), (Texture)(object)bgTex);
				}
				if ((Object)(object)accTex != (Object)null)
				{
					GUI.DrawTexture(new Rect(num10, num11, 4f * num, num9), (Texture)(object)accTex);
				}
				GUIStyle val2 = new GUIStyle(GUI.skin.label);
				val2.fontSize = Mathf.RoundToInt(22f * num);
				val2.fontStyle = (FontStyle)1;
				val2.alignment = (TextAnchor)4;
				val2.normal.textColor = new Color(1f, 1f, 1f, 0.92f);
				GUI.Label(new Rect(num10 + 14f * num, num11, num8 - 28f * num, num9), "Click on any object to apply effect", val2);
			}
			catch
			{
			}
		}

		private GameObject FindTargetFromHit(Transform hit)
		{
			GameObject result = null;
			for (Transform val = hit; (Object)(object)val != (Object)null; val = val.parent)
			{
				try
				{
					if (((Component)val).GetComponentsInChildren<Renderer>(true).Length > 0)
					{
						result = ((Component)val).gameObject;
					}
				}
				catch
				{
				}
				if ((Object)(object)val.parent == (Object)null)
				{
					break;
				}
				try
				{
					string text = ((Object)val.parent).name.ToLower();
					if (text.Contains("scene") || text.Contains("manager") || text.Contains("world") || text.Contains("level") || text.Contains("environment") || text.Contains("root") || text.Contains("arena") || text.Contains("map") || text.Contains("game") || text.Contains("instance") || text.Contains("dontdestroy") || text.Contains("static") || text.Contains("dynamic") || text.Contains("network") || text.Contains("server"))
					{
						break;
					}
					continue;
				}
				catch
				{
				}
				break;
			}
			return result;
		}

		private void ResetAll()
		{
			players.Clear();
			allRenderers.Clear();
			origMats.Clear();
			origColors.Clear();
			cProps.Clear();
			eProps.Clear();
			fProps.Clear();
			blocks.Clear();
			physIDs.Clear();
			lastIDs.Clear();
			searched = false;
			applied = false;
			reSearchT = 0f;
			cursorSelected = false;
		}

		private bool WasF9()
		{
			try
			{
				return Keyboard.current != null && ((ButtonControl)Keyboard.current[(Key)102]).wasPressedThisFrame;
			}
			catch
			{
				return false;
			}
		}

		private bool WasP()
		{
			try
			{
				return Keyboard.current != null && ((ButtonControl)Keyboard.current[(Key)30]).wasPressedThisFrame;
			}
			catch
			{
				return false;
			}
		}

		private void FixRigsOnTarget(GameObject go)
		{
			if ((Object)(object)go == (Object)null)
			{
				return;
			}
			try
			{
				foreach (Transform componentsInChild in go.GetComponentsInChildren<Transform>(true))
				{
					if ((Object)(object)componentsInChild == (Object)null)
					{
						continue;
					}
					foreach (Renderer component3 in ((Component)componentsInChild).GetComponents<Renderer>())
					{
						if (!((Object)(object)component3 == (Object)null) && !(component3 is SkinnedMeshRenderer))
						{
							component3.enabled = false;
						}
					}
					LineRenderer component = ((Component)componentsInChild).GetComponent<LineRenderer>();
					if ((Object)(object)component != (Object)null)
					{
						((Renderer)component).enabled = false;
					}
					TrailRenderer component2 = ((Component)componentsInChild).GetComponent<TrailRenderer>();
					if ((Object)(object)component2 != (Object)null)
					{
						((Renderer)component2).enabled = false;
					}
				}
			}
			catch
			{
			}
		}

		private void SelectTarget(GameObject go)
		{
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Expected O, but got Unknown
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			if (IsAlreadySelected(go))
			{
				return;
			}
			Restore();
			ResetAll();
			cursorSelected = true;
			players.Add(go);
			BuildPhys();
			RegisterAll();
			lastIDs.Add(((Object)go).GetInstanceID());
			reSearchT = 0f;
			FixRigsOnTarget(go);
			currentEffect = savedEffect;
			applied = false;
			if (currentEffect > 0)
			{
				if (MetallicEffects.Contains(currentEffect))
				{
					StartReflections();
				}
				bool flag = MetallicEffects.Contains(currentEffect);
				foreach (Renderer allRenderer in allRenderers)
				{
					if ((Object)(object)allRenderer == (Object)null || !origMats.TryGetValue(allRenderer, out Material[] value))
					{
						continue;
					}
					Material[] array = (Material[])(object)new Material[value.Length];
					for (int i = 0; i < value.Length; i++)
					{
						try
						{
							object obj = array;
							int num = i;
							obj = (object)((!((Object)(object)value[i] != (Object)null)) ? ((Material)null) : new Material(value[i]));
							((object[])obj)[num] = obj;
						}
						catch
						{
							array[i] = null;
						}
						if (!flag || !((Object)(object)array[i] != (Object)null))
						{
							continue;
						}
						try
						{
							array[i].EnableKeyword("_EMISSION");
						}
						catch
						{
						}
						try
						{
							array[i].EnableKeyword("_SPECULARHIGHLIGHTS");
						}
						catch
						{
						}
						try
						{
							array[i].EnableKeyword("_GLOSSYREFLECTIONS");
						}
						catch
						{
						}
						try
						{
							if (array[i].HasProperty("_Metallic"))
							{
								array[i].SetFloat("_Metallic", 1f);
							}
						}
						catch
						{
						}
						try
						{
							if (array[i].HasProperty("_Glossiness"))
							{
								array[i].SetFloat("_Glossiness", 1f);
							}
						}
						catch
						{
						}
						try
						{
							if (array[i].HasProperty("_Smoothness"))
							{
								array[i].SetFloat("_Smoothness", 1f);
							}
						}
						catch
						{
						}
					}
					try
					{
						allRenderer.sharedMaterials = Il2CppReferenceArray<Material>.op_Implicit(array);
					}
					catch
					{
						continue;
					}
					MaterialPropertyBlock[] array2 = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[value.Length];
					for (int j = 0; j < value.Length; j++)
					{
						try
						{
							array2[j] = new MaterialPropertyBlock();
							allRenderer.GetPropertyBlock(array2[j], j);
						}
						catch
						{
							array2[j] = new MaterialPropertyBlock();
						}
					}
					blocks[allRenderer] = array2;
				}
				applied = true;
				try
				{
					switch (currentEffect)
					{
					case 1:
						ERainbow();
						break;
					case 2:
						EGhost();
						break;
					case 3:
						ENeon();
						break;
					case 4:
						EStrobe();
						break;
					case 5:
						EShadow();
						break;
					case 6:
						EGold();
						break;
					case 7:
						EPulse();
						break;
					case 8:
						EChromatic();
						break;
					case 9:
						EIce();
						break;
					case 10:
						EInfrared();
						break;
					case 11:
						EMatrix();
						break;
					case 12:
						EBubblegum();
						break;
					case 13:
						EStatic();
						break;
					case 14:
						EToon();
						break;
					case 15:
						EVoid();
						break;
					case 16:
						ECopper();
						break;
					case 17:
						EHologram();
						break;
					case 18:
						ELava();
						break;
					case 19:
						EParallax();
						break;
					case 20:
						EAurora();
						break;
					case 21:
						EChrome();
						break;
					case 22:
						EZombie();
						break;
					case 23:
						EDiamond();
						break;
					case 24:
						EToxic();
						break;
					case 25:
						ESunset();
						break;
					case 26:
						ECyber();
						break;
					case 27:
						EFrostbite();
						break;
					case 28:
						ESolar();
						break;
					case 29:
						EPhantom();
						break;
					case 30:
						EOilSlick();
						break;
					case 31:
						EBlood();
						break;
					}
				}
				catch
				{
				}
				ui.Show(effectNames[currentEffect]);
				MelonLogger.Msg("[EffectsGB] Selected: " + ((Object)go).name + " | " + effectNames[currentEffect] + " | renderers=" + allRenderers.Count);
			}
			else
			{
				ui.Show("Off");
				MelonLogger.Msg("[EffectsGB] Selected: " + ((Object)go).name + " | Off | renderers=" + allRenderers.Count);
			}
		}

		private bool Respawned()
		{
			if (++respawnFrame % 25 != 0)
			{
				return false;
			}
			respawnFrame = 0;
			if (players.Count == 0)
			{
				return false;
			}
			HashSet<int> hashSet = new HashSet<int>();
			foreach (GameObject player in players)
			{
				if ((Object)(object)player != (Object)null)
				{
					hashSet.Add(((Object)player).GetInstanceID());
				}
			}
			if (lastIDs.Count > 0 && !EqSet(hashSet, lastIDs))
			{
				return true;
			}
			int num = 0;
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer != (Object)null && !((Object)allRenderer).Equals((Object)null))
				{
					num++;
				}
			}
			if (lastIDs.Count > 0 && num < allRenderers.Count / 2)
			{
				return true;
			}
			lastIDs.Clear();
			foreach (int item in hashSet)
			{
				lastIDs.Add(item);
			}
			return false;
		}

		private static bool EqSet(HashSet<int> a, HashSet<int> b)
		{
			if (a.Count != b.Count)
			{
				return false;
			}
			foreach (int item in a)
			{
				if (!b.Contains(item))
				{
					return false;
				}
			}
			return true;
		}

		private void Find()
		{
			try
			{
				searched = true;
				GameObject val = FindCamFollow();
				if ((Object)(object)val == (Object)null)
				{
					val = FindLocalInput();
				}
				if ((Object)(object)val == (Object)null)
				{
					val = FindLocalId();
				}
				if ((Object)(object)val == (Object)null)
				{
					val = FindCamChild();
				}
				if ((Object)(object)val == (Object)null)
				{
					val = FindAudio();
				}
				if ((Object)(object)val == (Object)null)
				{
					val = FindScored();
				}
				if ((Object)(object)val != (Object)null)
				{
					Finalize(val);
				}
			}
			catch
			{
			}
		}

		private GameObject FindCamFollow()
		{
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				return null;
			}
			Transform parent = ((Component)main).transform.parent;
			while ((Object)(object)parent != (Object)null)
			{
				if (Valid(((Component)parent).gameObject))
				{
					return ((Component)parent).gameObject;
				}
				parent = parent.parent;
			}
			foreach (Component component in ((Component)main).GetComponents<Component>())
			{
				if ((Object)(object)component == (Object)null)
				{
					continue;
				}
				string text = ((object)component).GetType().Name.ToLower();
				if (!text.Contains("follow") && !text.Contains("target") && !text.Contains("track"))
				{
					continue;
				}
				try
				{
					FieldInfo[] fields = ((object)component).GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
					foreach (FieldInfo fieldInfo in fields)
					{
						if (fieldInfo.FieldType != typeof(Transform) && fieldInfo.FieldType != typeof(GameObject))
						{
							continue;
						}
						try
						{
							object? value = fieldInfo.GetValue(component);
							Transform val = (Transform)((value is Transform) ? value : null);
							GameObject val2 = (GameObject)((value is GameObject) ? value : null);
							if (val2 != null)
							{
								val = val2.transform;
							}
							if ((Object)(object)val != (Object)null)
							{
								Transform val3 = Root(val);
								if (Valid(((Component)val3).gameObject))
								{
									return ((Component)val3).gameObject;
								}
							}
						}
						catch
						{
						}
					}
				}
				catch
				{
				}
			}
			RaycastHit val4 = default(RaycastHit);
			if (Physics.Raycast(((Component)main).transform.position, ((Component)main).transform.forward, ref val4, 80f))
			{
				Transform val5 = Root(((RaycastHit)(ref val4)).transform);
				if (Valid(((Component)val5).gameObject))
				{
					return ((Component)val5).gameObject;
				}
			}
			List<GameObject> list = AllCands().FindAll(Valid);
			if (list.Count == 0)
			{
				return null;
			}
			return ClosestCam(list);
		}

		private GameObject FindLocalInput()
		{
			try
			{
				Il2CppArrayBase<PlayerInput> val = Object.FindObjectsOfType<PlayerInput>();
				if (val == null)
				{
					return null;
				}
				foreach (PlayerInput item in val)
				{
					if ((Object)(object)item == (Object)null)
					{
						continue;
					}
					try
					{
						if (item.devices != null && item.devices.Count > 0)
						{
							Transform val2 = Root(((Component)item).transform);
							if (Valid(((Component)val2).gameObject))
							{
								return ((Component)val2).gameObject;
							}
						}
					}
					catch
					{
					}
				}
				foreach (PlayerInput item2 in val)
				{
					if (!((Object)(object)item2 == (Object)null))
					{
						Transform val3 = Root(((Component)item2).transform);
						if (Valid(((Component)val3).gameObject))
						{
							return ((Component)val3).gameObject;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private GameObject FindLocalId()
		{
			try
			{
				foreach (GameObject item in Object.FindObjectsOfType<GameObject>())
				{
					if ((Object)(object)item == (Object)null || !item.activeInHierarchy)
					{
						continue;
					}
					string text = ((Object)item).name.ToLower();
					if ((text.Contains("local") && text.Contains("player")) || text.Contains("player1") || text.Contains("localplayer"))
					{
						Transform val = Root(item.transform);
						if (Valid(((Component)val).gameObject))
						{
							return ((Component)val).gameObject;
						}
					}
					try
					{
						if (item.CompareTag("LocalPlayer") || item.CompareTag("Player1") || item.CompareTag("Player"))
						{
							Transform val2 = Root(item.transform);
							if (Valid(((Component)val2).gameObject))
							{
								return ((Component)val2).gameObject;
							}
						}
					}
					catch
					{
					}
					try
					{
						switch (LayerMask.LayerToName(item.layer))
						{
						case "LocalPlayer":
						case "Player1":
						case "Player":
						{
							Transform val3 = Root(item.transform);
							if (Valid(((Component)val3).gameObject))
							{
								return ((Component)val3).gameObject;
							}
							break;
						}
						}
					}
					catch
					{
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private GameObject FindCamChild()
		{
			try
			{
				Camera main = Camera.main;
				if ((Object)(object)main == (Object)null)
				{
					return null;
				}
				Transform val = ((Component)main).transform;
				while ((Object)(object)val.parent != (Object)null)
				{
					val = val.parent;
					if (Valid(((Component)val).gameObject))
					{
						return ((Component)val).gameObject;
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private GameObject FindAudio()
		{
			try
			{
				foreach (AudioListener item in Object.FindObjectsOfType<AudioListener>())
				{
					if ((Object)(object)item != (Object)null)
					{
						Transform val = Root(((Component)item).transform);
						if (Valid(((Component)val).gameObject))
						{
							return ((Component)val).gameObject;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private GameObject FindScored()
		{
			try
			{
				List<KeyValuePair<GameObject, int>> list = new List<KeyValuePair<GameObject, int>>();
				foreach (GameObject item in AllCands())
				{
					if (Valid(item))
					{
						int num = Score(item);
						if (num >= 10)
						{
							list.Add(new KeyValuePair<GameObject, int>(item, num));
						}
					}
				}
				if (list.Count == 0)
				{
					return null;
				}
				list.Sort((KeyValuePair<GameObject, int> a, KeyValuePair<GameObject, int> b) => b.Value.CompareTo(a.Value));
				int value = list[0].Value;
				List<GameObject> list2 = new List<GameObject>();
				foreach (KeyValuePair<GameObject, int> item2 in list)
				{
					if (item2.Value >= value - 5)
					{
						list2.Add(item2.Key);
					}
				}
				return (GameObject)((list2.Count == 1) ? ((object)list2[0]) : ((object)ClosestCam(list2)));
			}
			catch
			{
			}
			return null;
		}

		private List<GameObject> AllCands()
		{
			HashSet<GameObject> hashSet = new HashSet<GameObject>();
			try
			{
				foreach (SkinnedMeshRenderer item in Object.FindObjectsOfType<SkinnedMeshRenderer>())
				{
					if ((Object)(object)item != (Object)null && ((Component)item).gameObject.activeInHierarchy)
					{
						hashSet.Add(((Component)Root(((Component)item).transform)).gameObject);
					}
				}
			}
			catch
			{
			}
			try
			{
				foreach (Animator item2 in Object.FindObjectsOfType<Animator>())
				{
					if ((Object)(object)item2 != (Object)null && ((Component)item2).gameObject.activeInHierarchy)
					{
						hashSet.Add(((Component)Root(((Component)item2).transform)).gameObject);
					}
				}
			}
			catch
			{
			}
			try
			{
				foreach (PlayerInput item3 in Object.FindObjectsOfType<PlayerInput>())
				{
					if ((Object)(object)item3 != (Object)null)
					{
						hashSet.Add(((Component)Root(((Component)item3).transform)).gameObject);
					}
				}
			}
			catch
			{
			}
			try
			{
				foreach (Rigidbody item4 in Object.FindObjectsOfType<Rigidbody>())
				{
					if ((Object)(object)item4 != (Object)null && !item4.isKinematic)
					{
						Transform val = Root(((Component)item4).transform);
						if (((IEnumerable<Rigidbody>)((Component)val).GetComponentsInChildren<Rigidbody>()).Count((Rigidbody x) => !x.isKinematic) >= 3)
						{
							hashSet.Add(((Component)val).gameObject);
						}
					}
				}
			}
			catch
			{
			}
			return new List<GameObject>(hashSet);
		}

		private GameObject ClosestCam(List<GameObject> list)
		{
			//IL_0054: 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)
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null || list.Count == 0)
			{
				if (list.Count <= 0)
				{
					return null;
				}
				return list[0];
			}
			GameObject result = null;
			float num = float.MaxValue;
			foreach (GameObject item in list)
			{
				if (!((Object)(object)item == (Object)null))
				{
					float num2 = Vector3.Distance(((Component)main).transform.position, item.transform.position);
					if (num2 < num)
					{
						num = num2;
						result = item;
					}
				}
			}
			return result;
		}

		private bool Valid(GameObject go)
		{
			if ((Object)(object)go == (Object)null || !go.activeInHierarchy || Excluded(((Object)go).name))
			{
				return false;
			}
			int num = 0;
			try
			{
				Il2CppArrayBase<SkinnedMeshRenderer> componentsInChildren = go.GetComponentsInChildren<SkinnedMeshRenderer>();
				if (componentsInChildren != null)
				{
					num = componentsInChildren.Length;
				}
			}
			catch
			{
			}
			if (num < 2)
			{
				return false;
			}
			int num2 = 0;
			try
			{
				Il2CppArrayBase<Rigidbody> componentsInChildren2 = go.GetComponentsInChildren<Rigidbody>();
				if (componentsInChildren2 != null)
				{
					num2 = ((IEnumerable<Rigidbody>)componentsInChildren2).Count((Rigidbody r) => !r.isKinematic);
				}
			}
			catch
			{
			}
			if (num2 < 2)
			{
				return false;
			}
			bool flag = false;
			bool flag2 = false;
			try
			{
				foreach (Transform componentsInChild in go.GetComponentsInChildren<Transform>())
				{
					if (!((Object)(object)componentsInChild == (Object)null))
					{
						string text = ((Object)componentsInChild).name.ToLower();
						if (text.Contains("hand") || text.Contains("palm") || text.Contains("arm"))
						{
							flag = true;
						}
						if (text.Contains("foot") || text.Contains("ankle") || text.Contains("leg"))
						{
							flag2 = true;
						}
					}
				}
			}
			catch
			{
			}
			if (!flag || !flag2)
			{
				return false;
			}
			try
			{
				Animator componentInChildren = go.GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.isHuman && num >= 1)
				{
					return false;
				}
			}
			catch
			{
			}
			return true;
		}

		private int Score(GameObject go)
		{
			//IL_0124: 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)
			int num = 0;
			try
			{
				if ((Object)(object)go.GetComponentInChildren<PlayerInput>() != (Object)null)
				{
					num += 30;
				}
			}
			catch
			{
			}
			try
			{
				Animator componentInChildren = go.GetComponentInChildren<Animator>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					num = ((!componentInChildren.isHuman) ? (num - 30) : (num + 20));
				}
			}
			catch
			{
			}
			try
			{
				if (go.CompareTag("Player") || go.CompareTag("LocalPlayer"))
				{
					num += 20;
				}
			}
			catch
			{
			}
			try
			{
				string text = LayerMask.LayerToName(go.layer);
				if (text == "Player" || text == "LocalPlayer")
				{
					num += 15;
				}
			}
			catch
			{
			}
			string text2 = ((Object)go).name.ToLower();
			if (text2.Contains("local"))
			{
				num += 25;
			}
			if (text2.Contains("crowd") || text2.Contains("spectator") || text2.Contains("npc") || text2.Contains("bot") || text2.Contains("dummy") || text2.Contains("ai"))
			{
				num -= 60;
			}
			try
			{
				Camera main = Camera.main;
				if ((Object)(object)main != (Object)null)
				{
					float num2 = Vector3.Distance(((Component)main).transform.position, go.transform.position);
					if (num2 < 5f)
					{
						num += 15;
					}
					else if (num2 < 10f)
					{
						num += 8;
					}
				}
			}
			catch
			{
			}
			return num;
		}

		private void Finalize(GameObject go)
		{
			players.Clear();
			players.Add(go);
			BuildPhys();
			RegisterAll();
			lastIDs.Clear();
			lastIDs.Add(((Object)go).GetInstanceID());
			reSearchT = 0f;
			if (savedEffect > 0)
			{
				currentEffect = savedEffect;
				ui.Show(effectNames[currentEffect]);
				if (MetallicEffects.Contains(currentEffect))
				{
					StartReflections();
				}
			}
			else
			{
				currentEffect = 0;
				ui.Show("Off");
			}
		}

		private void BuildPhys()
		{
			physIDs.Clear();
			foreach (GameObject player in players)
			{
				if ((Object)(object)player == (Object)null)
				{
					continue;
				}
				try
				{
					foreach (Transform componentsInChild in player.GetComponentsInChildren<Transform>(true))
					{
						if ((Object)(object)componentsInChild != (Object)null && ((Object)(object)((Component)componentsInChild).gameObject.GetComponent<Collider>() != (Object)null || (Object)(object)((Component)componentsInChild).gameObject.GetComponent<Rigidbody>() != (Object)null || (Object)(object)((Component)componentsInChild).gameObject.GetComponent<Joint>() != (Object)null))
						{
							physIDs.Add(((Object)((Component)componentsInChild).gameObject).GetInstanceID());
						}
					}
				}
				catch
				{
				}
			}
		}

		private void RegisterAll()
		{
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			allRenderers.Clear();
			origMats.Clear();
			origColors.Clear();
			cProps.Clear();
			eProps.Clear();
			fProps.Clear();
			blocks.Clear();
			foreach (GameObject player in players)
			{
				if ((Object)(object)player == (Object)null)
				{
					continue;
				}
				Renderer[] array;
				try
				{
					array = Il2CppArrayBase<Renderer>.op_Implicit(player.GetComponentsInChildren<Renderer>(true));
				}
				catch
				{
					continue;
				}
				if (array == null)
				{
					continue;
				}
				Renderer[] array2 = array;
				foreach (Renderer val in array2)
				{
					try
					{
						if ((Object)(object)val == (Object)null || val.sharedMaterials == null || ((Il2CppArrayBase<Material>)(object)val.sharedMaterials).Length == 0 || (!cursorSelected && SkipName(((Object)val).name)))
						{
							continue;
						}
						bool flag = false;
						foreach (Material item in (Il2CppArrayBase<Material>)(object)val.sharedMaterials)
						{
							if ((Object)(object)item != (Object)null)
							{
								flag = true;
								break;
							}
						}
						if (!flag)
						{
							continue;
						}
						Il2CppReferenceArray<Material> sharedMaterials = val.sharedMaterials;
						origMats[val] = Il2CppArrayBase<Material>.op_Implicit((Il2CppArrayBase<Material>)(object)sharedMaterials);
						List<string> list = new List<string>();
						List<string> list2 = new List<string>();
						List<string> list3 = new List<string>();
						for (int j = 0; j < ((Il2CppArrayBase<Material>)(object)sharedMaterials).Length; j++)
						{
							if ((Object)(object)((Il2CppArrayBase<Material>)(object)sharedMaterials)[j] != (Object)null)
							{
								try
								{
									Disc(((Il2CppArrayBase<Material>)(object)sharedMaterials)[j], list, list2, list3);
								}
								catch
								{
								}
							}
						}
						cProps[val] = list;
						eProps[val] = list2;
						fProps[val] = list3;
						if (((Il2CppArrayBase<Material>)(object)sharedMaterials).Length > 0 && (Object)(object)((Il2CppArrayBase<Material>)(object)sharedMaterials)[0] != (Object)null)
						{
							origColors[val] = FirstCol(((Il2CppArrayBase<Material>)(object)sharedMaterials)[0], list);
						}
						allRenderers.Add(val);
					}
					catch
					{
					}
				}
			}
			if (allRenderers.Count > 0)
			{
				Renderer val2 = allRenderers[0];
				if ((Object)(object)val2 != (Object)null && val2.sharedMaterials != null && ((Il2CppArrayBase<Material>)(object)val2.sharedMaterials).Length > 0 && (Object)(object)((Il2CppArrayBase<Material>)(object)val2.sharedMaterials)[0] != (Object)null)
				{
					MelonLogger.Msg("[EffectsGB] Shader: " + ((Object)((Il2CppArrayBase<Material>)(object)val2.sharedMaterials)[0].shader).name + " | renderers=" + allRenderers.Count);
				}
			}
		}

		private void Disc(Material m, List<string> cp, List<string> ep, List<string> fp)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Shader shader = m.shader;
				int propertyCount = shader.GetPropertyCount();
				for (int i = 0; i < propertyCount; i++)
				{
					string propertyName = shader.GetPropertyName(i);
					try
					{
						m.GetColor(propertyName);
						if (propertyName.ToLower().Contains("emission") || propertyName.ToLower().Contains("emissive"))
						{
							ep.Add(propertyName);
						}
						else
						{
							cp.Add(propertyName);
						}
					}
					catch
					{
						try
						{
							m.GetFloat(propertyName);
							fp.Add(propertyName);
						}
						catch
						{
						}
					}
				}
			}
			catch
			{
			}
			string[] colorProps;
			if (cp.Count == 0)
			{
				colorProps = ColorProps;
				foreach (string text in colorProps)
				{
					try
					{
						if (m.HasProperty(text) && !cp.Contains(text))
						{
							cp.Add(text);
						}
					}
					catch
					{
					}
				}
			}
			if (ep.Count != 0)
			{
				return;
			}
			colorProps = EmissionProps;
			foreach (string text2 in colorProps)
			{
				try
				{
					if (m.HasProperty(text2) && !ep.Contains(text2))
					{
						ep.Add(text2);
					}
				}
				catch
				{
				}
			}
		}

		private static Color FirstCol(Material m, List<string> props)
		{
			//IL_006c: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			foreach (string prop in props)
			{
				try
				{
					Color color = m.GetColor(prop);
					if (color.a > 0.01f)
					{
						return color;
					}
				}
				catch
				{
				}
			}
			try
			{
				return (m.color.a > 0.01f) ? m.color : Color.white;
			}
			catch
			{
				return Color.white;
			}
		}

		private static bool SkipName(string n)
		{
			if (n == null)
			{
				return true;
			}
			string text = n.ToLower();
			if (!text.Contains("collider") && !text.Contains("helper") && !text.Contains("proxy") && !text.Contains("joint") && !text.Contains("effector") && !text.Contains("target") && !text.Contains("locator") && !text.Contains("gizmo") && !text.Contains("widget") && !text.Contains("handle") && !text.Contains("debug") && !text.Contains("wire") && !text.Contains("trigger") && !text.Contains("volume"))
			{
				return text.Contains("zone");
			}
			return true;
		}

		private static bool Excluded(string n)
		{
			if (n == null)
			{
				return true;
			}
			string text = n.ToLower();
			if (!text.Contains("menu") && !text.Contains("meat") && !text.Contains("pool") && !text.Contains("liquid") && !text.Contains("slime") && !text.Contains("grind") && !text.Contains("grill") && !text.Contains("platform") && !text.Contains("level") && !text.Contains("env") && !text.Contains("prop") && !text.Contains("scene") && !text.Contains("water") && !text.Contains("floor") && !text.Contains("ceiling") && !text.Contains("particle") && !text.Contains("ui") && !text.Contains("canvas") && !text.Contains("camera") && !text.Contains("audio") && !text.Contains("manager") && !text.Contains("network") && !text.Contains("rope") && !text.Contains("chain") && !text.Contains("hazard") && !text.Contains("death") && !text.Contains("cone") && !text.Contains("barrel") && !text.Contains("crate") && !text.Contains("grid") && !text.Contains("light") && !text.Contains("fog") && !text.Contains("smoke") && !text.Contains("fire") && !text.Contains("flame") && !text.Contains("decal") && !text.Contains("overlay") && !text.Contains("projector") && !text.Contains("octopus") && !text.Contains("fish") && !text.Contains("shark") && !text.Contains("whale") && !text.Contains("turtle") && !text.Contains("crab") && !text.Contains("seagull") && !text.Contains("bird") && !text.Contains("animal") && !text.Contains("creature") && !text.Contains("monster") && !text.Contains("beast") && !text.Contains("pet") && !text.Contains("enemy") && !text.Contains("mob") && !text.Contains("critter") && !text.Contains("wildlife") && !text.Contains("aquarium") && !text.Contains("tank") && !text.Contains("exhibit") && !text.Contains("display") && !text.Contains("decoration") && !text.Contains("sign") && !text.Contains("banner") && !text.Contains("flag") && !text.Contains("fence") && !text.Contains("rail") && !text.Contains("wall") && !text.Contains("glass") && !text.Contains("window") && !text.Contains("crowd") && !text.Contains("spectator") && !text.Contains("audience") && !text.Contains("bystander") && !text.Contains("npc") && !text.Contains("dummy_") && !text.Contains("bot_") && !text.Contains("ai_") && !text.Contains("cpu_") && !text.Contains("jellyfish") && !text.Contains("starfish") && !text.Contains("coral") && !text.Contains("seaweed") && !text.Contains("anemone") && !text.Contains("urchin") && !text.Contains("lobster") && !text.Contains("shrimp") && !text.Contains("eel") && !text.Contains("dolphin") && !text.Contains("seal") && !text.Contains("walrus") && !text.Contains("penguin") && !text.Contains("polar"))
			{
				return text.Contains("bear");
			}
			return true;
		}

		private static Transform Root(Transform t)
		{
			Transform val;
			for (val = t; (Object)(object)val.parent != (Object)null; val = val.parent)
			{
				try
				{
					string text = ((Object)val.parent).name.ToLower();
					if (text.Contains("scene") || text.Contains("manager") || text.Contains("world") || text.Contains("level") || text.Contains("environment") || text.Contains("root") || text.Contains("arena") || text.Contains("map") || text.Contains("game") || text.Contains("instance") || text.Contains("dontdestroy") || text.Contains("static") || text.Contains("dynamic") || text.Contains("network") || text.Contains("server") || text.Contains("actors") || text.Contains("characters") || text.Contains("players") || text.Contains("aquarium") || text.Contains("wildlife") || text.Contains("animals") || text.Contains("creatures") || text.Contains("crowd") || text.Contains("spectators"))
					{
						break;
					}
					continue;
				}
				catch
				{
				}
				break;
			}
			return val;
		}

		private void SC(Renderer r, Color c)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!blocks.TryGetValue(r, out MaterialPropertyBlock[] value))
			{
				return;
			}
			for (int i = 0; i < value.Length; i++)
			{
				if (value[i] == null)
				{
					continue;
				}
				if (cProps.TryGetValue(r, out List<string> value2))
				{
					foreach (string item in value2)
					{
						value[i].SetColor(item, c);
					}
				}
				r.SetPropertyBlock(value[i], i);
			}
		}

		private void SE(Renderer r, Color c)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!blocks.TryGetValue(r, out MaterialPropertyBlock[] value) || !eProps.TryGetValue(r, out List<string> value2))
			{
				return;
			}
			for (int i = 0; i < value.Length; i++)
			{
				if (value[i] == null)
				{
					continue;
				}
				foreach (string item in value2)
				{
					value[i].SetColor(item, c);
				}
				r.SetPropertyBlock(value[i], i);
			}
		}

		private void SF(Renderer r, string p, float v)
		{
			if (!blocks.TryGetValue(r, out MaterialPropertyBlock[] value) || !fProps.TryGetValue(r, out List<string> value2) || !value2.Contains(p))
			{
				return;
			}
			for (int i = 0; i < value.Length; i++)
			{
				if (value[i] != null)
				{
					value[i].SetFloat(p, v);
					r.SetPropertyBlock(value[i], i);
				}
			}
		}

		private void SA(Renderer r, float a)
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			if (!blocks.TryGetValue(r, out MaterialPropertyBlock[] value))
			{
				return;
			}
			for (int i = 0; i < value.Length; i++)
			{
				if (value[i] == null)
				{
					continue;
				}
				if (cProps.TryGetValue(r, out List<string> value2))
				{
					foreach (string item in value2)
					{
						r.GetPropertyBlock(value[i], i);
						Color color = value[i].GetColor(item);
						color.a = a;
						value[i].SetColor(item, color);
					}
				}
				r.SetPropertyBlock(value[i], i);
			}
		}

		private void SCAll(Color c)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer != (Object)null)
				{
					SC(allRenderer, c);
				}
			}
		}

		private void SEAll(Color c)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer != (Object)null)
				{
					SE(allRenderer, c);
				}
			}
		}

		private void SFAll(string p, float v)
		{
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer != (Object)null)
				{
					SF(allRenderer, p, v);
				}
			}
		}

		private void SAAll(float a)
		{
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer != (Object)null)
				{
					SA(allRenderer, a);
				}
			}
		}

		private void Each(Action<Renderer, int> fn)
		{
			int num = 0;
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer != (Object)null)
				{
					try
					{
						fn(allRenderer, num);
					}
					catch
					{
					}
				}
				num++;
			}
		}

		private void Cycle()
		{
			try
			{
				Restore();
				applied = false;
				currentEffect = (currentEffect + 1) % 32;
				savedEffect = currentEffect;
				if (MetallicEffects.Contains(savedEffect))
				{
					StartReflections();
				}
				else
				{
					StopReflections();
				}
				if (players.Count == 0)
				{
					searched = false;
					Find();
				}
				if (currentEffect == 0)
				{
					savedEffect = 0;
					ui.Show("Off");
				}
				else
				{
					ui.Show(effectNames[currentEffect]);
					slowmo = true;
					slowmoT = 0f;
					Time.timeScale = 0.3f;
				}
				PlayWarpSound();
			}
			catch (Exception ex)
			{
				MelonLogger.Error("[EffectsGB] Cycle: " + ex.Message);
				ui.ShowError("Error");
			}
		}

		private void Restore()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			applied = false;
			foreach (Renderer allRenderer in allRenderers)
			{
				if ((Object)(object)allRenderer == (Object)null)
				{
					continue;
				}
				if (origMats.TryGetValue(allRenderer, out Material[] value))
				{
					try
					{
						allRenderer.sharedMaterials = Il2CppReferenceArray<Material>.op_Implicit(value);
					}
					catch
					{
					}
				}
				try
				{
					allRenderer.SetPropertyBlock(new MaterialPropertyBlock());
				}
				catch
				{
				}
				try
				{
					int num = ((allRenderer.sharedMaterials != null) ? ((Il2CppArrayBase<Material>)(object)allRenderer.sharedMaterials).Length : 0);
					for (int i = 0; i < num; i++)
					{
						try
						{
							allRenderer.SetPropertyBlock((MaterialPropertyBlock)null, i);
						}
						catch
						{
						}
					}
				}
				catch
				{
				}
				try
				{
					allRenderer.enabled = false;
					allRenderer.enabled = true;
				}
				catch
				{
				}
			}
			blocks.Clear();
			StopReflections();
		}

		private void Apply()
		{
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Expected O, but got Unknown
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			if (!applied)
			{
				try
				{
					bool flag = MetallicEffects.Contains(currentEffect);
					foreach (Renderer allRenderer in allRenderers)
					{
						if ((Object)(object)allRenderer == (Object)null || !origMats.TryGetValue(allRenderer, out Material[] value))
						{
							continue;
						}
						Material[] array = (Material[])(object)new Material[value.Length];
						for (int i = 0; i < value.Length; i++)
						{
							try
							{
								object obj = array;
								int num = i;
								obj = (object)((!((Object)(object)value[i] != (Object)null)) ? ((Material)null) : new Material(value[i]));
								((object[])obj)[num] = obj;
							}
							catch
							{
								array[i] = null;
							}
							if (!flag || !((Object)(object)array[i] != (Object)null))
							{
								continue;
							}
							try
							{
								array[i].EnableKeyword("_EMISSION");
							}
							catch
							{
							}
							try
							{
								array[i].EnableKeyword("_SPECULARHIGHLIGHTS");
							}
							catch
							{
							}
							try
							{
								array[i].EnableKeyword("_GLOSSYREFLECTIONS");
							}
							catch
							{
							}
							try
							{
								if (array[i].HasProperty("_Metallic"))
								{
									array[i].SetFloat("_Metallic", 1f);
								}
							}
							catch
							{
							}
							try
							{
								if (array[i].HasProperty("_Glossiness"))
								{
									array[i].SetFloat("_Glossiness", 1f);
								}
							}
							catch
							{
							}
							try
							{
								if (array[i].HasProperty("_Smoothness"))
								{
									array[i].SetFloat("_Smoothness", 1f);
								}
							}
							catch
							{
							}
							try
							{
								if (array[i].HasProperty("_GlossyReflections"))
								{
									array[i].SetFloat("_GlossyReflections", 1f);
								}
							}
							catch
							{
							}
							try
							{
								if (array[i].HasProperty("_SpecularHighlights"))
								{
									array[i].SetFloat("_SpecularHighlights", 1f);
								}
							}
							catch
							{
							}
						}
						try
						{
							allRenderer.sharedMaterials = Il2CppReferenceArray<Material>.op_Implicit(array);
						}
						catch
						{
							continue;
						}
						MaterialPropertyBlock[] array2 = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[value.Length];
						for (int j = 0; j < value.Length; j++)
						{
							try
							{
								array2[j] = new MaterialPropertyBlock();
								allRenderer.GetPropertyBlock(array2[j], j);
							}
							catch
							{
								array2[j] = new MaterialPropertyBlock();
							}
						}
						blocks[allRenderer] = array2;
					}
					applied = true;
				}
				catch (Exception ex)
				{
					MelonLogger.Error("[EffectsGB] Apply: " + ex.Message);
					return;
				}
			}
			try
			{
				switch (currentEffect)
				{
				case 1:
					ERainbow();
					break;
				case 2:
					EGhost();
					break;
				case 3:
					ENeon();
					break;
				case 4:
					EStrobe();
					break;
				case 5:
					EShadow();
					break;
				case 6:
					EGold();
					break;
				case 7:
					EPulse();
					break;
				case 8:
					EChromatic();
					break;
				case 9:
					EIce();
					break;
				case 10:
					EInfrared();
					break;
				case 11:
					EMatrix();
					break;
				case 12:
					EBubblegum();
					break;
				case 13:
					EStatic();
					break;
				case 14:
					EToon();
					break;
				case 15:
					EVoid();
					break;
				case 16:
					ECopper();
					break;
				case 17:
					EHologram();
					break;
				case 18:
					ELava();
					break;
				case 19:
					EParallax();
					break;
				case 20:
					EAurora();
					break;
				case 21:
					EChrome();
					break;
				case 22:
					EZombie();
					break;
				case 23:
					EDiamond();
					break;
				case 24:
					EToxic();
					break;
				case 25:
					ESunset();
					break;
				case 26:
					ECyber();
					break;
				case 27:
					EFrostbite();
					break;
				case 28:
					ESolar();
					break;
				case 29:
					EPhantom();
					break;
				case 30:
					EOilSlick();
					break;
				case 31:
					EBlood();
					break;
				}
			}
			catch
			{
			}
		}

		private void EnsureProbe()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0075: 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)
			if ((Object)(object)probeHolder != (Object)null)
			{
				if ((Object)(object)myProbe == (Object)null)
				{
					try
					{
						myProbe = probeHolder.GetComponent<ReflectionProbe>();
						return;
					}
					catch
					{
						return;
					}
				}
				return;
			}
			try
			{
				probeHolder = new GameObject("FXRefProbe");
				Object.DontDestroyOnLoad((Object)(object)probeHolder);
				myProbe = probeHolder.AddComponent<ReflectionProbe>();
				myProbe.size = new Vector3(24f, 24f, 24f);
				myProbe.nearClipPlane = 0.01f;
				myProbe.farClipPlane = 100f;
				myProbe.resolution = 512;
				myProbe.importance = 200;
				myProbe.boxProjection = true;
				myProbe.intensity = 3f;
				myProbe.cullingMask = -1;
				myProbe.backgroundColor = new Color(0.6f, 0.6f, 0.7f, 1f);
				myProbe.clearFlags = (ReflectionProbeClearFlags)1;
				try
				{
					myProbe.mode = (ReflectionProbeMode)1;
				}
				catch
				{
				}
				try
				{
					myProbe.refreshMode = (ReflectionProbeRefreshMode)1;
				}
				catch
				{
				}
				try
				{
					myProbe.timeSlicingMode = (ReflectionProbeTimeSlicingMode)2;
				}
				catch
				{
				}
				try
				{
					myProbe.RenderProbe();
				}
				catch
				{
				}
			}
			catch
			{
			}
		}

		private void StartReflections()
		{
			reflectionsActive = true;
			probeTick = 0;
			EnsureProbe();
		}

		private void StopReflections()
		{
			reflectionsActive = false;
		}

		private void TickReflections()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			EnsureProbe();
			if ((Object)(object)myProbe == (Object)null || (Object)(object)probeHolder == (Object)null)
			{
				return;
			}
			try
			{
				if (players.Count > 0 && (Object)(object)players[0] != (Object)null)
				{
					probeHolder.transform.position = players[0].transform.position + Vector3.up * 0.5f;
				}
			}
			catch
			{
			}
			if (++probeTick % 5 != 0)
			{
				return;
			}
			try
			{
				myProbe.RenderProbe();
			}
			catch
			{
				myProbe = null;
			}
		}

		private void ERainbow()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_008d: 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_00de: Unknown result type (might be due to invalid IL or missing references)
				float num = (timer * 0.3f + (float)i * 0.08f) % 1f;
				float num2 = Mathf.Lerp(0.85f, 1f, (Mathf.Sin(timer * 1.2f + (float)i * 0.5f) + 1f) * 0.5f);
				float num3 = Mathf.Lerp(0.9f, 1f, (Mathf.Sin(timer * 0.8f + (float)i * 0.3f) + 1f) * 0.5f);
				SC(r, Color.HSVToRGB(num, num2, num3));
				SE(r, Color.HSVToRGB(num, 0.7f, 1f) * Mathf.Lerp(0.4f, 1.8f, (Mathf.Sin(timer * 2f + (float)i * 0.7f) + 1f) * 0.5f));
			});
			SFAll("_Metallic", Mathf.Lerp(0.3f, 0.85f, (Mathf.Sin(timer) + 1f) * 0.5f));
			SFAll("_Glossiness", Mathf.Lerp(0.6f, 0.95f, (Mathf.Sin(timer * 0.7f) + 1f) * 0.5f));
			SFAll("_Smoothness", Mathf.Lerp(0.6f, 0.95f, (Mathf.Sin(timer * 0.7f) + 1f) * 0.5f));
		}

		private void EGhost()
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			float num = (Mathf.Sin(timer * 1.2f) + 1f) * 0.5f;
			float num2 = Mathf.PerlinNoise(timer * 2f, 0f);
			SCAll(new Color(0.6f, 0.75f, 1f));
			SAAll(Mathf.Lerp(0.06f, 0.4f, num) * Mathf.Lerp(0.5f, 1f, num2));
			SFAll("_Metallic", 0.1f);
			SFAll("_Glossiness", 1f);
			SFAll("_Smoothness", 1f);
			float g = Mathf.Lerp(0.8f, 2.5f, num);
			Each(delegate(Renderer r, int i)
			{
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				float num3 = Mathf.Lerp(0.5f, 1.5f, (Mathf.Sin(timer * 3f + (float)i * 1.1f) + 1f) * 0.5f);
				SE(r, new Color(g * 0.2f * num3, g * 0.4f * num3, g * num3));
			});
		}

		private void ENeon()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			SCAll(new Color(0.02f, 0.02f, 0.02f));
			SFAll("_Metallic", 0f);
			SFAll("_Glossiness", 0.05f);
			SFAll("_Smoothness", 0.05f);
			Each(delegate(Renderer r, int i)
			{
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
				float num = (timer * 1.2f + (float)i * 0.15f) % 1f;
				float num2 = (num + 0.3f) % 1f;
				float num3 = Mathf.Lerp(2f, 6f, (Mathf.Sin(timer * 6f + (float)i * 1.8f) + 1f) * 0.5f);
				float num4 = (Mathf.Sin(timer * 3f + (float)i * 2f) + 1f) * 0.5f;
				SE(r, Color.Lerp(Color.HSVToRGB(num, 1f, 1f) * num3, Color.HSVToRGB(num2, 1f, 1f) * num3, num4));
			});
		}

		private void EStrobe()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_0084: 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_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				if (Mathf.Sin(timer * 18f + (float)i * 1.5f) > 0f)
				{
					float num = (timer * 0.5f + (float)i * 0.1f) % 1f;
					SC(r, Color.HSVToRGB(num, 0.3f, 1f));
					SE(r, Color.HSVToRGB(num, 0.5f, 1f) * 2f);
					SA(r, 1f);
				}
				else
				{
					SC(r, Color.black);
					SE(r, Color.black);
					SA(r, 0.03f);
				}
			});
		}

		private void EShadow()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.PerlinNoise(timer * 3f + (float)i * 7f, (float)i * 3f);
				float num2 = Mathf.PerlinNoise(timer * 5f + (float)i * 11f, (float)i * 5f);
				float num3 = Mathf.PerlinNoise(timer * 7f + (float)i * 13f, (float)i * 7f);
				float num4 = Mathf.Lerp(0.01f, 0.04f, (Mathf.Sin(timer * 0.5f + (float)i * 0.3f) + 1f) * 0.5f);
				SC(r, new Color(num4, num4 * 0.5f, num4 * 1.5f));
				float num5 = Mathf.Pow(num, 3f) * 6f;
				float num6 = Mathf.Pow(num2, 3f) * 4f;
				float num7 = Mathf.Pow(num3, 3f) * 5f;
				SE(r, new Color(num5 * 0.3f, num6 * 0.1f, num5 * 0.8f + num7 * 0.5f));
			});
			SFAll("_Metallic", 1f);
			SFAll("_Glossiness", 0.98f);
			SFAll("_Smoothness", 0.98f);
		}

		private void EGold()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_00e9: 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)
				float num = Mathf.PerlinNoise(timer * 4f + (float)i * 7f, (float)i * 3f);
				float num2 = Mathf.PerlinNoise(timer * 6f + (float)i * 11f, (float)i * 5f);
				float num3 = Mathf.PerlinNoise(timer * 8f + (float)i * 13f, (float)i * 7f);
				float num4 = Mathf.Lerp(0.7f, 1f, (Mathf.Sin(timer * 3f + (float)i * 0.9f) + 1f) * 0.5f);
				float num5 = Mathf.Lerp(0.85f, 1f, (Mathf.Sin(timer * 1.5f + (float)i * 0.4f) + 1f) * 0.5f);
				SC(r, new Color(num4, 0.76f * num4 * num5, 0.28f * num4 * num5));
				float num6 = Mathf.Pow(num, 3f) * 5f;
				float num7 = Mathf.Pow(num2, 3f) * 4f;
				float num8 = Mathf.Pow(num3, 3f) * 3f;
				float num9 = num6 + num7 + num8;
				SE(r, new Color(Mathf.Lerp(0.6f, 2.2f, num4) + num9 * 0.8f, Mathf.Lerp(0.6f, 2.2f, num4) * 0.55f + num9 * 0.5f, Mathf.Lerp(0.6f, 2.2f, num4) * 0.05f + num9 * 0.1f));
			});
			SFAll("_Metallic", 1f);
			SFAll("_Glossiness", Mathf.Lerp(0.85f, 0.97f, (Mathf.Sin(timer * 0.5f) + 1f) * 0.5f));
			SFAll("_Smoothness", Mathf.Lerp(0.85f, 0.97f, (Mathf.Sin(timer * 0.5f) + 1f) * 0.5f));
		}

		private void EPulse()
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			float b = (Mathf.Sin(timer * 2f) + 1f) * 0.5f;
			float a = Mathf.Lerp(0.05f, 1f, b * b);
			Each(delegate(Renderer r, int i)
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				if (origColors.TryGetValue(r, out var value))
				{
					float num2 = default(float);
					float num3 = default(float);
					float num4 = default(float);
					Color.RGBToHSV(value, ref num2, ref num3, ref num4);
					value = Color.HSVToRGB(num2, num3, Mathf.Lerp(num4 * 0.3f, num4, b));
					value.a = a;
					SC(r, value);
				}
			});
			SAAll(a);
			SFAll("_Metallic", 0f);
			SFAll("_Glossiness", 0.5f);
			SFAll("_Smoothness", 0.5f);
			float num = Mathf.Lerp(0f, 2f, b);
			SEAll(new Color(num, num, num));
		}

		private void EChromatic()
		{
			float ph = timer * 3f;
			Each(delegate(Renderer r, int i)
			{
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				float num = (float)i * 0.25f;
				float num2 = Mathf.Pow(Mathf.Sin(ph + num) * 0.5f + 0.5f, 1.5f);
				float num3 = Mathf.Pow(Mathf.Sin(ph + num + 2.094f) * 0.5f + 0.5f, 1.5f);
				float num4 = Mathf.Pow(Mathf.Sin(ph + num + 4.189f) * 0.5f + 0.5f, 1.5f);
				SC(r, new Color(num2, num3, num4));
				float num5 = Mathf.Lerp(0.8f, 3f, (Mathf.Sin(timer * 4f + (float)i * 1.2f) + 1f) * 0.5f);
				SE(r, new Color(num2 * num5, num3 * num5 * 0.4f, num4 * num5 * 0.4f));
			});
			SFAll("_Metallic", 0.1f);
			SFAll("_Glossiness", 0.4f);
			SFAll("_Smoothness", 0.4f);
		}

		private void EIce()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0099: 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)
				float num = Mathf.Lerp(0.5f, 1f, (Mathf.Sin(timer * 2.5f + (float)i * 0.7f) + 1f) * 0.5f);
				float num2 = Mathf.PerlinNoise(timer * 1.5f + (float)i * 3f, (float)i * 2f);
				SC(r, new Color(0.6f * num + num2 * 0.1f, 0.85f * num + num2 * 0.1f, 1f));
				SE(r, new Color(0.15f, 0.4f, 1f) * Mathf.Lerp(0.3f, 2.5f, num * num2));
			});
			SFAll("_Metallic", 0.2f);
			SFAll("_Glossiness", 1f);
			SFAll("_Smoothness", 1f);
			SAAll(0.88f);
		}

		private void EInfrared()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_0076: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: 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_00de: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: 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)
				float num = (Mathf.Sin(timer * 2f + (float)i * 0.6f) + 1f) * 0.5f;
				float num2 = Mathf.PerlinNoise(timer * 1.5f + (float)i * 2f, (float)i * 1.5f);
				num = Mathf.Clamp01(num * 0.7f + num2 * 0.3f);
				Color val = ((num < 0.33f) ? Color.Lerp(new Color(0.1f, 0f, 0.2f), new Color(0.8f, 0f, 0f), num * 3f) : ((!(num < 0.66f)) ? Color.Lerp(new Color(1f, 0.7f, 0f), new Color(1f, 1f, 0.9f), (num - 0.66f) * 3f) : Color.Lerp(new Color(0.8f, 0f, 0f), new Color(1f, 0.7f, 0f), (num - 0.33f) * 3f)));
				SC(r, val);
				SE(r, val * Mathf.Lerp(0.5f, 3f, num));
			});
			SFAll("_Metallic", 0f);
			SFAll("_Glossiness", 0f);
			SFAll("_Smoothness", 0f);
		}

		private void EMatrix()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Repeat(timer * 4f + (float)i * 2f, 1f);
				float num2 = ((num < 0.08f) ? 1f : Mathf.Lerp(0.03f, 0.2f, (Mathf.Sin(timer * 8f + (float)i * 3f) + 1f) * 0.5f));
				SC(r, new Color(0f, num2, 0f));
				float num3 = ((num < 0.08f) ? 4f : (Mathf.PerlinNoise(timer * 5f + (float)i * 8f, (float)i * 4f) * 3f));
				SE(r, new Color(0f, num3, 0f));
			});
			SFAll("_Metallic", 0f);
			SFAll("_Glossiness", 0.15f);
			SFAll("_Smoothness", 0.15f);
		}

		private void EBubblegum()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Abs(Mathf.Sin(timer * 3f + (float)i * 0.8f));
				SC(r, Color.HSVToRGB(Mathf.Lerp(0.82f, 0.97f, num), Mathf.Lerp(0.7f, 1f, num), Mathf.Lerp(0.85f, 1f, num)));
				SE(r, Color.HSVToRGB(Mathf.Lerp(0.82f, 0.97f, num), 0.4f, 1f) * Mathf.Lerp(0.3f, 1.5f, num));
			});
			SFAll("_Metallic", Mathf.Lerp(0.1f, 0.5f, Mathf.Abs(Mathf.Sin(timer * 3f))));
			SFAll("_Glossiness", Mathf.Lerp(0.5f, 1f, Mathf.Abs(Mathf.Sin(timer * 3f))));
			SFAll("_Smoothness", Mathf.Lerp(0.5f, 1f, Mathf.Abs(Mathf.Sin(timer * 3f))));
		}

		private void EStatic()
		{
			staticT += Time.deltaTime;
			if (!(staticT < 0.03f))
			{
				staticT = 0f;
				Each(delegate(Renderer r, int i)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_0078: Unknown result type (might be due to invalid IL or missing references)
					//IL_0044: Unknown result type (might be due to invalid IL or missing references)
					float value = Random.value;
					SC(r, new Color(value * 0.9f, value * 0.95f, value));
					SE(r, (Random.value > 0.85f) ? new Color(Random.Range(1.5f, 4f), Random.Range(1.5f, 4f), Random.Range(1.5f, 4f)) : new Color(value * 0.5f, value * 0.5f, value * 0.5f));
				});
				SFAll("_Metallic", 0f);
				SFAll("_Glossiness", 0f);
				SFAll("_Smoothness", 0f);
			}
		}

		private void EToon()
		{
			float hs = timer * 0.2f % 1f;
			Each(delegate(Renderer r, int i)
			{
				//IL_001c: 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_0093: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
				float num2 = default(float);
				float num3 = default(float);
				float num = default(float);
				Color.RGBToHSV(origColors.TryGetValue(r, out var value) ? value : Color.white, ref num, ref num2, ref num3);
				num = (num + hs + (float)i * 0.04f) % 1f;
				float num4 = Mathf.Sin(timer * 2f + (float)i * 0.8f);
				SC(r, Color.HSVToRGB(num, 1f, (num4 > 0f) ? 1f : ((num4 > -0.7f) ? 0.7f : 0.35f)));
				SE(r, (Color)((num4 > 0.75f) ? new Color(1.5f, 1.5f, 1.5f) : Color.black));
			});
			SFAll("_Metallic", 0f);
			SFAll("_Glossiness", 0f);
			SFAll("_Smoothness", 0f);
		}

		private void EVoid()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_0045: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Lerp(0.01f, 0.03f, (Mathf.Sin(timer * 0.3f + (float)i * 0.2f) + 1f) * 0.5f);
				SC(r, new Color(num * 0.5f, 0f, num));
				float num2 = timer * 0.3f + (float)i * 0.5f;
				float num3 = Mathf.Lerp(0f, 0.15f, (Mathf.Sin(timer * 0.4f) + 1f) * 0.5f);
				float num4 = Mathf.PerlinNoise(timer * 3f + (float)i * 9f, (float)i * 5f);
				SE(r, (num4 > 0.92f) ? new Color(num3 * 3f * Mathf.Sin(num2), num3 * 0.5f, num3 * 3f * Mathf.Cos(num2)) : new Color(num3 * Mathf.Sin(num2), 0f, num3 * Mathf.Cos(num2)));
			});
			SFAll("_Metallic", 0.3f);
			SFAll("_Glossiness", 0.9f);
			SFAll("_Smoothness", 0.9f);
		}

		private void ECopper()
		{
			Each(delegate(Renderer r, int i)
			{
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.PerlinNoise(timer * 4f + (float)i * 7f, (float)i * 3f);
				float num2 = Mathf.PerlinNoise(timer * 6f + (float)i * 11f, (float)i * 5f);
				float num3 = Mathf.PerlinNoise(timer * 8f + (float)i * 13f, (float)i * 7f);
				float num4 = Mathf.Lerp(0.65f, 1.1f, (Mathf.Sin(timer * 1.5f + (float)i * 0.5f) + 1f) * 0.5f);
				float num5 = Mathf.PerlinNoise(timer * 0.8f + (float)i * 4f, (float)i * 2f);