Decompiled source of EffectsGB v1.3.2

Mods/EffectsGB.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using EffectMod;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using MelonLoader;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(EffectsGB), "EffectsGB", "1.3.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: AssemblyDescription("mod for Gang Beasts")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EffectsGB")]
[assembly: AssemblyTitle("EffectsGB")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace EffectMod
{
	public class EffectsGB : MelonMod
	{
		private class MatInfo
		{
			public Renderer rend;

			public Material mat;

			public Shader origShader;

			public int origRenderQueue;

			public Color origColor;

			public Color origEmission;

			public float origMetallic;

			public float origGloss;

			public float origSmooth;

			public Color origSpec;

			public Texture[] origTexes = (Texture[])(object)new Texture[3];

			public Vector2[] origUVs = (Vector2[])(object)new Vector2[3];

			public Vector2[] origScales = (Vector2[])(object)new Vector2[3];

			public bool[] hasTexes = new bool[3];

			public Texture origEmissionMap;

			public bool hasEmissionColor;

			public bool hasMetallic;

			public bool hasGloss;

			public bool hasSmooth;

			public bool hasSpec;

			public bool hasEmissionMap;

			public bool origEmissionOn;
		}

		private readonly string[] effects = new string[25]
		{
			"None", "Rainbow", "Ghost", "Neon", "Strobe", "Shadow", "Gold", "Pulse", "Chromatic", "Ice",
			"Infrared", "Matrix", "Bubblegum", "Static", "Toon", "Void", "Copper", "Hologram", "Lava", "Parallax",
			"Fiery", "Chrome", "Silver", "ItzXngel", "Pure White"
		};

		private const int EFFECT_COUNT = 25;

		private const int TEX_SLOTS = 3;

		private Shader shFlat;

		private Shader shTransparent;

		private static readonly int[] TexIds = new int[3]
		{
			Shader.PropertyToID("_MainTex"),
			Shader.PropertyToID("_BaseMap"),
			Shader.PropertyToID("_AlbedoTex")
		};

		private static readonly int[] ColIds = new int[3]
		{
			Shader.PropertyToID("_Color"),
			Shader.PropertyToID("_BaseColor"),
			Shader.PropertyToID("_TintColor")
		};

		private static readonly int P_EmissionColor = Shader.PropertyToID("_EmissionColor");

		private static readonly int P_EmissionMap = Shader.PropertyToID("_EmissionMap");

		private static readonly int P_Metallic = Shader.PropertyToID("_Metallic");

		private static readonly int P_Gloss = Shader.PropertyToID("_Glossiness");

		private static readonly int P_Smooth = Shader.PropertyToID("_Smoothness");

		private static readonly int P_SpecColor = Shader.PropertyToID("_SpecColor");

		private readonly List<MatInfo> targets = new List<MatInfo>();

		private Texture2D tRainbow;

		private Texture2D tChromatic;

		private Texture2D tIce;

		private Texture2D tBubble;

		private Texture2D tHolo;

		private Texture2D tMatrix;

		private Texture2D tHeat;

		private Texture2D tGhost;

		private Texture2D[] tStaticFrames;

		private Texture2D[] tToonFrames;

		private Texture2D[] tFireFrames;

		private Texture2D[] tLavaFrames;

		private Texture2D[] tPulseFrames;

		private Texture2D[] tParallaxFrames;

		private int staticFrameIdx;

		private int toonFrameIdx;

		private float staticTimer;

		private float toonTimer;

		private float animTimer;

		private int animFrameIdx;

		private const float ANIM_INTERVAL = 0.08f;

		private GameObject player;

		private int current;

		private float timeAccum;

		private float findTimer;

		private float rescanTimer;

		private float deathCheckTimer;

		private float outGoneTimer;

		private const float OUT_GRACE = 1f;

		private GameObject hudRoot;

		private CanvasGroup hudGroup;

		private RectTransform hudPanel;

		private Text hudValue;

		private bool hudReady;

		private bool hudFailed;

		private float hudTimer = 999f;

		private const float HUD_HOLD = 2.4f;

		private const float HUD_FADE = 0.55f;

		private const float HUD_SLIDE = 0.22f;

		private const float HUD_X_ON = 22f;

		private const float HUD_X_OFF = -300f;

		private const int TILE_GHOST = 3;

		private const int TILE_FIRE = 4;

		private const int TILE_LAVA = 4;

		private const int TILE_ICE = 8;

		private const int TILE_HEAT = 6;

		private const int TILE_MATRIX = 6;

		private const int TILE_HOLO = 12;

		private static readonly Color XngelMain = new Color(0.82f, 0.1f, 1f);

		private static readonly Color XngelLight = new Color(1f, 0.55f, 1f);

		private static readonly Color XngelDark = new Color(0.22f, 0.02f, 0.45f);

		private static readonly Color NO_GLOW = new Color(0f, 0f, 0f, 0f);

		public override void OnInitializeMelon()
		{
			shFlat = Shader.Find("Unlit/Color");
			string[] array = new string[4] { "Unlit/Transparent", "Sprites/Default", "Legacy Shaders/Transparent/Diffuse", "UI/Default" };
			for (int i = 0; i < array.Length; i++)
			{
				try
				{
					Shader val = Shader.Find(array[i]);
					if ((Object)(object)val != (Object)null)
					{
						shTransparent = val;
						break;
					}
				}
				catch
				{
				}
			}
			BuildAllTextures();
			MelonLogger.Msg("[EffectsGB] v1.3.1 ready");
		}

		private Texture2D NewTex(int size, bool point = false)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			return new Texture2D(size, size, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)0,
				filterMode = (FilterMode)(!point),
				hideFlags = (HideFlags)32
			};
		}

		public override void OnSceneWasLoaded(int b, string s)
		{
			player = null;
			targets.Clear();
			findTimer = 0f;
			rescanTimer = 0f;
			deathCheckTimer = 0f;
			outGoneTimer = 0f;
			hudTimer = 2.95f;
		}

		public override void OnUpdate()
		{
			if (F9Down())
			{
				NextEffect();
			}
			if (!hudReady && !hudFailed)
			{
				TryBuildHud();
			}
			if ((Object)(object)player == (Object)null || ((Object)player).Equals((Object)null))
			{
				player = null;
				findTimer += Time.deltaTime;
				if (findTimer >= 0.5f)
				{
					findTimer = 0f;
					FindPlayer();
				}
			}
			if ((Object)(object)player != (Object)null && !((Object)player).Equals((Object)null))
			{
				rescanTimer += Time.deltaTime;
				if (rescanTimer >= 1f)
				{
					rescanTimer = 0f;
					RefreshCostumes();
				}
				if (current > 0)
				{
					RunEffect();
				}
			}
			deathCheckTimer += Time.deltaTime;
			if (deathCheckTimer >= 0.25f)
			{
				deathCheckTimer = 0f;
				CheckForTransfer();
			}
			animTimer += Time.deltaTime;
			if (animTimer >= 0.08f)
			{
				animTimer -= 0.08f;
				animFrameIdx++;
			}
			staticTimer += Time.deltaTime;
			if (staticTimer >= 0.05f)
			{
				staticTimer = 0f;
				staticFrameIdx++;
				if (tStaticFrames != null && staticFrameIdx >= tStaticFrames.Length)
				{
					staticFrameIdx = 0;
				}
			}
			toonTimer += Time.deltaTime;
			if (toonTimer >= 0.1f)
			{
				toonTimer = 0f;
				toonFrameIdx++;
				if (tToonFrames != null && toonFrameIdx >= tToonFrames.Length)
				{
					toonFrameIdx = 0;
				}
			}
			if (hudTimer < 2.95f)
			{
				hudTimer += Time.deltaTime;
				AnimateHud();
			}
			timeAccum += Time.deltaTime;
		}

		private bool F9Down()
		{
			try
			{
				Keyboard val = Keyboard.current;
				return val != null && ((ButtonControl)val.f9Key).wasPressedThisFrame;
			}
			catch
			{
				return false;
			}
		}

		private void BuildAllTextures()
		{
			BuildRainbow();
			BuildGhost();
			BuildChromatic();
			BuildIce();
			BuildHeat();
			BuildMatrix();
			BuildBubble();
			BuildHolo();
			BuildStaticFrames();
			BuildToonFrames();
			BuildFireFrames();
			BuildLavaFrames();
			BuildPulseFrames();
			BuildParallaxFrames();
		}

		private void BuildRainbow()
		{
			//IL_005a: 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)
			int num = 192;
			tRainbow = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = (float)j / (float)num;
					float num3 = (float)i / (float)num;
					array[i * num + j] = Color.HSVToRGB((num2 * 2f + num3 * 0.5f) % 1f, 1f, 1f);
				}
			}
			tRainbow.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tRainbow.Apply();
		}

		private void BuildGhost()
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			tGhost = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = (float)j / (float)num * 3f;
					float num3 = (float)i / (float)num * 3f;
					float num4 = Mathf.PerlinNoise(num2 * 2f, num3 * 0.5f);
					float num5 = Mathf.PerlinNoise(num2 * 5f + 11f, num3 * 1.2f + 3f) * 0.5f;
					float num6 = Mathf.Clamp01((num4 + num5) * 0.55f + 0.3f);
					array[i * num + j] = new Color(0.8f * num6 + 0.2f, 0.88f * num6 + 0.12f, 1f * num6, 0.72f);
				}
			}
			tGhost.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tGhost.Apply();
		}

		private void BuildChromatic()
		{
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			tChromatic = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = (float)j / (float)num * 8f;
					float num3 = Mathf.Pow(Mathf.Max(0f, Mathf.Cos(num2 * (float)Math.PI * 2f)), 2f);
					float num4 = Mathf.Pow(Mathf.Max(0f, Mathf.Cos(num2 * (float)Math.PI * 2f + 2.09f)), 2f);
					float num5 = Mathf.Pow(Mathf.Max(0f, Mathf.Cos(num2 * (float)Math.PI * 2f + 4.18f)), 2f);
					array[i * num + j] = new Color(num3, num4, num5, 1f);
				}
			}
			tChromatic.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tChromatic.Apply();
		}

		private void BuildIce()
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			tIce = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = (float)j / (float)num * 8f;
					float num3 = (float)i / (float)num * 8f;
					float num4 = Mathf.Pow(Mathf.Clamp01((Mathf.PerlinNoise(num2 * 3f, num3 * 3f) * 0.5f + Mathf.PerlinNoise(num2 * 9f + 5f, num3 * 9f + 5f) * 0.3f + Mathf.PerlinNoise(num2 * 20f + 11f, num3 * 20f + 11f) * 0.2f - 0.35f) * 3f), 0.6f);
					array[i * num + j] = new Color(num4 * 0.55f, num4 * 0.82f, Mathf.Min(1f, num4 * 1.05f), 1f);
				}
			}
			tIce.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tIce.Apply();
		}

		private void BuildHeat()
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			tHeat = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = (float)j / (float)num * 6f;
					float num3 = (float)i / (float)num * 6f;
					float num4 = Mathf.Clamp01((Mathf.PerlinNoise(num2 * 3f, num3 * 3f) * 0.55f + Mathf.PerlinNoise(num2 * 7f + 4f, num3 * 7f + 4f) * 0.3f + Mathf.PerlinNoise(num2 * 15f + 8f, num3 * 15f + 8f) * 0.15f - 0.2f) * 1.8f);
					Color val = ((num4 > 0.65f) ? new Color(1f, 0.9f, 0.35f) : ((num4 > 0.35f) ? new Color(1f, 0.45f, 0.05f) : new Color(num4 * 0.9f, num4 * 0.15f, num4 * 0.08f)));
					array[i * num + j] = val;
				}
			}
			tHeat.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tHeat.Apply();
		}

		private void BuildMatrix()
		{
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			int num = 256;
			tMatrix = NewTex(num, point: true);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = (float)j / (float)num * 6f * 8f;
					float num3 = (float)i / (float)num * 6f;
					float num4 = Mathf.PerlinNoise(Mathf.Floor(num2) * 17.31f, 0.7f);
					float num5 = 0.35f + num4 * 1.6f;
					float num6 = (num3 * num5 + num4 * 3.1f) % 1f;
					float num7 = Mathf.Clamp01(1f - num6 * 8f);
					float num8 = Mathf.Pow(Mathf.Clamp01(1f - num6), 2f) * 0.8f;
					float num9 = Mathf.Clamp01(num7 + num8);
					Color val = ((num9 > 0.9f) ? new Color(0.85f, 1f, 0.9f) : ((num9 > 0.4f) ? new Color(0.1f, 1f, 0.35f) : new Color(0f, num9 * 0.55f, 0.05f)));
					array[i * num + j] = val;
				}
			}
			tMatrix.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tMatrix.Apply();
		}

		private void BuildBubble()
		{
			//IL_01c3: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			tBubble = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			Color val = default(Color);
			((Color)(ref val))..ctor(1f, 0.55f, 0.82f);
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(1f, 0.8f, 0.92f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(1f, 0.45f, 0.72f);
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(0.85f, 0.2f, 0.55f);
			Color val5 = default(Color);
			((Color)(ref val5))..ctor(1f, 0.94f, 0.98f);
			int num2 = 4;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num3 = (float)j / (float)num * (float)num2;
					float num4 = (float)i / (float)num * (float)num2;
					float num5 = Mathf.Floor(num3);
					float num6 = Mathf.Floor(num4);
					float num7 = Mathf.PerlinNoise(num5 * 7.31f + 1.7f, num6 * 5.43f + 3.1f);
					float num8 = Mathf.PerlinNoise(num5 * 2.87f + 9.4f, num6 * 8.16f + 5.9f);
					float num9 = Mathf.PerlinNoise(num5 * 11.53f + 4.2f, num6 * 3.71f + 8.8f);
					float num10 = 0.5f + (num7 - 0.5f) * 0.5f;
					float num11 = 0.5f + (num8 - 0.5f) * 0.5f;
					float num12 = 0.2f + num9 * 0.16f;
					float num13 = num3 - num5 - num10;
					float num14 = num4 - num6 - num11;
					float num15 = Mathf.Sqrt(num13 * num13 + num14 * num14);
					float num16 = Mathf.SmoothStep(num12, num12 * 0.75f, num15);
					float num17 = Mathf.SmoothStep(num12 * 0.45f, num12 * 0.2f, num15);
					Color val6 = ((!(num7 < 0.33f)) ? ((!(num7 < 0.66f)) ? val4 : val3) : val2);
					Color val7 = val;
					val7 = Color.Lerp(val7, val6, num16);
					val7 = Color.Lerp(val7, val5, num17 * 0.55f);
					array[i * num + j] = val7;
				}
			}
			tBubble.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tBubble.Apply();
		}

		private void BuildHolo()
		{
			//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)
			int num = 192;
			tHolo = NewTex(num);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (((float)i / (float)num * 12f * 10f % 1f < 0.35f) ? 1f : 0.08f);
				for (int j = 0; j < num; j++)
				{
					float num3 = Mathf.PerlinNoise((float)j * 0.12f, (float)i * 0.12f) * 0.2f;
					array[i * num + j] = new Color(num3 * 0.5f, Mathf.Clamp01(num2 + num3), Mathf.Clamp01(num2 * 1.05f + num3 * 0.7f), 1f);
				}
			}
			tHolo.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
			tHolo.Apply();
		}

		private void BuildStaticFrames()
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			int num2 = 6;
			tStaticFrames = (Texture2D[])(object)new Texture2D[num2];
			for (int i = 0; i < num2; i++)
			{
				Texture2D val = NewTex(num, point: true);
				Color[] array = (Color[])(object)new Color[num * num];
				for (int j = 0; j < array.Length; j++)
				{
					float value = Random.value;
					value = ((value < 0.5f) ? (value * 0.85f) : (1f - (1f - value) * 0.85f));
					if (Random.value > 0.85f)
					{
						value = 1f;
					}
					if (Random.value > 0.85f)
					{
						value = 0f;
					}
					array[j] = new Color(value, value, value, 1f);
				}
				val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
				val.Apply(false);
				tStaticFrames[i] = val;
			}
		}

		private void BuildToonFrames()
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			int num = 192;
			int num2 = 12;
			tToonFrames = (Texture2D[])(object)new Texture2D[num2];
			for (int i = 0; i < num2; i++)
			{
				Texture2D val = NewTex(num);
				Color[] array = (Color[])(object)new Color[num * num];
				float num3 = (float)i / (float)num2;
				for (int j = 0; j < num; j++)
				{
					for (int k = 0; k < num; k++)
					{
						float num4 = (float)k / (float)num;
						float num5 = (float)j / (float)num;
						float num6 = num4 * 0.4f + num5 * 0.6f;
						int num7 = 5;
						int num8 = Mathf.FloorToInt(num6 * (float)num7);
						if (num8 >= num7)
						{
							num8 = num7 - 1;
						}
						float num9 = (float)num8 / (float)(num7 - 1);
						float num10 = (num3 + num9 * 0.55f) % 1f;
						float num11 = 0.75f + num9 * 0.25f;
						float num12 = 0.45f + num9 * 0.55f;
						float num13 = num6 * (float)num7 - Mathf.Floor(num6 * (float)num7);
						if (num13 < 0.05f || num13 > 0.95f)
						{
							num12 *= 0.28f;
						}
						array[j * num + k] = Color.HSVToRGB(num10, num11, num12);
					}
				}
				val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
				val.Apply(false);
				tToonFrames[i] = val;
			}
		}

		private void BuildFireFrames()
		{
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			int num = 160;
			int num2 = 10;
			tFireFrames = (Texture2D[])(object)new Texture2D[num2];
			for (int i = 0; i < num2; i++)
			{
				Texture2D val = NewTex(num);
				Color[] array = (Color[])(object)new Color[num * num];
				float num3 = (float)i / (float)num2;
				for (int j = 0; j < num; j++)
				{
					float num4 = ((float)j / (float)num + num3) % 1f * 4f;
					for (int k = 0; k < num; k++)
					{
						float num5 = (float)k / (float)num * 4f;
						float num6 = Mathf.PerlinNoise(num5 * 3f, num4 * 2f);
						float num7 = Mathf.PerlinNoise(num5 * 6f + 3f, num4 * 4f + 4f) * 0.5f;
						float num8 = Mathf.PerlinNoise(num5 * 12f + 6f, num4 * 8f + 8f) * 0.25f;
						float num9 = Mathf.Clamp01((num6 + num7 + num8) * 1.1f);
						Color val2 = ((!(num9 < 0.3f)) ? ((!(num9 < 0.65f)) ? Color.Lerp(new Color(1f, 0.6f, 0.05f), new Color(1f, 0.98f, 0.6f), (num9 - 0.65f) / 0.35f) : Color.Lerp(new Color(0.9f, 0.18f, 0f), new Color(1f, 0.6f, 0.05f), (num9 - 0.3f) / 0.35f)) : Color.Lerp(new Color(0.2f, 0.02f, 0f), new Color(0.9f, 0.18f, 0f), num9 / 0.3f));
						array[j * num + k] = val2;
					}
				}
				val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
				val.Apply();
				tFireFrames[i] = val;
			}
		}

		private void BuildLavaFrames()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: 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_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			int num = 160;
			int num2 = 10;
			tLavaFrames = (Texture2D[])(object)new Texture2D[num2];
			for (int i = 0; i < num2; i++)
			{
				Texture2D val = NewTex(num);
				Color[] array = (Color[])(object)new Color[num * num];
				float num3 = (float)i / (float)num2;
				for (int j = 0; j < num; j++)
				{
					float num4 = ((float)j / (float)num + num3) % 1f * 4f;
					for (int k = 0; k < num; k++)
					{
						float num5 = (float)k / (float)num * 4f;
						float num6 = Mathf.PerlinNoise(num5 * 2.5f, num4 * 2.5f);
						float num7 = Mathf.PerlinNoise(num5 * 6f + 3f, num4 * 6f + 3f) * 0.5f;
						float num8 = Mathf.PerlinNoise(num5 * 12f + 7f, num4 * 12f + 7f) * 0.25f;
						float num9 = Mathf.Pow(Mathf.Clamp01(num6 + num7 + num8 - 0.3f), 0.75f);
						Color val2 = ((!(num9 < 0.35f)) ? ((!(num9 < 0.7f)) ? Color.Lerp(new Color(1f, 0.55f, 0.06f), new Color(1f, 0.96f, 0.6f), (num9 - 0.7f) / 0.3f) : Color.Lerp(new Color(0.75f, 0.12f, 0f), new Color(1f, 0.55f, 0.06f), (num9 - 0.35f) / 0.35f)) : Color.Lerp(new Color(0.15f, 0.02f, 0f), new Color(0.75f, 0.12f, 0f), num9 / 0.35f));
						array[j * num + k] = val2;
					}
				}
				val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
				val.Apply();
				tLavaFrames[i] = val;
			}
		}

		private void BuildPulseFrames()
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			int num = 160;
			int num2 = 24;
			tPulseFrames = (Texture2D[])(object)new Texture2D[num2];
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)num2;
				Texture2D val = NewTex(num);
				Color[] array = (Color[])(object)new Color[num * num];
				for (int j = 0; j < num; j++)
				{
					for (int k = 0; k < num; k++)
					{
						float num4 = (float)k / (float)num - 0.5f;
						float num5 = (float)j / (float)num - 0.5f;
						float num6 = Mathf.Pow(Mathf.Abs(Mathf.Sin(Mathf.Sqrt(num4 * num4 + num5 * num5) * 2f * 30f - num3 * (float)Math.PI * 2f)), 0.4f);
						float num7 = ((num6 > 0.85f) ? 1f : (num6 * 0.35f));
						array[j * num + k] = new Color(num7, num7 * 0.35f, num7 * 0.85f, 1f);
					}
				}
				val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
				val.Apply();
				tPulseFrames[i] = val;
			}
		}

		private void BuildParallaxFrames()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: 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)
			int num = 160;
			int num2 = 16;
			tParallaxFrames = (Texture2D[])(object)new Texture2D[num2];
			Color[] array = (Color[])(object)new Color[6]
			{
				new Color(0.75f, 0.1f, 1f),
				new Color(0.1f, 1f, 0.4f),
				new Color(1f, 0.95f, 0.2f),
				new Color(0.2f, 0.9f, 1f),
				new Color(1f, 0.35f, 0.9f),
				new Color(0.6f, 1f, 0.25f)
			};
			Color val = default(Color);
			((Color)(ref val))..ctor(0.1f, 0.03f, 0.2f);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)num2;
				Texture2D val2 = NewTex(num);
				Color[] array2 = (Color[])(object)new Color[num * num];
				for (int j = 0; j < num; j++)
				{
					for (int k = 0; k < num; k++)
					{
						float num4 = (float)k / (float)num;
						float num5 = (float)j / (float)num;
						Color val3 = val;
						for (int l = 0; l < 6; l++)
						{
							float num6 = Mathf.PerlinNoise((float)l * 4.3f + 1.7f, 0.3f);
							float num7 = Mathf.PerlinNoise((float)l * 2.9f + 5.1f, 0.7f);
							float num8 = 0.5f + Mathf.Sin((num3 + num6) * (float)Math.PI * 2f) * 0.35f;
							float num9 = 0.5f + Mathf.Cos((num3 + num7) * (float)Math.PI * 2f) * 0.35f;
							float num10 = 0.18f + num6 * 0.12f;
							float num11 = num4 - num8;
							float num12 = num5 - num9;
							float num13 = Mathf.Sqrt(num11 * num11 + num12 * num12);
							float num14 = Mathf.SmoothStep(num10, num10 * 0.1f, num13);
							num14 = Mathf.Pow(num14, 1.3f);
							val3 = Color.Lerp(val3, array[l], num14);
						}
						array2[j * num + k] = val3;
					}
				}
				val2.SetPixels(Il2CppStructArray<Color>.op_Implicit(array2));
				val2.Apply();
				tParallaxFrames[i] = val2;
			}
		}

		private void TryBuildHud()
		{
			try
			{
				MakeHud();
				hudReady = true;
				ShowHud("Ready");
			}
			catch (Exception ex)
			{
				hudFailed = true;
				MelonLogger.Error("[EffectsGB] HUD build failed: " + ex.Message);
			}
		}

		private void MakeHud()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			Font font = PickGameFont();
			hudRoot = new GameObject("EffectsGB_Hud");
			Object.DontDestroyOnLoad((Object)(object)hudRoot);
			Canvas obj = hudRoot.AddComponent<Canvas>();
			obj.renderMode = (RenderMode)0;
			obj.sortingOrder = 9999;
			CanvasScaler obj2 = hudRoot.AddComponent<CanvasScaler>();
			obj2.uiScaleMode = (ScaleMode)1;
			obj2.referenceResolution = new Vector2(1920f, 1080f);
			obj2.matchWidthOrHeight = 0.5f;
			hudGroup = hudRoot.AddComponent<CanvasGroup>();
			hudGroup.alpha = 0f;
			hudGroup.blocksRaycasts = false;
			hudGroup.interactable = false;
			GameObject val = NewRect("Panel", hudRoot.transform);
			hudPanel = val.GetComponent<RectTransform>();
			hudPanel.anchorMin = new Vector2(0f, 1f);
			hudPanel.anchorMax = new Vector2(0f, 1f);
			hudPanel.pivot = new Vector2(0f, 1f);
			hudPanel.anchoredPosition = new Vector2(-300f, -22f);
			hudPanel.sizeDelta = new Vector2(220f, 46f);
			FillImg("Bg", val.transform, 0f, 0f, 0f, 0f, new Color(0.03f, 0.04f, 0.06f, 0.78f));
			GameObject obj3 = NewRect("Under", val.transform);
			RectTransform component = obj3.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 0f);
			component.pivot = new Vector2(0f, 0f);
			component.anchoredPosition = Vector2.zero;
			component.sizeDelta = new Vector2(0f, 1f);
			Image obj4 = obj3.AddComponent<Image>();
			((Graphic)obj4).color = new Color(0.85f, 0.85f, 0.85f, 0.28f);
			((Graphic)obj4).raycastTarget = false;
			hudValue = NewText("Value", val.transform, "", 22, (FontStyle)0, font);
			((Graphic)hudValue).color = new Color(0.96f, 0.96f, 0.96f);
			hudValue.alignment = (TextAnchor)4;
		}

		private GameObject NewRect(string name, Transform parent)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			Il2CppReferenceArray<Type> val = new Il2CppReferenceArray<Type>(1L);
			((Il2CppArrayBase<Type>)(object)val)[0] = Il2CppType.From(typeof(RectTransform));
			GameObject val2 = new GameObject(name, val);
			val2.transform.SetParent(parent, false);
			return val2;
		}

		private Image FillImg(string name, Transform parent, float l, float b, float r, float t, Color col)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = NewRect(name, parent);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.offsetMin = new Vector2(l, b);
			component.offsetMax = new Vector2(0f - r, 0f - t);
			Image obj2 = obj.AddComponent<Image>();
			((Graphic)obj2).color = col;
			((Graphic)obj2).raycastTarget = false;
			return obj2;
		}

		private Text NewText(string name, Transform parent, string txt, int size, FontStyle style, Font font)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = NewRect(name, parent);
			RectTransform component = obj.GetComponent<RectTransform>();
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(1f, 1f);
			component.offsetMin = Vector2.zero;
			component.offsetMax = Vector2.zero;
			Text obj2 = obj.AddComponent<Text>();
			obj2.text = txt;
			obj2.font = font;
			obj2.fontSize = size;
			obj2.fontStyle = style;
			obj2.alignment = (TextAnchor)4;
			((Graphic)obj2).color = Color.white;
			((Graphic)obj2).raycastTarget = false;
			obj2.horizontalOverflow = (HorizontalWrapMode)1;
			obj2.verticalOverflow = (VerticalWrapMode)1;
			return obj2;
		}

		private Font PickGameFont()
		{
			try
			{
				Il2CppArrayBase<Font> val = Resources.FindObjectsOfTypeAll<Font>();
				if (val != null && val.Length > 0)
				{
					for (int i = 0; i < val.Length; i++)
					{
						Font val2 = val[i];
						if ((Object)(object)val2 == (Object)null)
						{
							continue;
						}
						string name = ((Object)val2).name;
						if (!string.IsNullOrEmpty(name))
						{
							switch (name)
							{
							case "Arial":
							case "Arial.ttf":
							case "LegacyRuntime":
							case "LegacyRuntime.ttf":
								continue;
							}
							return val2;
						}
					}
				}
			}
			catch
			{
			}
			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
			{
			}
			string[] array = new string[4] { "Arial", "Segoe UI", "Verdana", "Tahoma" };
			for (int j = 0; j < array.Length; j++)
			{
				try
				{
					Font val3 = Font.CreateDynamicFontFromOSFont(array[j], 16);
					if ((Object)(object)val3 != (Object)null)
					{
						return val3;
					}
				}
				catch
				{
				}
			}
			return null;
		}

		private void ShowHud(string text)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			hudTimer = 0f;
			if ((Object)(object)hudValue != (Object)null)
			{
				hudValue.text = text;
			}
			if ((Object)(object)hudPanel != (Object)null)
			{
				hudPanel.anchoredPosition = new Vector2(-300f, -22f);
			}
		}

		private void AnimateHud()
		{
			//IL_009c: 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)
			if (!((Object)(object)hudGroup == (Object)null) && !((Object)(object)hudPanel == (Object)null))
			{
				if (hudTimer < 2.4f)
				{
					float num = Mathf.Clamp01(hudTimer / 0.22f);
					float num2 = 1f - Mathf.Pow(1f - num, 3f);
					float num3 = Mathf.Lerp(-300f, 22f, num2);
					hudPanel.anchoredPosition = new Vector2(num3, -22f);
					hudGroup.alpha = 1f;
				}
				else
				{
					hudPanel.anchoredPosition = new Vector2(22f, -22f);
					float num4 = (hudTimer - 2.4f) / 0.55f;
					hudGroup.alpha = Mathf.Clamp01(1f - num4);
				}
			}
		}

		private void FindPlayer()
		{
			Il2CppArrayBase<MonoBehaviour> val = Object.FindObjectsOfType<MonoBehaviour>();
			for (int i = 0; i < val.Length; i++)
			{
				MonoBehaviour val2 = val[i];
				if ((Object)(object)val2 == (Object)null || !IsActorComponent(val2))
				{
					continue;
				}
				GameObject gameObject;
				try
				{
					gameObject = ((Component)val2).gameObject;
				}
				catch
				{
					continue;
				}
				if (!((Object)(object)gameObject == (Object)null) && gameObject.activeInHierarchy && !ReadBoolProp(val2, "IsAI", defaultValue: false) && !IsActorDead(val2) && !((Object)(object)gameObject.GetComponentInChildren<Renderer>(true) == (Object)null))
				{
					player = gameObject;
					targets.Clear();
					Il2CppArrayBase<Renderer> componentsInChildren = gameObject.GetComponentsInChildren<Renderer>(true);
					for (int j = 0; j < componentsInChildren.Length; j++)
					{
						AddRenderer(componentsInChildren[j]);
					}
					return;
				}
			}
			GameObject val3 = GameObject.FindGameObjectWithTag("Player");
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3.GetComponentInChildren<Renderer>(true) != (Object)null)
			{
				player = val3;
				targets.Clear();
				Il2CppArrayBase<Renderer> componentsInChildren2 = val3.GetComponentsInChildren<Renderer>(true);
				for (int k = 0; k < componentsInChildren2.Length; k++)
				{
					AddRenderer(componentsInChildren2[k]);
				}
				return;
			}
			Il2CppArrayBase<GameObject> val4 = Object.FindObjectsOfType<GameObject>();
			for (int l = 0; l < val4.Length; l++)
			{
				GameObject val5 = val4[l];
				if ((Object)(object)val5 == (Object)null || !val5.activeInHierarchy)
				{
					continue;
				}
				string text = ((Object)val5).name.ToLower();
				if ((text.Contains("player") || text.Contains("fighter")) && !text.Contains("ai") && !text.Contains("bot") && !text.Contains("npc") && (Object)(object)val5.GetComponentInChildren<SkinnedMeshRenderer>(true) != (Object)null)
				{
					player = val5;
					targets.Clear();
					Il2CppArrayBase<Renderer> componentsInChildren3 = val5.GetComponentsInChildren<Renderer>(true);
					for (int m = 0; m < componentsInChildren3.Length; m++)
					{
						AddRenderer(componentsInChildren3[m]);
					}
					break;
				}
			}
		}

		private bool IsActorComponent(MonoBehaviour mb)
		{
			if ((Object)(object)mb == (Object)null)
			{
				return false;
			}
			try
			{
				Type type = ((object)mb).GetType();
				if (type == null)
				{
					return false;
				}
				if (type.Name == "Actor")
				{
					return true;
				}
				if (type.GetProperty("DrawBeast") != null)
				{
					return true;
				}
				if (type.GetProperty("actorState") != null)
				{
					return true;
				}
			}
			catch
			{
			}
			return false;
		}

		private bool ReadBoolProp(object obj, string propName, bool defaultValue)
		{
			if (obj == null)
			{
				return defaultValue;
			}
			try
			{
				Type type = obj.GetType();
				if (type == null)
				{
					return defaultValue;
				}
				PropertyInfo property = type.GetProperty(propName);
				if (property == null)
				{
					return defaultValue;
				}
				object value = property.GetValue(obj);
				if (value == null)
				{
					return defaultValue;
				}
				if (value is bool result)
				{
					return result;
				}
			}
			catch
			{
			}
			return defaultValue;
		}

		private string ReadActorState(MonoBehaviour actor)
		{
			if ((Object)(object)actor == (Object)null)
			{
				return null;
			}
			try
			{
				Type type = ((object)actor).GetType();
				if (type == null)
				{
					return null;
				}
				PropertyInfo property = type.GetProperty("actorState");
				if (property == null)
				{
					return null;
				}
				return property.GetValue(actor)?.ToString();
			}
			catch
			{
			}
			return null;
		}

		private bool IsActorDead(MonoBehaviour actor)
		{
			if ((Object)(object)actor == (Object)null)
			{
				return true;
			}
			string text = ReadActorState(actor);
			if (!string.IsNullOrEmpty(text) && text == "Dead")
			{
				return true;
			}
			if (!ReadBoolProp(actor, "DrawBeast", defaultValue: true))
			{
				return true;
			}
			return false;
		}

		private int CountActiveRenderers(GameObject go)
		{
			if ((Object)(object)go == (Object)null)
			{
				return 0;
			}
			int num = 0;
			try
			{
				Il2CppArrayBase<Renderer> componentsInChildren = go.GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					if (!((Object)(object)componentsInChildren[i] == (Object)null) && componentsInChildren[i].enabled && ((Component)componentsInChildren[i]).gameObject.activeInHierarchy)
					{
						num++;
					}
				}
			}
			catch
			{
			}
			return num;
		}

		private void RefreshCostumes()
		{
			if ((Object)(object)player == (Object)null || ((Object)player).Equals((Object)null))
			{
				return;
			}
			try
			{
				for (int num = targets.Count - 1; num >= 0; num--)
				{
					if ((Object)(object)targets[num].rend == (Object)null || ((Object)targets[num].rend).Equals((Object)null) || (Object)(object)targets[num].mat == (Object)null)
					{
						targets.RemoveAt(num);
					}
				}
				Il2CppArrayBase<Renderer> componentsInChildren = player.GetComponentsInChildren<Renderer>(true);
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					Renderer val = componentsInChildren[i];
					if ((Object)(object)val == (Object)null || !val.enabled)
					{
						continue;
					}
					string text = ((Object)((Component)val).gameObject).name.ToLower();
					if (text.Contains("gizmo") || text.Contains("debug") || text.Contains("helper") || text == "rig" || text.StartsWith("rig_") || text.Contains("_rig") || text.Contains("joint"))
					{
						continue;
					}
					if (!(val is SkinnedMeshRenderer))
					{
						switch (((Object)((Component)val).gameObject).name.ToLower())
						{
						case "sphere":
						case "capsule":
						case "cylinder":
						case "cube":
						case "quad":
							continue;
						}
					}
					Material[] array;
					try
					{
						array = Il2CppArrayBase<Material>.op_Implicit((Il2CppArrayBase<Material>)(object)val.materials);
					}
					catch
					{
						continue;
					}
					if (array == null)
					{
						continue;
					}
					for (int j = 0; j < array.Length; j++)
					{
						bool flag = false;
						for (int k = 0; k < targets.Count; k++)
						{
							if ((Object)(object)targets[k].mat == (Object)(object)array[j])
							{
								flag = true;
								break;
							}
						}
						if (!flag)
						{
							AddMaterial(val, array[j]);
						}
					}
				}
			}
			catch
			{
			}
		}

		private void AddRenderer(Renderer r)
		{
			if ((Object)(object)r == (Object)null || ((Object)r).Equals((Object)null) || !r.enabled || (Object)(object)((Component)r).gameObject == (Object)null || !((Component)r).gameObject.activeInHierarchy)
			{
				return;
			}
			string text = ((Object)((Component)r).gameObject).name.ToLower();
			if (text.Contains("gizmo") || text.Contains("debug") || text.Contains("helper") || text == "rig" || text.StartsWith("rig_") || text.Contains("_rig") || text.Contains("joint"))
			{
				return;
			}
			if (!(r is SkinnedMeshRenderer))
			{
				switch (((Object)((Component)r).gameObject).name.ToLower())
				{
				case "capsule":
					return;
				case "cylinder":
					return;
				case "cube":
					return;
				case "quad":
					return;
				}
			}
			Material[] array;
			try
			{
				array = Il2CppArrayBase<Material>.op_Implicit((Il2CppArrayBase<Material>)(object)r.materials);
			}
			catch
			{
				return;
			}
			if (array != null)
			{
				for (int i = 0; i < array.Length; i++)
				{
					AddMaterial(r, array[i]);
				}
			}
		}

		private void AddMaterial(Renderer r, Material m)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)m == (Object)null)
			{
				return;
			}
			MatInfo matInfo = new MatInfo();
			matInfo.rend = r;
			matInfo.mat = m;
			matInfo.origShader = m.shader;
			matInfo.origRenderQueue = m.renderQueue;
			matInfo.hasEmissionColor = m.HasProperty(P_EmissionColor);
			matInfo.hasMetallic = m.HasProperty(P_Metallic);
			matInfo.hasGloss = m.HasProperty(P_Gloss);
			matInfo.hasSmooth = m.HasProperty(P_Smooth);
			matInfo.hasSpec = m.HasProperty(P_SpecColor);
			matInfo.hasEmissionMap = m.HasProperty(P_EmissionMap);
			try
			{
				for (int i = 0; i < ColIds.Length; i++)
				{
					if (m.HasProperty(ColIds[i]))
					{
						matInfo.origColor = m.GetColor(ColIds[i]);
						break;
					}
				}
				if (matInfo.hasEmissionColor)
				{
					matInfo.origEmission = m.GetColor(P_EmissionColor);
				}
				if (matInfo.hasMetallic)
				{
					matInfo.origMetallic = m.GetFloat(P_Metallic);
				}
				if (matInfo.hasGloss)
				{
					matInfo.origGloss = m.GetFloat(P_Gloss);
				}
				if (matInfo.hasSmooth)
				{
					matInfo.origSmooth = m.GetFloat(P_Smooth);
				}
				if (matInfo.hasSpec)
				{
					matInfo.origSpec = m.GetColor(P_SpecColor);
				}
				matInfo.origEmissionOn = m.IsKeywordEnabled("_EMISSION");
				for (int j = 0; j < 3; j++)
				{
					if (m.HasProperty(TexIds[j]))
					{
						matInfo.hasTexes[j] = true;
						matInfo.origTexes[j] = m.GetTexture(TexIds[j]);
						matInfo.origUVs[j] = m.GetTextureOffset(TexIds[j]);
						matInfo.origScales[j] = m.GetTextureScale(TexIds[j]);
					}
				}
				if (matInfo.hasEmissionMap)
				{
					matInfo.origEmissionMap = m.GetTexture(P_EmissionMap);
				}
			}
			catch
			{
			}
			targets.Add(matInfo);
		}

		private void NextEffect()
		{
			Restore();
			current = (current + 1) % 25;
			if ((Object)(object)player == (Object)null)
			{
				FindPlayer();
			}
			ShowHud(effects[current]);
		}

		private void Restore()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < targets.Count; i++)
			{
				MatInfo matInfo = targets[i];
				if ((Object)(object)matInfo.rend == (Object)null || ((Object)matInfo.rend).Equals((Object)null) || (Object)(object)matInfo.mat == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)matInfo.origShader != (Object)null && (Object)(object)matInfo.mat.shader != (Object)(object)matInfo.origShader)
					{
						matInfo.mat.shader = matInfo.origShader;
					}
					for (int j = 0; j < ColIds.Length; j++)
					{
						if (matInfo.mat.HasProperty(ColIds[j]))
						{
							matInfo.mat.SetColor(ColIds[j], matInfo.origColor);
						}
					}
					if (matInfo.hasEmissionColor)
					{
						matInfo.mat.SetColor(P_EmissionColor, matInfo.origEmission);
					}
					if (matInfo.hasMetallic)
					{
						matInfo.mat.SetFloat(P_Metallic, matInfo.origMetallic);
					}
					if (matInfo.hasGloss)
					{
						matInfo.mat.SetFloat(P_Gloss, matInfo.origGloss);
					}
					if (matInfo.hasSmooth)
					{
						matInfo.mat.SetFloat(P_Smooth, matInfo.origSmooth);
					}
					if (matInfo.hasSpec)
					{
						matInfo.mat.SetColor(P_SpecColor, matInfo.origSpec);
					}
					if (matInfo.origEmissionOn)
					{
						matInfo.mat.EnableKeyword("_EMISSION");
					}
					else
					{
						matInfo.mat.DisableKeyword("_EMISSION");
					}
					for (int k = 0; k < 3; k++)
					{
						if (matInfo.hasTexes[k])
						{
							matInfo.mat.SetTexture(TexIds[k], matInfo.origTexes[k]);
							matInfo.mat.SetTextureOffset(TexIds[k], matInfo.origUVs[k]);
							matInfo.mat.SetTextureScale(TexIds[k], matInfo.origScales[k]);
						}
					}
					if (matInfo.hasEmissionMap)
					{
						matInfo.mat.SetTexture(P_EmissionMap, matInfo.origEmissionMap);
					}
					matInfo.mat.renderQueue = matInfo.origRenderQueue;
				}
				catch
				{
				}
			}
		}

		private void CheckForTransfer()
		{
			if (current == 0)
			{
				outGoneTimer = 0f;
				return;
			}
			bool flag = false;
			if ((Object)(object)player == (Object)null || ((Object)player).Equals((Object)null))
			{
				flag = true;
			}
			else if (!player.activeInHierarchy)
			{
				flag = true;
			}
			else
			{
				MonoBehaviour actorComponent = GetActorComponent(player);
				if ((Object)(object)actorComponent == (Object)null)
				{
					flag = true;
				}
				else if (IsActorDead(actorComponent))
				{
					flag = true;
				}
				else if (CountActiveRenderers(player) == 0)
				{
					flag = true;
				}
			}
			if (!flag)
			{
				outGoneTimer = 0f;
				return;
			}
			outGoneTimer += 0.25f;
			if (!(outGoneTimer < 1f))
			{
				outGoneTimer = 0f;
				HopToRandomAlive();
			}
		}

		private MonoBehaviour GetActorComponent(GameObject go)
		{
			if ((Object)(object)go == (Object)null)
			{
				return null;
			}
			try
			{
				Il2CppArrayBase<MonoBehaviour> components = go.GetComponents<MonoBehaviour>();
				for (int i = 0; i < components.Length; i++)
				{
					MonoBehaviour val = components[i];
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					Type type = ((object)val).GetType();
					if (!(type == null))
					{
						if (type.Name == "Actor")
						{
							return val;
						}
						if (type.GetProperty("actorState") != null)
						{
							return val;
						}
						if (type.GetProperty("DrawBeast") != null)
						{
							return val;
						}
					}
				}
			}
			catch
			{
			}
			return null;
		}

		private void HopToRandomAlive()
		{
			List<GameObject> list = new List<GameObject>();
			Il2CppArrayBase<MonoBehaviour> val = Object.FindObjectsOfType<MonoBehaviour>();
			for (int i = 0; i < val.Length; i++)
			{
				MonoBehaviour val2 = val[i];
				if (!((Object)(object)val2 == (Object)null) && IsActorComponent(val2))
				{
					GameObject gameObject;
					try
					{
						gameObject = ((Component)val2).gameObject;
					}
					catch
					{
						continue;
					}
					if (!((Object)(object)gameObject == (Object)null) && gameObject.activeInHierarchy && !((Object)(object)gameObject == (Object)(object)player) && !ReadBoolProp(val2, "IsAI", defaultValue: false) && !IsActorDead(val2) && CountActiveRenderers(gameObject) != 0)
					{
						list.Add(gameObject);
					}
				}
			}
			if (list.Count != 0)
			{
				MelonLogger.Msg("[EffectsGB] fighter is Dead - hopping to another one");
				Restore();
				player = list[Random.Range(0, list.Count)];
				targets.Clear();
				Il2CppArrayBase<Renderer> componentsInChildren = player.GetComponentsInChildren<Renderer>(true);
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					AddRenderer(componentsInChildren[j]);
				}
				if (current > 0)
				{
					RunEffect();
				}
			}
		}

		private void SetColorProps(Material m, Color c)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < ColIds.Length; i++)
			{
				if (m.HasProperty(ColIds[i]))
				{
					m.SetColor(ColIds[i], c);
				}
			}
		}

		private void ApplyFlatColor(Color c)
		{
			//IL_00ff: 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_0122: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < targets.Count; i++)
			{
				MatInfo matInfo = targets[i];
				if ((Object)(object)matInfo.mat == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)shFlat != (Object)null)
					{
						if ((Object)(object)matInfo.mat.shader != (Object)(object)shFlat)
						{
							matInfo.mat.shader = shFlat;
						}
						for (int j = 0; j < 3; j++)
						{
							if (matInfo.hasTexes[j])
							{
								matInfo.mat.SetTexture(TexIds[j], (Texture)null);
							}
						}
						SetColorProps(matInfo.mat, c);
						continue;
					}
					if ((Object)(object)matInfo.origShader != (Object)null && (Object)(object)matInfo.mat.shader != (Object)(object)matInfo.origShader)
					{
						matInfo.mat.shader = matInfo.origShader;
					}
					for (int k = 0; k < 3; k++)
					{
						if (matInfo.hasTexes[k])
						{
							matInfo.mat.SetTexture(TexIds[k], (Texture)null);
						}
					}
					SetColorProps(matInfo.mat, c);
					if (matInfo.mat.HasProperty(P_EmissionColor))
					{
						matInfo.mat.SetColor(P_EmissionColor, c);
						matInfo.mat.EnableKeyword("_EMISSION");
					}
				}
				catch
				{
				}
			}
		}

		private void ApplyPattern(Texture2D tex, Vector2 uvOff, Vector2 uvScale, Color glow)
		{
			//IL_000a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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)
			if ((Object)(object)tex == (Object)null)
			{
				return;
			}
			bool flag = glow.a > 0.01f;
			for (int i = 0; i < targets.Count; i++)
			{
				MatInfo matInfo = targets[i];
				if ((Object)(object)matInfo.mat == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)matInfo.origShader != (Object)null && (Object)(object)matInfo.mat.shader != (Object)(object)matInfo.origShader)
					{
						matInfo.mat.shader = matInfo.origShader;
					}
					for (int j = 0; j < 3; j++)
					{
						if (matInfo.hasTexes[j])
						{
							matInfo.mat.SetTexture(TexIds[j], (Texture)(object)tex);
							matInfo.mat.SetTextureOffset(TexIds[j], uvOff);
							matInfo.mat.SetTextureScale(TexIds[j], uvScale);
						}
					}
					SetColorProps(matInfo.mat, Color.white);
					if (matInfo.hasEmissionColor)
					{
						if (flag)
						{
							matInfo.mat.SetColor(P_EmissionColor, glow);
							matInfo.mat.EnableKeyword("_EMISSION");
						}
						else if (!matInfo.origEmissionOn)
						{
							matInfo.mat.SetColor(P_EmissionColor, Color.black);
							matInfo.mat.DisableKeyword("_EMISSION");
						}
					}
				}
				catch
				{
				}
			}
		}

		private void ApplyPatternPerPart(Texture2D tex, Vector2 baseOff, Vector2 baseScale, Color glow)
		{
			//IL_000a: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_00e3: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)tex == (Object)null)
			{
				return;
			}
			bool flag = glow.a > 0.01f;
			Vector2 val = default(Vector2);
			for (int i = 0; i < targets.Count; i++)
			{
				MatInfo matInfo = targets[i];
				if ((Object)(object)matInfo.mat == (Object)null)
				{
					continue;
				}
				try
				{
					float num = (float)i * 0.137f;
					((Vector2)(ref val))..ctor(baseOff.x + num, baseOff.y + num * 0.7f);
					if ((Object)(object)matInfo.origShader != (Object)null && (Object)(object)matInfo.mat.shader != (Object)(object)matInfo.origShader)
					{
						matInfo.mat.shader = matInfo.origShader;
					}
					for (int j = 0; j < 3; j++)
					{
						if (matInfo.hasTexes[j])
						{
							matInfo.mat.SetTexture(TexIds[j], (Texture)(object)tex);
							matInfo.mat.SetTextureOffset(TexIds[j], val);
							matInfo.mat.SetTextureScale(TexIds[j], baseScale);
						}
					}
					SetColorProps(matInfo.mat, Color.white);
					if (matInfo.hasEmissionColor)
					{
						if (flag)
						{
							matInfo.mat.SetColor(P_EmissionColor, glow);
							matInfo.mat.EnableKeyword("_EMISSION");
						}
						else if (!matInfo.origEmissionOn)
						{
							matInfo.mat.SetColor(P_EmissionColor, Color.black);
							matInfo.mat.DisableKeyword("_EMISSION");
						}
					}
				}
				catch
				{
				}
			}
		}

		private void ApplyMetal(Color tint, Color emission)
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: 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)
			for (int i = 0; i < targets.Count; i++)
			{
				MatInfo matInfo = targets[i];
				if ((Object)(object)matInfo.mat == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)matInfo.origShader != (Object)null && (Object)(object)matInfo.mat.shader != (Object)(object)matInfo.origShader)
					{
						matInfo.mat.shader = matInfo.origShader;
					}
					for (int j = 0; j < 3; j++)
					{
						if (matInfo.hasTexes[j])
						{
							matInfo.mat.SetTexture(TexIds[j], matInfo.origTexes[j]);
							matInfo.mat.SetTextureOffset(TexIds[j], matInfo.origUVs[j]);
							matInfo.mat.SetTextureScale(TexIds[j], matInfo.origScales[j]);
						}
					}
					if (matInfo.hasEmissionMap)
					{
						matInfo.mat.SetTexture(P_EmissionMap, matInfo.origEmissionMap);
					}
					SetColorProps(matInfo.mat, tint);
					if (matInfo.hasMetallic)
					{
						matInfo.mat.SetFloat(P_Metallic, 1f);
					}
					if (matInfo.hasGloss)
					{
						matInfo.mat.SetFloat(P_Gloss, 1f);
					}
					if (matInfo.hasSmooth)
					{
						matInfo.mat.SetFloat(P_Smooth, 1f);
					}
					if (matInfo.hasSpec)
					{
						matInfo.mat.SetColor(P_SpecColor, tint);
					}
					if (matInfo.mat.HasProperty(P_EmissionColor))
					{
						matInfo.mat.SetColor(P_EmissionColor, emission);
						matInfo.mat.EnableKeyword("_EMISSION");
					}
				}
				catch
				{
				}
			}
		}

		private void RunEffect()
		{
			switch (current)
			{
			case 1:
				EffRainbow();
				break;
			case 2:
				EffGhost();
				break;
			case 3:
				EffNeon();
				break;
			case 4:
				EffStrobe();
				break;
			case 5:
				EffShadow();
				break;
			case 6:
				EffGold();
				break;
			case 7:
				EffPulse();
				break;
			case 8:
				EffChromatic();
				break;
			case 9:
				EffIce();
				break;
			case 10:
				EffInfrared();
				break;
			case 11:
				EffMatrix();
				break;
			case 12:
				EffBubblegum();
				break;
			case 13:
				EffStatic();
				break;
			case 14:
				EffToon();
				break;
			case 15:
				EffVoid();
				break;
			case 16:
				EffCopper();
				break;
			case 17:
				EffHologram();
				break;
			case 18:
				EffLava();
				break;
			case 19:
				EffParallax();
				break;
			case 20:
				EffFiery();
				break;
			case 21:
				EffChrome();
				break;
			case 22:
				EffSilver();
				break;
			case 23:
				EffItzXngel();
				break;
			case 24:
				EffPureWhite();
				break;
			}
		}

		private void EffNeon()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.9f % 1f;
			ApplyFlatColor(Color.HSVToRGB(num, 1f, 1f));
		}

		private void EffStrobe()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			bool flag = Mathf.Sin(timeAccum * 22f) > 0f;
			ApplyFlatColor((Color)(flag ? Color.white : new Color(0.06f, 0.06f, 0.1f)));
		}

		private void EffShadow()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Lerp(0.05f, 0.16f, (Mathf.Sin(timeAccum * 1.6f) + 1f) * 0.5f);
			ApplyFlatColor(new Color(num, num, num * 1.4f));
		}

		private void EffItzXngel()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.55f % 3f;
			Color c = ((num < 1f) ? Color.Lerp(XngelMain, XngelLight, num) : ((!(num < 2f)) ? Color.Lerp(XngelDark, XngelMain, num - 2f) : Color.Lerp(XngelLight, XngelDark, num - 1f)));
			ApplyFlatColor(c);
		}

		private void EffVoid()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ApplyFlatColor(Color.black);
		}

		private void EffPureWhite()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			ApplyFlatColor(Color.white);
		}

		private void EffGhost()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)tGhost == (Object)null || (Object)(object)shTransparent == (Object)null)
			{
				ApplyFlatColor(new Color(0.85f, 0.92f, 1f));
				return;
			}
			for (int i = 0; i < targets.Count; i++)
			{
				MatInfo matInfo = targets[i];
				if ((Object)(object)matInfo.mat == (Object)null)
				{
					continue;
				}
				try
				{
					if ((Object)(object)matInfo.mat.shader != (Object)(object)shTransparent)
					{
						matInfo.mat.shader = shTransparent;
					}
					for (int j = 0; j < 3; j++)
					{
						if (matInfo.hasTexes[j])
						{
							matInfo.mat.SetTexture(TexIds[j], (Texture)(object)tGhost);
							matInfo.mat.SetTextureOffset(TexIds[j], Vector2.zero);
							matInfo.mat.SetTextureScale(TexIds[j], Vector2.one);
						}
					}
					SetColorProps(matInfo.mat, Color.white);
					if (matInfo.hasEmissionColor && !matInfo.origEmissionOn)
					{
						matInfo.mat.SetColor(P_EmissionColor, Color.black);
						matInfo.mat.DisableKeyword("_EMISSION");
					}
				}
				catch
				{
				}
			}
		}

		private void EffRainbow()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.55f % 1f;
			float num2 = timeAccum * 0.25f % 1f;
			ApplyPattern(tRainbow, new Vector2(num, num2), Vector2.one, NO_GLOW);
		}

		private void EffChromatic()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.5f % 1f;
			ApplyPattern(tChromatic, new Vector2(num, 0f), Vector2.one, NO_GLOW);
		}

		private void EffPulse()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (tPulseFrames != null && tPulseFrames.Length != 0)
			{
				Texture2D tex = tPulseFrames[animFrameIdx % tPulseFrames.Length];
				ApplyPattern(tex, Vector2.zero, Vector2.one, NO_GLOW);
			}
		}

		private void EffStatic()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (tStaticFrames != null && tStaticFrames.Length != 0)
			{
				Texture2D tex = tStaticFrames[staticFrameIdx % tStaticFrames.Length];
				ApplyPatternPerPart(tex, Vector2.zero, Vector2.one, NO_GLOW);
			}
		}

		private void EffToon()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (tToonFrames != null && tToonFrames.Length != 0)
			{
				Texture2D tex = tToonFrames[toonFrameIdx % tToonFrames.Length];
				ApplyPatternPerPart(tex, Vector2.zero, Vector2.one, NO_GLOW);
			}
		}

		private void EffLava()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (tLavaFrames != null && tLavaFrames.Length != 0)
			{
				Texture2D tex = tLavaFrames[animFrameIdx % tLavaFrames.Length];
				ApplyPatternPerPart(tex, Vector2.zero, Vector2.one, NO_GLOW);
			}
		}

		private void EffFiery()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (tFireFrames != null && tFireFrames.Length != 0)
			{
				Texture2D tex = tFireFrames[animFrameIdx % tFireFrames.Length];
				ApplyPatternPerPart(tex, Vector2.zero, Vector2.one, NO_GLOW);
			}
		}

		private void EffParallax()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (tParallaxFrames != null && tParallaxFrames.Length != 0)
			{
				Texture2D tex = tParallaxFrames[animFrameIdx % tParallaxFrames.Length];
				ApplyPatternPerPart(tex, Vector2.zero, Vector2.one, NO_GLOW);
			}
		}

		private void EffIce()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.12f % 1f;
			float num2 = timeAccum * 0.06f % 1f;
			ApplyPattern(tIce, new Vector2(num, num2), Vector2.one, new Color(0.28f, 0.42f, 0.75f, 1f));
		}

		private void EffInfrared()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)tHeat == (Object)null))
			{
				float num = Mathf.Sin(timeAccum * 0.6f) * 0.05f;
				ApplyPattern(tHeat, new Vector2(num, 0f), Vector2.one, new Color(0.6f, 0.1f, 0.02f, 1f));
			}
		}

		private void EffMatrix()
		{
			//IL_0021: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.35f % 1f;
			ApplyPatternPerPart(tMatrix, new Vector2(0f, 0f - num), Vector2.one, new Color(0.05f, 0.55f, 0.1f, 1f));
		}

		private void EffBubblegum()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 0.12f % 1f;
			float num2 = timeAccum * 0.2f % 1f;
			ApplyPatternPerPart(tBubble, new Vector2(num, 0f - num2), Vector2.one, new Color(0.65f, 0.2f, 0.45f, 1f));
		}

		private void EffHologram()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			float num = timeAccum * 1.1f % 1f;
			ApplyPattern(tHolo, new Vector2(0f, num), Vector2.one, new Color(0f, 0.55f, 0.55f, 1f));
		}

		private void EffChrome()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			ApplyMetal(new Color(0.95f, 0.97f, 1f), new Color(0.35f, 0.4f, 0.5f));
		}

		private void EffSilver()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			ApplyMetal(new Color(0.86f, 0.88f, 0.92f), new Color(0.3f, 0.33f, 0.38f));
		}

		private void EffGold()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			ApplyMetal(new Color(1f, 0.8f, 0.15f), new Color(0.9f, 0.65f, 0.08f));
		}

		private void EffCopper()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			ApplyMetal(new Color(0.9f, 0.55f, 0.25f), new Color(0.75f, 0.35f, 0.1f));
		}
	}
}