Decompiled source of GreaterCores v0.1.1

Cores.dll

Decompiled 19 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using NiflCore;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NiflCore
{
	internal static class Words
	{
		private static readonly Dictionary<string, string> English = new Dictionary<string, string>();

		private static readonly HashSet<string> Missing = new HashSet<string>();

		private static ManualLogSource _log;

		private static bool _loaded;

		public static Func<bool> PadWording;

		public static Func<string, string> PadNames;

		public static void Load(ManualLogSource log)
		{
			if (_loaded)
			{
				return;
			}
			_loaded = true;
			_log = log;
			try
			{
				string text;
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("en.json"))
				{
					if (stream == null)
					{
						log.LogError((object)"lang/en.json is not in the dll; every line will show as its key");
						return;
					}
					using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8);
					text = streamReader.ReadToEnd();
				}
				Parse(text, English, log);
				LocalizationManager.Instance.GetLocalization().AddJsonFile("English", text);
				log.LogInfo((object)("words: " + English.Count + " lines of English loaded"));
			}
			catch (Exception ex)
			{
				log.LogError((object)("words: could not read lang/en.json, " + ex.Message));
			}
		}

		public static string T(string key)
		{
			if (PadWording != null && English.ContainsKey(key + "_pad") && PadWording())
			{
				if (PadNames == null)
				{
					return Read(key + "_pad");
				}
				return PadNames(Read(key + "_pad"));
			}
			return Read(key);
		}

		private static string Read(string key)
		{
			if (Localization.instance != null)
			{
				string text = Localization.instance.Localize("$" + key);
				if (!string.IsNullOrEmpty(text) && text != "[" + key + "]" && text != "$" + key)
				{
					return text;
				}
			}
			if (English.TryGetValue(key, out var value))
			{
				return value;
			}
			if (Missing.Add(key) && _log != null)
			{
				_log.LogWarning((object)("words: nothing under \"" + key + "\" in lang/en.json; the key is shown instead"));
			}
			return key;
		}

		public static string T(string key, params object[] fill)
		{
			try
			{
				return string.Format(T(key), fill);
			}
			catch (FormatException)
			{
				return T(key);
			}
		}

		private static void Parse(string json, Dictionary<string, string> into, ManualLogSource log)
		{
			int i = 0;
			string text = null;
			while (i < json.Length)
			{
				char c = json[i];
				if (c == '"')
				{
					string text2 = ReadString(json, ref i);
					if (text == null)
					{
						text = text2;
						continue;
					}
					into[text] = text2;
					text = null;
				}
				else if (text != null && c != ':' && !char.IsWhiteSpace(c))
				{
					log.LogWarning((object)("words: \"" + text + "\" in lang/en.json is not a string; skipped"));
					text = null;
					int num = 0;
					for (; i < json.Length; i++)
					{
						c = json[i];
						if (num == 0 && (c == ',' || c == '}'))
						{
							break;
						}
						switch (c)
						{
						case '[':
						case '{':
							num++;
							break;
						case ']':
						case '}':
							num--;
							break;
						}
					}
				}
				else
				{
					i++;
				}
			}
		}

		private static string ReadString(string json, ref int i)
		{
			StringBuilder stringBuilder = new StringBuilder();
			i++;
			while (i < json.Length && json[i] != '"')
			{
				char c = json[i];
				if (c == '\\' && i + 1 < json.Length)
				{
					c = json[++i];
					switch (c)
					{
					case 'n':
						c = '\n';
						break;
					case 't':
						c = '\t';
						break;
					case 'r':
						c = '\r';
						break;
					case 'b':
						c = '\b';
						break;
					case 'f':
						c = '\f';
						break;
					case 'u':
						if (i + 4 < json.Length)
						{
							c = (char)Convert.ToInt32(json.Substring(i + 1, 4), 16);
							i += 4;
						}
						break;
					}
				}
				stringBuilder.Append(c);
				i++;
			}
			i++;
			return stringBuilder.ToString();
		}
	}
	internal static class Looks
	{
		public static GameObject Part(Transform parent, string name, int layer, Mesh mesh, params Material[] looks)
		{
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(MeshFilter),
				typeof(MeshRenderer)
			})
			{
				layer = layer
			};
			val.transform.SetParent(parent, false);
			val.GetComponent<MeshFilter>().sharedMesh = mesh;
			((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterials = looks;
			return val;
		}

		public static Texture2D Picture(string name, int width, int height, Color[] pixels, bool mipmaps, TextureWrapMode wrap, FilterMode filter = (FilterMode)1)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_000c: 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)
			Texture2D val = new Texture2D(width, height, (TextureFormat)4, mipmaps);
			((Texture)val).filterMode = filter;
			val.SetPixels(pixels);
			val.Apply(mipmaps);
			if (name != null)
			{
				((Object)val).name = name;
			}
			((Texture)val).wrapMode = wrap;
			return val;
		}

		public static void StripTextures(Material m)
		{
			string[] array = new string[10] { "_MainTex", "_BaseMap", "_EmissionMap", "_EmissiveTex", "_GlowTex", "_BumpMap", "_MetallicGlossMap", "_OcclusionMap", "_DetailAlbedoMap", "_DetailNormalMap" };
			foreach (string text in array)
			{
				if (m.HasProperty(text))
				{
					m.SetTexture(text, (Texture)null);
				}
			}
			m.DisableKeyword("_NORMALMAP");
			m.DisableKeyword("_METALLICGLOSSMAP");
		}

		public static void ClearTextures(Material m, string keep = null)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			Shader shader = m.shader;
			for (int i = 0; i < shader.GetPropertyCount(); i++)
			{
				if ((int)shader.GetPropertyType(i) == 4)
				{
					string propertyName = shader.GetPropertyName(i);
					if (propertyName != keep)
					{
						m.SetTexture(propertyName, (Texture)null);
					}
				}
			}
		}

		public static void Fade(Material m, int queue)
		{
			if (m.HasProperty("_Mode"))
			{
				m.SetFloat("_Mode", 2f);
			}
			m.SetInt("_SrcBlend", 5);
			m.SetInt("_DstBlend", 10);
			m.SetInt("_ZWrite", 0);
			m.DisableKeyword("_ALPHATEST_ON");
			m.EnableKeyword("_ALPHABLEND_ON");
			m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
			m.SetOverrideTag("RenderType", "Transparent");
			m.renderQueue = queue;
		}

		public static Color Full(Color c)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			c *= 1f / Mathf.Max(0.001f, ((Color)(ref c)).maxColorComponent);
			c.a = 1f;
			return c;
		}

		public static Color32[] ReadSmall(Texture picture, int n)
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			RenderTexture temporary = RenderTexture.GetTemporary(n, n, 0, (RenderTextureFormat)0);
			RenderTexture active = RenderTexture.active;
			try
			{
				Graphics.Blit(picture, temporary);
				RenderTexture.active = temporary;
				Texture2D val = new Texture2D(n, n, (TextureFormat)4, false);
				val.ReadPixels(new Rect(0f, 0f, (float)n, (float)n), 0, 0);
				val.Apply(false);
				Color32[] pixels = val.GetPixels32();
				Object.Destroy((Object)val);
				return pixels;
			}
			finally
			{
				RenderTexture.active = active;
				RenderTexture.ReleaseTemporary(temporary);
			}
		}
	}
	internal static class Reflect
	{
		public static Type RequireType(string fullName)
		{
			Type type = AccessTools.TypeByName(fullName);
			if (type == null)
			{
				throw new InvalidOperationException("Type not found: " + fullName);
			}
			return type;
		}

		public static MethodInfo RequireMethod(Type type, string name, Type[] parameters)
		{
			MethodInfo methodInfo = AccessTools.Method(type, name, parameters, (Type[])null);
			if (methodInfo == null)
			{
				throw new InvalidOperationException("Method not found: " + type.FullName + "." + name);
			}
			return methodInfo;
		}

		public static FieldInfo RequireField(Type type, string name)
		{
			if (type == null)
			{
				throw new InvalidOperationException("Field " + name + " asked for on a type that is not there");
			}
			FieldInfo fieldInfo = AccessTools.Field(type, name);
			if (fieldInfo == null)
			{
				throw new InvalidOperationException("Field not found: " + type.FullName + "." + name);
			}
			return fieldInfo;
		}

		public static T Bind<T>(Type type, string name, Type[] parameters) where T : class
		{
			return (T)(object)Delegate.CreateDelegate(typeof(T), RequireMethod(type, name, parameters));
		}

		public static HarmonyMethod Hook(Type owner, string name)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			MethodInfo? method = owner.GetMethod(name, BindingFlags.Static | BindingFlags.NonPublic);
			if (method == null)
			{
				throw new InvalidOperationException("Hook not found: " + owner.FullName + "." + name);
			}
			return new HarmonyMethod(method);
		}
	}
}
namespace Niflheim.Cores
{
	internal static class CoreShape
	{
		internal sealed class Shed
		{
			public string Name;

			public Func<Color, Color> Colour;

			public float Rate;

			public float Life;

			public float SizeMin;

			public float SizeMax;

			public float Spread;

			public Vector3 VelMin;

			public Vector3 VelMax;

			public float Gravity;

			public bool Streak;
		}

		internal sealed class Skin
		{
			public string Name;

			public SkinPicture Picture;

			public Color Body = Color.black;

			public Color Light = Color.black;

			public float EitrGlow;

			public SkinWay Way;

			public float DriftAcross;

			public float DriftDown;

			public float Most;

			public float Size;

			public int Order;

			public float Wander;

			public bool Together;

			public float Round = 13f;

			public float Swing;

			public float Meander;

			public float Channel;

			public float Bend;
		}

		private static Material _fxMaterial;

		private const float VeinHalf = 0.012f;

		private const float VeinProud = 0.01f;

		private const float VeinWander = 0.04f;

		private const float VeinGlow = 2.2f;

		internal const float VeinIdle = 0f;

		private static Mesh[] _veinMeshes;

		private static float[] _veinLengths;

		private static Texture2D _veinPulse;

		internal const float SmokeGlow = 1.9f;

		internal const float LavaAcross = 0.004f;

		internal const float LavaDown = 0.05f;

		private static readonly Dictionary<SkinPicture, Texture2D> _pictures = new Dictionary<SkinPicture, Texture2D>();

		private static Vector2[] _plateAt;

		private const int PlateCells = 4;

		public const string CageName = "nif_core_cage";

		public const string CrystalName = "nif_core_crystal";

		private const string StoneSource = "SurtlingCore";

		private const int Seed = 7741;

		private const float WholeSize = 1.05f;

		private const float CoreSize = 0.8f;

		private const float CrystalGlow = 2f;

		private const float CrystalBody = 0.45f;

		private const float DarkGlowKeep = 0.15f;

		private const float PaleGlowCut = 0.45f;

		private const float TarGlow = 0.72f;

		private const float Twist = -60f;

		private const float Wide = 0.62f;

		private const float Half = 0.32f;

		private const float Swell = 0.06f;

		private const float CapAt = 0.86f;

		private const float CapWide = 0.25f;

		private const int Slices = 14;

		private const float BandWide = 0.227f;

		private const float Girth = 1.8f;

		private const float Gap = 0.2f;

		private const float Grain = 0.57f;

		private const float Shade = 0.32f;

		private static Mesh _crystal;

		private static Mesh _cage;

		private static Material _stone;

		private static bool _stoneTried;

		private static float Roll(Random rng)
		{
			return (float)rng.NextDouble() * 2f - 1f;
		}

		private static Vector3 Ring(float y, float radius, float turn, int corner)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			float num = (turn + (float)corner * 90f) * ((float)Math.PI / 180f);
			return new Vector3(Mathf.Cos(num) * radius, y, Mathf.Sin(num) * radius);
		}

		private static void Strips(List<Vector3[]> lefts, List<Vector3[]> rights, List<Vector3[]> cuts)
		{
			//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_0040: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: 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_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//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_028a: 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_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: 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_015f: 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_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < 4; i++)
			{
				int corner = i + 1;
				lefts.Add((Vector3[])(object)new Vector3[2]
				{
					Ring(0.86f, 0.25f, 0f, i),
					Ring(0.32f, 0.62f, 0f, i)
				});
				rights.Add((Vector3[])(object)new Vector3[2]
				{
					Ring(0.86f, 0.25f, 0f, corner),
					Ring(0.32f, 0.62f, 0f, corner)
				});
				Vector3[] array = (Vector3[])(object)new Vector3[15];
				Vector3[] array2 = (Vector3[])(object)new Vector3[15];
				for (int j = 0; j <= 14; j++)
				{
					float num = (float)j / 14f;
					float radius = 0.62f * (1f + 0.06f * Mathf.Sin(num * (float)Math.PI));
					array[j] = Ring(Mathf.Lerp(0.32f, -0.32f, num), radius, -60f * num, i);
					array2[j] = Ring(Mathf.Lerp(0.32f, -0.32f, num), radius, -60f * num, corner);
				}
				lefts.Add(array);
				rights.Add(array2);
				lefts.Add((Vector3[])(object)new Vector3[2]
				{
					Ring(-0.32f, 0.62f, -60f, i),
					Ring(-0.86f, 0.25f, -60f, i)
				});
				rights.Add((Vector3[])(object)new Vector3[2]
				{
					Ring(-0.32f, 0.62f, -60f, corner),
					Ring(-0.86f, 0.25f, -60f, corner)
				});
			}
			cuts.Add((Vector3[])(object)new Vector3[4]
			{
				Ring(0.86f, 0.25f, 0f, 0),
				Ring(0.86f, 0.25f, 0f, 1),
				Ring(0.86f, 0.25f, 0f, 2),
				Ring(0.86f, 0.25f, 0f, 3)
			});
			cuts.Add((Vector3[])(object)new Vector3[4]
			{
				Ring(-0.86f, 0.25f, -60f, 0),
				Ring(-0.86f, 0.25f, -60f, 1),
				Ring(-0.86f, 0.25f, -60f, 2),
				Ring(-0.86f, 0.25f, -60f, 3)
			});
		}

		private static void Reach(float end, int corner, out float from, out float to)
		{
			from = ((corner % 2 == 0) ? (end + 0.2f) : 0f);
			to = ((corner % 2 == 0) ? 1f : (1f - end - 0.2f));
		}

		private static float End(Vector3[] l, Vector3[] r)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			for (int i = 0; i + 1 < l.Length; i++)
			{
				float num2 = num;
				Vector3 val = l[i + 1] + r[i + 1] - (l[i] + r[i]);
				num = num2 + ((Vector3)(ref val)).magnitude * 0.5f;
			}
			return Mathf.Min(0.4f, 0.1135f / num);
		}

		private static Vector3 Along(Vector3[] line, float s)
		{
			//IL_001d: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			float num = Mathf.Clamp01(s) * (float)(line.Length - 1);
			int num2 = Mathf.Min((int)num, line.Length - 2);
			return Vector3.Lerp(line[num2], line[num2 + 1], num - (float)num2);
		}

		private static Mesh Solid()
		{
			//IL_016f: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3[]> list = new List<Vector3[]>();
			List<Vector3[]> list2 = new List<Vector3[]>();
			List<Vector3[]> list3 = new List<Vector3[]>();
			Strips(list, list2, list3);
			List<Vector3> verts = new List<Vector3>();
			List<Vector3> normals = new List<Vector3>();
			List<int> tris = new List<int>();
			for (int i = 0; i < list.Count; i++)
			{
				for (int j = 0; j + 1 < list[i].Length; j++)
				{
					int num = ((list[i].Length <= 2) ? 1 : 12);
					for (int k = 0; k < num; k++)
					{
						float num2 = (float)k / (float)num;
						float num3 = (float)(k + 1) / (float)num;
						Quad(verts, normals, tris, Vector3.Lerp(list[i][j], list2[i][j], num2), Vector3.Lerp(list[i][j], list2[i][j], num3), Vector3.Lerp(list[i][j + 1], list2[i][j + 1], num3), Vector3.Lerp(list[i][j + 1], list2[i][j + 1], num2), Vector3.zero);
					}
				}
			}
			foreach (Vector3[] item in list3)
			{
				Quad(verts, normals, tris, item[0], item[1], item[2], item[3], Vector3.zero);
			}
			return Build("nif_core_crystal", verts, normals, tris, null);
		}

		private static Mesh Casing()
		{
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0733: Unknown result type (might be due to invalid IL or missing references)
			//IL_073b: 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_077d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0782: Unknown result type (might be due to invalid IL or missing references)
			//IL_078f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: 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_01dd: 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_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: 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_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: 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_02f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_069f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_0468: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: 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_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_0498: 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_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: 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_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: 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_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0560: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: 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_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_057f: 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_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_059d: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c3: 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_05ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: 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_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0609: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_0647: Unknown result type (might be due to invalid IL or missing references)
			//IL_0649: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0650: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3[]> list = new List<Vector3[]>();
			List<Vector3[]> list2 = new List<Vector3[]>();
			List<Vector3[]> list3 = new List<Vector3[]>();
			Strips(list, list2, list3);
			List<Vector3> list4 = new List<Vector3>();
			List<Vector3> normals = new List<Vector3>();
			List<int> tris = new List<int>();
			List<Vector2> list5 = new List<Vector2>();
			Random rng = new Random(7750);
			float num = 0.1135f;
			Vector2 val3 = default(Vector2);
			for (int i = 0; i < list.Count; i++)
			{
				Vector3[] array = list[i];
				Vector3[] array2 = list2[i];
				int num2 = array.Length - 1;
				bool flag = num2 > 1;
				int num3 = i / 3;
				float num4 = End(array, array2);
				float[] array3 = new float[2];
				float[] array4 = new float[2] { 1f, 1f };
				if (flag)
				{
					Reach(num4, num3, out array3[0], out array4[0]);
					Reach(num4, (num3 + 1) % 4, out array3[1], out array4[1]);
				}
				List<float> list6 = new List<float>
				{
					0f,
					num4,
					1f - num4,
					1f
				};
				for (int j = 1; j < num2; j++)
				{
					list6.Add((float)j / (float)num2);
				}
				for (int k = 0; k < 2; k++)
				{
					list6.Add(array3[k]);
					list6.Add(array4[k]);
				}
				list6.Sort();
				for (int num5 = list6.Count - 1; num5 > 0; num5--)
				{
					if (list6[num5] - list6[num5 - 1] < 0.0005f)
					{
						list6.RemoveAt(num5);
					}
				}
				Vector3 val = (Along(array, 0.5f) + Along(array2, 0.5f)) * 0.5f;
				Vector3 val2 = Along(array2, 0.5f) - Along(array, 0.5f);
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				val2 = Along(array, 1f) + Along(array2, 1f) - Along(array, 0f) - Along(array2, 0f);
				Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
				((Vector2)(ref val3))..ctor(0.5f + Roll(rng) * 0.2f, 0.5f + Roll(rng) * 0.2f);
				int count = list4.Count;
				float[] array5 = new float[4];
				float[] array6 = new float[4];
				for (int l = 0; l + 1 < list6.Count; l++)
				{
					float num6 = list6[l];
					float num7 = list6[l + 1];
					Vector3 val4 = Along(array, num6);
					Vector3 val5 = Along(array2, num6);
					Vector3 val6 = Along(array, num7);
					Vector3 val7 = Along(array2, num7);
					if (num7 <= num4 + 0.001f || num6 >= 1f - num4 - 0.001f)
					{
						Quad(list4, normals, tris, val4, val5, val7, val6, Vector3.zero);
						continue;
					}
					for (int m = 0; m < 2; m++)
					{
						float s = ((m == 0) ? num6 : num7);
						Vector3 val8 = ((m == 0) ? val4 : val6);
						Vector3 val9 = ((m == 0) ? val5 : val7);
						float[] obj = ((m == 0) ? array5 : array6);
						float num8;
						if (!flag)
						{
							val2 = val9 - val8;
							num8 = num / ((Vector3)(ref val2)).magnitude;
						}
						else
						{
							num8 = HalfBand(array, array2, s, 0f, num * 1.8f);
						}
						float num9 = num8;
						float num10 = (flag ? HalfBand(array, array2, s, 1f, num * 1.8f) : num9);
						obj[0] = 0f;
						obj[1] = Mathf.Min(0.42f, num9);
						obj[2] = 1f - Mathf.Min(0.42f, num10);
						obj[3] = 1f;
					}
					float num11 = 0f;
					float num12 = 0f;
					for (int n = 0; n <= 2; n++)
					{
						bool flag2 = n < 2 && num6 >= array3[n] - 0.001f && num7 <= array4[n] + 0.001f;
						if (n < 2 && !flag2)
						{
							continue;
						}
						float num13 = ((n < 2) ? array5[n * 2] : 1f);
						float num14 = ((n < 2) ? array6[n * 2] : 1f);
						if (num13 - num11 > 0.002f || num14 - num12 > 0.002f)
						{
							Vector3 val10 = Vector3.Lerp(val4, val5, num11);
							Vector3 val11 = Vector3.Lerp(val4, val5, num13);
							Vector3 val12 = Vector3.Lerp(val6, val7, num12);
							Vector3 val13 = Vector3.Lerp(val6, val7, num14);
							Vector3 window = (val10 + val11 + val12 + val13) * 0.25f;
							if (Mathf.Abs(num6 - num4) < 0.001f)
							{
								Wall(list4, normals, tris, val10, val11, window);
							}
							if (Mathf.Abs(num7 - (1f - num4)) < 0.001f)
							{
								Wall(list4, normals, tris, val12, val13, window);
							}
						}
						if (n == 2)
						{
							break;
						}
						Vector3 val14 = Vector3.Lerp(val4, val5, array5[n * 2]);
						Vector3 val15 = Vector3.Lerp(val4, val5, array5[n * 2 + 1]);
						Vector3 val16 = Vector3.Lerp(val6, val7, array6[n * 2]);
						Vector3 val17 = Vector3.Lerp(val6, val7, array6[n * 2 + 1]);
						Vector3 val18 = (val14 + val15 + val16 + val17) * 0.25f;
						Quad(list4, normals, tris, val14, val15, val17, val16, Vector3.zero);
						if (n == 1)
						{
							Wall(list4, normals, tris, val14, val16, val14 + val16 - val18);
						}
						if (n == 0)
						{
							Wall(list4, normals, tris, val15, val17, val15 + val17 - val18);
						}
						if (Mathf.Abs(num6 - array3[n]) < 0.001f && array3[n] > num4 + 0.001f)
						{
							Wall(list4, normals, tris, val14, val15, val14 + val15 - val18);
						}
						if (Mathf.Abs(num7 - array4[n]) < 0.001f && array4[n] < 1f - num4 - 0.001f)
						{
							Wall(list4, normals, tris, val16, val17, val16 + val17 - val18);
						}
						num11 = array5[n * 2 + 1];
						num12 = array6[n * 2 + 1];
					}
				}
				for (int num15 = count; num15 < list4.Count; num15++)
				{
					Vector3 val19 = list4[num15] - val;
					list5.Add(val3 + new Vector2(Vector3.Dot(val19, normalized), Vector3.Dot(val19, normalized2)) * 0.57f);
				}
			}
			Vector2 val20 = default(Vector2);
			foreach (Vector3[] item in list3)
			{
				int count2 = list4.Count;
				Quad(list4, normals, tris, item[0], item[1], item[2], item[3], Vector3.zero);
				((Vector2)(ref val20))..ctor(0.5f + Roll(rng) * 0.2f, 0.5f + Roll(rng) * 0.2f);
				for (int num16 = count2; num16 < list4.Count; num16++)
				{
					list5.Add(val20 + new Vector2(list4[num16].x, list4[num16].z) * 0.57f);
				}
			}
			Mesh obj2 = Build("nif_core_cage", list4, normals, tris, list5);
			obj2.RecalculateTangents();
			return obj2;
		}

		private static float HalfBand(Vector3[] l, Vector3[] r, float s, float t, float half)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_004b: 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_005b: 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_006a: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Along(l, s);
			Vector3 val2 = Along(r, s) - val;
			Vector3 val3 = Vector3.Lerp(Along(l, s + 0.03f), Along(r, s + 0.03f), t) - Vector3.Lerp(Along(l, s - 0.03f), Along(r, s - 0.03f), t);
			Vector3 val4 = Vector3.Cross(((Vector3)(ref val3)).normalized, ((Vector3)(ref val2)).normalized);
			float num = Mathf.Max(0.35f, ((Vector3)(ref val4)).magnitude);
			return half / (((Vector3)(ref val2)).magnitude * num);
		}

		private static void Wall(List<Vector3> verts, List<Vector3> normals, List<int> tris, Vector3 a, Vector3 b, Vector3 window)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_001f: 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_0025: 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_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_003e: 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_0049: 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)
			float num = 0.78000003f;
			Vector3 val = a * num;
			Vector3 val2 = b * num;
			Vector3 val3 = (a + b + val + val2) * 0.25f;
			Quad(verts, normals, tris, a, b, val2, val, val3 * 2f - window);
		}

		private static Mesh Build(string name, List<Vector3> verts, List<Vector3> normals, List<int> tris, List<Vector2> uvs)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			Mesh val = new Mesh
			{
				name = name
			};
			val.SetVertices(verts);
			val.SetNormals(normals);
			val.SetUVs(0, uvs ?? new List<Vector2>((IEnumerable<Vector2>)(object)new Vector2[verts.Count]));
			val.SetTriangles(tris, 0);
			val.RecalculateBounds();
			return val;
		}

		private static void Quad(List<Vector3> verts, List<Vector3> normals, List<int> tris, Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 inside)
		{
			//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)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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)
			//IL_0074: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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)
			Vector3 val = Vector3.Cross(b - a, c - a);
			Vector3 val2 = ((Vector3)(ref val)).normalized;
			bool flag = Vector3.Dot(val2, (a + b + c + d) * 0.25f - inside) < 0f;
			if (flag)
			{
				val2 = -val2;
			}
			int count = verts.Count;
			verts.Add(a);
			verts.Add(b);
			verts.Add(c);
			verts.Add(d);
			for (int i = 0; i < 4; i++)
			{
				normals.Add(val2);
			}
			if (flag)
			{
				tris.Add(count);
				tris.Add(count + 2);
				tris.Add(count + 1);
				tris.Add(count);
				tris.Add(count + 3);
				tris.Add(count + 2);
			}
			else
			{
				tris.Add(count);
				tris.Add(count + 1);
				tris.Add(count + 2);
				tris.Add(count);
				tris.Add(count + 2);
				tris.Add(count + 3);
			}
		}

		public static void Effects(GameObject prefab, CoreKind kind)
		{
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: 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_0206: Expected O, but got Unknown
			//IL_0237: 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_025a: 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_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: 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_02b9: 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_0156: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			string prefab2 = kind.Prefab;
			Transform val = null;
			Transform val2 = null;
			Transform[] componentsInChildren = prefab.GetComponentsInChildren<Transform>(true);
			foreach (Transform val3 in componentsInChildren)
			{
				if (((Object)val3).name == "nif_core_crystal")
				{
					val = val3;
				}
				if (((Object)val3).name == "nif_core_cage")
				{
					val2 = val3;
				}
			}
			if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
			{
				return;
			}
			CoreDayGlow component = ((Component)val).GetComponent<CoreDayGlow>();
			if ((Object)(object)component != (Object)null)
			{
				component.Mood = kind.Mood;
				component.Lamp = prefab.GetComponentInChildren<Light>(true);
			}
			Skin[] skins = kind.Skins;
			foreach (Skin skin in skins)
			{
				Inside(val, skin);
			}
			Veins(val2, kind);
			if ((Object)(object)_fxMaterial == (Object)null)
			{
				Material val4 = null;
				ParticleSystemRenderer[] componentsInChildren2 = prefab.GetComponentsInChildren<ParticleSystemRenderer>(true);
				foreach (ParticleSystemRenderer val5 in componentsInChildren2)
				{
					if ((Object)(object)((Renderer)val5).sharedMaterial != (Object)null && ((Renderer)val5).sharedMaterial.HasProperty("_TintColor"))
					{
						val4 = ((Renderer)val5).sharedMaterial;
						break;
					}
				}
				if ((Object)(object)val4 == (Object)null)
				{
					CoresPlugin.Log.LogWarning((object)(prefab2 + ": no particle material to borrow; this core has no particle effects"));
					return;
				}
				_fxMaterial = new Material(val4);
				((Object)_fxMaterial).name = "nif_core_fx";
				_fxMaterial.SetTexture("_MainTex", (Texture)(object)Dot());
				_fxMaterial.SetColor("_TintColor", new Color(0.5f, 0.5f, 0.5f, 0.5f));
				if (_fxMaterial.HasProperty("_InvFade"))
				{
					_fxMaterial.SetFloat("_InvFade", 3f);
				}
				CoresPlugin.Log.LogInfo((object)("particle effects on shader " + ((Object)_fxMaterial.shader).name));
			}
			Transform parent = val2.parent;
			Vector3 lossyScale = parent.lossyScale;
			GameObject val6 = new GameObject("nif_core_fx");
			val6.AddComponent<CoreFx>();
			val6.layer = ((Component)val2).gameObject.layer;
			val6.transform.SetParent(parent, false);
			val6.transform.localPosition = val2.localPosition;
			val6.transform.localScale = new Vector3(1f / lossyScale.x, 1f / lossyScale.y, 1f / lossyScale.z);
			float r = val2.localScale.x * lossyScale.x * 0.6f;
			Color hue = Looks.Full(kind.Tint);
			Shed[] sheds = kind.Sheds;
			foreach (Shed shed in sheds)
			{
				Fx(val6, shed, hue, r);
			}
		}

		private static void Veins(Transform cage, CoreKind kind)
		{
			//IL_002f: 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_0081: 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)
			//IL_00ea: 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_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			MeshRenderer component = ((Component)cage).GetComponent<MeshRenderer>();
			if (!((Object)(object)component == (Object)null) && !((Object)(object)((Renderer)component).sharedMaterial == (Object)null))
			{
				float num = 2.2f * (1f - 0.45f * Pale(kind.Tint)) * (kind.Smothered ? 0.8f : 1f);
				if ((Object)(object)_veinPulse == (Object)null)
				{
					_veinPulse = Pulse();
				}
				if (_veinMeshes == null)
				{
					VeinMeshes();
				}
				Material val = new Material(((Renderer)component).sharedMaterial);
				Looks.StripTextures(val);
				((Object)val).name = "nif_core_vein";
				if (val.HasProperty("_Color"))
				{
					val.SetColor("_Color", new Color(0f, 0f, 0f, 1f));
				}
				val.SetTexture("_MainTex", (Texture)(object)_veinPulse);
				Looks.Fade(val, 3000);
				Color val2 = Looks.Full(kind.Tint) * num;
				val2.a = 1f;
				val.SetColor("_EmissionColor", val2);
				val.SetTexture("_EmissionMap", (Texture)(object)_veinPulse);
				val.EnableKeyword("_EMISSION");
				for (int i = 0; i < _veinMeshes.Length; i++)
				{
					GameObject obj = Looks.Part(cage.parent, "nif_core_vein_" + i, ((Component)cage).gameObject.layer, _veinMeshes[i], val);
					obj.transform.localPosition = cage.localPosition;
					obj.transform.localRotation = cage.localRotation;
					obj.transform.localScale = cage.localScale;
					MeshRenderer component2 = obj.GetComponent<MeshRenderer>();
					((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)component2).receiveShadows = false;
					obj.AddComponent<CoreVeins>().Length = _veinLengths[i];
				}
			}
		}

		private static Texture2D Pulse()
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			Color[] array = (Color[])(object)new Color[256];
			for (int i = 0; i < 128; i++)
			{
				float num = ((float)i + 0.5f) / 128f;
				float num2 = 0f + 1f * Mathf.Exp(0f - Mathf.Pow((num - 0.5f) / 0.12f, 2f));
				if (i == 0 || i == 127)
				{
					num2 = 0f;
				}
				array[i] = new Color(0f, 0f, 0f, 0f);
				array[128 + i] = new Color(num2, num2, num2, num2);
			}
			return Looks.Picture("nif_core_pulse", 128, 2, array, mipmaps: false, (TextureWrapMode)1, (FilterMode)1);
		}

		private static void VeinMeshes()
		{
			//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_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: 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_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//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_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: 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_0286: 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_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3[]> list = new List<Vector3[]>();
			List<Vector3[]> list2 = new List<Vector3[]>();
			List<Vector3[]> cuts = new List<Vector3[]>();
			Strips(list, list2, cuts);
			Random random = new Random(7762);
			Vector3 a = default(Vector3);
			((Vector3)(ref a))..ctor(0f, 0.86f, 0f);
			Vector3 b = default(Vector3);
			((Vector3)(ref b))..ctor(0f, -0.86f, 0f);
			_veinMeshes = (Mesh[])(object)new Mesh[4];
			_veinLengths = new float[4];
			for (int i = 0; i < 4; i++)
			{
				Vector3[] array = list[i * 3];
				Vector3[] array2 = list[i * 3 + 1];
				Vector3[] array3 = list[i * 3 + 2];
				Vector3[] r = list2[i * 3 + 1];
				Reach(End(array2, r), i, out var from, out var to);
				if (i % 2 == 0)
				{
					from += 0.03f;
				}
				else
				{
					to -= 0.03f;
				}
				List<List<Vector3>> list3 = new List<List<Vector3>>();
				List<Vector3> list4 = new List<Vector3>();
				bool flag = random.NextDouble() < 0.6;
				bool flag2 = random.NextDouble() < 0.6;
				bool flag3 = flag || random.NextDouble() < 0.7;
				bool flag4 = flag2 || random.NextDouble() < 0.7;
				if (flag)
				{
					list3.Add(Line(a, array[0], 4));
					list4.Add(Vector3.up);
				}
				if (flag3)
				{
					float num = (flag ? 0f : ((float)random.NextDouble() * 0.6f));
					list3.Add(Line(Vector3.Lerp(array[0], array[1], num), array[1], 6));
					list4.Add(Vector3.zero);
				}
				float num2 = (flag3 ? from : Mathf.Lerp(from, to, (float)random.NextDouble() * 0.4f));
				float num3 = (flag4 ? to : Mathf.Lerp(from, to, 0.6f + (float)random.NextDouble() * 0.4f));
				List<Vector3> list5 = new List<Vector3>();
				for (int j = 0; j <= 14; j++)
				{
					list5.Add(Along(array2, Mathf.Lerp(num2, num3, (float)j / 14f)));
				}
				list3.Add(list5);
				list4.Add(Vector3.zero);
				if (flag4)
				{
					float num4 = (flag2 ? 1f : (0.4f + (float)random.NextDouble() * 0.6f));
					list3.Add(Line(array3[0], Vector3.Lerp(array3[0], array3[1], num4), 6));
					list4.Add(Vector3.zero);
				}
				if (flag2)
				{
					list3.Add(Line(array3[1], b, 4));
					list4.Add(Vector3.down);
				}
				List<Vector3> verts = new List<Vector3>();
				List<Vector3> normals = new List<Vector3>();
				List<int> tris = new List<int>();
				List<Vector2> uvs = new List<Vector2>();
				float num5 = 0f;
				Vector3 last = list3[0][0];
				for (int k = 0; k < list3.Count; k++)
				{
					num5 = Vein(verts, normals, tris, uvs, list3[k], list4[k], random, num5, ref last);
				}
				_veinMeshes[i] = Build("nif_core_vein_" + i, verts, normals, tris, uvs);
				_veinLengths[i] = num5;
			}
		}

		private static List<Vector3> Line(Vector3 a, Vector3 b, int pieces)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			for (int i = 0; i <= pieces; i++)
			{
				list.Add(Vector3.Lerp(a, b, (float)i / (float)pieces));
			}
			return list;
		}

		private static float Vein(List<Vector3> verts, List<Vector3> normals, List<int> tris, List<Vector2> uvs, List<Vector3> path, Vector3 fixedOut, Random rng, float u, ref Vector3 last)
		{
			//IL_0050: 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_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_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: 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_0075: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: 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_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: 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_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_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: 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_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: 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_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: 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_0335: 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_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: 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_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: 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_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: 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_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: 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_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
			int count = path.Count;
			Vector3[] array = (Vector3[])(object)new Vector3[count];
			Vector3[] array2 = (Vector3[])(object)new Vector3[count];
			Vector3[] array3 = (Vector3[])(object)new Vector3[count];
			Vector3[] array4 = (Vector3[])(object)new Vector3[count];
			Vector3[] array5 = (Vector3[])(object)new Vector3[count];
			Vector3[] array6 = (Vector3[])(object)new Vector3[count];
			Vector3[] array7 = (Vector3[])(object)new Vector3[count];
			float[] array8 = new float[count];
			Vector3 val;
			for (int i = 0; i < count; i++)
			{
				int num = i;
				Vector3 val2;
				if (!(fixedOut != Vector3.zero))
				{
					val = new Vector3(path[i].x, 0f, path[i].z);
					val2 = ((Vector3)(ref val)).normalized;
				}
				else
				{
					val2 = fixedOut;
				}
				array2[num] = val2;
				val = path[Mathf.Min(i + 1, count - 1)] - path[Mathf.Max(i - 1, 0)];
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				int num2 = i;
				val = Vector3.Cross(array2[i], normalized);
				array3[num2] = ((Vector3)(ref val)).normalized;
				float num3 = ((i == 0 || i == count - 1) ? 0f : (Roll(rng) * 0.04f));
				array[i] = path[i] + array3[i] * num3;
			}
			float num4 = u;
			val = array[0] - last;
			u = num4 + ((Vector3)(ref val)).magnitude;
			for (int j = 0; j < count; j++)
			{
				if (j > 0)
				{
					float num5 = u;
					val = array[j] - array[j - 1];
					u = num5 + ((Vector3)(ref val)).magnitude;
				}
				array8[j] = u;
				float num6 = 0.012f * (0.65f + 0.6f * (float)rng.NextDouble());
				array4[j] = array[j] + array2[j] * 0.01f - array3[j] * num6;
				array5[j] = array[j] + array2[j] * 0.01f + array3[j] * num6;
				array6[j] = array4[j] - array2[j] * 0.07f;
				array7[j] = array5[j] - array2[j] * 0.07f;
			}
			last = array[count - 1];
			Vector2 item = default(Vector2);
			Vector2 item2 = default(Vector2);
			for (int k = 0; k + 1 < count; k++)
			{
				Vector3 inside = (array[k] + array[k + 1]) * 0.5f - array2[k] * 0.1f;
				((Vector2)(ref item))..ctor(array8[k], 0.5f);
				((Vector2)(ref item2))..ctor(array8[k + 1], 0.5f);
				Quad(verts, normals, tris, array4[k], array5[k], array5[k + 1], array4[k + 1], inside);
				uvs.Add(item);
				uvs.Add(item);
				uvs.Add(item2);
				uvs.Add(item2);
				Quad(verts, normals, tris, array4[k], array4[k + 1], array6[k + 1], array6[k], inside);
				uvs.Add(item);
				uvs.Add(item2);
				uvs.Add(item2);
				uvs.Add(item);
				Quad(verts, normals, tris, array5[k], array5[k + 1], array7[k + 1], array7[k], inside);
				uvs.Add(item);
				uvs.Add(item2);
				uvs.Add(item2);
				uvs.Add(item);
			}
			return u;
		}

		private unsafe static Color RefinedEitr()
		{
			//IL_003e: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//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_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: 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)
			Color result = default(Color);
			((Color)(ref result))..ctor(0.35f, 0.55f, 1f);
			GameObject prefab = PrefabManager.Instance.GetPrefab("Eitr");
			if ((Object)(object)prefab == (Object)null)
			{
				CoresPlugin.Log.LogWarning((object)"no Eitr item to take the colour of refined eitr from; using a blue");
				return result;
			}
			Light componentInChildren = prefab.GetComponentInChildren<Light>(true);
			if ((Object)(object)componentInChildren != (Object)null && Saturated(componentInChildren.color))
			{
				CoresPlugin.Log.LogInfo((object)("refined eitr colour from its light: " + ((object)componentInChildren.color/*cast due to .constrained prefix*/).ToString()));
				return Looks.Full(componentInChildren.color);
			}
			Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				Material[] sharedMaterials = val.sharedMaterials;
				foreach (Material val2 in sharedMaterials)
				{
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					string[] array = new string[3] { "_EmissionColor", "_TintColor", "_Color" };
					foreach (string text in array)
					{
						if (val2.HasProperty(text))
						{
							Color color = val2.GetColor(text);
							if (Saturated(color))
							{
								ManualLogSource log = CoresPlugin.Log;
								string[] obj = new string[6]
								{
									"refined eitr colour from ",
									((Object)val).name,
									" ",
									text,
									": ",
									null
								};
								Color val3 = color;
								obj[5] = ((object)(*(Color*)(&val3))/*cast due to .constrained prefix*/).ToString();
								log.LogInfo((object)string.Concat(obj));
								return Looks.Full(color);
							}
						}
					}
				}
			}
			CoresPlugin.Log.LogWarning((object)"the Eitr item has no colour to its light or glow; using a blue");
			return result;
		}

		private static bool Saturated(Color c)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			float maxColorComponent = ((Color)(ref c)).maxColorComponent;
			float num = Mathf.Min(c.r, Mathf.Min(c.g, c.b));
			if (maxColorComponent > 0.05f)
			{
				return (maxColorComponent - num) / maxColorComponent > 0.25f;
			}
			return false;
		}

		private static float Pale(Color c)
		{
			//IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references)
			return Mathf.Min(c.r, Mathf.Min(c.g, c.b)) / Mathf.Max(0.001f, ((Color)(ref c)).maxColorComponent);
		}

		private static void Fx(GameObject holder, Shed shed, Color hue, float r)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//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_00b0: 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_00d1: 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_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: 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_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_0189: 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_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_01db: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: 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_021c: 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)
			//IL_0232: 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_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0259: 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_026c: Unknown result type (might be due to invalid IL or missing references)
			string name = shed.Name;
			Color val = shed.Colour(hue);
			float rate = shed.Rate;
			float life = shed.Life;
			float sizeMin = shed.SizeMin;
			float sizeMax = shed.SizeMax;
			float radius = r * shed.Spread;
			Vector3 velMin = shed.VelMin;
			Vector3 velMax = shed.VelMax;
			float gravity = shed.Gravity;
			bool streak = shed.Streak;
			GameObject val2 = new GameObject("nif_core_fx_" + name);
			val2.layer = holder.layer;
			val2.transform.SetParent(holder.transform, false);
			ParticleSystem obj = val2.AddComponent<ParticleSystem>();
			MainModule main = obj.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(life);
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(sizeMin, sizeMax);
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val);
			((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(gravity);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1;
			((MainModule)(ref main)).maxParticles = Mathf.CeilToInt(rate * life) + 4;
			EmissionModule emission = obj.emission;
			((EmissionModule)(ref emission)).enabled = true;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate);
			ShapeModule shape = obj.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0;
			((ShapeModule)(ref shape)).radius = radius;
			VelocityOverLifetimeModule velocityOverLifetime = obj.velocityOverLifetime;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).enabled = true;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).space = (ParticleSystemSimulationSpace)1;
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).x = new MinMaxCurve(velMin.x, velMax.x);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).y = new MinMaxCurve(velMin.y, velMax.y);
			((VelocityOverLifetimeModule)(ref velocityOverLifetime)).z = new MinMaxCurve(velMin.z, velMax.z);
			ColorOverLifetimeModule colorOverLifetime = obj.colorOverLifetime;
			((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true;
			Gradient val3 = new Gradient();
			val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
			{
				new GradientColorKey(Color.white, 0f),
				new GradientColorKey(Color.white, 1f)
			}, (GradientAlphaKey[])(object)new GradientAlphaKey[4]
			{
				new GradientAlphaKey(0f, 0f),
				new GradientAlphaKey(1f, 0.15f),
				new GradientAlphaKey(1f, 0.7f),
				new GradientAlphaKey(0f, 1f)
			});
			((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val3);
			ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>();
			((Renderer)component).sharedMaterial = _fxMaterial;
			((Renderer)component).shadowCastingMode = (ShadowCastingMode)0;
			((Renderer)component).receiveShadows = false;
			if (streak)
			{
				component.renderMode = (ParticleSystemRenderMode)1;
				component.velocityScale = 0.12f;
				component.lengthScale = 1.6f;
			}
		}

		private static Texture2D Dot()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			Color[] array = (Color[])(object)new Color[1024];
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(16f, 16f)) / 16f;
					float num2 = Mathf.Clamp01(1f - num);
					array[i * 32 + j] = new Color(1f, 1f, 1f, num2 * num2);
				}
			}
			return Looks.Picture("nif_core_dot", 32, 32, array, mipmaps: false, (TextureWrapMode)1, (FilterMode)1);
		}

		public static Sprite Icon(CoreKind kind, float pixelsPerUnit)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: 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_0232: 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_0257: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: 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_0289: 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_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: 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_01e0: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: 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_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_crystal == (Object)null)
			{
				_crystal = Solid();
			}
			if ((Object)(object)_cage == (Object)null)
			{
				_cage = Casing();
			}
			Color[] array = (Color[])(object)new Color[65536];
			float[] array2 = new float[65536];
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i] = float.MaxValue;
			}
			Color hue = (Color)(((??)kind.IconHue) ?? Looks.Full(kind.Tint));
			bool smothered = kind.Smothered;
			float lit = (smothered ? 0.8f : 1f);
			Quaternion turn = Quaternion.Euler(-14f, 105f, 15f);
			Vector3 val = new Vector3(-0.45f, 0.75f, -0.5f);
			Vector3 sun = ((Vector3)(ref val)).normalized;
			float scale = 122.82828f;
			Draw(array, array2, 256, _crystal, turn, 0.8f, scale, delegate(Vector3 n)
			{
				//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_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				Color result = Color.Lerp(hue, Color.white, 0.08f + 0.3f * Mathf.Abs(n.z)) * lit;
				result.a = 1f;
				return result;
			});
			Color stone = new Color(0.3f, 0.25f, 0.19f);
			Draw(array, array2, 256, _cage, turn, 1f, scale, delegate(Vector3 n)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: 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_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				Color result = stone * (0.45f + 0.75f * Mathf.Max(0f, Vector3.Dot(n, sun))) + hue * 0.07f;
				result.a = 1f;
				return result;
			});
			Color[] array3 = (Color[])(object)new Color[4096];
			Color val2 = default(Color);
			for (int num = 0; num < 64; num++)
			{
				for (int num2 = 0; num2 < 64; num2++)
				{
					((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
					for (int num3 = 0; num3 < 4; num3++)
					{
						for (int num4 = 0; num4 < 4; num4++)
						{
							Color val3 = array[(num * 4 + num3) * 256 + num2 * 4 + num4];
							val2.r += val3.r * val3.a;
							val2.g += val3.g * val3.a;
							val2.b += val3.b * val3.a;
							val2.a += val3.a;
						}
					}
					float num5 = val2.a / 16f;
					Color val4 = (Color)((val2.a > 0f) ? new Color(val2.r / val2.a, val2.g / val2.a, val2.b / val2.a, 1f) : hue);
					float num6 = Vector2.Distance(new Vector2((float)num2 + 0.5f, (float)num + 0.5f), new Vector2(32f, 32f)) / 32f;
					float num7 = Mathf.Pow(Mathf.Clamp01(1f - num6), 2f) * (smothered ? 0.3f : 0.55f);
					Color val5 = hue;
					val5.a = num7;
					Color val6 = Color.Lerp(val5, val4, num5);
					val6.a = Mathf.Lerp(num7, 1f, num5);
					array3[num * 64 + num2] = val6;
				}
			}
			return Sprite.Create(Looks.Picture(null, 64, 64, array3, mipmaps: false, (TextureWrapMode)1, (FilterMode)1), new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), pixelsPerUnit, 0u, (SpriteMeshType)0);
		}

		private static void Draw(Color[] colour, float[] depth, int big, Mesh mesh, Quaternion turn, float size, float scale, Func<Vector3, Color> shade)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: 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_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: 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_0136: 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_0140: 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_0149: 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_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_016b: 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_0175: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: 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_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: 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_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] vertices = mesh.vertices;
			int[] triangles = mesh.triangles;
			Vector3[] array = (Vector3[])(object)new Vector3[vertices.Length];
			for (int i = 0; i < vertices.Length; i++)
			{
				Vector3 val = turn * (vertices[i] * size);
				array[i] = new Vector3((float)big * 0.5f + val.x * scale, (float)big * 0.5f + val.y * scale, val.z);
			}
			for (int j = 0; j < triangles.Length; j += 3)
			{
				Vector3 val2 = array[triangles[j]];
				Vector3 val3 = array[triangles[j + 1]];
				Vector3 val4 = array[triangles[j + 2]];
				float num = (val3.x - val2.x) * (val4.y - val2.y) - (val4.x - val2.x) * (val3.y - val2.y);
				if (Mathf.Abs(num) < 0.0001f)
				{
					continue;
				}
				Vector3 val5 = Vector3.Cross(turn * (vertices[triangles[j + 1]] - vertices[triangles[j]]), turn * (vertices[triangles[j + 2]] - vertices[triangles[j]]));
				Vector3 val6 = ((Vector3)(ref val5)).normalized;
				if (val6.z > 0f)
				{
					val6 = -val6;
				}
				Color val7 = shade(val6);
				int num2 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val2.x, Mathf.Min(val3.x, val4.x))));
				int num3 = Mathf.Min(big - 1, Mathf.CeilToInt(Mathf.Max(val2.x, Mathf.Max(val3.x, val4.x))));
				int num4 = Mathf.Max(0, Mathf.FloorToInt(Mathf.Min(val2.y, Mathf