Decompiled source of Ability Api v0.1.2

AbilityApi.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AbilityApi.Internal;
using BepInEx;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("AbilityApi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8a26308fae945ee39d1c3b4b591d444002517380")]
[assembly: AssemblyProduct("AbilityApi")]
[assembly: AssemblyTitle("AbilityApi")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 MiniJSON
{
	public static class Json
	{
		private sealed class Parser : IDisposable
		{
			private enum TOKEN
			{
				NONE,
				CURLY_OPEN,
				CURLY_CLOSE,
				SQUARED_OPEN,
				SQUARED_CLOSE,
				COLON,
				COMMA,
				STRING,
				NUMBER,
				TRUE,
				FALSE,
				NULL
			}

			private const string WORD_BREAK = "{}[],:\"";

			private const string HEX_DIGIT = "0123456789ABCDEFabcdef";

			private StringReader json;

			private char PeekChar => Convert.ToChar(json.Peek());

			private char NextChar => Convert.ToChar(json.Read());

			private string NextWord
			{
				get
				{
					StringBuilder stringBuilder = new StringBuilder();
					while (!IsWordBreak(PeekChar))
					{
						stringBuilder.Append(NextChar);
						if (json.Peek() == -1)
						{
							break;
						}
					}
					return stringBuilder.ToString();
				}
			}

			private TOKEN NextToken
			{
				get
				{
					EatWhitespace();
					if (json.Peek() == -1)
					{
						return TOKEN.NONE;
					}
					switch (PeekChar)
					{
					case '{':
						return TOKEN.CURLY_OPEN;
					case '}':
						json.Read();
						return TOKEN.CURLY_CLOSE;
					case '[':
						return TOKEN.SQUARED_OPEN;
					case ']':
						json.Read();
						return TOKEN.SQUARED_CLOSE;
					case ',':
						json.Read();
						return TOKEN.COMMA;
					case '"':
						return TOKEN.STRING;
					case ':':
						return TOKEN.COLON;
					case '-':
					case '0':
					case '1':
					case '2':
					case '3':
					case '4':
					case '5':
					case '6':
					case '7':
					case '8':
					case '9':
						return TOKEN.NUMBER;
					default:
						return NextWord switch
						{
							"false" => TOKEN.FALSE, 
							"true" => TOKEN.TRUE, 
							"null" => TOKEN.NULL, 
							_ => TOKEN.NONE, 
						};
					}
				}
			}

			public static bool IsWordBreak(char c)
			{
				return char.IsWhiteSpace(c) || "{}[],:\"".IndexOf(c) != -1;
			}

			public static bool IsHexDigit(char c)
			{
				return "0123456789ABCDEFabcdef".IndexOf(c) != -1;
			}

			private Parser(string jsonString)
			{
				json = new StringReader(jsonString);
			}

			public static object Parse(string jsonString)
			{
				using Parser parser = new Parser(jsonString);
				return parser.ParseValue();
			}

			public void Dispose()
			{
				json.Dispose();
				json = null;
			}

			private Dictionary<string, object> ParseObject()
			{
				Dictionary<string, object> dictionary = new Dictionary<string, object>();
				json.Read();
				while (true)
				{
					string text;
					object obj;
					switch (NextToken)
					{
					case TOKEN.NONE:
						return null;
					case TOKEN.CURLY_CLOSE:
						return dictionary;
					case TOKEN.STRING:
					{
						text = ParseString();
						if (text == null)
						{
							return null;
						}
						if (NextToken != TOKEN.COLON)
						{
							return null;
						}
						json.Read();
						TOKEN nextToken = NextToken;
						obj = ParseByToken(nextToken);
						if (obj == null && nextToken != TOKEN.NULL)
						{
							return null;
						}
						goto IL_00ba;
					}
					default:
						return null;
					case TOKEN.COMMA:
						break;
					}
					continue;
					IL_00ba:
					dictionary[text] = obj;
				}
			}

			private List<object> ParseArray()
			{
				List<object> list = new List<object>();
				json.Read();
				bool flag = true;
				while (flag)
				{
					TOKEN nextToken = NextToken;
					switch (nextToken)
					{
					case TOKEN.NONE:
						return null;
					case TOKEN.SQUARED_CLOSE:
						flag = false;
						continue;
					case TOKEN.COMMA:
						continue;
					}
					object obj = ParseByToken(nextToken);
					if (obj == null && nextToken != TOKEN.NULL)
					{
						return null;
					}
					list.Add(obj);
				}
				return list;
			}

			private object ParseValue()
			{
				TOKEN nextToken = NextToken;
				return ParseByToken(nextToken);
			}

			private object ParseByToken(TOKEN token)
			{
				return token switch
				{
					TOKEN.STRING => ParseString(), 
					TOKEN.NUMBER => ParseNumber(), 
					TOKEN.CURLY_OPEN => ParseObject(), 
					TOKEN.SQUARED_OPEN => ParseArray(), 
					TOKEN.TRUE => true, 
					TOKEN.FALSE => false, 
					TOKEN.NULL => null, 
					_ => null, 
				};
			}

			private string ParseString()
			{
				StringBuilder stringBuilder = new StringBuilder();
				json.Read();
				bool flag = true;
				while (flag)
				{
					if (json.Peek() == -1)
					{
						flag = false;
						break;
					}
					char nextChar = NextChar;
					switch (nextChar)
					{
					case '"':
						flag = false;
						break;
					case '\\':
						if (json.Peek() == -1)
						{
							flag = false;
							break;
						}
						nextChar = NextChar;
						switch (nextChar)
						{
						case '"':
						case '/':
						case '\\':
							stringBuilder.Append(nextChar);
							break;
						case 'b':
							stringBuilder.Append('\b');
							break;
						case 'f':
							stringBuilder.Append('\f');
							break;
						case 'n':
							stringBuilder.Append('\n');
							break;
						case 'r':
							stringBuilder.Append('\r');
							break;
						case 't':
							stringBuilder.Append('\t');
							break;
						case 'u':
						{
							char[] array = new char[4];
							for (int i = 0; i < 4; i++)
							{
								array[i] = NextChar;
								if (!IsHexDigit(array[i]))
								{
									return null;
								}
							}
							stringBuilder.Append((char)Convert.ToInt32(new string(array), 16));
							break;
						}
						}
						break;
					default:
						stringBuilder.Append(nextChar);
						break;
					}
				}
				return stringBuilder.ToString();
			}

			private object ParseNumber()
			{
				string nextWord = NextWord;
				if (nextWord.IndexOf('.') == -1 && nextWord.IndexOf('E') == -1 && nextWord.IndexOf('e') == -1)
				{
					long.TryParse(nextWord, NumberStyles.Any, CultureInfo.InvariantCulture, out var result);
					return result;
				}
				double.TryParse(nextWord, NumberStyles.Any, CultureInfo.InvariantCulture, out var result2);
				return result2;
			}

			private void EatWhitespace()
			{
				while (char.IsWhiteSpace(PeekChar))
				{
					json.Read();
					if (json.Peek() == -1)
					{
						break;
					}
				}
			}
		}

		private sealed class Serializer
		{
			private StringBuilder builder;

			private Serializer()
			{
				builder = new StringBuilder();
			}

			public static string Serialize(object obj)
			{
				Serializer serializer = new Serializer();
				serializer.SerializeValue(obj);
				return serializer.builder.ToString();
			}

			private void SerializeValue(object value)
			{
				if (value == null)
				{
					builder.Append("null");
				}
				else if (value is string str)
				{
					SerializeString(str);
				}
				else if (value is bool)
				{
					builder.Append(((bool)value) ? "true" : "false");
				}
				else if (value is IList anArray)
				{
					SerializeArray(anArray);
				}
				else if (value is IDictionary obj)
				{
					SerializeObject(obj);
				}
				else if (value is char)
				{
					SerializeString(new string((char)value, 1));
				}
				else
				{
					SerializeOther(value);
				}
			}

			private void SerializeObject(IDictionary obj)
			{
				bool flag = true;
				builder.Append('{');
				foreach (object key in obj.Keys)
				{
					if (!flag)
					{
						builder.Append(',');
					}
					SerializeString(key.ToString());
					builder.Append(':');
					SerializeValue(obj[key]);
					flag = false;
				}
				builder.Append('}');
			}

			private void SerializeArray(IList anArray)
			{
				builder.Append('[');
				bool flag = true;
				for (int i = 0; i < anArray.Count; i++)
				{
					object value = anArray[i];
					if (!flag)
					{
						builder.Append(',');
					}
					SerializeValue(value);
					flag = false;
				}
				builder.Append(']');
			}

			private void SerializeString(string str)
			{
				builder.Append('"');
				char[] array = str.ToCharArray();
				foreach (char c in array)
				{
					switch (c)
					{
					case '"':
						builder.Append("\\\"");
						continue;
					case '\\':
						builder.Append("\\\\");
						continue;
					case '\b':
						builder.Append("\\b");
						continue;
					case '\f':
						builder.Append("\\f");
						continue;
					case '\n':
						builder.Append("\\n");
						continue;
					case '\r':
						builder.Append("\\r");
						continue;
					case '\t':
						builder.Append("\\t");
						continue;
					}
					int num = Convert.ToInt32(c);
					if (num >= 32 && num <= 126)
					{
						builder.Append(c);
						continue;
					}
					builder.Append("\\u");
					builder.Append(num.ToString("x4"));
				}
				builder.Append('"');
			}

			private void SerializeOther(object value)
			{
				if (value is float)
				{
					builder.Append(((float)value).ToString("R", CultureInfo.InvariantCulture));
				}
				else if (value is int || value is uint || value is long || value is sbyte || value is byte || value is short || value is ushort || value is ulong)
				{
					builder.Append(value);
				}
				else if (value is double || value is decimal)
				{
					builder.Append(Convert.ToDouble(value).ToString("R", CultureInfo.InvariantCulture));
				}
				else
				{
					SerializeString(value.ToString());
				}
			}
		}

		public static object Deserialize(string json)
		{
			if (json == null)
			{
				return null;
			}
			return Parser.Parse(json);
		}

		public static string Serialize(object obj)
		{
			return Serializer.Serialize(obj);
		}
	}
}
namespace AbilityApi
{
	public class Api
	{
		public class AbilityTextureMetaData
		{
			public Vector2 BackroundTopLeftCourner = default(Vector2);

			public Vector2 BackroundSize = default(Vector2);

			public Vector2 IconTopLeftCourner = default(Vector2);

			public Vector2 IconSize = default(Vector2);

			public Vector2 TotalSize = default(Vector2);
		}

		public static List<Texture2D> CustomAbilityTexstures = new List<Texture2D>();

		public static Dictionary<NamedSprite, List<NamedSprite>> CustomAbilitySpritesWithBackrounds = new Dictionary<NamedSprite, List<NamedSprite>>();

		public static NamedSpriteList CustomAbilitySpritesWithBackroundList = (NamedSpriteList)ScriptableObject.CreateInstance("NamedSpriteList");

		public static List<NamedSprite> Sprites = new List<NamedSprite>();

		public static AbilityGrid abilityGrid;

		public static T ConstructInstantAbility<T>(string name) where T : MonoUpdatable
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			InstantAbility val2 = val.AddComponent<InstantAbility>();
			val.AddComponent<FixTransform>();
			MonoUpdatable val3 = (MonoUpdatable)(object)val.AddComponent<T>();
			if ((Object)(object)val3 == (Object)null)
			{
				Object.Destroy((Object)(object)val);
				throw new MissingReferenceException("Invalid type was fed to ConstructInstantAbility");
			}
			return (T)(object)val3;
		}

		public static Texture2D LoadImage(string path)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			byte[] array = File.ReadAllBytes(path);
			Texture2D val = new Texture2D(1, 1);
			ImageConversion.LoadImage(val, array);
			return val;
		}

		public static void RegisterNamedSprites(NamedSprite namedSprite, bool IsOffensiveAbility)
		{
			//IL_0033: 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_003a: 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_0057: 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_008e: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			if (CustomAbilitySpritesWithBackroundList.sprites == null)
			{
				CustomAbilitySpritesWithBackroundList.sprites = new List<NamedSprite>();
			}
			foreach (NamedSprite sprite in Sprites)
			{
				if (sprite.name == namedSprite.name)
				{
					throw new Exception("ERROR: ABILITY WITH NAME " + namedSprite.name + " ALREADY EXSITS! NOT CREATING ABILITY!");
				}
			}
			((Object)namedSprite.associatedGameObject).name = namedSprite.name;
			CustomAbilityTexstures.Add(namedSprite.sprite.texture);
			List<NamedSprite> list = new List<NamedSprite>();
			Debug.Log((object)Plugin.BackroundSprites.Count);
			NamedSprite item = default(NamedSprite);
			foreach (Texture2D backroundSprite in Plugin.BackroundSprites)
			{
				Texture2D val = OverlayBackround(namedSprite.sprite.texture, backroundSprite);
				Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
				((NamedSprite)(ref item))..ctor(namedSprite.name, val2, namedSprite.associatedGameObject, IsOffensiveAbility);
				list.Add(item);
				CustomAbilitySpritesWithBackroundList.sprites.Add(item);
			}
			CustomAbilitySpritesWithBackrounds.Add(namedSprite, list);
			Sprites.Add(namedSprite);
		}

		public static Texture2D OverlayBackround(Texture2D ability, Texture2D backround)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_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_01ff: 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_020c: 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_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: 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_0253: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			Color32[,] array = Texture2DTo2DArray(ability);
			Color32[,] array2 = Texture2DTo2DArray(backround);
			Vector2Int val = default(Vector2Int);
			if (((Texture)ability).width > ((Texture)backround).width)
			{
				((Vector2Int)(ref val)).x = ((Texture)ability).width;
			}
			else
			{
				((Vector2Int)(ref val)).x = ((Texture)backround).width;
			}
			if (((Texture)ability).height > ((Texture)backround).height)
			{
				((Vector2Int)(ref val)).y = ((Texture)ability).height;
			}
			else
			{
				((Vector2Int)(ref val)).y = ((Texture)backround).height;
			}
			Vector2Int val2 = default(Vector2Int);
			((Vector2Int)(ref val2))..ctor(((Vector2Int)(ref val)).x / 2, ((Vector2Int)(ref val)).y / 2);
			Vector2Int val3 = default(Vector2Int);
			((Vector2Int)(ref val3))..ctor(((Vector2Int)(ref val2)).x - ((Texture)ability).width / 2, ((Vector2Int)(ref val2)).y - ((Texture)ability).height / 2);
			Vector2Int val4 = default(Vector2Int);
			((Vector2Int)(ref val4))..ctor(((Vector2Int)(ref val2)).x - ((Texture)backround).width / 2, ((Vector2Int)(ref val2)).y - ((Texture)backround).height / 2);
			Color32[,] array3 = new Color32[((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y];
			Color32[,] array4 = new Color32[((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y];
			Color32[,] array5 = new Color32[((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y];
			for (int i = 0; i < ((Texture)ability).width; i++)
			{
				for (int j = 0; j < ((Texture)ability).height; j++)
				{
					array4[i + ((Vector2Int)(ref val3)).x, j + ((Vector2Int)(ref val3)).y] = array[i, j];
				}
			}
			for (int k = 0; k < ((Texture)backround).width; k++)
			{
				for (int l = 0; l < ((Texture)backround).height; l++)
				{
					array5[k + ((Vector2Int)(ref val4)).x, l + ((Vector2Int)(ref val4)).y] = array2[k, l];
				}
			}
			for (int m = 0; m < ((Vector2Int)(ref val)).x; m++)
			{
				for (int n = 0; n < ((Vector2Int)(ref val)).y; n++)
				{
					Color32 val5 = array4[m, n];
					Color32 val6 = array5[m, n];
					if (val5.a >= 160)
					{
						array3[m, n] = val5;
					}
					else if (val6.a > 50)
					{
						array3[m, n] = MixColor32(val6, val5);
					}
					else
					{
						array3[m, n] = val6;
					}
				}
			}
			return TwoArrayToTexture2D(array3, ((Vector2Int)(ref val)).x, ((Vector2Int)(ref val)).y);
		}

		private static Color32 MixColor32(Color32 background, Color32 overlay)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)(int)background.a / 255f;
			float num2 = (float)(int)overlay.a / 255f;
			float num3 = num + num2 * (1f - num);
			byte b = (byte)Mathf.Clamp(num3 * 255f, 0f, 255f);
			byte b2 = (byte)(((float)(int)overlay.r * num2 + (float)(int)background.r * num * (1f - num2)) / num3);
			byte b3 = (byte)(((float)(int)overlay.g * num2 + (float)(int)background.g * num * (1f - num2)) / num3);
			byte b4 = (byte)(((float)(int)overlay.b * num2 + (float)(int)background.b * num * (1f - num2)) / num3);
			return new Color32(b2, b3, b4, b);
		}

		private static Color32[,] Texture2DTo2DArray(Texture2D texture)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			Color32[] pixels = texture.GetPixels32();
			Color32[,] array = new Color32[((Texture)texture).width, ((Texture)texture).height];
			for (int i = 0; i < ((Texture)texture).width; i++)
			{
				for (int j = 0; j < ((Texture)texture).height; j++)
				{
					array[i, j] = pixels[i + j * ((Texture)texture).width];
				}
			}
			return array;
		}

		private static Texture2D TwoArrayToTexture2D(Color32[,] ColorData2D, int width, int height)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			Color32[] array = (Color32[])(object)new Color32[width * height];
			for (int i = 0; i < width; i++)
			{
				for (int j = 0; j < height; j++)
				{
					array[i + j * width] = ColorData2D[i, j];
				}
			}
			Texture2D val = new Texture2D(width, height, (TextureFormat)5, false);
			val.SetPixels32(array);
			val.Apply();
			return val;
		}
	}
	internal class scroller
	{
		[HarmonyPatch(typeof(AbilityGrid), "Awake")]
		public static class AbilityGridPatch
		{
			public static void Postfix(AbilityGrid __instance)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Expected O, but got Unknown
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0160: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject("viewport_mask");
				val.AddComponent<RectTransform>();
				Transform transform = ((Component)__instance).gameObject.transform;
				val.transform.SetParent(transform, false);
				Transform val2 = transform.Find("border");
				((Component)transform.Find("selectionCircle")).gameObject.SetActive(false);
				if (!((Object)(object)transform.Find("scroller_content") == (Object)null))
				{
					return;
				}
				RectTransform component = ((Component)val2).GetComponent<RectTransform>();
				RectTransform component2 = val.GetComponent<RectTransform>();
				component2.sizeDelta = component.sizeDelta;
				component2.anchorMin = component.anchorMin;
				component2.anchorMax = component.anchorMax;
				component2.pivot = component.pivot;
				GameObject val3 = new GameObject("scroller_content");
				RectMask2D val4 = val.gameObject.AddComponent<RectMask2D>();
				val4.rectTransform.sizeDelta = new Vector2(component.sizeDelta.x * 2f, component.sizeDelta.y - 110f);
				val4.rectTransform.anchorMin = component.anchorMin;
				val4.rectTransform.anchorMax = component.anchorMax;
				val4.rectTransform.pivot = component.pivot;
				Vector2 val5 = default(Vector2);
				((Vector2)(ref val5))..ctor(0f, -120f);
				RectTransform rectTransform = val4.rectTransform;
				rectTransform.anchoredPosition += val5;
				RectTransform content = val3.AddComponent<RectTransform>();
				ScrollRect val6 = val3.AddComponent<ScrollRect>();
				val3.transform.SetParent(val.transform, false);
				IEnumerable<GameObject> enumerable = from child in ((Component)transform).GetComponentsInChildren<Transform>()
					where ((Object)((Component)child).gameObject).name == "AbilityGridEntry(Clone)"
					select ((Component)child).gameObject;
				foreach (GameObject item in enumerable)
				{
					item.transform.SetParent(val3.transform, false);
				}
				val3.SetActive(true);
				val6.content = content;
				val6.viewport = ((Component)transform).GetComponent<RectTransform>();
				val6.scrollSensitivity = -5f;
				val6.horizontal = false;
				val6.movementType = (MovementType)1;
				val6.elasticity = 0.5f;
			}
		}
	}
	public class InstantTestAbility : MonoUpdatable
	{
		public void Awake()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			Updater.RegisterUpdatable((MonoUpdatable)(object)this);
			InstantAbility component = ((Component)this).GetComponent<InstantAbility>();
			if (component.funcOnEnter == null)
			{
				component.funcOnEnter = new UnityEvent();
			}
			UnityEvent funcOnEnter = component.funcOnEnter;
			funcOnEnter.AddListener(new UnityAction(CastAbility));
		}

		public void CastAbility()
		{
			AudioManager.Get().Play("startGame");
		}

		public override void Init()
		{
		}

		public override void UpdateSim(Fix SimDeltaTime)
		{
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "AbilityApi";

		public const string PLUGIN_NAME = "AbilityApi";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace AbilityApi.Internal
{
	[BepInPlugin("com.AbilityAPITeam.AbilityAPI", "Ability API", "0.1.1")]
	public class Plugin : BaseUnityPlugin
	{
		public struct CircleEntry
		{
			public Sprite sprite;

			public Vector4 center;
		}

		[HarmonyPatch(typeof(AbilityReadyIndicator), "SetSprite")]
		public static class SpriteCirclePatch
		{
			public static void Postfix(AbilityReadyIndicator __instance, ref Sprite sprite)
			{
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				if (Api.CustomAbilityTexstures.Contains(sprite.texture))
				{
					((Renderer)__instance.spriteRen).material.SetVector("_CircleExtents", new Vector4(0f, 0f, 0f, 0f));
				}
				else
				{
					((Renderer)__instance.spriteRen).material.SetVector("_CircleExtents", defaultExtents);
				}
			}
		}

		[HarmonyPatch(typeof(AbilityGrid), "Awake")]
		public static class AbilityGridPatch
		{
			public static void Postfix(AbilityGrid __instance)
			{
				Api.abilityGrid = __instance;
				if (__instance.abilityIcons.sprites.Count == defaultAbilityCount)
				{
					Debug.Log((object)"adding");
					__instance.abilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(AchievementHandler), "Awake")]
		public static class AchievementHandlerPatch
		{
			public static void Postfix(AchievementHandler __instance)
			{
				if (__instance.abilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(CharacterStatsList), "TryStartNextLevel_online")]
		public static class CharacterStatsListPatch
		{
			public static void Prefix(CharacterStatsList __instance)
			{
				if (__instance.abilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(DynamicAbilityPickup), "Awake")]
		public static class DynamicAbilityPickupPatch
		{
			public static void Postfix(DynamicAbilityPickup __instance)
			{
				if (__instance.abilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(MidGameAbilitySelect), "Awake")]
		public static class MidGameAbilitySelectPatch
		{
			public static void Postfix(MidGameAbilitySelect __instance)
			{
				if (__instance.AbilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.AbilityIcons.sprites.AddRange(Api.Sprites);
					__instance.localAbilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(RandomAbility), "Awake")]
		public static class RandomAbilityPatch
		{
			public static void Postfix(RandomAbility __instance)
			{
				if (__instance.abilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(SelectAbility), "Awake")]
		public static class SelectAbilityPatch
		{
			public static void Postfix(SelectAbility __instance)
			{
				if (__instance.abilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIcons.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(SlimeController), "Awake")]
		public static class SlimeControllerAwakePatch
		{
			public static void Postfix(SlimeController __instance)
			{
				if (__instance.abilityIconsFull.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIconsFull.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(SlimeController), "DropAbilities")]
		public static class SlimeControllerDropAbilitiesPatch
		{
			public static bool Prefix(SlimeController __instance)
			{
				//IL_00d9: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0103: 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_010d: Unknown result type (might be due to invalid IL or missing references)
				//IL_011a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e5: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
				if (!GameSession.IsInitialized() || GameSessionHandler.HasGameEnded() || __instance.abilities.Count <= 0)
				{
					return false;
				}
				PlayerHandler.Get().GetPlayer(__instance.playerNumber);
				for (int i = 0; i < __instance.AbilityReadyIndicators.Length; i++)
				{
					if ((Object)(object)__instance.AbilityReadyIndicators[i] != (Object)null)
					{
						__instance.AbilityReadyIndicators[i].InstantlySyncTransform();
					}
				}
				int num = Settings.Get().NumberOfAbilities - 1;
				while (num >= 0 && (num >= __instance.AbilityReadyIndicators.Length || (Object)(object)__instance.AbilityReadyIndicators[num] == (Object)null))
				{
					num--;
				}
				if (num < 0)
				{
					return false;
				}
				Vec2 val = Vec2.NormalizedSafe(Vec2.up + new Vec2(Updater.RandomFix((Fix)(-0.3f), (Fix)0.3f), (Fix)0L));
				DynamicAbilityPickup val2 = FixTransform.InstantiateFixed<DynamicAbilityPickup>(__instance.abilityPickupPrefab, __instance.body.position);
				Sprite primarySprite = __instance.AbilityReadyIndicators[num].GetPrimarySprite();
				NamedSprite val3 = default(NamedSprite);
				if (__instance.abilityIconsFull.IndexOf(primarySprite) != -1)
				{
					val3 = __instance.abilityIconsFull.sprites[__instance.abilityIconsFull.IndexOf(primarySprite)];
					Debug.Log((object)"droping normal ability");
				}
				else
				{
					Debug.Log((object)"droping custom ability");
					val3 = Api.CustomAbilitySpritesWithBackroundList.sprites[Api.CustomAbilitySpritesWithBackroundList.IndexOf(primarySprite)];
				}
				if ((Object)(object)val3.associatedGameObject == (Object)null)
				{
					val3 = __instance.abilityIconsDemo.sprites[__instance.abilityIconsDemo.IndexOf(primarySprite)];
				}
				val2.InitPickup(val3.associatedGameObject, primarySprite, val);
				return false;
			}
		}

		[HarmonyPatch(typeof(PlayerCollision), "SpawnClone")]
		public static class PlayerCollisionPatch
		{
			public static bool Prefix(PlayerCollision __instance, Player player, SlimeController slimeContToRevive, Vec2 targetPosition)
			{
				return false;
			}

			public static void Postfix(PlayerCollision __instance, Player player, SlimeController slimeContToRevive, Vec2 targetPosition, ref SlimeController __result)
			{
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
				if (player.playersAndClonesStillAlive < Constants.MaxClones + 1)
				{
					int playersAndClonesStillAlive = player.playersAndClonesStillAlive;
					player.playersAndClonesStillAlive = playersAndClonesStillAlive + 1;
					SlimeController val = FixTransform.InstantiateFixed<SlimeController>(__instance.reviveEffectPrefab.emptyPlayerPrefab, targetPosition);
					val.playerNumber = player.Id;
					val.GetPlayerSprite().sprite = null;
					((Renderer)val.GetPlayerSprite()).material = player.Color;
					List<AbilityMonoBehaviour> list = new List<AbilityMonoBehaviour>();
					for (int i = 0; i < slimeContToRevive.abilities.Count; i++)
					{
						int num = slimeContToRevive.abilityIcons.IndexOf(slimeContToRevive.AbilityReadyIndicators[i].GetPrimarySprite());
						GameObject val2 = null;
						if (num != -1)
						{
							val2 = FixTransform.InstantiateFixed(slimeContToRevive.abilityIcons.sprites[num].associatedGameObject, Vec2.zero);
						}
						else
						{
							int index = Api.CustomAbilitySpritesWithBackroundList.IndexOf(slimeContToRevive.AbilityReadyIndicators[i].GetPrimarySprite());
							val2 = FixTransform.InstantiateFixed(Api.CustomAbilitySpritesWithBackroundList.sprites[index].associatedGameObject, Vec2.zero);
						}
						val2.gameObject.SetActive(false);
						list.Add(val2.GetComponent<AbilityMonoBehaviour>());
					}
					val.abilities = list;
					AbilityReadyIndicator[] array = (AbilityReadyIndicator[])(object)new AbilityReadyIndicator[3];
					for (int j = 0; j < slimeContToRevive.AbilityReadyIndicators.Length; j++)
					{
						if (!((Object)(object)slimeContToRevive.AbilityReadyIndicators[j] == (Object)null))
						{
							array[j] = Object.Instantiate<GameObject>(__instance.reviveEffectPrefab.AbilityReadyIndicators[j]).GetComponent<AbilityReadyIndicator>();
							array[j].SetSprite(slimeContToRevive.AbilityReadyIndicators[j].GetPrimarySprite(), true);
							array[j].Init();
							array[j].SetColor(__instance.reviveEffectPrefab.teamColors.teamColors[player.Team].fill);
							((Component)array[j]).GetComponent<FollowTransform>().Leader = ((Component)val).transform;
							((Component)array[j]).gameObject.SetActive(false);
						}
					}
					val.AbilityReadyIndicators = array;
					val.PrepareToRevive(targetPosition);
					__result = val;
				}
				else
				{
					__result = null;
				}
			}
		}

		[HarmonyPatch(typeof(SteamManager), "Awake")]
		public static class SteamManagerPatch
		{
			public static void Postfix(SteamManager __instance)
			{
				if (__instance.abilityIconsFull.sprites.Count == defaultAbilityCount)
				{
					__instance.abilityIconsFull.sprites.AddRange(Api.Sprites);
				}
			}
		}

		[HarmonyPatch(typeof(CharacterSelectHandler_online), "InitPlayer")]
		public static class CharacterSelectHandler_onlinePatch
		{
			public static Player playerToReturn;

			public static bool Prefix(CharacterSelectHandler_online __instance, int id, byte color, byte team, byte ability1, byte ability2, byte ability3, int nrOfAbilities, PlayerColors playerColors)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0158: Unknown result type (might be due to invalid IL or missing references)
				//IL_0163: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_027e: Unknown result type (might be due to invalid IL or missing references)
				//IL_029c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_022e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0251: Unknown result type (might be due to invalid IL or missing references)
				//IL_025c: Unknown result type (might be due to invalid IL or missing references)
				NamedSpriteList abilityIcons = SteamManager.instance.abilityIcons;
				Player val = new Player();
				val.Id = id;
				val.Color = playerColors.playerColors[color].playerMaterial;
				val.Team = team;
				Debug.Log((object)$"team is {team}");
				if (nrOfAbilities > 0)
				{
					if (Api.CustomAbilitySpritesWithBackrounds.ContainsKey(abilityIcons.sprites[ability1]))
					{
						val.Abilities.Add(Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[ability1]][team].associatedGameObject);
						val.AbilityIcons.Add(Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[ability1]][team].sprite);
					}
					else
					{
						val.Abilities.Add(abilityIcons.sprites[ability1].associatedGameObject);
						val.AbilityIcons.Add(abilityIcons.sprites[ability1].sprite);
					}
				}
				if (nrOfAbilities > 1)
				{
					if (Api.CustomAbilitySpritesWithBackrounds.ContainsKey(abilityIcons.sprites[ability2]))
					{
						val.Abilities.Add(Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[ability2]][team].associatedGameObject);
						val.AbilityIcons.Add(Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[ability2]][team].sprite);
					}
					else
					{
						val.Abilities.Add(abilityIcons.sprites[ability2].associatedGameObject);
						val.AbilityIcons.Add(abilityIcons.sprites[ability2].sprite);
					}
				}
				if (nrOfAbilities > 2)
				{
					if (Api.CustomAbilitySpritesWithBackrounds.ContainsKey(abilityIcons.sprites[ability3]))
					{
						val.Abilities.Add(Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[ability3]][team].associatedGameObject);
						val.AbilityIcons.Add(Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[ability3]][team].sprite);
					}
					else
					{
						val.Abilities.Add(abilityIcons.sprites[ability3].associatedGameObject);
						val.AbilityIcons.Add(abilityIcons.sprites[ability3].sprite);
					}
				}
				val.IsLocalPlayer = false;
				playerToReturn = val;
				return false;
			}

			public static void Postfix(CharacterSelectHandler_online __instance, ref Player __result)
			{
				__result = playerToReturn;
			}
		}

		[HarmonyPatch(typeof(CharacterSelectHandler), "TryStartGame_inner")]
		public static class CharacterSelectHandlerPatch
		{
			public static bool Prefix(CharacterSelectHandler __instance)
			{
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Invalid comparison between Unknown and I4
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: 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_00a2: Expected O, but got Unknown
				//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				//IL_013c: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0159: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0224: Unknown result type (might be due to invalid IL or missing references)
				//IL_022b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0247: 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_02b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_026b: 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_028e: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0306: Unknown result type (might be due to invalid IL or missing references)
				//IL_0322: Unknown result type (might be due to invalid IL or missing references)
				//IL_0329: 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_0392: Unknown result type (might be due to invalid IL or missing references)
				//IL_0346: Unknown result type (might be due to invalid IL or missing references)
				//IL_034d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0369: Unknown result type (might be due to invalid IL or missing references)
				if (CharacterSelectHandler.startButtonAvailable && CharacterSelectHandler.allReadyForMoreThanOneFrame)
				{
					AudioManager val = AudioManager.Get();
					if ((Object)(object)val != (Object)null)
					{
						val.Play("startGame");
					}
					CharacterSelectHandler.startButtonAvailable = false;
					List<Player> list = PlayerHandler.Get().PlayerList();
					list.Clear();
					int num = 1;
					NamedSpriteList abilityIcons = SteamManager.instance.abilityIcons;
					for (int i = 0; i < __instance.characterSelectBoxes.Length; i++)
					{
						if ((int)__instance.characterSelectBoxes[i].menuState != 2)
						{
							continue;
						}
						PlayerInit playerInit = __instance.characterSelectBoxes[i].playerInit;
						Player val2 = new Player(num, playerInit.team);
						val2.Color = __instance.playerColors[playerInit.color].playerMaterial;
						val2.UsesKeyboardAndMouse = playerInit.usesKeyboardMouse;
						val2.CanUseAbilities = true;
						val2.inputDevice = playerInit.inputDevice;
						val2.Abilities = new List<GameObject>(3);
						val2.AbilityIcons = new List<Sprite>(3);
						val2.Abilities.Add(abilityIcons.sprites[playerInit.ability0].associatedGameObject);
						if (Api.CustomAbilitySpritesWithBackrounds.ContainsKey(abilityIcons.sprites[playerInit.ability0]))
						{
							List<NamedSprite> list2 = Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[playerInit.ability0]];
							Debug.Log((object)$"AbilityWithBackroundsList length is {list2.Count}");
							Debug.Log((object)$"player.Team is {val2.Team}");
							val2.AbilityIcons.Add(list2[val2.Team].sprite);
						}
						else
						{
							val2.AbilityIcons.Add(abilityIcons.sprites[playerInit.ability0].sprite);
						}
						Settings val3 = Settings.Get();
						if ((Object)(object)val3 != (Object)null && val3.NumberOfAbilities > 1)
						{
							val2.Abilities.Add(abilityIcons.sprites[playerInit.ability1].associatedGameObject);
							if (Api.Sprites.Contains(abilityIcons.sprites[playerInit.ability1]))
							{
								List<NamedSprite> list3 = Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[playerInit.ability1]];
								val2.AbilityIcons.Add(list3[val2.Team].sprite);
							}
							else
							{
								val2.AbilityIcons.Add(abilityIcons.sprites[playerInit.ability1].sprite);
							}
						}
						Settings val4 = Settings.Get();
						if ((Object)(object)val4 != (Object)null && val4.NumberOfAbilities > 2)
						{
							val2.Abilities.Add(abilityIcons.sprites[playerInit.ability2].associatedGameObject);
							if (Api.Sprites.Contains(abilityIcons.sprites[playerInit.ability2]))
							{
								List<NamedSprite> list4 = Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[playerInit.ability2]];
								val2.AbilityIcons.Add(list4[val2.Team].sprite);
							}
							else
							{
								val2.AbilityIcons.Add(abilityIcons.sprites[playerInit.ability2].sprite);
							}
						}
						val2.CustomKeyBinding = playerInit.keybindOverride;
						num++;
						list.Add(val2);
					}
					GameSession.Init();
					SceneManager.LoadScene("Level1");
					if (!WinnerTriangleCanvas.HasBeenSpawned)
					{
						SceneManager.LoadScene("winnerTriangle", (LoadSceneMode)1);
					}
				}
				return false;
			}
		}

		public static int defaultAbilityCount = 30;

		public static Vector4 defaultExtents = new Vector4(0.04882813f, 0.04882813f, 0.08300781f, 0.9287109f);

		public static string directoryToModFolder = "";

		public static InstantTestAbility testAbilityPrefab;

		public static Texture2D testAbilityTex;

		public static Sprite testSprite;

		public static List<Texture2D> BackroundSprites = new List<Texture2D>();

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Ability API is loaded!");
			Harmony val = new Harmony("com.AbilityAPITeam.AbilityAPI");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"harmany created");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Ability API Patch Compleate!");
			new Harmony("Ability API").PatchAll(Assembly.GetExecutingAssembly());
			directoryToModFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BackroundSprites.Add(Api.LoadImage(Path.Combine(directoryToModFolder, "BlueTeam.png")));
			BackroundSprites.Add(Api.LoadImage(Path.Combine(directoryToModFolder, "OrangeTeam.png")));
			BackroundSprites.Add(Api.LoadImage(Path.Combine(directoryToModFolder, "GreenTeam.png")));
			BackroundSprites.Add(Api.LoadImage(Path.Combine(directoryToModFolder, "PinkTeam.png")));
		}
	}
}