Decompiled source of TABS Cinematic Overhaul v4.18.0

TABSCinematicOverhaul.dll

Decompiled 40 minutes ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.AI;
using Landfall.TABS.AI.Components;
using Landfall.TABS.GameState;
using TFBGames;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace CinematicOverhaul;

internal class WaterFX : MonoBehaviour
{
	private struct Recent
	{
		public Vector3 p;

		public float t;
	}

	private class Inflow
	{
		public Vector3 p;

		public Vector3 away;

		public float amount;

		public float until;

		public float next;
	}

	private static WaterFX inst;

	private static bool failed;

	private ParticleSystem drops;

	private ParticleSystem rings;

	private ParticleSystem core;

	private ParticleSystem wisps;

	private ParticleSystem tint;

	private ParticleSystem inside;

	private Particle[] buf = (Particle[])(object)new Particle[1024];

	private AnimationCurve coreCurve;

	private AnimationCurve wispCurve;

	private AnimationCurve tintCurve;

	private AnimationCurve insideCurve;

	private float nextFlow;

	private int queueBuilt = -1;

	private int flowTick;

	private static int frame = -1;

	private static int splashes;

	private static int clouds;

	private static readonly Recent[] recent = new Recent[32];

	private static int recentCursor;

	private static readonly Recent[] hitsNear = new Recent[64];

	private static int hitCursor;

	private static readonly List<Inflow> inflows = new List<Inflow>();

	private static bool On
	{
		get
		{
			if (Cfg.WaterEffects != null && Cfg.WaterEffects.Value)
			{
				return OverhaulManager.InBattle;
			}
			return false;
		}
	}

	private static float Strength
	{
		get
		{
			if (Cfg.WaterBloodAmount == null)
			{
				return 1f;
			}
			return Mathf.Clamp(Cfg.WaterBloodAmount.Value, 0f, 3f);
		}
	}

	private static WaterFX Get()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		if ((Object)(object)inst != (Object)null)
		{
			return inst;
		}
		if (failed)
		{
			return null;
		}
		try
		{
			GameObject val = new GameObject("CinematicOverhaul.WaterFX");
			Object.DontDestroyOnLoad((Object)val);
			inst = val.AddComponent<WaterFX>();
			inst.Build();
		}
		catch (Exception ex)
		{
			failed = true;
			Plugin.Log.LogWarning((object)("Water effects unavailable: " + ex.Message));
			inst = null;
		}
		return inst;
	}

	private static bool Budget(bool cloud)
	{
		if (Time.frameCount != frame)
		{
			frame = Time.frameCount;
			splashes = 0;
			clouds = 0;
		}
		if (cloud)
		{
			return clouds++ < 20;
		}
		return splashes++ < 10;
	}

	public static void NoteHit(Vector3 p)
	{
		//IL_000f: 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)
		hitsNear[hitCursor].p = p;
		hitsNear[hitCursor].t = Time.time;
		hitCursor = (hitCursor + 1) % hitsNear.Length;
	}

	public static bool FreshHitNear(Vector3 p, float seconds = 10f, float range = 2.5f)
	{
		//IL_0045: 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_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)
		float time = Time.time;
		float num = range * range;
		for (int i = 0; i < hitsNear.Length; i++)
		{
			if (hitsNear[i].t > 0f && time - hitsNear[i].t < seconds)
			{
				Vector3 val = hitsNear[i].p - p;
				val.y *= 0.5f;
				if (((Vector3)(ref val)).sqrMagnitude < num)
				{
					return true;
				}
			}
		}
		return false;
	}

	private static Shader AlphaShader()
	{
		string[] array = new string[4] { "Legacy Shaders/Particles/Alpha Blended", "Particles/Alpha Blended", "Mobile/Particles/Alpha Blended", "Sprites/Default" };
		for (int i = 0; i < array.Length; i++)
		{
			Shader val = Shader.Find(array[i]);
			if ((Object)(object)val != (Object)null && val.isSupported)
			{
				return val;
			}
		}
		return null;
	}

	private static Texture2D Ring(int n)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(n, n, (TextureFormat)4, true);
		((Texture)val).wrapMode = (TextureWrapMode)1;
		Color32[] array = (Color32[])(object)new Color32[n * n];
		float num = (float)(n - 1) * 0.5f;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				float num2 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num) * ((float)i - num)) / num;
				float num3 = Mathf.Exp((0f - (num2 - 0.82f) * (num2 - 0.82f)) / 0.006f);
				num3 += 0.25f * Mathf.Exp((0f - (num2 - 0.62f) * (num2 - 0.62f)) / 0.004f);
				num3 *= Mathf.Clamp01((1f - num2) * 12f);
				array[i * n + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Clamp01(num3) * 255f));
			}
		}
		val.SetPixels32(array);
		val.Apply(true);
		return val;
	}

	private static Texture2D Wisp(int n, int seed, float soft)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(n, n, (TextureFormat)4, true);
		((Texture)val).wrapMode = (TextureWrapMode)1;
		Color32[] array = (Color32[])(object)new Color32[n * n];
		float num = (float)(n - 1) * 0.5f;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				float num2 = ((float)j - num) / num;
				float num3 = ((float)i - num) / num;
				float num4 = num2 + 0.35f * (Mathf.PerlinNoise((float)j * 0.035f + (float)seed, (float)i * 0.035f) - 0.5f);
				float num5 = num3 + 0.35f * (Mathf.PerlinNoise((float)j * 0.035f, (float)i * 0.035f + (float)seed * 1.7f) - 0.5f);
				float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5);
				float num7 = Mathf.Pow(Mathf.Clamp01(1f - num6), soft);
				float num8 = Mathf.PerlinNoise((float)j * 0.08f + (float)seed * 5.3f, (float)i * 0.08f - (float)seed * 2.1f);
				float num9 = Mathf.PerlinNoise((float)j * 0.22f - (float)seed, (float)i * 0.22f + (float)seed * 0.7f);
				float num10 = num7 * Mathf.Clamp01(0.35f + 0.9f * num8 * (0.6f + 0.6f * num9));
				array[i * n + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Clamp01(num10) * 255f));
			}
		}
		val.SetPixels32(array);
		val.Apply(true);
		return val;
	}

	private void Build()
	{
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Expected O, but got Unknown
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Expected O, but got Unknown
		//IL_01d9: 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_022e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Expected O, but got Unknown
		//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_036e: Unknown result type (might be due to invalid IL or missing references)
		//IL_039f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d3: Expected O, but got Unknown
		//IL_041a: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Unknown result type (might be due to invalid IL or missing references)
		Shader val = AlphaShader();
		if ((Object)(object)val == (Object)null)
		{
			throw new Exception("no particle shader");
		}
		drops = Make("CO_SplashDrops", Mat(val, Tex.SoftDot(32, 2.2f)), 1.1f, flat: false, 3000);
		ParticleSystemRenderer component = ((Component)drops).GetComponent<ParticleSystemRenderer>();
		component.renderMode = (ParticleSystemRenderMode)1;
		component.velocityScale = 0.04f;
		component.lengthScale = 1.3f;
		rings = Make("CO_WaterRings", Mat(val, Ring(128)), 0f, flat: true, 600);
		Grow(rings, new AnimationCurve((Keyframe[])(object)new Keyframe[2]
		{
			new Keyframe(0f, 0.2f, 0f, 2.6f),
			new Keyframe(1f, 1f, 0.2f, 0f)
		}));
		Fade(rings, Color.white, new Color(0.9f, 0.95f, 1f), 0.08f, 0.35f);
		coreCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
		{
			new Keyframe(0f, 0.3f, 0f, 3.5f),
			new Keyframe(0.4f, 0.8f, 0.8f, 0.8f),
			new Keyframe(1f, 1f, 0.1f, 0f)
		});
		core = Make("CO_WaterBloodCore", Mat(val, Wisp(128, 2, 1.6f)), 0f, flat: true, 300);
		Grow(core, coreCurve);
		Fade(core, Color.white, new Color(1f, 0.9f, 0.9f), 0.04f, 0.45f);
		Spin(core, 0.35f);
		wispCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
		{
			new Keyframe(0f, 0.25f, 0f, 2.2f),
			new Keyframe(0.45f, 0.75f, 0.7f, 0.7f),
			new Keyframe(1f, 1f, 0.2f, 0f)
		});
		wisps = Make("CO_WaterBloodWisps", Mat(val, Wisp(128, 7, 1.15f)), 0f, flat: true, 1000);
		Grow(wisps, wispCurve);
		Fade(wisps, Color.white, new Color(1f, 0.93f, 0.92f), 0.1f, 0.6f);
		Spin(wisps, 0.18f);
		tintCurve = AnimationCurve.EaseInOut(0f, 0.45f, 1f, 1f);
		tint = Make("CO_WaterBloodTint", Mat(val, Wisp(64, 13, 0.8f)), 0f, flat: true, 260);
		Grow(tint, tintCurve);
		Fade(tint, Color.white, Color.white, 0.25f, 0.65f);
		insideCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
		{
			new Keyframe(0f, 0.3f, 0f, 2f),
			new Keyframe(1f, 1f, 0.3f, 0f)
		});
		inside = Make("CO_WaterBloodInside", Mat(val, Wisp(64, 19, 1.3f)), 0f, flat: false, 400);
		Grow(inside, insideCurve);
		Fade(inside, Color.white, new Color(1f, 0.9f, 0.9f), 0.12f, 0.55f);
		Spin(inside, 0.2f);
		((Component)inside).GetComponent<ParticleSystemRenderer>().maxParticleSize = 1.5f;
		ApplyQueues();
	}

	private void ApplyQueues()
	{
		int waterQueue = WaterZones.WaterQueue;
		if (waterQueue != queueBuilt)
		{
			queueBuilt = waterQueue;
			int num = Mathf.Max(3001, waterQueue + 1);
			int renderQueue = ((waterQueue > 2500) ? (waterQueue - 1) : 2999);
			((Renderer)((Component)drops).GetComponent<ParticleSystemRenderer>()).sharedMaterial.renderQueue = num + 2;
			((Renderer)((Component)rings).GetComponent<ParticleSystemRenderer>()).sharedMaterial.renderQueue = num + 1;
			((Renderer)((Component)tint).GetComponent<ParticleSystemRenderer>()).sharedMaterial.renderQueue = num;
			((Renderer)((Component)wisps).GetComponent<ParticleSystemRenderer>()).sharedMaterial.renderQueue = num;
			((Renderer)((Component)core).GetComponent<ParticleSystemRenderer>()).sharedMaterial.renderQueue = num;
			((Renderer)((Component)inside).GetComponent<ParticleSystemRenderer>()).sharedMaterial.renderQueue = renderQueue;
		}
	}

	private static Material Mat(Shader sh, Texture2D tex)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		Material val = new Material(sh);
		((Object)val).name = "CO_Water_" + ((Object)tex).GetInstanceID();
		val.mainTexture = (Texture)(object)tex;
		if (val.HasProperty("_TintColor"))
		{
			val.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f));
		}
		return val;
	}

	private ParticleSystem Make(string name, Material mat, float gravity, bool flat, int max)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject(name);
		val.transform.SetParent(((Component)this).transform, false);
		ParticleSystem obj = val.AddComponent<ParticleSystem>();
		obj.Stop(true, (ParticleSystemStopBehavior)0);
		MainModule main = obj.main;
		((MainModule)(ref main)).loop = true;
		((MainModule)(ref main)).duration = 1f;
		((MainModule)(ref main)).playOnAwake = false;
		((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
		((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
		((MainModule)(ref main)).maxParticles = max;
		((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity);
		EmissionModule emission = obj.emission;
		((EmissionModule)(ref emission)).enabled = false;
		ShapeModule shape = obj.shape;
		((ShapeModule)(ref shape)).enabled = false;
		ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>();
		((Renderer)component).sharedMaterial = mat;
		((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
		((Renderer)component).receiveShadows = false;
		component.renderMode = (ParticleSystemRenderMode)0;
		if (flat)
		{
			((MainModule)(ref main)).startRotation3D = true;
			component.alignment = (ParticleSystemRenderSpace)1;
		}
		component.maxParticleSize = (flat ? 4f : 0.5f);
		component.sortMode = (ParticleSystemSortMode)2;
		obj.Play();
		return obj;
	}

	private static void Grow(ParticleSystem ps, AnimationCurve c)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		SizeOverLifetimeModule sizeOverLifetime = ps.sizeOverLifetime;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
		((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, c);
	}

	private static void Spin(ParticleSystem ps, float r)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		RotationOverLifetimeModule rotationOverLifetime = ps.rotationOverLifetime;
		((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
		((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(0f - r, r);
	}

	private static void Fade(ParticleSystem ps, Color c0, Color c1, float fadeIn, float mid)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Expected O, but got Unknown
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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_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_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//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_009f: Unknown result type (might be due to invalid IL or missing references)
		ColorOverLifetimeModule colorOverLifetime = ps.colorOverLifetime;
		((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
		Gradient val = new Gradient();
		val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
		{
			new GradientColorKey(c0, 0f),
			new GradientColorKey(c1, 1f)
		}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
		{
			new GradientAlphaKey(0f, 0f),
			new GradientAlphaKey(1f, fadeIn),
			new GradientAlphaKey(mid, 0.55f),
			new GradientAlphaKey(0f, 1f)
		});
		((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val);
	}

	private static bool Seen(Vector3 p, float r)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		return ViewCull.Visible(p, r);
	}

	public static void Splash(Vector3 surface, float strength, Vector3 vel)
	{
		//IL_000f: 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_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_0075: 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_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: 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_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_00b2: 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_00be: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: 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_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: 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_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: 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_01db: 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_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		if (!On || !Budget(cloud: false) || !Seen(surface, 3f))
		{
			return;
		}
		WaterFX waterFX = Get();
		if (!((Object)(object)waterFX == (Object)null))
		{
			strength = Mathf.Clamp(strength, 0.1f, 2.5f);
			surface.y = WaterZones.VisualTop(surface, WaterZones.HeightAt(surface, surface.y)) + 0.03f;
			int num = Mathf.RoundToInt(8f + 26f * strength);
			EmitParams val = default(EmitParams);
			Vector3 val2 = new Vector3(vel.x, 0f, vel.z) * 0.15f;
			Color waterTint = WaterZones.WaterTint;
			Color val3 = Color.Lerp(new Color(0.88f, 0.94f, 1f), waterTint, 0.25f);
			for (int i = 0; i < num; i++)
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				((EmitParams)(ref val)).position = surface + new Vector3(insideUnitCircle.x, 0f, insideUnitCircle.y) * 0.25f * Mathf.Sqrt(strength);
				((EmitParams)(ref val)).velocity = new Vector3(insideUnitCircle.x, 0f, insideUnitCircle.y) * Random.Range(0.6f, 2.6f) * strength + Vector3.up * Random.Range(1.8f, 4.2f + 2f * strength) * Mathf.Sqrt(strength) + val2;
				((EmitParams)(ref val)).startSize = Random.Range(0.035f, 0.1f) * Mathf.Lerp(0.8f, 1.4f, strength * 0.5f);
				((EmitParams)(ref val)).startLifetime = Random.Range(0.45f, 1.1f);
				val3.a = Random.Range(0.55f, 0.9f);
				((EmitParams)(ref val)).startColor = Color32.op_Implicit(val3);
				((EmitParams)(ref val)).applyShapeToPosition = false;
				waterFX.drops.Emit(val, 1);
			}
			Ring(waterFX, surface, Mathf.Lerp(1.2f, 3.4f, strength * 0.5f), 1.3f, 0.75f);
			if (strength > 0.6f)
			{
				Ring(waterFX, surface, Mathf.Lerp(0.8f, 2.2f, strength * 0.5f), 0.9f, 0.6f);
			}
		}
	}

	public static void Ripple(Vector3 surface, float size)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		if (On && Budget(cloud: false) && Seen(surface, 2f))
		{
			WaterFX waterFX = Get();
			if (!((Object)(object)waterFX == (Object)null))
			{
				surface.y = WaterZones.VisualTop(surface, WaterZones.HeightAt(surface, surface.y)) + 0.02f;
				Ring(waterFX, surface, size, Random.Range(1.3f, 1.9f), 0.4f);
			}
		}
	}

	private static void Ring(WaterFX fx, Vector3 p, float size, float life, float alpha)
	{
		//IL_0002: 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_0012: 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_002f: 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_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_007d: Unknown result type (might be due to invalid IL or missing references)
		EmitParams val = default(EmitParams);
		((EmitParams)(ref val)).position = p;
		((EmitParams)(ref val)).velocity = Vector3.zero;
		((EmitParams)(ref val)).startSize = size;
		((EmitParams)(ref val)).startLifetime = life;
		((EmitParams)(ref val)).rotation3D = WaterSurface.FlatOn(WaterSurface.NormalAt(p), Random.Range(0f, 360f));
		((EmitParams)(ref val)).startColor = Color32.op_Implicit(new Color(1f, 1f, 1f, alpha));
		((EmitParams)(ref val)).applyShapeToPosition = false;
		fx.rings.Emit(val, 1);
	}

	public static void BloodCloud(Vector3 surface, float amount)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		BloodCloud(surface, amount, Vector3.zero);
	}

	public static void BloodCloud(Vector3 surface, float amount, Vector3 push)
	{
		//IL_005d: 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_0063: 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)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: 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_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: 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_013d: 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_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: 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_01c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: 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_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_030e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: 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_0341: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0367: 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)
		//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_043d: Unknown result type (might be due to invalid IL or missing references)
		//IL_043f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0441: Unknown result type (might be due to invalid IL or missing references)
		//IL_0448: Unknown result type (might be due to invalid IL or missing references)
		//IL_044d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0485: Unknown result type (might be due to invalid IL or missing references)
		//IL_048b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_049f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0526: Unknown result type (might be due to invalid IL or missing references)
		//IL_0528: Unknown result type (might be due to invalid IL or missing references)
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Unknown result type (might be due to invalid IL or missing references)
		//IL_0569: Unknown result type (might be due to invalid IL or missing references)
		//IL_0570: Unknown result type (might be due to invalid IL or missing references)
		//IL_0575: Unknown result type (might be due to invalid IL or missing references)
		//IL_057c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0581: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0615: Unknown result type (might be due to invalid IL or missing references)
		//IL_0626: Unknown result type (might be due to invalid IL or missing references)
		//IL_0632: Unknown result type (might be due to invalid IL or missing references)
		//IL_0634: Unknown result type (might be due to invalid IL or missing references)
		//IL_0644: Unknown result type (might be due to invalid IL or missing references)
		if (!On || Cfg.BloodEnabled == null || !Cfg.BloodEnabled.Value || amount <= 0.001f || Strength <= 0f)
		{
			return;
		}
		float time = Time.time;
		for (int i = 0; i < recent.Length; i++)
		{
			if (time - recent[i].t < 0.2f)
			{
				Vector3 val = recent[i].p - surface;
				if (((Vector3)(ref val)).sqrMagnitude < 0.04f && Random.value > amount * 2.5f)
				{
					return;
				}
			}
		}
		if (!Budget(cloud: true) || !Seen(surface, 4f))
		{
			return;
		}
		WaterFX waterFX = Get();
		if (!((Object)(object)waterFX == (Object)null))
		{
			recent[recentCursor].p = surface;
			recent[recentCursor].t = time;
			recentCursor = (recentCursor + 1) % recent.Length;
			float num = Mathf.Clamp(amount, 0.02f, 1.5f);
			float num2 = Mathf.Sqrt(num);
			float strength = Strength;
			float num3 = WaterZones.VisualTop(surface, WaterZones.HeightAt(surface, surface.y));
			Vector3 n = WaterSurface.NormalAt(surface);
			float num4 = Mathf.Max(0.25f, WaterField.BankDistance(new Vector3(surface.x, num3, surface.z), 1.2f));
			Color fresh = BloodPalette.Fresh;
			Color dark = BloodPalette.Dark;
			Color waterTint = WaterZones.WaterTint;
			EmitParams val2 = default(EmitParams);
			((EmitParams)(ref val2)).applyShapeToPosition = false;
			Color val3 = Color.Lerp(dark, fresh, 0.35f);
			val3.a = Mathf.Clamp01((0.38f + 0.25f * num2) * strength);
			((EmitParams)(ref val2)).position = new Vector3(surface.x, num3 + 0.03f, surface.z);
			((EmitParams)(ref val2)).velocity = push * 0.6f;
			((EmitParams)(ref val2)).startSize = Mathf.Min(Mathf.Lerp(0.22f, 0.7f, num2), num4 * 1.3f);
			((EmitParams)(ref val2)).startLifetime = Random.Range(2.5f, 4.5f);
			((EmitParams)(ref val2)).rotation3D = WaterSurface.FlatOn(n, Random.Range(0f, 360f));
			((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val3);
			waterFX.core.Emit(val2, 1);
			int num5 = Mathf.Clamp(2 + Mathf.RoundToInt(num * 5f), 2, 7);
			for (int j = 0; j < num5; j++)
			{
				Vector2 insideUnitCircle = Random.insideUnitCircle;
				Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized;
				Color val4 = Color.Lerp(Color.Lerp(fresh, dark, Random.Range(0f, 0.35f)), waterTint, Random.Range(0.15f, 0.35f));
				val4.a = Mathf.Clamp01(Random.Range(0.18f, 0.3f) * (0.75f + 0.5f * num2) * strength);
				((EmitParams)(ref val2)).position = new Vector3(surface.x + normalized.x * 0.08f, num3 + 0.025f + 0.002f * (float)j, surface.z + normalized.y * 0.08f);
				((EmitParams)(ref val2)).velocity = new Vector3(normalized.x, 0f, normalized.y) * Random.Range(0.06f, 0.22f) * (0.6f + num2) + push;
				((EmitParams)(ref val2)).startSize = Mathf.Min(Mathf.Lerp(0.45f, 1.5f, num2) * Random.Range(0.75f, 1.2f), num4 * 1.8f);
				((EmitParams)(ref val2)).startLifetime = Mathf.Lerp(8f, 16f, num2) * Random.Range(0.8f, 1.2f);
				((EmitParams)(ref val2)).rotation3D = WaterSurface.FlatOn(n, Random.Range(0f, 360f));
				((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val4);
				waterFX.wisps.Emit(val2, 1);
			}
			int num6 = ((!(num > 0.25f)) ? 1 : 2);
			for (int k = 0; k < num6; k++)
			{
				Vector2 val5 = Random.insideUnitCircle * 0.2f;
				Color val6 = Color.Lerp(fresh, dark, 0.4f);
				val6.a = Mathf.Clamp01(0.3f * strength);
				((EmitParams)(ref val2)).position = new Vector3(surface.x + val5.x, num3 - Random.Range(0.06f, 0.3f), surface.z + val5.y);
				((EmitParams)(ref val2)).velocity = new Vector3(val5.x, Random.Range(-0.03f, 0.02f), val5.y) * 0.5f + push * 0.5f;
				((EmitParams)(ref val2)).startSize = Mathf.Lerp(0.25f, 0.8f, num2);
				((EmitParams)(ref val2)).startLifetime = Random.Range(5f, 9f);
				((EmitParams)(ref val2)).rotation = Random.Range(0f, 360f);
				((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val6);
				waterFX.inside.Emit(val2, 1);
			}
			if (num > 0.2f || Random.value < 0.2f)
			{
				Color val7 = Color.Lerp(Color.Lerp(fresh, dark, 0.2f), waterTint, 0.45f);
				val7.a = Mathf.Clamp01(0.08f * strength * (0.7f + num2));
				((EmitParams)(ref val2)).position = new Vector3(surface.x, num3 + 0.02f, surface.z);
				((EmitParams)(ref val2)).velocity = push * 0.4f;
				((EmitParams)(ref val2)).startSize = Mathf.Min(Mathf.Lerp(1.6f, 3.2f, num2), num4 * 2.2f + 0.6f);
				((EmitParams)(ref val2)).startLifetime = Random.Range(22f, 38f);
				((EmitParams)(ref val2)).rotation3D = WaterSurface.FlatOn(n, Random.Range(0f, 360f));
				((EmitParams)(ref val2)).startColor = Color32.op_Implicit(val7);
				waterFX.tint.Emit(val2, 1);
			}
		}
	}

	public static void AddInflow(Vector3 surface, Vector3 away, float amount, float seconds)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		if (!On || amount <= 0f)
		{
			return;
		}
		away.y = 0f;
		away = ((((Vector3)(ref away)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref away)).normalized : Vector3.zero);
		for (int i = 0; i < inflows.Count; i++)
		{
			Inflow inflow = inflows[i];
			Vector3 val = inflow.p - surface;
			if (((Vector3)(ref val)).sqrMagnitude < 0.09f)
			{
				inflow.amount = Mathf.Min(1.5f, inflow.amount + amount);
				inflow.until = Mathf.Max(inflow.until, Time.time + seconds);
				return;
			}
		}
		if (inflows.Count < 48)
		{
			inflows.Add(new Inflow
			{
				p = surface,
				away = away,
				amount = Mathf.Min(1.5f, amount),
				until = Time.time + seconds,
				next = Time.time
			});
			Get();
		}
	}

	private void Update()
	{
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		if (!On)
		{
			return;
		}
		float time = Time.time;
		for (int num = inflows.Count - 1; num >= 0; num--)
		{
			Inflow inflow = inflows[num];
			if (time > inflow.until || inflow.amount <= 0.01f)
			{
				inflows.RemoveAt(num);
			}
			else if (time >= inflow.next)
			{
				inflow.next = time + Random.Range(0.25f, 0.5f);
				float num2 = Mathf.Clamp(inflow.amount * 0.18f, 0.03f, 0.25f);
				inflow.amount -= num2 * 0.6f;
				Vector3 push = inflow.away * Random.Range(0.08f, 0.18f);
				BloodCloud(inflow.p + inflow.away * 0.08f + Random.insideUnitSphere * 0.05f, num2, push);
			}
		}
		if (time >= nextFlow)
		{
			nextFlow = time + 0.1f;
			flowTick++;
			ApplyQueues();
			Flow(wisps, wispCurve, 0.1f, flat: true, 0.025f);
			Flow(core, coreCurve, 0.1f, flat: true, 0.03f);
			Flow(tint, tintCurve, 0.1f, flat: true, 0.02f);
			Flow(inside, insideCurve, 0.1f, flat: false, 0f);
		}
	}

	private void Flow(ParticleSystem ps, AnimationCurve curve, float dt, bool flat, float lift)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: 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_00e2: 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_00fa: 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_0124: 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_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: 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_0184: 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_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: 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_01ac: 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_01bd: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0337: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_036b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0402: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_045d: Unknown result type (might be due to invalid IL or missing references)
		int particleCount = ps.particleCount;
		if (particleCount == 0)
		{
			return;
		}
		if (buf.Length < particleCount)
		{
			buf = (Particle[])(object)new Particle[particleCount + 256];
		}
		int particles = ps.GetParticles(buf);
		float time = Time.time;
		Vector3 val3 = default(Vector3);
		Vector3 val6 = default(Vector3);
		for (int i = 0; i < particles; i++)
		{
			Particle val = buf[i];
			Vector3 position = ((Particle)(ref val)).position;
			Vector3 velocity = ((Particle)(ref val)).velocity;
			Vector3 val2 = WaterZones.StreamAt(position);
			uint randomSeed = ((Particle)(ref val)).randomSeed;
			float num = (float)(randomSeed % 1000) * 0.01f;
			float num2 = (Mathf.PerlinNoise(position.x * 0.6f + num, time * 0.15f) - 0.5f) * 0.12f;
			float num3 = (Mathf.PerlinNoise(position.z * 0.6f - num, time * 0.15f + 7.3f) - 0.5f) * 0.12f;
			((Vector3)(ref val3))..ctor(velocity.x, 0f, velocity.z);
			val3 = Vector3.Lerp(val3, val2, 1f - Mathf.Exp((0f - dt) * (0.35f + ((Vector3)(ref val2)).magnitude * 0.9f)));
			val3 *= Mathf.Exp((0f - dt) * 0.12f);
			val3.x += num2 * dt * 2f;
			val3.z += num3 * dt * 2f;
			Vector3 val4 = position + val3 * dt * 2f;
			if (!WaterField.IsWater(val4))
			{
				bool num4 = WaterField.IsWater(new Vector3(val4.x, position.y, position.z));
				bool flag = WaterField.IsWater(new Vector3(position.x, position.y, val4.z));
				if (!num4)
				{
					val3.x = (0f - val3.x) * 0.3f;
				}
				if (!flag)
				{
					val3.z = (0f - val3.z) * 0.3f;
				}
				if (num4 && flag)
				{
					val3 *= -0.3f;
				}
			}
			if (!WaterField.IsWater(position))
			{
				Vector3 val5 = Vector3.zero;
				for (int j = 0; j < 8; j++)
				{
					float num5 = (float)j * ((float)Math.PI / 4f);
					((Vector3)(ref val6))..ctor(Mathf.Cos(num5), 0f, Mathf.Sin(num5));
					if (WaterField.IsWater(position + val6 * 0.4f))
					{
						val5 += val6;
					}
				}
				if (((Vector3)(ref val5)).sqrMagnitude > 0.01f)
				{
					val3 += ((Vector3)(ref val5)).normalized * 0.12f;
				}
				else
				{
					((Particle)(ref val)).remainingLifetime = Mathf.Min(((Particle)(ref val)).remainingLifetime, 0.4f);
				}
			}
			float h;
			Vector3 n;
			bool flag2 = WaterSurface.Height(position, out h, out n) == 1;
			if (!flag2 || n.y < 0.2f)
			{
				n = Vector3.up;
			}
			float num6 = (flag2 ? ((0f - (n.x * val3.x + n.z * val3.z)) / n.y) : 0f);
			float num7 = WaterZones.VisualTop(position, flag2 ? h : position.y);
			if (flat)
			{
				position.y = num7 + (lift + (float)(randomSeed % 7) * 0.0015f) / Mathf.Max(0.35f, n.y);
				((Particle)(ref val)).rotation3D = WaterSurface.FlatOn(n, ((Particle)(ref val)).rotation3D.z);
			}
			else
			{
				float num8 = 0.06f + (float)(randomSeed % 100) * 0.0025f;
				position.y = Mathf.Lerp(position.y, num7 - num8, 0.2f);
			}
			((Particle)(ref val)).position = position;
			((Particle)(ref val)).velocity = new Vector3(val3.x, flat ? num6 : (flag2 ? num6 : (velocity.y * 0.9f)), val3.z);
			float startLifetime = ((Particle)(ref val)).startLifetime;
			float num9 = ((startLifetime > 0f) ? Mathf.Clamp01(1f - ((Particle)(ref val)).remainingLifetime / startLifetime) : 1f);
			float num10 = Mathf.Max(0.05f, curve.Evaluate(num9));
			if ((uint)((int)randomSeed + flowTick) % 5u == 0)
			{
				float num11 = WaterField.BankDistance(position, 1.6f);
				float num12 = (flat ? (num11 * 2.2f + 0.35f) : (num11 * 2f + 0.3f));
				if (((Particle)(ref val)).startSize * num10 > num12)
				{
					((Particle)(ref val)).startSize = Mathf.Max(0.05f, num12 / num10);
				}
			}
			buf[i] = val;
		}
		ps.SetParticles(buf, particles);
	}

	internal static void ClearAll()
	{
		inflows.Clear();
		WaterField.Clear();
		for (int i = 0; i < hitsNear.Length; i++)
		{
			hitsNear[i].t = -100f;
		}
		if ((Object)(object)inst != (Object)null)
		{
			inst.drops.Clear();
			inst.rings.Clear();
			inst.core.Clear();
			inst.wisps.Clear();
			inst.tint.Clear();
			inst.inside.Clear();
		}
	}
}
internal static class Bandage
{
	private static Material mat;

	private static bool failed;

	public static void Wrap(Rigidbody rig, Vector3 point, float scale)
	{
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0267: Unknown result type (might be due to invalid IL or missing references)
		//IL_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_027e: Unknown result type (might be due to invalid IL or missing references)
		//IL_027f: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: 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_02e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: 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_013c: 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_014a: 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_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: 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_01ad: 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_01c9: 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_01d8: 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_01e5: 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_01f2: 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_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0229: Unknown result type (might be due to invalid IL or missing references)
		//IL_022e: Unknown result type (might be due to invalid IL or missing references)
		if (failed || (Object)(object)rig == (Object)null)
		{
			return;
		}
		try
		{
			if ((Object)(object)mat == (Object)null)
			{
				Shader val = Shader.Find("Standard");
				if ((Object)(object)val == (Object)null || !val.isSupported)
				{
					val = Shader.Find("Legacy Shaders/Diffuse");
				}
				if ((Object)(object)val == (Object)null || !val.isSupported)
				{
					val = Shader.Find("Sprites/Default");
				}
				if ((Object)(object)val == (Object)null)
				{
					failed = true;
					return;
				}
				mat = new Material(val);
				((Object)mat).name = "CO_Bandage";
				mat.color = new Color(0.9f, 0.87f, 0.8f, 1f);
			}
			GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)2);
			((Object)val2).name = "CO_Bandage";
			Collider component = val2.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
			Renderer component2 = val2.GetComponent<Renderer>();
			component2.sharedMaterial = mat;
			component2.shadowCastingMode = (ShadowCastingMode)0;
			Transform transform = ((Component)rig).transform;
			Vector3 val3 = transform.up;
			Collider component3 = ((Component)rig).GetComponent<Collider>();
			float num = 0.09f * scale;
			if ((Object)(object)component3 != (Object)null)
			{
				Bounds bounds = component3.bounds;
				Vector3 size = ((Bounds)(ref bounds)).size;
				num = Mathf.Clamp(Mathf.Min(size.x, Mathf.Min(size.y, size.z)) * 0.6f, 0.05f * scale, 0.2f * scale);
				val3 = ((size.x >= size.y && size.x >= size.z) ? Vector3.right : ((!(size.z >= size.y) || !(size.z >= size.x)) ? Vector3.up : Vector3.forward));
				Vector3[] array = (Vector3[])(object)new Vector3[3] { transform.right, transform.up, transform.forward };
				float num2 = -1f;
				for (int i = 0; i < 3; i++)
				{
					float num3 = Mathf.Abs(Vector3.Dot(array[i], val3));
					if (num3 > num2)
					{
						num2 = num3;
						val3 = array[i];
					}
				}
			}
			Vector3 worldCenterOfMass = rig.worldCenterOfMass;
			Vector3 val4 = Vector3.Project(point - worldCenterOfMass, val3);
			val2.transform.SetParent(transform, true);
			val2.transform.position = worldCenterOfMass + val4;
			val2.transform.rotation = Quaternion.FromToRotation(Vector3.up, val3);
			val2.transform.localScale = Vector3.one;
			Vector3 lossyScale = val2.transform.lossyScale;
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(num * 2.1f, 0.045f * scale, num * 2.1f);
			val2.transform.localScale = new Vector3(val5.x / Mathf.Max(0.0001f, lossyScale.x), val5.y / Mathf.Max(0.0001f, lossyScale.y), val5.z / Mathf.Max(0.0001f, lossyScale.z));
		}
		catch (Exception ex)
		{
			failed = true;
			Plugin.Log.LogWarning((object)("Bandage: " + ex.Message));
		}
	}
}
internal static class Tex
{
	private class Canvas
	{
		public readonly int S;

		public readonly float[] a;

		public readonly float[] v;

		public Canvas(int s)
		{
			S = s;
			a = new float[s * s];
			v = new float[s * s];
			for (int i = 0; i < v.Length; i++)
			{
				v[i] = 1f;
			}
		}

		public void Max(int x, int y, float alpha, float shade)
		{
			int num = y * S + x;
			if (alpha > a[num])
			{
				a[num] = alpha;
				v[num] = shade;
			}
		}

		public void Disc(float cx, float cy, float r, float shade = 0.9f)
		{
			int num = Mathf.Max(0, (int)((cx - r) * (float)S) - 1);
			int num2 = Mathf.Min(S - 1, (int)((cx + r) * (float)S) + 1);
			int num3 = Mathf.Max(0, (int)((cy - r) * (float)S) - 1);
			int num4 = Mathf.Min(S - 1, (int)((cy + r) * (float)S) + 1);
			for (int i = num3; i <= num4; i++)
			{
				for (int j = num; j <= num2; j++)
				{
					float num5 = ((float)j + 0.5f) / (float)S - cx;
					float num6 = ((float)i + 0.5f) / (float)S - cy;
					float x = Mathf.Sqrt(num5 * num5 + num6 * num6);
					Max(j, i, Smooth(r, r * 0.65f, x), Mathf.Lerp(shade * 0.92f, shade, Smooth(r, r * 0.4f, x)));
				}
			}
		}

		public void Capsule(float ax, float ay, float bx, float by, float ra, float rb, float shade = 0.9f)
		{
			float num = Mathf.Max(ra, rb);
			int num2 = Mathf.Max(0, (int)((Mathf.Min(ax, bx) - num) * (float)S) - 1);
			int num3 = Mathf.Min(S - 1, (int)((Mathf.Max(ax, bx) + num) * (float)S) + 1);
			int num4 = Mathf.Max(0, (int)((Mathf.Min(ay, by) - num) * (float)S) - 1);
			int num5 = Mathf.Min(S - 1, (int)((Mathf.Max(ay, by) + num) * (float)S) + 1);
			float num6 = bx - ax;
			float num7 = by - ay;
			float num8 = Mathf.Max(1E-06f, num6 * num6 + num7 * num7);
			for (int i = num4; i <= num5; i++)
			{
				for (int j = num2; j <= num3; j++)
				{
					float num9 = ((float)j + 0.5f) / (float)S - ax;
					float num10 = ((float)i + 0.5f) / (float)S - ay;
					float num11 = Mathf.Clamp01((num9 * num6 + num10 * num7) / num8);
					float num12 = num9 - num6 * num11;
					float num13 = num10 - num7 * num11;
					float x = Mathf.Sqrt(num12 * num12 + num13 * num13);
					float num14 = Mathf.Lerp(ra, rb, num11);
					Max(j, i, Smooth(num14, num14 * 0.6f, x), shade);
				}
			}
		}

		public void NoisyBlob(float cx, float cy, float r, float seed, float rough, float rx = 1f, float ry = 1f)
		{
			float num = r * (1f + rough) * Mathf.Max(rx, ry);
			int num2 = Mathf.Max(0, (int)((cx - num) * (float)S) - 1);
			int num3 = Mathf.Min(S - 1, (int)((cx + num) * (float)S) + 1);
			int num4 = Mathf.Max(0, (int)((cy - num) * (float)S) - 1);
			int num5 = Mathf.Min(S - 1, (int)((cy + num) * (float)S) + 1);
			for (int i = num4; i <= num5; i++)
			{
				for (int j = num2; j <= num3; j++)
				{
					float num6 = (((float)j + 0.5f) / (float)S - cx) / rx;
					float num7 = (((float)i + 0.5f) / (float)S - cy) / ry;
					float x = Mathf.Sqrt(num6 * num6 + num7 * num7);
					float ang = Mathf.Atan2(num7, num6);
					float num8 = r * (1f - rough * 0.5f + rough * (Ring(ang, seed, 1.6f) * 0.75f + Ring(ang, seed + 7f, 4.5f) * 0.25f));
					Max(j, i, Smooth(num8, num8 - 0.04f, x), Mathf.Lerp(0.86f, 1f, Smooth(num8, num8 * 0.55f, x)));
				}
			}
		}

		public Texture2D Bake(bool mips = true)
		{
			//IL_000e: 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_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(S, S, (TextureFormat)4, mips)
			{
				wrapMode = (TextureWrapMode)1,
				filterMode = (FilterMode)2,
				anisoLevel = 4
			};
			Color[] array = (Color[])(object)new Color[S * S];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = new Color(v[i], v[i], v[i], Mathf.Clamp01(a[i]));
			}
			val.SetPixels(array);
			val.Apply(mips);
			return val;
		}
	}

	private struct Drop
	{
		public float x;

		public float y;

		public float r;

		public float ex;

		public float ey;

		public float amt;
	}

	private static readonly List<Drop>[] splash = new List<Drop>[4];

	private static float splashSeed;

	private static float Smooth(float e0, float e1, float x)
	{
		float num = Mathf.Clamp01((x - e0) / (e1 - e0));
		return num * num * (3f - 2f * num);
	}

	private static float Ring(float ang, float seed, float freq)
	{
		return Mathf.PerlinNoise(seed + Mathf.Cos(ang) * freq, seed * 0.37f + Mathf.Sin(ang) * freq);
	}

	public static Texture2D SoftDot(int size, float hardness)
	{
		//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_0011: Expected O, but got Unknown
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		Texture2D val = new Texture2D(size, size, (TextureFormat)4, true)
		{
			wrapMode = (TextureWrapMode)1
		};
		Color[] array = (Color[])(object)new Color[size * size];
		for (int i = 0; i < size; i++)
		{
			for (int j = 0; j < size; j++)
			{
				float num = ((float)j + 0.5f) / (float)size * 2f - 1f;
				float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f;
				float num3 = Mathf.Sqrt(num * num + num2 * num2);
				array[i * size + j] = new Color(1f, 1f, 1f, Mathf.Pow(Mathf.Clamp01(1f - num3), hardness));
			}
		}
		val.SetPixels(array);
		val.Apply(true);
		return val;
	}

	public static Texture2D Splat(int seed, bool radial)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		float num = 0.16f + func() * 0.05f;
		canvas.NoisyBlob(0.5f, 0.5f, num, seed, 0.55f);
		int num2 = (radial ? 6 : 14) + rnd.Next(8);
		for (int num3 = 0; num3 < num2; num3++)
		{
			float num4 = func() * (float)Math.PI * 2f;
			float num5 = 0.24f + func() * 0.22f;
			canvas.Disc(0.5f + Mathf.Cos(num4) * num5, 0.5f + Mathf.Sin(num4) * num5, 0.008f + func() * (radial ? 0.012f : 0.022f));
		}
		if (radial)
		{
			for (int num6 = 0; num6 < 7; num6++)
			{
				float num7 = func() * (float)Math.PI * 2f;
				float num8 = 0.25f + func() * 0.2f;
				canvas.Capsule(0.5f + Mathf.Cos(num7) * num * 0.6f, 0.5f + Mathf.Sin(num7) * num * 0.6f, 0.5f + Mathf.Cos(num7) * num8, 0.5f + Mathf.Sin(num7) * num8, 0.022f, 0.005f, 0.85f);
			}
		}
		return canvas.Bake();
	}

	public static Texture2D Directional(int seed)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		canvas.NoisyBlob(0.5f, 0.3f, 0.14f, seed, 0.35f, 0.9f, 1.25f);
		float num = 0.5f;
		float num2 = 0.42f;
		float num3 = 0.05f;
		while (num2 < 0.96f && num3 > 0.006f)
		{
			canvas.Disc(num, num2, num3);
			num += (func() - 0.5f) * 0.05f;
			num2 += num3 * 1.6f + func() * 0.05f;
			num3 *= 0.72f + func() * 0.12f;
		}
		for (int num4 = 0; num4 < 5; num4++)
		{
			float num5 = (float)Math.PI / 180f * (60f + func() * 60f) * ((num4 % 2 == 0) ? 1f : (-1f)) + (float)Math.PI / 2f;
			float num6 = 0.15f + func() * 0.22f;
			canvas.Capsule(0.5f, 0.32f, 0.5f + Mathf.Cos(num5) * num6 * 0.6f, 0.32f + Mathf.Sin(num5) * num6, 0.018f, 0.004f, 0.85f);
			canvas.Disc(0.5f + Mathf.Cos(num5) * num6 * 0.65f, 0.32f + Mathf.Sin(num5) * num6 * 1.08f, 0.006f + func() * 0.01f);
		}
		for (int num7 = 0; num7 < 10; num7++)
		{
			canvas.Disc(0.5f + (func() - 0.5f) * 0.5f, 0.35f + func() * 0.6f, 0.004f + func() * 0.008f);
		}
		return canvas.Bake();
	}

	public static Texture2D Dots(int seed)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		int num = 70 + rnd.Next(60);
		for (int num2 = 0; num2 < num; num2++)
		{
			float num3 = (func() + func() + func() - 1.5f) * 0.28f;
			float num4 = (func() + func() + func() - 1.5f) * 0.28f;
			canvas.Disc(0.5f + num3, 0.5f + num4, 0.004f + func() * func() * 0.03f);
		}
		return canvas.Bake();
	}

	public static Texture2D Crown(int seed)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		float num = 0.15f;
		canvas.NoisyBlob(0.5f, 0.5f, num, seed, 0.3f);
		int num2 = 14 + rnd.Next(8);
		for (int num3 = 0; num3 < num2; num3++)
		{
			float num4 = ((float)num3 + func() * 0.5f) / (float)num2 * (float)Math.PI * 2f;
			float num5 = num + 0.08f + func() * 0.2f;
			float bx = 0.5f + Mathf.Cos(num4) * num5;
			float num6 = 0.5f + Mathf.Sin(num4) * num5;
			canvas.Capsule(0.5f + Mathf.Cos(num4) * num * 0.8f, 0.5f + Mathf.Sin(num4) * num * 0.8f, bx, num6, 0.02f, 0.006f, 0.88f);
			canvas.Disc(0.5f + Mathf.Cos(num4) * (num5 + 0.03f), 0.5f + Mathf.Sin(num4) * (num5 + 0.03f), 0.01f + func() * 0.014f);
		}
		return canvas.Bake();
	}

	public static Texture2D DripRun(int seed)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		canvas.NoisyBlob(0.5f, 0.09f, 0.075f, seed, 0.45f, 3.2f);
		int num = 2 + rnd.Next(4);
		for (int num2 = 0; num2 < num; num2++)
		{
			float num3 = 0.3f + func() * 0.4f;
			float num4 = 0.35f + func() * 0.6f;
			float num5 = 0.025f + func() * 0.03f;
			float num6 = 0.08f;
			while (num6 < num4)
			{
				float num7 = Mathf.Min(num4, num6 + 0.04f);
				float num8 = num3 + (Mathf.PerlinNoise((float)seed + (float)num2 * 3f, num7 * 6f) - 0.5f) * 0.03f;
				canvas.Capsule(num3, num6, num8, num7, num5, num5 * 0.96f, 0.85f);
				num3 = num8;
				num6 = num7;
				num5 *= 0.985f;
			}
			canvas.Disc(num3, num4 + num5 * 0.6f, num5 * 1.5f, 0.8f);
		}
		return canvas.Bake();
	}

	public static Texture2D Smear(int seed)
	{
		Canvas canvas = new Canvas(128);
		for (int i = 0; i < 128; i++)
		{
			for (int j = 0; j < 128; j++)
			{
				float num = ((float)j + 0.5f) / 128f;
				float num2 = ((float)i + 0.5f) / 128f;
				float num3 = (Mathf.PerlinNoise((float)seed, num2 * 3f) - 0.5f) * 0.12f;
				float num4 = num + num3;
				float num5 = Smooth(0.02f, 0.2f, num4) * Smooth(0.98f, 0.8f, num4);
				float num6 = 0.5f + 0.5f * Mathf.PerlinNoise(num4 * 26f + (float)seed, num2 * 1.2f);
				float num7 = Smooth(0.28f, 0.5f, Mathf.PerlinNoise(num4 * 7f + (float)seed * 0.3f, num2 * 3.5f + (float)seed));
				float num8 = Smooth(0f, 0.1f, num2) * Smooth(1f, 0.82f, num2);
				float alpha = num5 * num8 * Mathf.Lerp(0.35f, 1f, num7) * Mathf.Lerp(0.6f, 1f, num6);
				canvas.Max(j, i, alpha, Mathf.Lerp(0.7f, 1f, num6));
			}
		}
		return canvas.Bake();
	}

	public static Texture2D Handprint(int seed, bool right)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		float i = (right ? (-1f) : 1f);
		Func<float, float> func2 = (float x) => 0.5f + (x - 0.5f) * i;
		canvas.NoisyBlob(0.5f, 0.38f, 0.15f, seed, 0.2f, 1f, 1.2f);
		float[] array = new float[4] { 0.4f, 0.48f, 0.56f, 0.63f };
		float[] array2 = new float[4] { 0.8f, 0.87f, 0.84f, 0.74f };
		for (int num = 0; num < 4; num++)
		{
			float arg = array[num] + (array[num] - 0.5f) * 0.35f;
			canvas.Capsule(func2(array[num]), 0.55f, func2(arg), array2[num] + (func() - 0.5f) * 0.03f, 0.04f, 0.034f, 0.85f);
		}
		canvas.Capsule(func2(0.36f), 0.42f, func2(0.21f), 0.57f, 0.045f, 0.036f, 0.85f);
		canvas.Capsule(0.5f, 0.28f, 0.5f + (func() - 0.5f) * 0.1f, 0.1f, 0.1f, 0.05f, 0.8f);
		for (int num2 = 0; num2 < canvas.a.Length; num2++)
		{
			float num3 = (float)(num2 % canvas.S) / (float)canvas.S;
			float num4 = (float)(num2 / canvas.S) / (float)canvas.S;
			canvas.a[num2] *= Mathf.Lerp(0.45f, 1f, Mathf.PerlinNoise(num3 * 12f + (float)seed, num4 * 12f));
		}
		return canvas.Bake();
	}

	public static Texture2D Pool(int seed)
	{
		Canvas canvas = new Canvas(256);
		for (int i = 0; i < 256; i++)
		{
			for (int j = 0; j < 256; j++)
			{
				float num = ((float)j + 0.5f) / 256f - 0.5f;
				float num2 = ((float)i + 0.5f) / 256f - 0.5f;
				float x = Mathf.Sqrt(num * num + num2 * num2) * 2f;
				float ang = Mathf.Atan2(num2, num);
				float num3 = 0.72f * (0.78f + 0.3f * Ring(ang, seed, 1.2f) + 0.12f * Ring(ang, seed + 3, 3.5f));
				float alpha = Smooth(num3, num3 - 0.07f, x);
				float num4 = Smooth(num3 - 0.04f, num3 * 0.35f, x);
				float shade = Mathf.Lerp(1f, 0.9f, num4) * (0.95f + 0.05f * Mathf.PerlinNoise((float)j * 0.05f + (float)seed, (float)i * 0.05f));
				canvas.Max(j, i, alpha, shade);
			}
		}
		return canvas.Bake();
	}

	public static Texture2D Spatter(int seed)
	{
		Canvas canvas = new Canvas(128);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		float num = 0.5f;
		float num2 = 0.24f + func() * 0.04f;
		float num3 = 0.11f + func() * 0.03f;
		canvas.NoisyBlob(num, num2, num3, seed, 0.28f, 0.92f, 1.18f);
		float num4 = num;
		float num5 = num2 + num3 * 0.6f;
		float num6 = num3 * 0.62f;
		float num7 = 0.62f + func() * 0.2f;
		while (num5 < num7 && num6 > 0.006f)
		{
			float num8 = num5 + 0.025f;
			float num9 = num4 + (func() - 0.5f) * 0.012f;
			canvas.Capsule(num4, num5, num9, num8, num6, num6 * 0.9f, 0.86f);
			num4 = num9;
			num5 = num8;
			num6 *= 0.86f + func() * 0.06f;
		}
		int num10 = 2 + rnd.Next(4);
		for (int num11 = 0; num11 < num10; num11++)
		{
			float num12 = num7 + 0.04f + func() * (0.96f - num7 - 0.04f);
			float num13 = 0.5f + (func() - 0.5f) * 0.14f;
			float num14 = 0.008f + func() * 0.016f;
			canvas.Capsule(num13, num12 - num14 * 1.6f, num13, num12 + num14 * 1.2f, num14 * 0.7f, num14, 0.86f);
		}
		for (int num15 = 0; num15 < 14; num15++)
		{
			float num16 = (float)Math.PI * 2f * ((float)num15 + func() * 0.6f) / 14f;
			float num17 = Mathf.Max(0f, Mathf.Sin(num16));
			float num18 = num3 * (1.02f + func() * 0.18f + num17 * func() * 0.35f);
			float ax = num + Mathf.Cos(num16) * num3 * 0.8f;
			float ay = num2 + Mathf.Sin(num16) * num3 * 0.8f;
			canvas.Capsule(ax, ay, num + Mathf.Cos(num16) * num18, num2 + Mathf.Sin(num16) * num18, 0.016f, 0.004f, 0.84f);
		}
		for (int num19 = 0; num19 < 5; num19++)
		{
			canvas.Disc(0.5f + (func() - 0.5f) * 0.22f, num2 - num3 - 0.02f - func() * 0.1f, 0.003f + func() * 0.006f);
		}
		return canvas.Bake();
	}

	public static Texture2D Spray(int seed)
	{
		Canvas canvas = new Canvas(256);
		Random rnd = new Random(seed);
		Func<float> func = () => (float)rnd.NextDouble();
		int num = 170 + rnd.Next(80);
		for (int num2 = 0; num2 < num; num2++)
		{
			float num3 = (func() + func() - 1f) * 0.5f;
			float num4 = 0.06f + Mathf.Pow(func(), 0.8f) * 0.9f;
			float num5 = 0.5f + Mathf.Sin(num3) * num4 * 0.85f;
			float num6 = 0.02f + Mathf.Cos(num3) * num4;
			if (!(num6 > 0.97f) && !(num5 < 0.03f) && !(num5 > 0.97f))
			{
				float num7 = (0.0035f + func() * func() * 0.016f) * Mathf.Lerp(1.25f, 0.6f, num4);
				float num8 = num7 * (1.5f + num4 * 3f);
				float num9 = Mathf.Sin(num3);
				float num10 = Mathf.Cos(num3);
				canvas.Capsule(num5 - num9 * num8 * 0.5f, num6 - num10 * num8 * 0.5f, num5 + num9 * num8 * 0.5f, num6 + num10 * num8 * 0.5f, num7 * 0.55f, num7, 0.86f);
			}
		}
		for (int num11 = 0; num11 < 10; num11++)
		{
			float num12 = (func() - 0.5f) * 0.7f;
			float num13 = 0.05f + func() * 0.25f;
			canvas.Disc(0.5f + Mathf.Sin(num12) * num13 * 0.5f, 0.03f + Mathf.Cos(num12) * num13, 0.01f + func() * 0.02f);
		}
		return canvas.Bake();
	}

	public static Texture2D WoundAtlas(int seed)
	{
		//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_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_013b: 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_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Expected O, but got Unknown
		//IL_00c0: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		int num = 128;
		int num2 = num * 4;
		int num3 = num * 4;
		Color[] array = (Color[])(object)new Color[num2 * num3];
		float sd = (float)seed * 0.77f;
		Color fresh = BloodPalette.Fresh;
		PrepareSplash(seed);
		for (int i = 0; i < 12; i++)
		{
			int num4 = i % 4 * num;
			int num5 = i / 4 * num;
			for (int j = 0; j < num; j++)
			{
				for (int k = 0; k < num; k++)
				{
					float num6 = ((float)k + 0.5f) / (float)num;
					float num7 = ((float)j + 0.5f) / (float)num;
					float num8 = Smooth(0f, 0.05f, Mathf.Min(Mathf.Min(num6, 1f - num6), Mathf.Min(num7, 1f - num7)));
					Color val = BloodPalette.Match((i >= 8) ? SplashCell(i, num6, num7) : WoundCell(i, num6, num7, sd), fresh);
					val.a = Mathf.Clamp01(val.a * num8);
					array[(num5 + j) * num2 + num4 + k] = val;
				}
			}
		}
		Texture2D val2 = new Texture2D(num2, num3, (TextureFormat)4, true)
		{
			wrapMode = (TextureWrapMode)1,
			filterMode = (FilterMode)2,
			anisoLevel = 2
		};
		val2.SetPixels(array);
		val2.Apply(true);
		return val2;
	}

	private static Color WoundCell(int cell, float u, float v, float sd)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: 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_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: 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_014c: 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_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_028d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_035b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0361: Unknown result type (might be due to invalid IL or missing references)
		//IL_0366: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_048c: Unknown result type (might be due to invalid IL or missing references)
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0493: Unknown result type (might be due to invalid IL or missing references)
		//IL_049a: Unknown result type (might be due to invalid IL or missing references)
		//IL_049f: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05df: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0602: Unknown result type (might be due to invalid IL or missing references)
		//IL_0705: Unknown result type (might be due to invalid IL or missing references)
		//IL_0706: Unknown result type (might be due to invalid IL or missing references)
		//IL_070c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0711: Unknown result type (might be due to invalid IL or missing references)
		//IL_0717: Unknown result type (might be due to invalid IL or missing references)
		//IL_071e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0725: Unknown result type (might be due to invalid IL or missing references)
		//IL_072a: Unknown result type (might be due to invalid IL or missing references)
		//IL_072c: Unknown result type (might be due to invalid IL or missing references)
		//IL_072e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0740: Unknown result type (might be due to invalid IL or missing references)
		//IL_0745: Unknown result type (might be due to invalid IL or missing references)
		//IL_08bd: Unknown result type (might be due to invalid IL or missing references)
		Color val = default(Color);
		((Color)(ref val))..ctor(0.035f, 0f, 0.002f);
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.42f, 0.045f, 0.04f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0.17f, 0.004f, 0.006f);
		float num = u - 0.5f;
		float num2 = v - 0.5f;
		float num3 = Mathf.Sqrt(num * num + num2 * num2);
		float num4 = Mathf.Atan2(num2, num);
		Color val4 = default(Color);
		float a;
		switch (cell)
		{
		case 0:
		{
			float num47 = 0.07f + 0.025f * Ring(num4, sd + 1f, 2.5f);
			float num48 = 0.14f + 0.05f * Ring(num4, sd + 3f, 4f);
			float num49 = 0.3f + 0.16f * Ring(num4, sd + 5f, 1.6f);
			float num50 = Smooth(num49, num49 * 0.45f, num3) * 0.82f;
			float num51 = Smooth(num48, num48 - 0.03f, num3);
			val4 = Color.Lerp(val3, val2, num51 * 0.85f);
			val4 = Color.Lerp(val4, val, Smooth(num47, num47 - 0.02f, num3));
			a = Mathf.Max(num50, num51);
			break;
		}
		case 1:
		{
			float num40 = Ring(num4, sd + 11f, 3.2f) * 0.7f + Ring(num4, sd + 13f, 7f) * 0.3f;
			float num41 = 0.1f + 0.08f * num40;
			float num42 = 0.2f + 0.12f * Ring(num4, sd + 17f, 5.5f);
			float num43 = 0.36f + 0.12f * Ring(num4, sd + 19f, 2f);
			float num44 = Smooth(num43, num43 * 0.5f, num3) * 0.88f;
			float num45 = Smooth(num42, num42 - 0.05f, num3);
			float num46 = Mathf.PerlinNoise(sd + Mathf.Cos(num4) * 9f, sd + Mathf.Sin(num4) * 9f + num3 * 14f);
			val4 = Color.Lerp(val3, Color.Lerp(val2 * 0.8f, val2 * 1.25f, num46), num45);
			val4 = Color.Lerp(val4, val, Smooth(num41, num41 - 0.03f, num3) * 0.95f);
			a = Mathf.Max(num44, num45);
			break;
		}
		case 2:
		{
			float num33 = Mathf.Abs(num) / 0.3f;
			float num34 = Mathf.Clamp01(1f - Mathf.Pow(num33, 2.2f));
			float x4 = Mathf.Abs(num2);
			float num35 = 0.035f * num34;
			float num36 = 0.075f * num34 + 0.006f;
			float num37 = 0.3f + 0.08f * Ring(num4, sd + 23f, 2f);
			float num38 = Smooth(num37, num37 * 0.35f, Mathf.Sqrt(num * num * 0.6f + num2 * num2 * 1.8f)) * 0.85f;
			float num39 = Smooth(num36, num36 - 0.02f, x4) * Smooth(1.05f, 0.95f, num33);
			val4 = Color.Lerp(val3 * 0.9f, val2 * 0.9f, num39);
			val4 = Color.Lerp(val4, val, Smooth(num35, num35 * 0.3f, x4) * Smooth(1f, 0.9f, num33));
			a = Mathf.Max(num38, num39);
			break;
		}
		case 4:
		{
			float num25 = Mathf.Abs(num) * 2f;
			float num26 = Mathf.Clamp01(1f - Mathf.Pow(num25 / 0.9f, 3f));
			float num27 = (Mathf.PerlinNoise(sd + 31f, u * 9f) - 0.5f) * 0.03f;
			float x3 = Mathf.Abs(num2 - num27);
			float num28 = 0.022f * num26 + 0.002f;
			float num29 = 0.07f * num26 + 0.01f;
			float num30 = 0.2f * Mathf.Sqrt(num26) + 0.03f;
			float num31 = Smooth(num30, num30 * 0.4f, x3) * Smooth(1f, 0.85f, num25) * 0.8f;
			float num32 = Smooth(num29, num29 - 0.02f, x3) * Smooth(0.98f, 0.9f, num25);
			val4 = Color.Lerp(val3, val2 * 1.1f, num32);
			val4 = Color.Lerp(val4, val, Smooth(num28, num28 * 0.4f, x3) * Smooth(0.94f, 0.85f, num25));
			a = Mathf.Max(num31, num32);
			break;
		}
		case 5:
		{
			float num19 = (Mathf.PerlinNoise(sd + 41f, v * 2.2f) - 0.5f) * 0.06f;
			float num20 = 0.33f + 0.05f * Mathf.PerlinNoise(sd + 43f, v * 3f);
			num20 = Mathf.Lerp(num20, 0.44f, Smooth(0.8f, 0.92f, v));
			float x2 = Mathf.Abs(num - num19);
			float num21 = Smooth(num20, num20 - 0.07f, x2);
			float num22 = Smooth(0.99f, 0.93f, v) * Smooth(0f, 0.05f, v);
			float num23 = Smooth(num20 - 0.12f, num20 - 0.02f, x2);
			float num24 = Mathf.Lerp(0.88f, 1.12f, Mathf.PerlinNoise(sd + 47f + u * 3f, v * 4f));
			val4 = new Color(0.27f, 0.008f, 0.01f) * num24;
			val4 = Color.Lerp(val4, new Color(0.11f, 0f, 0.003f), num23 * 0.75f);
			a = num21 * num22 * 0.95f;
			break;
		}
		case 6:
		{
			float num11 = Mathf.Pow(Mathf.Clamp01(Mathf.Sin(v * (float)Math.PI)), 0.55f);
			float num12 = (Mathf.PerlinNoise(sd + 61f, v * 6f) - 0.5f) * 0.05f;
			float x = Mathf.Abs(num - num12);
			float num13 = 0.05f * num11 * (0.7f + 0.6f * Mathf.PerlinNoise(sd + 63f, v * 4f));
			float num14 = num13 + 0.07f * num11 + 0.01f;
			float num15 = num14 + 0.2f * num11 * (0.6f + 0.6f * Mathf.PerlinNoise(sd + 67f, v * 3f));
			float num16 = Smooth(num15, num15 * 0.5f, x) * 0.85f;
			float num17 = Smooth(num14, num14 - 0.02f, x);
			float num18 = Mathf.PerlinNoise(sd + 71f + u * 20f, v * 30f);
			val4 = Color.Lerp(val3, Color.Lerp(val2 * 0.85f, val2 * 1.3f, num18), num17);
			val4 = Color.Lerp(val4, val, Smooth(num13, num13 * 0.3f, x));
			a = Mathf.Max(num16, num17) * Smooth(0f, 0.04f, v) * Smooth(1f, 0.96f, v);
			break;
		}
		default:
		{
			float num5 = sd + (float)cell * 5f;
			float num6 = 0.34f + 0.1f * Ring(num4, num5, 1.4f) + 0.04f * Ring(num4, num5 + 3f, 4f);
			float num7 = Mathf.Pow(Smooth(num6, num6 * 0.2f, num3), 0.7f);
			float num8 = Mathf.Lerp(0.72f, 1f, Mathf.PerlinNoise(num5 + u * 6f, v * 6f)) * Mathf.Lerp(0.88f, 1f, Mathf.PerlinNoise(num5 + 9f + u * 17f, v * 17f));
			float num9 = Smooth(0.74f, 0.82f, Mathf.PerlinNoise(num5 + 17f + u * 26f, v * 26f)) * Smooth(num6 + 0.04f, num6 - 0.12f, num3);
			float num10 = Mathf.Lerp(1f, 0.62f, Smooth(num6 * 0.75f, 0f, num3));
			((Color)(ref val4))..ctor(num10, num10, num10);
			a = Mathf.Clamp01(num7 * num8 + num9 * 0.25f);
			break;
		}
		}
		val4.a = a;
		return val4;
	}

	public static Texture2D Flesh(int seed)
	{
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_0025: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: 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_0116: 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_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_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: 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_01ae: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		int num = 128;
		Texture2D val = new Texture2D(num, num, (TextureFormat)4, true)
		{
			wrapMode = (TextureWrapMode)0,
			filterMode = (FilterMode)2,
			anisoLevel = 2
		};
		Color[] array = (Color[])(object)new Color[num * num];
		float num2 = (float)seed * 1.37f;
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.36f, 0.035f, 0.04f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0.62f, 0.12f, 0.1f);
		Color val4 = default(Color);
		((Color)(ref val4))..ctor(0.86f, 0.62f, 0.55f);
		Color val5 = default(Color);
		((Color)(ref val5))..ctor(0.17f, 0.01f, 0.015f);
		for (int i = 0; i < num; i++)
		{
			for (int j = 0; j < num; j++)
			{
				float num3 = (float)j / (float)num;
				float num4 = (float)i / (float)num;
				float num5 = Mathf.PerlinNoise(num2 + num3 * 6f, num2 + num4 * 6f) * 0.7f + Mathf.PerlinNoise(num2 + num3 * 19f, num2 * 0.5f + num4 * 19f) * 0.3f;
				Color val6 = Color.Lerp(val2, val3, num5);
				float x = Mathf.Abs(Mathf.PerlinNoise(num2 * 2f + num3 * 9f, num4 * 9f) - 0.5f);
				val6 = Color.Lerp(val6, val4, Smooth(0.035f, 0f, x) * 0.5f);
				float x2 = Mathf.PerlinNoise(num2 + 40f + num3 * 12f, num4 * 12f);
				val6 = Color.Lerp(val6, val5, Smooth(0.62f, 0.78f, x2) * 0.8f);
				float num6 = num3 - 0.5f;
				float num7 = num4 - 0.5f;
				float x3 = Mathf.Sqrt(num6 * num6 + num7 * num7);
				val6 = Color.Lerp(val6, new Color(0.92f, 0.88f, 0.8f), Smooth(0.11f, 0.08f, x3) * Smooth(0.03f, 0.06f, x3) * 0.9f);
				val6.a = 1f;
				array[i * num + j] = val6;
			}
		}
		val.SetPixels(array);
		val.Apply(true);
		return val;
	}

	public static Texture2D SmearStrip(int seed)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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_0020: 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_002f: Expected O, but got Unknown
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		int num = 64;
		int num2 = 256;
		Texture2D val = new Texture2D(num, num2, (TextureFormat)4, true)
		{
			wrapModeU = (TextureWrapMode)1,
			wrapModeV = (TextureWrapMode)0,
			filterMode = (FilterMode)2,
			anisoLevel = 4
		};
		Color[] array = (Color[])(object)new Color[num * num2];
		float num3 = (float)seed * 0.913f;
		for (int i = 0; i < num2; i++)
		{
			float num4 = (float)i / (float)num2 * (float)Math.PI * 2f;
			float num5 = Mathf.Cos(num4);
			float num6 = Mathf.Sin(num4);
			float num7 = 0.11f + 0.09f * Mathf.PerlinNoise(num3 + num5 * 1.3f, num3 + num6 * 1.3f) + 0.05f * Mathf.PerlinNoise(num3 + 9f + num5 * 4f, num6 * 4f);
			float num8 = 0.11f + 0.09f * Mathf.PerlinNoise(num3 + 30f + num5 * 1.3f, num3 + num6 * 1.3f) + 0.05f * Mathf.PerlinNoise(num3 + 51f + num5 * 4f, num6 * 4f);
			float num9 = 0.55f + 0.45f * Mathf.PerlinNoise(num3 + 70f + num5 * 0.9f, num6 * 0.9f);
			for (int j = 0; j < num; j++)
			{
				float num10 = ((float)j + 0.5f) / (float)num;
				float num11 = Smooth(num7 - 0.05f, num7 + 0.03f, num10) * Smooth(1f - num8 + 0.05f, 1f - num8 - 0.03f, num10);
				float num12 = Mathf.PerlinNoise(num3 + num10 * 38f, 3.1f + num5 * 0.25f + num6 * 0.25f);
				float num13 = Mathf.PerlinNoise(num3 + 90f + num10 * 11f, num5 * 2.2f + num6 * 2.2f);
				float num14 = Mathf.Lerp(0.45f, 1f, Smooth(0.25f, 0.7f, num12)) * Mathf.Lerp(0.7f, 1f, num13);
				float num15 = Mathf.Clamp01(num11 * num14 * num9 * 1.15f);
				float num16 = Mathf.Lerp(0.72f, 1f, num12);
				array[i * num + j] = new Color(num16, num16, num16, num15);
			}
		}
		val.SetPixels(array);
		val.Apply(true);
		return val;
	}

	public static Texture2D Bone(int seed)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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_0021: Expected O, but got Unknown
		//IL_0036: 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_0072: 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)
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: 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)
		int num = 64;
		int num2 = 128;
		Texture2D val = new Texture2D(num, num2, (TextureFormat)4, true)
		{
			wrapMode = (TextureWrapMode)0,
			filterMode = (FilterMode)2
		};
		Color[] array = (Color[])(object)new Color[num * num2];
		float num3 = (float)seed * 0.71f;
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.93f, 0.89f, 0.8f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0.72f, 0.64f, 0.52f);
		Color val4 = default(Color);
		((Color)(ref val4))..ctor(0.45f, 0.06f, 0.05f);
		for (int i = 0; i < num2; i++)
		{
			float num4 = (float)i / (float)num2;
			for (int j = 0; j < num; j++)
			{
				float num5 = (float)j / (float)num;
				float num6 = Mathf.PerlinNoise(num3 + num5 * 22f, num4 * 3f) * 0.7f + Mathf.PerlinNoise(num3 + num5 * 60f, num4 * 60f) * 0.3f;
				Color val5 = Color.Lerp(val2, val3, num6 * 0.8f);
				val5 = Color.Lerp(val5, val4, Smooth(0.72f, 0.92f, num4 + Mathf.PerlinNoise(num3 + num5 * 9f, 4f) * 0.1f) * 0.85f);
				val5.a = 1f;
				array[i * num + j] = val5;
			}
		}
		val.SetPixels(array);
		val.Apply(true);
		return val;
	}

	public static Texture2D BloodyBone(int seed)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: 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_0021: Expected O, but got Unknown
		//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_003d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: 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_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due t