Decompiled source of Wings of the Valkyrie v1.0.0

WingsoftheValkyrie.dll

Decompiled 5 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using WingsoftheValkyrie.VFX;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("WingsoftheValkyrie")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Valheim Wings of the Valkyrie Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WingsoftheValkyrie")]
[assembly: AssemblyTitle("WingsoftheValkyrie")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WingsoftheValkyrie
{
	[HarmonyPatch(typeof(Player))]
	public static class FlightController
	{
		private static bool isGliding;

		private static bool wantsToFlap;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		public static void UpdatePostfix(Player __instance)
		{
			//IL_0072: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || !ModConfig.EnableMod.Value)
			{
				return;
			}
			RuneWingVFX runeWingVFX = ((Component)__instance).GetComponent<RuneWingVFX>();
			if ((Object)(object)runeWingVFX == (Object)null)
			{
				runeWingVFX = ((Component)__instance).gameObject.AddComponent<RuneWingVFX>();
			}
			string equippedWingsName = WingsItem.GetEquippedWingsName(__instance);
			if (equippedWingsName != null)
			{
				switch (equippedWingsName)
				{
				case "WingsOf_Crude":
					runeWingVFX.SetTierColor(Color.green);
					break;
				case "WingsOf_Troll":
					runeWingVFX.SetTierColor(Color.cyan);
					break;
				case "WingsOf_Lox":
					runeWingVFX.SetTierColor(new Color(0.8f, 0.8f, 1f));
					break;
				case "WingsOf_Dragon":
					runeWingVFX.SetTierColor(new Color(0.8f, 0.1f, 1f));
					break;
				}
				if (!((Character)__instance).IsOnGround() && !((Character)__instance).IsSwimming() && !((Character)__instance).InWater())
				{
					if (ZInput.GetButtonDown("Jump"))
					{
						float num = 10f;
						switch (equippedWingsName)
						{
						case "WingsOf_Crude":
							num = ModConfig.CrudeFlapStaminaCost.Value;
							break;
						case "WingsOf_Troll":
							num = ModConfig.TrollFlapStaminaCost.Value;
							break;
						case "WingsOf_Lox":
							num = ModConfig.LoxFlapStaminaCost.Value;
							break;
						case "WingsOf_Dragon":
							num = ModConfig.DragonFlapStaminaCost.Value;
							break;
						}
						if (((Character)__instance).HaveStamina(num))
						{
							((Character)__instance).UseStamina(num);
							runeWingVFX.TriggerFlap();
							wantsToFlap = true;
						}
						else
						{
							((Character)__instance).Message((MessageType)2, "Not enough stamina to flap!", 0, (Sprite)null);
						}
					}
					if (!isGliding && (wantsToFlap || ((Character)__instance).GetVelocity().y < -5f))
					{
						isGliding = true;
					}
					if (isGliding)
					{
						Traverse.Create((object)__instance).Field("m_maxAirAltitude").SetValue((object)((Component)__instance).transform.position.y);
					}
				}
				else
				{
					isGliding = false;
				}
			}
			else
			{
				isGliding = false;
			}
			runeWingVFX.SetGlidingState(isGliding);
		}

		[HarmonyPatch("FixedUpdate")]
		[HarmonyPostfix]
		public static void FixedUpdatePostfix(Player __instance)
		{
			//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_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: 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_0358: 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_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || !ModConfig.EnableMod.Value || !isGliding || ((Character)__instance).IsOnGround() || ((Character)__instance).IsSwimming() || ((Character)__instance).InWater())
			{
				return;
			}
			Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>();
			if (!((Object)(object)component != (Object)null))
			{
				return;
			}
			float num = 15f;
			float num2 = 50f;
			float num3 = 12f;
			switch (WingsItem.GetEquippedWingsName(__instance))
			{
			case "WingsOf_Crude":
				num = ModConfig.CrudeGlideSpeed.Value;
				num2 = ModConfig.CrudeFlightCeiling.Value;
				num3 = ModConfig.CrudeFlapForce.Value;
				break;
			case "WingsOf_Troll":
				num = ModConfig.TrollGlideSpeed.Value;
				num2 = ModConfig.TrollFlightCeiling.Value;
				num3 = ModConfig.TrollFlapForce.Value;
				break;
			case "WingsOf_Lox":
				num = ModConfig.LoxGlideSpeed.Value;
				num2 = ModConfig.LoxFlightCeiling.Value;
				num3 = ModConfig.LoxFlapForce.Value;
				break;
			case "WingsOf_Dragon":
				num = ModConfig.DragonGlideSpeed.Value;
				num2 = ModConfig.DragonFlightCeiling.Value;
				num3 = ModConfig.DragonFlapForce.Value;
				break;
			}
			if (wantsToFlap)
			{
				component.velocity = new Vector3(component.velocity.x, num3, component.velocity.z);
				wantsToFlap = false;
			}
			else
			{
				Vector3 lookDir = ((Character)__instance).GetLookDir();
				float num4 = -2f;
				if (lookDir.y < 0f)
				{
					num4 = Mathf.Lerp(-2f, -20f, 0f - lookDir.y);
				}
				if (component.velocity.y < num4)
				{
					component.velocity = new Vector3(component.velocity.x, num4, component.velocity.z);
				}
			}
			Vector3 value = Traverse.Create((object)__instance).Field("m_moveDir").GetValue<Vector3>();
			if (((Vector3)(ref value)).magnitude > 0.1f)
			{
				Vector3 val = value * num;
				val.y = component.velocity.y;
				component.velocity = Vector3.Lerp(component.velocity, val, 3f * Time.fixedDeltaTime);
			}
			if ((Object)(object)ZoneSystem.instance != (Object)null)
			{
				float groundHeight = ZoneSystem.instance.GetGroundHeight(((Component)__instance).transform.position);
				float num5 = 50f;
				switch (WingsItem.GetEquippedWingsName(__instance))
				{
				case "WingsOf_Crude":
					num5 = ModConfig.CrudeFlightCeiling.Value;
					break;
				case "WingsOf_Troll":
					num5 = ModConfig.TrollFlightCeiling.Value;
					break;
				case "WingsOf_Lox":
					num5 = ModConfig.LoxFlightCeiling.Value;
					break;
				case "WingsOf_Dragon":
					num5 = ModConfig.DragonFlightCeiling.Value;
					break;
				}
				if (((Component)__instance).transform.position.y - groundHeight > num5 && component.velocity.y > 0f)
				{
					component.velocity = new Vector3(component.velocity.x, 0f, component.velocity.z);
				}
			}
		}
	}
	public static class ModConfig
	{
		public static ConfigEntry<bool> EnableMod { get; private set; }

		public static ConfigEntry<float> CrudeFlightCeiling { get; private set; }

		public static ConfigEntry<float> CrudeGlideSpeed { get; private set; }

		public static ConfigEntry<float> CrudeFlapForce { get; private set; }

		public static ConfigEntry<float> CrudeFlapStaminaCost { get; private set; }

		public static ConfigEntry<string> CrudeCraftingStation { get; private set; }

		public static ConfigEntry<int> CrudeMinStationLevel { get; private set; }

		public static ConfigEntry<string> CrudeCraftingRequirements { get; private set; }

		public static ConfigEntry<float> TrollFlightCeiling { get; private set; }

		public static ConfigEntry<float> TrollGlideSpeed { get; private set; }

		public static ConfigEntry<float> TrollFlapForce { get; private set; }

		public static ConfigEntry<float> TrollFlapStaminaCost { get; private set; }

		public static ConfigEntry<string> TrollCraftingStation { get; private set; }

		public static ConfigEntry<int> TrollMinStationLevel { get; private set; }

		public static ConfigEntry<string> TrollCraftingRequirements { get; private set; }

		public static ConfigEntry<float> LoxFlightCeiling { get; private set; }

		public static ConfigEntry<float> LoxGlideSpeed { get; private set; }

		public static ConfigEntry<float> LoxFlapForce { get; private set; }

		public static ConfigEntry<float> LoxFlapStaminaCost { get; private set; }

		public static ConfigEntry<string> LoxCraftingStation { get; private set; }

		public static ConfigEntry<int> LoxMinStationLevel { get; private set; }

		public static ConfigEntry<string> LoxCraftingRequirements { get; private set; }

		public static ConfigEntry<float> DragonFlightCeiling { get; private set; }

		public static ConfigEntry<float> DragonGlideSpeed { get; private set; }

		public static ConfigEntry<float> DragonFlapForce { get; private set; }

		public static ConfigEntry<float> DragonFlapStaminaCost { get; private set; }

		public static ConfigEntry<string> DragonCraftingStation { get; private set; }

		public static ConfigEntry<int> DragonMinStationLevel { get; private set; }

		public static ConfigEntry<string> DragonCraftingRequirements { get; private set; }

		public static void Init(ConfigFile config)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Expected O, but got Unknown
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Expected O, but got Unknown
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Expected O, but got Unknown
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Expected O, but got Unknown
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Expected O, but got Unknown
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Expected O, but got Unknown
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Expected O, but got Unknown
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Expected O, but got Unknown
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Expected O, but got Unknown
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Expected O, but got Unknown
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Expected O, but got Unknown
			//IL_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_049a: Expected O, but got Unknown
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Expected O, but got Unknown
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Expected O, but got Unknown
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Expected O, but got Unknown
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Expected O, but got Unknown
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Expected O, but got Unknown
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b8: Expected O, but got Unknown
			ConfigurationManagerAttributes val = new ConfigurationManagerAttributes
			{
				IsAdminOnly = true
			};
			AcceptableValueRange<float> val2 = new AcceptableValueRange<float>(10f, 5000f);
			AcceptableValueRange<float> val3 = new AcceptableValueRange<float>(1f, 100f);
			AcceptableValueRange<float> val4 = new AcceptableValueRange<float>(1f, 100f);
			AcceptableValueRange<float> val5 = new AcceptableValueRange<float>(0f, 100f);
			AcceptableValueRange<int> val6 = new AcceptableValueRange<int>(1, 10);
			EnableMod = config.Bind<bool>("1. General", "EnableMod", true, new ConfigDescription("Enable or disable the Valkyrie Wings mod.", (AcceptableValueBase)null, new object[1] { val }));
			CrudeFlightCeiling = config.Bind<float>("2. Crude Wings", "FlightCeiling", 120f, new ConfigDescription("Flight ceiling limit above ground.", (AcceptableValueBase)(object)val2, new object[1] { val }));
			CrudeGlideSpeed = config.Bind<float>("2. Crude Wings", "GlideSpeed", 10f, new ConfigDescription("Horizontal glide speed.", (AcceptableValueBase)(object)val3, new object[1] { val }));
			CrudeFlapForce = config.Bind<float>("2. Crude Wings", "FlapForce", 15f, new ConfigDescription("Upward lift force when flapping.", (AcceptableValueBase)(object)val4, new object[1] { val }));
			CrudeFlapStaminaCost = config.Bind<float>("2. Crude Wings", "FlapStaminaCost", 10f, new ConfigDescription("Stamina consumed per flap.", (AcceptableValueBase)(object)val5, new object[1] { val }));
			CrudeCraftingStation = config.Bind<string>("2. Crude Wings", "CraftingStation", "piece_workbench", new ConfigDescription("Prefab name of the crafting station.", (AcceptableValueBase)null, new object[1] { val }));
			CrudeMinStationLevel = config.Bind<int>("2. Crude Wings", "MinStationLevel", 1, new ConfigDescription("Minimum station level required.", (AcceptableValueBase)(object)val6, new object[1] { val }));
			CrudeCraftingRequirements = config.Bind<string>("2. Crude Wings", "CraftingRequirements", "Feathers:10,LeatherScraps:10", new ConfigDescription("Required items. Format: ItemName:Amount,ItemName:Amount", (AcceptableValueBase)null, new object[1] { val }));
			TrollFlightCeiling = config.Bind<float>("3. Troll Wings", "FlightCeiling", 135f, new ConfigDescription("Flight ceiling limit above ground.", (AcceptableValueBase)(object)val2, new object[1] { val }));
			TrollGlideSpeed = config.Bind<float>("3. Troll Wings", "GlideSpeed", 15f, new ConfigDescription("Horizontal glide speed.", (AcceptableValueBase)(object)val3, new object[1] { val }));
			TrollFlapForce = config.Bind<float>("3. Troll Wings", "FlapForce", 18f, new ConfigDescription("Upward lift force when flapping.", (AcceptableValueBase)(object)val4, new object[1] { val }));
			TrollFlapStaminaCost = config.Bind<float>("3. Troll Wings", "FlapStaminaCost", 8f, new ConfigDescription("Stamina consumed per flap.", (AcceptableValueBase)(object)val5, new object[1] { val }));
			TrollCraftingStation = config.Bind<string>("3. Troll Wings", "CraftingStation", "piece_workbench", new ConfigDescription("Prefab name of the crafting station.", (AcceptableValueBase)null, new object[1] { val }));
			TrollMinStationLevel = config.Bind<int>("3. Troll Wings", "MinStationLevel", 2, new ConfigDescription("Minimum station level required.", (AcceptableValueBase)(object)val6, new object[1] { val }));
			TrollCraftingRequirements = config.Bind<string>("3. Troll Wings", "CraftingRequirements", "TrollHide:5,Feathers:15", new ConfigDescription("Required items.", (AcceptableValueBase)null, new object[1] { val }));
			LoxFlightCeiling = config.Bind<float>("4. Lox Wings", "FlightCeiling", 160f, new ConfigDescription("Flight ceiling limit above ground.", (AcceptableValueBase)(object)val2, new object[1] { val }));
			LoxGlideSpeed = config.Bind<float>("4. Lox Wings", "GlideSpeed", 20f, new ConfigDescription("Horizontal glide speed.", (AcceptableValueBase)(object)val3, new object[1] { val }));
			LoxFlapForce = config.Bind<float>("4. Lox Wings", "FlapForce", 22f, new ConfigDescription("Upward lift force when flapping.", (AcceptableValueBase)(object)val4, new object[1] { val }));
			LoxFlapStaminaCost = config.Bind<float>("4. Lox Wings", "FlapStaminaCost", 6f, new ConfigDescription("Stamina consumed per flap.", (AcceptableValueBase)(object)val5, new object[1] { val }));
			LoxCraftingStation = config.Bind<string>("4. Lox Wings", "CraftingStation", "forge", new ConfigDescription("Prefab name of the crafting station.", (AcceptableValueBase)null, new object[1] { val }));
			LoxMinStationLevel = config.Bind<int>("4. Lox Wings", "MinStationLevel", 1, new ConfigDescription("Minimum station level required.", (AcceptableValueBase)(object)val6, new object[1] { val }));
			LoxCraftingRequirements = config.Bind<string>("4. Lox Wings", "CraftingRequirements", "LoxPelt:5,Silver:5", new ConfigDescription("Required items.", (AcceptableValueBase)null, new object[1] { val }));
			DragonFlightCeiling = config.Bind<float>("5. Dragon Wings", "FlightCeiling", 1100f, new ConfigDescription("Flight ceiling limit above ground.", (AcceptableValueBase)(object)val2, new object[1] { val }));
			DragonGlideSpeed = config.Bind<float>("5. Dragon Wings", "GlideSpeed", 30f, new ConfigDescription("Horizontal glide speed.", (AcceptableValueBase)(object)val3, new object[1] { val }));
			DragonFlapForce = config.Bind<float>("5. Dragon Wings", "FlapForce", 28f, new ConfigDescription("Upward lift force when flapping.", (AcceptableValueBase)(object)val4, new object[1] { val }));
			DragonFlapStaminaCost = config.Bind<float>("5. Dragon Wings", "FlapStaminaCost", 4f, new ConfigDescription("Stamina consumed per flap.", (AcceptableValueBase)(object)val5, new object[1] { val }));
			DragonCraftingStation = config.Bind<string>("5. Dragon Wings", "CraftingStation", "piece_magetable", new ConfigDescription("Prefab name of the crafting station.", (AcceptableValueBase)null, new object[1] { val }));
			DragonMinStationLevel = config.Bind<int>("5. Dragon Wings", "MinStationLevel", 1, new ConfigDescription("Minimum station level required.", (AcceptableValueBase)(object)val6, new object[1] { val }));
			DragonCraftingRequirements = config.Bind<string>("5. Dragon Wings", "CraftingRequirements", "Feathers:20,Eitr:5", new ConfigDescription("Required items.", (AcceptableValueBase)null, new object[1] { val }));
		}
	}
	public static class WingsItem
	{
		public static void Init()
		{
			PrefabManager.OnVanillaPrefabsAvailable += CreateCustomWings;
		}

		private static void CreateCustomWings()
		{
			//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_001c: 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_0039: 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_0065: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Expected O, but got Unknown
			//IL_0105: 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_0116: 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_0133: 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_015f: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			//IL_0182: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Expected O, but got Unknown
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			CustomItem val = new CustomItem("WingsOf_Crude", "CapeDeerHide", new ItemConfig
			{
				Name = "Wings of the Valkyrie (Crude)",
				Description = "Basic crafted wings. Low flight ceiling.",
				CraftingStation = ModConfig.CrudeCraftingStation.Value,
				MinStationLevel = ModConfig.CrudeMinStationLevel.Value,
				Requirements = ParseRequirements(ModConfig.CrudeCraftingRequirements.Value)
			});
			StripCapeVisuals(val.ItemPrefab);
			ItemManager.Instance.AddItem(val);
			CustomItem val2 = new CustomItem("WingsOf_Troll", "CapeTrollHide", new ItemConfig
			{
				Name = "Wings of the Valkyrie (Troll)",
				Description = "Improved glide and lift.",
				CraftingStation = ModConfig.TrollCraftingStation.Value,
				MinStationLevel = ModConfig.TrollMinStationLevel.Value,
				Requirements = ParseRequirements(ModConfig.TrollCraftingRequirements.Value)
			});
			StripCapeVisuals(val2.ItemPrefab);
			ItemManager.Instance.AddItem(val2);
			CustomItem val3 = new CustomItem("WingsOf_Lox", "CapeLox", new ItemConfig
			{
				Name = "Wings of the Valkyrie (Lox)",
				Description = "High glide speed, strong lift.",
				CraftingStation = ModConfig.LoxCraftingStation.Value,
				MinStationLevel = ModConfig.LoxMinStationLevel.Value,
				Requirements = ParseRequirements(ModConfig.LoxCraftingRequirements.Value)
			});
			StripCapeVisuals(val3.ItemPrefab);
			ItemManager.Instance.AddItem(val3);
			CustomItem val4 = new CustomItem("WingsOf_Dragon", "CapeFeather", new ItemConfig
			{
				Name = "Wings of the Valkyrie (Dragon)",
				Description = "Unlimited sky ceiling and excellent speed.",
				CraftingStation = ModConfig.DragonCraftingStation.Value,
				MinStationLevel = ModConfig.DragonMinStationLevel.Value,
				Requirements = ParseRequirements(ModConfig.DragonCraftingRequirements.Value)
			});
			StripCapeVisuals(val4.ItemPrefab);
			ItemManager.Instance.AddItem(val4);
			PrefabManager.OnVanillaPrefabsAvailable -= CreateCustomWings;
		}

		private static void StripCapeVisuals(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				return;
			}
			ItemDrop component = prefab.GetComponent<ItemDrop>();
			if ((Object)(object)component != (Object)null && component.m_itemData != null && component.m_itemData.m_shared != null)
			{
				component.m_itemData.m_shared.m_armorMaterial = null;
				component.m_itemData.m_shared.m_equipStatusEffect = null;
			}
			Component[] componentsInChildren = prefab.GetComponentsInChildren<Component>(true);
			Component[] array = componentsInChildren;
			foreach (Component val in array)
			{
				if ((Object)(object)val != (Object)null && ((object)val).GetType().Name == "Cloth")
				{
					Object.DestroyImmediate((Object)(object)val);
				}
			}
			SkinnedMeshRenderer[] componentsInChildren2 = prefab.GetComponentsInChildren<SkinnedMeshRenderer>(true);
			SkinnedMeshRenderer[] array2 = componentsInChildren2;
			foreach (SkinnedMeshRenderer val2 in array2)
			{
				Object.DestroyImmediate((Object)(object)val2);
			}
			MeshRenderer[] componentsInChildren3 = prefab.GetComponentsInChildren<MeshRenderer>(true);
			MeshRenderer[] array3 = componentsInChildren3;
			foreach (MeshRenderer val3 in array3)
			{
				Object.DestroyImmediate((Object)(object)val3);
			}
		}

		private static RequirementConfig[] ParseRequirements(string requirementsString)
		{
			if (string.IsNullOrWhiteSpace(requirementsString))
			{
				return (RequirementConfig[])(object)new RequirementConfig[0];
			}
			return (from r in ((IEnumerable<string>)requirementsString.Split(new char[1] { ',' })).Select((Func<string, RequirementConfig>)delegate(string req)
				{
					//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_003f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0048: Expected O, but got Unknown
					string[] array = req.Split(new char[1] { ':' });
					int result;
					return (array.Length == 2 && int.TryParse(array[1], out result)) ? new RequirementConfig
					{
						Item = array[0].Trim(),
						Amount = result
					} : ((RequirementConfig)null);
				})
				where r != null
				select r).ToArray();
		}

		public static string GetEquippedWingsName(Player player)
		{
			if ((Object)(object)player == (Object)null)
			{
				return null;
			}
			Inventory inventory = ((Humanoid)player).GetInventory();
			if (inventory == null)
			{
				return null;
			}
			List<ItemData> equippedItems = inventory.GetEquippedItems();
			if (equippedItems == null)
			{
				return null;
			}
			ItemData val = ((IEnumerable<ItemData>)equippedItems).FirstOrDefault((Func<ItemData, bool>)((ItemData i) => (int)i.m_shared.m_itemType == 17));
			if (val != null && (Object)(object)val.m_dropPrefab != (Object)null)
			{
				string name = ((Object)val.m_dropPrefab).name;
				switch (name)
				{
				default:
					if (!(name == "WingsOf_Dragon"))
					{
						break;
					}
					goto case "WingsOf_Crude";
				case "WingsOf_Crude":
				case "WingsOf_Troll":
				case "WingsOf_Lox":
					return name;
				}
			}
			return null;
		}

		public static bool IsWingsEquipped(Player player)
		{
			return GetEquippedWingsName(player) != null;
		}
	}
	[BepInPlugin("wubarrk.wingsofthevalkyrie", "Wings of the Valkyrie", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class WingsoftheValkyriePlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "wubarrk.wingsofthevalkyrie";

		public const string PluginName = "Wings of the Valkyrie";

		public const string PluginVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("wubarrk.wingsofthevalkyrie");

		private void Awake()
		{
			Logger.LogInfo((object)"Wings of the Valkyrie initializing...");
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			WingsItem.Init();
			harmony.PatchAll();
			Logger.LogInfo((object)"Wings of the Valkyrie has loaded!");
		}
	}
}
namespace WingsoftheValkyrie.VFX
{
	public class RuneWingVFX : MonoBehaviour
	{
		private Player _player;

		private ParticleSystem _leftWing;

		private ParticleSystem _rightWing;

		private Transform _leftRoot;

		private Transform _rightRoot;

		private bool _isGliding = false;

		private float _flapTimer = 0f;

		private void Awake()
		{
			_player = ((Component)this).GetComponent<Player>();
		}

		public void EnsureEmitters()
		{
			//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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0155: 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)
			if (!((Object)(object)_leftWing != (Object)null) || !((Object)(object)_rightWing != (Object)null))
			{
				Transform transform = ((Component)_player).transform;
				Texture2D runeTex = ValkyrieRuneTextureGenerator.GenerateSoftTrail(Color.white);
				Material orCreateRuneMaterial = ValkyrieRuneVFX_Helper.GetOrCreateRuneMaterial(runeTex, Color.white);
				Texture2D runeTex2 = ValkyrieRuneTextureGenerator.GenerateRuneAtlas(Color.white);
				Material orCreateRuneMaterial2 = ValkyrieRuneVFX_Helper.GetOrCreateRuneMaterial(runeTex2, Color.white);
				_leftRoot = new GameObject("RuneWing_Left").transform;
				((Component)_leftRoot).gameObject.layer = ((Component)_player).gameObject.layer;
				_leftRoot.SetParent(transform, false);
				_leftRoot.localPosition = new Vector3(-0.3f, 1.2f, -0.3f);
				_leftRoot.localRotation = Quaternion.Euler(0f, -20f, 0f);
				BuildWingStructure(((Component)_leftRoot).gameObject, orCreateRuneMaterial, isRight: false);
				_rightRoot = new GameObject("RuneWing_Right").transform;
				((Component)_rightRoot).gameObject.layer = ((Component)_player).gameObject.layer;
				_rightRoot.SetParent(transform, false);
				_rightRoot.localPosition = new Vector3(0.3f, 1.2f, -0.3f);
				_rightRoot.localRotation = Quaternion.Euler(0f, 20f, 0f);
				BuildWingStructure(((Component)_rightRoot).gameObject, orCreateRuneMaterial, isRight: true);
				_leftWing = CreateParticleSystem(((Component)_leftRoot).gameObject, orCreateRuneMaterial2);
				_rightWing = CreateParticleSystem(((Component)_rightRoot).gameObject, orCreateRuneMaterial2);
			}
		}

		private void BuildWingStructure(GameObject root, Material mat, bool isRight)
		{
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: 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_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: 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_0257: 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_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Expected O, but got Unknown
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: 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_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_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: 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_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: 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_031c: 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_0339: 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_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0388: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0428: Unknown result type (might be due to invalid IL or missing references)
			//IL_042d: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: 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_0481: 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_0490: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: 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_04c5: 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_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: 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_0509: Unknown result type (might be due to invalid IL or missing references)
			//IL_0513: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0535: 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_054d: 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_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_056f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Expected O, but got Unknown
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_0680: Unknown result type (might be due to invalid IL or missing references)
			float num = (isRight ? 1f : (-1f));
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0f, 0f, 0f);
			Vector3 p = default(Vector3);
			((Vector3)(ref p))..ctor(0.8f * num, 0.2f, 0.4f);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(2.2f * num, 0.5f, 0.2f);
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(2.4f * num, 0.7f, 0.3f);
			Vector3 val4 = default(Vector3);
			((Vector3)(ref val4))..ctor(2.5f * num, 0.9f, 0.4f);
			Vector3 p2 = default(Vector3);
			((Vector3)(ref p2))..ctor(3.8f * num, 0.4f, -0.2f);
			Vector3 val5 = default(Vector3);
			((Vector3)(ref val5))..ctor(5f * num, 0.2f, -1f);
			Vector3 p3 = default(Vector3);
			((Vector3)(ref p3))..ctor(3.5f * num, 0.1f, -0.6f);
			Vector3 val6 = default(Vector3);
			((Vector3)(ref val6))..ctor(4.6f * num, -0.2f, -1.6f);
			Vector3 p4 = default(Vector3);
			((Vector3)(ref p4))..ctor(3f * num, -0.2f, -1f);
			Vector3 val7 = default(Vector3);
			((Vector3)(ref val7))..ctor(3.8f * num, -0.5f, -2.2f);
			Vector3 p5 = default(Vector3);
			((Vector3)(ref p5))..ctor(2.3f * num, -0.4f, -1.2f);
			Vector3 val8 = default(Vector3);
			((Vector3)(ref val8))..ctor(2.6f * num, -0.7f, -2.6f);
			Vector3 val9 = default(Vector3);
			((Vector3)(ref val9))..ctor(0.2f * num, -0.5f, -0.5f);
			Vector3[] bezierCurve = GetBezierCurve(val, p, val2, 10);
			Vector3[] bezierCurve2 = GetBezierCurve(val2, p2, val5, 10);
			Vector3[] bezierCurve3 = GetBezierCurve(val2, p3, val6, 10);
			Vector3[] bezierCurve4 = GetBezierCurve(val2, p4, val7, 10);
			Vector3[] bezierCurve5 = GetBezierCurve(val2, p5, val8, 10);
			AddBoneLine(root, mat, bezierCurve, 0.25f, 0.15f);
			AddBoneLine(root, mat, (Vector3[])(object)new Vector3[3] { val2, val3, val4 }, 0.08f, 0.01f);
			AddBoneLine(root, mat, bezierCurve2, 0.12f, 0.01f);
			AddBoneLine(root, mat, bezierCurve3, 0.12f, 0.01f);
			AddBoneLine(root, mat, bezierCurve4, 0.12f, 0.01f);
			AddBoneLine(root, mat, bezierCurve5, 0.12f, 0.01f);
			AddBoneLine(root, mat, (Vector3[])(object)new Vector3[2] { val, val9 }, 0.1f, 0.05f);
			Mesh val10 = new Mesh();
			val10.vertices = (Vector3[])(object)new Vector3[23]
			{
				val,
				bezierCurve[5],
				val2,
				bezierCurve2[2],
				bezierCurve2[6],
				val5,
				bezierCurve3[2],
				bezierCurve3[6],
				val6,
				bezierCurve4[2],
				bezierCurve4[6],
				val7,
				bezierCurve5[2],
				bezierCurve5[6],
				val8,
				val9,
				default(Vector3),
				default(Vector3),
				default(Vector3),
				default(Vector3),
				default(Vector3),
				default(Vector3),
				default(Vector3)
			};
			val10.uv = (Vector2[])(object)new Vector2[23]
			{
				new Vector2(0f, 1f) * 3f,
				new Vector2(0.2f, 0.8f) * 3f,
				new Vector2(0.3f, 1f) * 3f,
				new Vector2(0.5f, 0.9f) * 3f,
				new Vector2(0.7f, 0.8f) * 3f,
				new Vector2(1f, 0.8f) * 3f,
				new Vector2(0.5f, 0.6f) * 3f,
				new Vector2(0.7f, 0.5f) * 3f,
				new Vector2(1f, 0.5f) * 3f,
				new Vector2(0.4f, 0.4f) * 3f,
				new Vector2(0.6f, 0.3f) * 3f,
				new Vector2(0.9f, 0.2f) * 3f,
				new Vector2(0.3f, 0.2f) * 3f,
				new Vector2(0.4f, 0.1f) * 3f,
				new Vector2(0.6f, 0f) * 3f,
				new Vector2(0f, 0f) * 3f,
				default(Vector2),
				default(Vector2),
				default(Vector2),
				default(Vector2),
				default(Vector2),
				default(Vector2),
				default(Vector2)
			};
			int[] array = new int[63]
			{
				0, 1, 2, 2, 6, 3, 3, 6, 7, 3,
				7, 4, 4, 7, 8, 4, 8, 5, 2, 9,
				6, 6, 9, 10, 6, 10, 7, 7, 10, 11,
				7, 11, 8, 2, 12, 9, 9, 12, 13, 9,
				13, 10, 10, 13, 14, 10, 14, 11, 2, 1,
				12, 1, 0, 12, 0, 15, 12, 15, 13, 12,
				15, 14, 13
			};
			int[] array2 = new int[array.Length * 2];
			for (int i = 0; i < array.Length; i += 3)
			{
				array2[i] = array[i];
				array2[i + 1] = array[i + 1];
				array2[i + 2] = array[i + 2];
				array2[array.Length + i] = array[i];
				array2[array.Length + i + 1] = array[i + 2];
				array2[array.Length + i + 2] = array[i + 1];
			}
			val10.triangles = array2;
			val10.RecalculateNormals();
			GameObject val11 = new GameObject("Membrane");
			val11.transform.SetParent(root.transform, false);
			MeshFilter val12 = val11.AddComponent<MeshFilter>();
			val12.mesh = val10;
			MeshRenderer val13 = val11.AddComponent<MeshRenderer>();
			Texture2D runeTex = ValkyrieRuneTextureGenerator.GenerateRuneAtlas(Color.white);
			Material orCreateRuneMaterial = ValkyrieRuneVFX_Helper.GetOrCreateRuneMaterial(runeTex, Color.white);
			((Renderer)val13).material = orCreateRuneMaterial;
			((Renderer)val13).enabled = false;
		}

		private Vector3[] GetBezierCurve(Vector3 p0, Vector3 p1, Vector3 p2, int segments)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[segments + 1];
			for (int i = 0; i <= segments; i++)
			{
				float num = (float)i / (float)segments;
				float num2 = 1f - num;
				array[i] = num2 * num2 * p0 + 2f * num2 * num * p1 + num * num * p2;
			}
			return array;
		}

		private void AddBoneLine(GameObject root, Material mat, Vector3[] points, float startWidth, float endWidth)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GameObject val = new GameObject("BoneLine");
			val.transform.SetParent(root.transform, false);
			LineRenderer val2 = val.AddComponent<LineRenderer>();
			val2.useWorldSpace = false;
			val2.positionCount = points.Length;
			val2.SetPositions(points);
			val2.startWidth = startWidth;
			val2.endWidth = endWidth;
			((Renderer)val2).material = mat;
			((Renderer)val2).enabled = false;
		}

		private ParticleSystem CreateParticleSystem(GameObject go, Material mat)
		{
			//IL_0009: 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_0028: 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_0056: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem val = go.AddComponent<ParticleSystem>();
			MainModule main = val.main;
			((MainModule)(ref main)).loop = true;
			((MainModule)(ref main)).playOnAwake = true;
			((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(2f);
			((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.5f, 1.2f);
			((MainModule)(ref main)).startSize = new MinMaxCurve(0.08f, 0.18f);
			((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1;
			((MainModule)(ref main)).scalingMode = (ParticleSystemScalingMode)1;
			EmissionModule emission = val.emission;
			((EmissionModule)(ref emission)).enabled = true;
			((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(80f);
			ShapeModule shape = val.shape;
			((ShapeModule)(ref shape)).enabled = true;
			((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)12;
			((ShapeModule)(ref shape)).radius = 3f;
			TextureSheetAnimationModule textureSheetAnimation = val.textureSheetAnimation;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).enabled = true;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesX = 4;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).numTilesY = 4;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).animation = (ParticleSystemAnimationType)0;
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).startFrame = new MinMaxCurve(0f, 15f);
			((TextureSheetAnimationModule)(ref textureSheetAnimation)).timeMode = (ParticleSystemAnimationTimeMode)0;
			ParticleSystemRenderer component = go.GetComponent<ParticleSystemRenderer>();
			component.renderMode = (ParticleSystemRenderMode)0;
			if ((Object)(object)mat != (Object)null)
			{
				((Renderer)component).material = mat;
			}
			val.Stop(true, (ParticleSystemStopBehavior)0);
			return val;
		}

		public void SetTierColor(Color c)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: 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_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: 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_01df: 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_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_leftWing == (Object)null || (Object)(object)_rightWing == (Object)null)
			{
				EnsureEmitters();
			}
			MainModule main = _leftWing.main;
			((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(c);
			MainModule main2 = _rightWing.main;
			((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(c);
			LineRenderer[] componentsInChildren = ((Component)_leftRoot).GetComponentsInChildren<LineRenderer>();
			foreach (LineRenderer val in componentsInChildren)
			{
				val.startColor = c;
				val.endColor = new Color(c.r, c.g, c.b, 0.2f);
			}
			LineRenderer[] componentsInChildren2 = ((Component)_rightRoot).GetComponentsInChildren<LineRenderer>();
			foreach (LineRenderer val2 in componentsInChildren2)
			{
				val2.startColor = c;
				val2.endColor = new Color(c.r, c.g, c.b, 0.2f);
			}
			MeshRenderer[] componentsInChildren3 = ((Component)_leftRoot).GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val3 in componentsInChildren3)
			{
				if (((Renderer)val3).material.HasProperty("_Color"))
				{
					((Renderer)val3).material.SetColor("_Color", new Color(c.r, c.g, c.b, 0.15f));
				}
				if (((Renderer)val3).material.HasProperty("_TintColor"))
				{
					((Renderer)val3).material.SetColor("_TintColor", new Color(c.r, c.g, c.b, 0.15f));
				}
				if (((Renderer)val3).material.HasProperty("_EmissionColor"))
				{
					((Renderer)val3).material.SetColor("_EmissionColor", new Color(c.r, c.g, c.b, 0.05f));
				}
			}
			MeshRenderer[] componentsInChildren4 = ((Component)_rightRoot).GetComponentsInChildren<MeshRenderer>();
			foreach (MeshRenderer val4 in componentsInChildren4)
			{
				if (((Renderer)val4).material.HasProperty("_Color"))
				{
					((Renderer)val4).material.SetColor("_Color", new Color(c.r, c.g, c.b, 0.15f));
				}
				if (((Renderer)val4).material.HasProperty("_TintColor"))
				{
					((Renderer)val4).material.SetColor("_TintColor", new Color(c.r, c.g, c.b, 0.15f));
				}
				if (((Renderer)val4).material.HasProperty("_EmissionColor"))
				{
					((Renderer)val4).material.SetColor("_EmissionColor", new Color(c.r, c.g, c.b, 0.05f));
				}
			}
		}

		public void SetGlidingState(bool gliding)
		{
			if (_isGliding == gliding)
			{
				return;
			}
			_isGliding = gliding;
			if ((Object)(object)_leftWing == (Object)null || (Object)(object)_rightWing == (Object)null)
			{
				EnsureEmitters();
			}
			if (_isGliding)
			{
				if (!_leftWing.isPlaying)
				{
					_leftWing.Play();
				}
				if (!_rightWing.isPlaying)
				{
					_rightWing.Play();
				}
				LineRenderer[] componentsInChildren = ((Component)_leftRoot).GetComponentsInChildren<LineRenderer>();
				foreach (LineRenderer val in componentsInChildren)
				{
					((Renderer)val).enabled = true;
				}
				LineRenderer[] componentsInChildren2 = ((Component)_rightRoot).GetComponentsInChildren<LineRenderer>();
				foreach (LineRenderer val2 in componentsInChildren2)
				{
					((Renderer)val2).enabled = true;
				}
				MeshRenderer[] componentsInChildren3 = ((Component)_leftRoot).GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val3 in componentsInChildren3)
				{
					((Renderer)val3).enabled = true;
				}
				MeshRenderer[] componentsInChildren4 = ((Component)_rightRoot).GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val4 in componentsInChildren4)
				{
					((Renderer)val4).enabled = true;
				}
			}
			else
			{
				_leftWing.Stop(true, (ParticleSystemStopBehavior)1);
				_rightWing.Stop(true, (ParticleSystemStopBehavior)1);
				LineRenderer[] componentsInChildren5 = ((Component)_leftRoot).GetComponentsInChildren<LineRenderer>();
				foreach (LineRenderer val5 in componentsInChildren5)
				{
					((Renderer)val5).enabled = false;
				}
				LineRenderer[] componentsInChildren6 = ((Component)_rightRoot).GetComponentsInChildren<LineRenderer>();
				foreach (LineRenderer val6 in componentsInChildren6)
				{
					((Renderer)val6).enabled = false;
				}
				MeshRenderer[] componentsInChildren7 = ((Component)_leftRoot).GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val7 in componentsInChildren7)
				{
					((Renderer)val7).enabled = false;
				}
				MeshRenderer[] componentsInChildren8 = ((Component)_rightRoot).GetComponentsInChildren<MeshRenderer>();
				foreach (MeshRenderer val8 in componentsInChildren8)
				{
					((Renderer)val8).enabled = false;
				}
			}
		}

		public void TriggerFlap()
		{
			if ((Object)(object)_leftWing == (Object)null || (Object)(object)_rightWing == (Object)null)
			{
				EnsureEmitters();
			}
			_flapTimer = 0.4f;
			if (!_isGliding)
			{
				_leftWing.Emit(15);
				_rightWing.Emit(15);
			}
		}

		private void Update()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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_010f: 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_0088: 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)
			if (!((Object)(object)_leftRoot == (Object)null) && !((Object)(object)_rightRoot == (Object)null))
			{
				if (_flapTimer > 0f)
				{
					_flapTimer -= Time.deltaTime;
					float num = 1f - _flapTimer / 0.4f;
					float num2 = Mathf.Sin(num * (float)Math.PI * 2f) * 45f;
					_leftRoot.localRotation = Quaternion.Euler(0f, -20f, num2);
					_rightRoot.localRotation = Quaternion.Euler(0f, 20f, 0f - num2);
				}
				else
				{
					_leftRoot.localRotation = Quaternion.Lerp(_leftRoot.localRotation, Quaternion.Euler(0f, -20f, 0f), Time.deltaTime * 5f);
					_rightRoot.localRotation = Quaternion.Lerp(_rightRoot.localRotation, Quaternion.Euler(0f, 20f, 0f), Time.deltaTime * 5f);
				}
			}
		}
	}
	public static class ValkyrieRuneTextureGenerator
	{
		private const int Size = 128;

		public unsafe static Texture2D GenerateRune(Color color)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(((object)(*(Color*)(&color))/*cast due to .constrained prefix*/).GetHashCode());
			int runeIndex = num % 16;
			return GenerateRune(color, runeIndex);
		}

		public static Texture2D GenerateRuneAtlas(Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_0055: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			int num = 512;
			int num2 = 128;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, true);
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color[] array = (Color[])(object)new Color[num * num];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = val2;
			}
			val.SetPixels(array);
			for (int j = 0; j < 16; j++)
			{
				int num3 = j % 4;
				int num4 = 3 - j / 4;
				DrawRuneOntoAtlas(val, color, j, num3 * num2, num4 * num2, num2);
			}
			val.Apply(true);
			return val;
		}

		public static Texture2D GenerateSoftTrail(Color color)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(64f, 64f);
			float num = 64f;
			Vector2 val3 = default(Vector2);
			Color val4 = default(Color);
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					((Vector2)(ref val3))..ctor((float)j + 0.5f, (float)i + 0.5f);
					float num2 = Vector2.Distance(val3, val2) / num;
					float num3 = Mathf.Clamp01(1f - num2);
					num3 = Mathf.SmoothStep(0f, 1f, num3);
					num3 = Mathf.Pow(num3, 1.6f);
					((Color)(ref val4))..ctor(color.r, color.g, color.b, color.a * num3);
					val.SetPixel(j, i, val4);
				}
			}
			val.Apply(true);
			return val;
		}

		public static Texture2D GenerateStreak(Color color)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00bb: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false);
			((Texture)val).filterMode = (FilterMode)1;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(64f, 64f);
			float num = 64f;
			Color val3 = default(Color);
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					float num2 = Mathf.Abs((float)i + 0.5f - val2.y) / num;
					float num3 = Mathf.Abs((float)j + 0.5f - val2.x) / (num * 0.6f);
					float num4 = Mathf.Clamp01(1f - num3);
					float num5 = Mathf.SmoothStep(1f, 0f, num2);
					num4 *= Mathf.Pow(num5, 0.9f);
					((Color)(ref val3))..ctor(color.r, color.g, color.b, color.a * num4);
					val.SetPixel(j, i, val3);
				}
			}
			val.Apply(true);
			return val;
		}

		public static Texture2D GenerateBlend(Color color)
		{
			//IL_0001: 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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_003b: 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_0046: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = GenerateSoftTrail(color);
			Texture2D val2 = GenerateRune(color);
			Texture2D val3 = new Texture2D(128, 128, (TextureFormat)4, false);
			((Texture)val3).filterMode = (FilterMode)1;
			Color val4 = default(Color);
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					Color pixel = val.GetPixel(j, i);
					Color pixel2 = val2.GetPixel(j, i);
					float num = Mathf.Clamp01(pixel.a + pixel2.a * 0.65f);
					((Color)(ref val4))..ctor(color.r, color.g, color.b, color.a * num);
					val3.SetPixel(j, i, val4);
				}
			}
			val3.Apply(true);
			return val3;
		}

		private static void DrawRuneOntoAtlas(Texture2D tex, Color color, int runeIndex, int offsetX, int offsetY, int size)
		{
			//IL_001c: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_01a2: 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_01c6: 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_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: 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_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: 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_0354: 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_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: 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_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0589: 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_05ad: 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_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_0619: Unknown result type (might be due to invalid IL or missing references)
			//IL_062b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0642: Unknown result type (might be due to invalid IL or missing references)
			//IL_0654: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0731: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_0779: Unknown result type (might be due to invalid IL or missing references)
			//IL_0790: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_080e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0825: Unknown result type (might be due to invalid IL or missing references)
			//IL_0837: Unknown result type (might be due to invalid IL or missing references)
			//IL_0849: Unknown result type (might be due to invalid IL or missing references)
			//IL_085b: Unknown result type (might be due to invalid IL or missing references)
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_087f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
			Color c = default(Color);
			((Color)(ref c))..ctor(color.r * 0.6f, color.g * 0.6f, color.b * 0.6f, 0.6f);
			Color c2 = default(Color);
			((Color)(ref c2))..ctor(color.r, color.g, color.b, 1f);
			float scale = (float)size / 128f;
			switch (runeIndex)
			{
			case 0:
				DrawLineLocal(20, 20, 108, 108, c, 6);
				DrawLineLocal(108, 20, 20, 108, c, 6);
				DrawLineLocal(20, 20, 108, 108, c2, 3);
				DrawLineLocal(108, 20, 20, 108, c2, 3);
				break;
			case 1:
				DrawLineLocal(64, 16, 64, 112, c, 6);
				DrawLineLocal(64, 64, 32, 96, c, 5);
				DrawLineLocal(64, 64, 96, 96, c, 5);
				DrawLineLocal(64, 16, 64, 112, c2, 3);
				DrawLineLocal(64, 64, 32, 96, c2, 2);
				DrawLineLocal(64, 64, 96, 96, c2, 2);
				break;
			case 2:
				DrawLineLocal(40, 20, 40, 108, c, 6);
				DrawLineLocal(40, 96, 96, 112, c, 5);
				DrawLineLocal(40, 72, 96, 88, c, 5);
				DrawLineLocal(40, 20, 40, 108, c2, 3);
				DrawLineLocal(40, 96, 96, 112, c2, 2);
				DrawLineLocal(40, 72, 96, 88, c2, 2);
				break;
			case 3:
				DrawLineLocal(40, 20, 40, 112, c, 6);
				DrawLineLocal(40, 96, 88, 112, c, 5);
				DrawLineLocal(88, 112, 88, 80, c, 5);
				DrawLineLocal(88, 80, 40, 96, c, 5);
				DrawLineLocal(40, 20, 40, 112, c2, 3);
				DrawLineLocal(40, 96, 88, 112, c2, 2);
				DrawLineLocal(88, 112, 88, 80, c2, 2);
				DrawLineLocal(88, 80, 40, 96, c2, 2);
				break;
			case 4:
				DrawLineLocal(64, 16, 64, 112, c, 8);
				DrawLineLocal(64, 16, 64, 112, c2, 4);
				break;
			case 5:
				DrawLineLocal(64, 16, 64, 112, c, 6);
				DrawLineLocal(64, 40, 32, 72, c, 5);
				DrawLineLocal(64, 40, 96, 72, c, 5);
				DrawLineLocal(64, 16, 64, 112, c2, 3);
				DrawLineLocal(64, 40, 32, 72, c2, 2);
				DrawLineLocal(64, 40, 96, 72, c2, 2);
				break;
			case 6:
				DrawLineLocal(36, 16, 36, 112, c, 6);
				DrawLineLocal(92, 16, 92, 112, c, 6);
				DrawLineLocal(36, 36, 92, 92, c, 5);
				DrawLineLocal(36, 16, 36, 112, c2, 3);
				DrawLineLocal(92, 16, 92, 112, c2, 3);
				DrawLineLocal(36, 36, 92, 92, c2, 2);
				break;
			case 7:
				DrawLineLocal(80, 20, 40, 20, c, 5);
				DrawLineLocal(80, 20, 40, 64, c, 5);
				DrawLineLocal(40, 64, 80, 108, c, 5);
				DrawLineLocal(80, 108, 40, 108, c, 5);
				DrawLineLocal(80, 20, 40, 20, c2, 2);
				DrawLineLocal(80, 20, 40, 64, c2, 2);
				DrawLineLocal(40, 64, 80, 108, c2, 2);
				DrawLineLocal(80, 108, 40, 108, c2, 2);
				break;
			case 8:
				DrawLineLocal(64, 16, 64, 112, c, 6);
				DrawLineLocal(96, 96, 32, 32, c, 5);
				DrawLineLocal(64, 16, 64, 112, c2, 3);
				DrawLineLocal(96, 96, 32, 32, c2, 2);
				break;
			case 9:
				DrawLineLocal(32, 48, 32, 112, c, 6);
				DrawLineLocal(96, 48, 96, 112, c, 6);
				DrawLineLocal(32, 48, 64, 16, c, 5);
				DrawLineLocal(64, 16, 96, 48, c, 5);
				DrawLineLocal(32, 48, 32, 112, c2, 3);
				DrawLineLocal(96, 48, 96, 112, c2, 3);
				DrawLineLocal(32, 48, 64, 16, c2, 2);
				DrawLineLocal(64, 16, 96, 48, c2, 2);
				break;
			case 10:
				DrawLineLocal(48, 16, 48, 112, c, 6);
				DrawLineLocal(48, 80, 96, 48, c, 5);
				DrawLineLocal(48, 16, 48, 112, c2, 3);
				DrawLineLocal(48, 80, 96, 48, c2, 2);
				break;
			case 11:
				DrawLineLocal(64, 112, 96, 72, c, 5);
				DrawLineLocal(96, 72, 64, 32, c, 5);
				DrawLineLocal(64, 32, 32, 72, c, 5);
				DrawLineLocal(32, 72, 64, 112, c, 5);
				DrawLineLocal(32, 72, 16, 16, c, 5);
				DrawLineLocal(96, 72, 112, 16, c, 5);
				DrawLineLocal(64, 112, 96, 72, c2, 2);
				DrawLineLocal(96, 72, 64, 32, c2, 2);
				DrawLineLocal(64, 32, 32, 72, c2, 2);
				DrawLineLocal(32, 72, 64, 112, c2, 2);
				DrawLineLocal(32, 72, 16, 16, c2, 2);
				DrawLineLocal(96, 72, 112, 16, c2, 2);
				break;
			case 12:
				DrawLineLocal(20, 20, 64, 64, c, 5);
				DrawLineLocal(20, 108, 64, 64, c, 5);
				DrawLineLocal(108, 20, 64, 64, c, 5);
				DrawLineLocal(108, 108, 64, 64, c, 5);
				DrawLineLocal(20, 20, 64, 64, c2, 2);
				DrawLineLocal(20, 108, 64, 64, c2, 2);
				DrawLineLocal(108, 20, 64, 64, c2, 2);
				DrawLineLocal(108, 108, 64, 64, c2, 2);
				break;
			case 13:
				DrawLineLocal(36, 16, 36, 112, c, 6);
				DrawLineLocal(36, 96, 80, 80, c, 5);
				DrawLineLocal(80, 80, 36, 64, c, 5);
				DrawLineLocal(36, 64, 80, 48, c, 5);
				DrawLineLocal(80, 48, 36, 32, c, 5);
				DrawLineLocal(36, 16, 36, 112, c2, 3);
				DrawLineLocal(36, 96, 80, 80, c2, 2);
				DrawLineLocal(80, 80, 36, 64, c2, 2);
				DrawLineLocal(36, 64, 80, 48, c2, 2);
				DrawLineLocal(80, 48, 36, 32, c2, 2);
				break;
			case 14:
				DrawLineLocal(32, 16, 32, 112, c, 6);
				DrawLineLocal(96, 16, 96, 112, c, 6);
				DrawLineLocal(32, 112, 96, 64, c, 5);
				DrawLineLocal(96, 112, 32, 64, c, 5);
				DrawLineLocal(32, 16, 32, 112, c2, 3);
				DrawLineLocal(96, 16, 96, 112, c2, 3);
				DrawLineLocal(32, 112, 96, 64, c2, 2);
				DrawLineLocal(96, 112, 32, 64, c2, 2);
				break;
			case 15:
				DrawLineLocal(64, 16, 108, 64, c, 6);
				DrawLineLocal(108, 64, 64, 112, c, 6);
				DrawLineLocal(64, 112, 20, 64, c, 6);
				DrawLineLocal(20, 64, 64, 16, c, 6);
				DrawLineLocal(64, 16, 108, 64, c2, 3);
				DrawLineLocal(108, 64, 64, 112, c2, 3);
				DrawLineLocal(64, 112, 20, 64, c2, 3);
				DrawLineLocal(20, 64, 64, 16, c2, 3);
				break;
			}
			void DrawLineLocal(int x0, int y0, int x1, int y1, Color c3, int thickness)
			{
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				DrawLineAtlas(tex, offsetX + (int)((float)x0 * scale), offsetY + (int)((float)y0 * scale), offsetX + (int)((float)x1 * scale), offsetY + (int)((float)y1 * scale), c3, thickness, 512);
			}
		}

		public static Texture2D GenerateRune(Color color, int runeIndex)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: 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_02a5: 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_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: 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_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: 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_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0456: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0478: 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_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: 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_055f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0575: Unknown result type (might be due to invalid IL or missing references)
			//IL_0586: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: 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_05b9: 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_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0657: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_0679: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_069b: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_0739: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_076c: 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_0793: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_080f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0820: Unknown result type (might be due to invalid IL or missing references)
			//IL_0831: Unknown result type (might be due to invalid IL or missing references)
			//IL_0842: Unknown result type (might be due to invalid IL or missing references)
			//IL_0853: Unknown result type (might be due to invalid IL or missing references)
			//IL_0864: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, true);
			((Texture)val).filterMode = (FilterMode)1;
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color c = default(Color);
			((Color)(ref c))..ctor(color.r * 0.6f, color.g * 0.6f, color.b * 0.6f, 0.6f);
			Color c2 = default(Color);
			((Color)(ref c2))..ctor(color.r, color.g, color.b, 1f);
			Color[] array = (Color[])(object)new Color[16384];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = val2;
			}
			val.SetPixels(array);
			switch (runeIndex)
			{
			case 0:
				DrawLine(val, 20, 20, 108, 108, c, 6);
				DrawLine(val, 108, 20, 20, 108, c, 6);
				DrawLine(val, 20, 20, 108, 108, c2, 3);
				DrawLine(val, 108, 20, 20, 108, c2, 3);
				break;
			case 1:
				DrawLine(val, 64, 16, 64, 112, c, 6);
				DrawLine(val, 64, 64, 32, 96, c, 5);
				DrawLine(val, 64, 64, 96, 96, c, 5);
				DrawLine(val, 64, 16, 64, 112, c2, 3);
				DrawLine(val, 64, 64, 32, 96, c2, 2);
				DrawLine(val, 64, 64, 96, 96, c2, 2);
				break;
			case 2:
				DrawLine(val, 40, 20, 40, 108, c, 6);
				DrawLine(val, 40, 96, 96, 112, c, 5);
				DrawLine(val, 40, 72, 96, 88, c, 5);
				DrawLine(val, 40, 20, 40, 108, c2, 3);
				DrawLine(val, 40, 96, 96, 112, c2, 2);
				DrawLine(val, 40, 72, 96, 88, c2, 2);
				break;
			case 3:
				DrawLine(val, 40, 20, 40, 112, c, 6);
				DrawLine(val, 40, 96, 88, 112, c, 5);
				DrawLine(val, 88, 112, 88, 80, c, 5);
				DrawLine(val, 88, 80, 40, 96, c, 5);
				DrawLine(val, 40, 20, 40, 112, c2, 3);
				DrawLine(val, 40, 96, 88, 112, c2, 2);
				DrawLine(val, 88, 112, 88, 80, c2, 2);
				DrawLine(val, 88, 80, 40, 96, c2, 2);
				break;
			case 4:
				DrawLine(val, 64, 16, 64, 112, c, 8);
				DrawLine(val, 64, 16, 64, 112, c2, 4);
				break;
			case 5:
				DrawLine(val, 64, 16, 64, 112, c, 6);
				DrawLine(val, 64, 40, 32, 72, c, 5);
				DrawLine(val, 64, 40, 96, 72, c, 5);
				DrawLine(val, 64, 16, 64, 112, c2, 3);
				DrawLine(val, 64, 40, 32, 72, c2, 2);
				DrawLine(val, 64, 40, 96, 72, c2, 2);
				break;
			case 6:
				DrawLine(val, 36, 16, 36, 112, c, 6);
				DrawLine(val, 92, 16, 92, 112, c, 6);
				DrawLine(val, 36, 36, 92, 92, c, 5);
				DrawLine(val, 36, 16, 36, 112, c2, 3);
				DrawLine(val, 92, 16, 92, 112, c2, 3);
				DrawLine(val, 36, 36, 92, 92, c2, 2);
				break;
			default:
				DrawLine(val, 80, 20, 40, 20, c, 5);
				DrawLine(val, 80, 20, 40, 64, c, 5);
				DrawLine(val, 40, 64, 80, 108, c, 5);
				DrawLine(val, 80, 108, 40, 108, c, 5);
				DrawLine(val, 80, 20, 40, 20, c2, 2);
				DrawLine(val, 80, 20, 40, 64, c2, 2);
				DrawLine(val, 40, 64, 80, 108, c2, 2);
				DrawLine(val, 80, 108, 40, 108, c2, 2);
				break;
			case 8:
				DrawLine(val, 64, 16, 64, 112, c, 6);
				DrawLine(val, 96, 96, 32, 32, c, 5);
				DrawLine(val, 64, 16, 64, 112, c2, 3);
				DrawLine(val, 96, 96, 32, 32, c2, 2);
				break;
			case 9:
				DrawLine(val, 32, 48, 32, 112, c, 6);
				DrawLine(val, 96, 48, 96, 112, c, 6);
				DrawLine(val, 32, 48, 64, 16, c, 5);
				DrawLine(val, 64, 16, 96, 48, c, 5);
				DrawLine(val, 32, 48, 32, 112, c2, 3);
				DrawLine(val, 96, 48, 96, 112, c2, 3);
				DrawLine(val, 32, 48, 64, 16, c2, 2);
				DrawLine(val, 64, 16, 96, 48, c2, 2);
				break;
			case 10:
				DrawLine(val, 48, 16, 48, 112, c, 6);
				DrawLine(val, 48, 80, 96, 48, c, 5);
				DrawLine(val, 48, 16, 48, 112, c2, 3);
				DrawLine(val, 48, 80, 96, 48, c2, 2);
				break;
			case 11:
				DrawLine(val, 64, 112, 96, 72, c, 5);
				DrawLine(val, 96, 72, 64, 32, c, 5);
				DrawLine(val, 64, 32, 32, 72, c, 5);
				DrawLine(val, 32, 72, 64, 112, c, 5);
				DrawLine(val, 32, 72, 16, 16, c, 5);
				DrawLine(val, 96, 72, 112, 16, c, 5);
				DrawLine(val, 64, 112, 96, 72, c2, 2);
				DrawLine(val, 96, 72, 64, 32, c2, 2);
				DrawLine(val, 64, 32, 32, 72, c2, 2);
				DrawLine(val, 32, 72, 64, 112, c2, 2);
				DrawLine(val, 32, 72, 16, 16, c2, 2);
				DrawLine(val, 96, 72, 112, 16, c2, 2);
				break;
			case 12:
				DrawLine(val, 20, 20, 64, 64, c, 5);
				DrawLine(val, 20, 108, 64, 64, c, 5);
				DrawLine(val, 108, 20, 64, 64, c, 5);
				DrawLine(val, 108, 108, 64, 64, c, 5);
				DrawLine(val, 20, 20, 64, 64, c2, 2);
				DrawLine(val, 20, 108, 64, 64, c2, 2);
				DrawLine(val, 108, 20, 64, 64, c2, 2);
				DrawLine(val, 108, 108, 64, 64, c2, 2);
				break;
			case 13:
				DrawLine(val, 36, 16, 36, 112, c, 6);
				DrawLine(val, 36, 96, 80, 80, c, 5);
				DrawLine(val, 80, 80, 36, 64, c, 5);
				DrawLine(val, 36, 64, 80, 48, c, 5);
				DrawLine(val, 80, 48, 36, 32, c, 5);
				DrawLine(val, 36, 16, 36, 112, c2, 3);
				DrawLine(val, 36, 96, 80, 80, c2, 2);
				DrawLine(val, 80, 80, 36, 64, c2, 2);
				DrawLine(val, 36, 64, 80, 48, c2, 2);
				DrawLine(val, 80, 48, 36, 32, c2, 2);
				break;
			case 14:
				DrawLine(val, 32, 16, 32, 112, c, 6);
				DrawLine(val, 96, 16, 96, 112, c, 6);
				DrawLine(val, 32, 112, 96, 64, c, 5);
				DrawLine(val, 96, 112, 32, 64, c, 5);
				DrawLine(val, 32, 16, 32, 112, c2, 3);
				DrawLine(val, 96, 16, 96, 112, c2, 3);
				DrawLine(val, 32, 112, 96, 64, c2, 2);
				DrawLine(val, 96, 112, 32, 64, c2, 2);
				break;
			case 15:
				DrawLine(val, 64, 16, 108, 64, c, 6);
				DrawLine(val, 108, 64, 64, 112, c, 6);
				DrawLine(val, 64, 112, 20, 64, c, 6);
				DrawLine(val, 20, 64, 64, 16, c, 6);
				DrawLine(val, 64, 16, 108, 64, c2, 3);
				DrawLine(val, 108, 64, 64, 112, c2, 3);
				DrawLine(val, 64, 112, 20, 64, c2, 3);
				DrawLine(val, 20, 64, 64, 16, c2, 3);
				break;
			}
			val.Apply(true);
			return val;
		}

		private static void DrawLineAtlas(Texture2D tex, int x0, int y0, int x1, int y1, Color c, int thickness, int atlasSize)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(x1 - x0);
			int num2 = Mathf.Abs(y1 - y0);
			int num3 = ((x0 < x1) ? 1 : (-1));
			int num4 = ((y0 < y1) ? 1 : (-1));
			int num5 = num - num2;
			while (true)
			{
				DrawCircleAtlas(tex, x0, y0, thickness, c, atlasSize);
				if (x0 == x1 && y0 == y1)
				{
					break;
				}
				int num6 = 2 * num5;
				if (num6 > -num2)
				{
					num5 -= num2;
					x0 += num3;
				}
				if (num6 < num)
				{
					num5 += num;
					y0 += num4;
				}
			}
		}

		private static void DrawCircleAtlas(Texture2D tex, int cx, int cy, int r, Color c, int atlasSize)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			for (int i = -r; i <= r; i++)
			{
				for (int j = -r; j <= r; j++)
				{
					if (j * j + i * i <= r * r)
					{
						int num = cx + j;
						int num2 = cy + i;
						if (num >= 0 && num < atlasSize && num2 >= 0 && num2 < atlasSize)
						{
							tex.SetPixel(num, num2, c);
						}
					}
				}
			}
		}

		private static void DrawLine(Texture2D tex, int x0, int y0, int x1, int y1, Color c, int thickness)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			int num = Mathf.Abs(x1 - x0);
			int num2 = Mathf.Abs(y1 - y0);
			int num3 = ((x0 < x1) ? 1 : (-1));
			int num4 = ((y0 < y1) ? 1 : (-1));
			int num5 = num - num2;
			while (true)
			{
				DrawCircle(tex, x0, y0, thickness, c);
				if (x0 == x1 && y0 == y1)
				{
					break;
				}
				int num6 = 2 * num5;
				if (num6 > -num2)
				{
					num5 -= num2;
					x0 += num3;
				}
				if (num6 < num)
				{
					num5 += num;
					y0 += num4;
				}
			}
		}

		private static void DrawCircle(Texture2D tex, int cx, int cy, int r, Color c)
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing refer