Decompiled source of Ability Api v1.0.0

Ability Api.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AbilityApi;
using AbilityApi.Internal;
using Ability_Api;
using BepInEx;
using BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
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: AssemblyTitle("Ability Api")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ability Api")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b9c59e65-9c8c-4dd8-af94-554220b22886")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 Ability_Api
{
	public class DummyAbility : MonoBehaviour
	{
	}
	public abstract class Gun : MonoBehaviour
	{
		public abstract string abilityName { get; }

		public abstract string namespaceName { get; }

		public abstract string playerInAbilitySpriteName { get; }

		public abstract string abilityIconSpriteName { get; }

		public abstract string bulletSpriteName { get; }

		public abstract Fix cooldown { get; }

		public abstract float bulletSpeed { get; }

		public abstract float bulletGravity { get; }

		public abstract string shootSoundEffect { get; }

		public abstract float scale { get; }

		public void SetUpGun()
		{
			//IL_001a: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			GunAbility gunAbility = Api.ConstructGun<GunAbility>(abilityName, namespaceName, playerInAbilitySpriteName, bulletSpriteName, cooldown, bulletSpeed, bulletGravity, shootSoundEffect, scale);
			((Component)gunAbility).gameObject.AddComponent<PlayerPhysics>();
			Texture2D val = Api.LoadImageFromResources(namespaceName, abilityIconSpriteName);
			Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			NamedSprite namedSprite = default(NamedSprite);
			((NamedSprite)(ref namedSprite))..ctor(abilityName, val2, ((Component)gunAbility).gameObject, true);
			Api.RegisterNamedSprites(namedSprite, IsOffensiveAbility: true);
		}
	}
}
namespace AbilityApi
{
	public class Api
	{
		public class AbilityTextureMetaData
		{
			public Vector2 BackroundTopLeftCourner { get; set; }

			public Vector2 BackroundSize { get; set; }

			public Vector2 IconTopLeftCourner { get; set; }

			public Vector2 IconSize { get; set; }

			public Vector2 TotalSize { get; set; }
		}

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

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

		public static NamedSpriteList CustomAbilitySpritesWithBackroundList = ScriptableObject.CreateInstance<NamedSpriteList>();

		public static NamedSpriteList CustomAbilitySpritesWithoutBackroundList = ScriptableObject.CreateInstance<NamedSpriteList>();

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

		public static AbilityGrid abilityGrid;

		private static Stream GetResourceStream(string namespaceName, string path)
		{
			return Assembly.GetExecutingAssembly().GetManifestResourceStream(namespaceName + "." + path);
		}

		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_0048: 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>();
			val.AddComponent<DummyAbility>();
			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 T ConstructAbility<T>(string name, string namespaceName, string playerSpriteFileName) 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_0045: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			Ability val2 = val.AddComponent<Ability>();
			val.AddComponent<FixTransform>();
			val.AddComponent<SpriteRenderer>();
			Texture2D val3 = LoadImageFromResources(namespaceName, playerSpriteFileName);
			Sprite sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f));
			val.GetComponent<SpriteRenderer>().sprite = sprite;
			((Renderer)val.GetComponent<SpriteRenderer>()).enabled = false;
			val.AddComponent<PlayerBody>();
			val.AddComponent<DPhysicsBox>();
			val.AddComponent<PlayerCollision>();
			val.AddComponent<DummyAbility>();
			MonoUpdatable val4 = (MonoUpdatable)(object)val.AddComponent<T>();
			if ((Object)(object)val4 == (Object)null)
			{
				Object.Destroy((Object)(object)val);
				throw new MissingReferenceException("Invalid type was fed to ConstructAbility");
			}
			return (T)(object)val4;
		}

		public static T ConstructGun<T>(string name, string namespaceName, string playerSpriteFileName, string bulletFileName, Fix cooldown, float bulletSpeed, float bulletGravity, string shootSoundEffect, float scale) 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_0045: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name);
			Object.DontDestroyOnLoad((Object)(object)val);
			Ability val2 = val.AddComponent<Ability>();
			val.AddComponent<FixTransform>();
			val.AddComponent<SpriteRenderer>();
			Texture2D val3 = LoadImageFromResources(namespaceName, playerSpriteFileName);
			Sprite sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f));
			val.GetComponent<SpriteRenderer>().sprite = sprite;
			((Renderer)val.GetComponent<SpriteRenderer>()).enabled = false;
			val.AddComponent<PlayerBody>();
			val.AddComponent<DPhysicsBox>();
			val.GetComponent<DPhysicsBox>().Scale = (Fix)scale;
			val.AddComponent<PlayerCollision>();
			val.AddComponent<DummyAbility>();
			MonoUpdatable val4 = (MonoUpdatable)(object)val.AddComponent<T>();
			if ((Object)(object)val4 == (Object)null)
			{
				Object.Destroy((Object)(object)val);
				throw new MissingReferenceException("Invalid type was fed to ConstructAbility");
			}
			GunAbility component = val.GetComponent<GunAbility>();
			component.nameSpaceName = namespaceName;
			component.bulletSprite = bulletFileName;
			component.gunSprite = playerSpriteFileName;
			component.SetCooldown(cooldown);
			component.bulletSpeed = bulletSpeed;
			component.bulletGravity = bulletGravity;
			component.shootSoundEffect = shootSoundEffect;
			return (T)(object)val4;
		}

		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;
		}

		private static byte[] ReadFully(Stream input)
		{
			byte[] array = new byte[16384];
			using MemoryStream memoryStream = new MemoryStream();
			int count;
			while ((count = input.Read(array, 0, array.Length)) > 0)
			{
				memoryStream.Write(array, 0, count);
			}
			return memoryStream.ToArray();
		}

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

		public static void RegisterNamedSprites(NamedSprite namedSprite, bool IsOffensiveAbility)
		{
			//IL_0007: 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_00a3: 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_0173: 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_01af: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			if (CustomAbilitySpritesWithBackroundList.sprites == null)
			{
				CustomAbilitySpritesWithBackroundList.sprites = new List<NamedSprite>();
			}
			if (CustomAbilitySpritesWithoutBackroundList.sprites == null)
			{
				CustomAbilitySpritesWithoutBackroundList.sprites = new List<NamedSprite>();
			}
			if (Sprites.Any((NamedSprite sprite) => sprite.name == namedSprite.name) && CustomAbilitySpritesWithBackroundList.sprites == null)
			{
				CustomAbilitySpritesWithBackroundList.sprites = new List<NamedSprite>();
			}
			using (List<NamedSprite>.Enumerator enumerator = Sprites.GetEnumerator())
			{
				if (enumerator.MoveNext())
				{
					NamedSprite current = enumerator.Current;
					throw new Exception("Error: Ability with the name " + namedSprite.name + " already exists, not creating ability!");
				}
			}
			((Object)namedSprite.associatedGameObject).name = namedSprite.name;
			CustomAbilityTexstures.Add(namedSprite.sprite.texture);
			List<NamedSprite> list = new List<NamedSprite>();
			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);
				CustomAbilitySpritesWithoutBackroundList.sprites.Add(namedSprite);
			}
			CustomAbilitySpritesWithBackrounds.Add(namedSprite, list);
			Sprites.Add(namedSprite);
		}

		public static Texture2D OverlayBackround(Texture2D ability, Texture2D backround)
		{
			//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_0164: 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_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: 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)
			Color32[,] array = Texture2DTo2DArray(ability);
			Color32[,] array2 = Texture2DTo2DArray(backround);
			Vector2Int val = default(Vector2Int);
			((Vector2Int)(ref val))..ctor(Math.Max(((Texture)ability).width, ((Texture)backround).width), Math.Max(((Texture)ability).height, ((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 GunAbility : MonoUpdatable, IAbilityComponent
	{
		public Ability ab;

		private Player player;

		private FixTransform playerTransform;

		private PlayerBody body;

		private PlayerPhysics playerPhysics;

		private SpriteRenderer spriteRenderer;

		private bool hasFired = true;

		private bool releasedButton;

		private Vec2 inputVector;

		private Vec2 actualInputVector;

		private Fix FirePointOffsetX = (Fix)3f;

		private Fix FirePointOffSetY = -(Fix)3f;

		private RingBuffer<BoplBody> Bullets;

		private BoplBody Bullet;

		public string bulletSprite;

		public string nameSpaceName;

		public string gunSprite;

		public float bulletSpeed;

		public float bulletGravity;

		public string shootSoundEffect;

		public void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			Updater.RegisterUpdatable((MonoUpdatable)(object)this);
			ab = ((Component)this).GetComponent<Ability>();
			spriteRenderer = ((Component)this).GetComponent<SpriteRenderer>();
			playerPhysics = ((Component)this).GetComponent<PlayerPhysics>();
			body = ((Component)this).GetComponent<PlayerBody>();
			player = PlayerHandler.Get().GetPlayer(ab.GetPlayerInfo().playerId);
			Bullets = new RingBuffer<BoplBody>(120, true);
		}

		public void Update()
		{
		}

		public void SetCooldown(Fix cooldown)
		{
			//IL_0007: 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)
			ab.Cooldown = cooldown;
		}

		public override void Init()
		{
		}

		private void OldUpdate(Fix simDeltaTime)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_009e: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			if (player != null)
			{
				Vec2 val = player.AimVector();
				if (Vec2.Magnitude(val) > (Fix)0.4 && !releasedButton && !hasFired)
				{
					Vec2 val2 = default(Vec2);
					((Vec2)(ref val2))..ctor((Fix)1L / val.x, -(Fix)1L / val.y);
					inputVector = Vec2.Normalized(val2);
				}
				Vec2 val3 = player.AimVector();
				if (Vec2.Magnitude(val) > (Fix)0.4 && !releasedButton && !hasFired)
				{
					actualInputVector = Vec2.Normalized(val3);
				}
				if (!player.AbilityButtonIsDown(ab.GetPlayerInfo().AbilityButtonUsedIndex012) && !hasFired)
				{
					Fire();
					releasedButton = true;
				}
			}
		}

		public override void UpdateSim(Fix SimDeltaTime)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: 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_018f: 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_01a2: 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_01ba: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: 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_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0409: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_0420: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: 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_042f: 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_043b: 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_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_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0451: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0479: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_048e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: 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_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: 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_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			OldUpdate(SimDeltaTime);
			_ = inputVector;
			if (!hasFired)
			{
				float num = (float)(Math.Atan2((float)inputVector.y, (float)inputVector.x) / (Math.PI * 2.0));
				body.rotation = (Fix)num;
				float num2 = num;
				num2 *= 360f;
				if (num2 > 0f && num2 < 90f)
				{
					spriteRenderer.flipX = false;
					spriteRenderer.flipY = false;
				}
				if (num2 > 90f && num2 < 180f)
				{
					spriteRenderer.flipX = true;
					spriteRenderer.flipY = false;
				}
				if (num2 > -180f && num2 < -90f)
				{
					spriteRenderer.flipX = false;
					spriteRenderer.flipY = true;
				}
				if (num2 > -90f && num2 < 0f)
				{
					spriteRenderer.flipX = true;
					spriteRenderer.flipY = true;
				}
			}
			if ((Object)(object)playerPhysics == (Object)null)
			{
				return;
			}
			if (SceneBounds.WaterHeight > body.position.y - (Fix)0.2f)
			{
				AbilityExitInfo info = default(AbilityExitInfo);
				info.position = body.position;
				info.selfImposedVelocity = body.selfImposedVelocity;
				ExitAbility(info);
			}
			if (playerPhysics.IsGrounded() && (Vec2.SqrMagnitude(body.selfImposedVelocity) > (Fix)1E-06f || (Object)(object)playerPhysics.getAttachedGround() == (Object)null || !((Behaviour)playerPhysics.getAttachedGround()).isActiveAndEnabled))
			{
				playerPhysics.gravity_modifier = (Fix)0f;
				playerPhysics.UnGround(false, true);
			}
			if (!playerPhysics.IsGrounded())
			{
				playerPhysics.AddGravityFactor();
				if (playerPhysics.VelocityBasedRaycasts(true, SimDeltaTime) && hasFired)
				{
					AbilityExitInfo val = default(AbilityExitInfo);
					body.rotation = Fix.Zero;
					val.justlanded = true;
					val.groundedSpeed = playerPhysics.groundedSpeed;
					val.isGrounded = playerPhysics.IsGrounded();
					val.isFacingRight = inputVector.x >= 0L;
					val.position = body.position;
					val.selfImposedVelocity = body.selfImposedVelocity;
					val.externalVelocity = body.externalVelocity;
					val.currentlyAttachedGround = playerPhysics.getAttachedGround();
					val.lastSprite = spriteRenderer.sprite;
					val.groundedLocalPosition = playerPhysics.LocalPlatformPos;
					val.radius = playerPhysics.radius;
					((AbilityMonoBehaviour)ab).ExitAbility(val);
				}
			}
			if (!hasFired)
			{
				body.up = inputVector;
				if (Vec2.Magnitude(body.selfImposedVelocity) > (Fix)9f)
				{
					body.selfImposedVelocity = Vec2.Normalized(body.selfImposedVelocity) * (Fix)9f;
				}
			}
			else
			{
				Vec2 selfImposedVelocity = body.selfImposedVelocity;
				Fix val2 = player.HorizontalAxis();
				playerPhysics.AirealMovement(val2, SimDeltaTime);
				Vec2 selfImposedVelocity2 = body.selfImposedVelocity;
				body.selfImposedVelocity = Vec2.Lerp(selfImposedVelocity, selfImposedVelocity2, (Fix)0.5f);
			}
			if (Vec2.Magnitude(body.selfImposedVelocity) > playerPhysics.Speed)
			{
				body.selfImposedVelocity = Vec2.Normalized(body.selfImposedVelocity) * playerPhysics.Speed;
			}
			if (playerPhysics.IsGrounded())
			{
				playerPhysics.gravity_modifier = Fix.Zero;
				playerPhysics.UnGround(false, false);
				playerPhysics.DropPlatformTest();
			}
		}

		public void OnEnterAbility()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)spriteRenderer).material = ab.GetPlayerInfo().playerMaterial;
			((Renderer)spriteRenderer).enabled = true;
			spriteRenderer.flipX = false;
			spriteRenderer.flipY = false;
			body.position = ab.GetPlayerInfo().position;
			body.rotation = (Fix)0L;
			playerPhysics.SyncPhysicsTo(ab.GetPlayerInfo());
			player = PlayerHandler.Get().GetPlayer(ab.GetPlayerInfo().playerId);
			releasedButton = false;
			hasFired = false;
			inputVector = ab.GetPlayerInfo().upVector;
			body.rotation = Fix.Zero;
			playerPhysics.gravity_modifier = Fix.One;
			playerPhysics.UnGround(false, true);
		}

		public void Fire()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00b4: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: 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_021a: 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_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_022f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			if (shootSoundEffect != "")
			{
				AudioManager.Get().Play(shootSoundEffect);
			}
			AbilityExitInfo val = default(AbilityExitInfo);
			val.position = body.position;
			val.selfImposedVelocity = body.selfImposedVelocity;
			float num = (float)(Math.Atan2((float)inputVector.y, (float)inputVector.x) / (Math.PI * 2.0));
			body.rotation = (Fix)num;
			float num2 = num;
			num2 *= 360f;
			Vec2 val2 = CurrentFirePoint();
			BoplBody val3 = FixTransform.InstantiateFixed<BoplBody>(Plugin.Arrow, CurrentFirePoint(), body.rotation);
			((Object)((Component)val3).gameObject).name = "bullet-api";
			((Component)val3).GetComponent<Arrow>().StickTo = default(LayerMask);
			Bullets.Add(val3);
			Texture2D val4 = Api.LoadImageFromResources(nameSpaceName, bulletSprite);
			Sprite sprite = Sprite.Create(val4, new Rect(0f, 0f, (float)((Texture)val4).width, (float)((Texture)val4).height), new Vector2(0.5f, 0.5f));
			((Component)val3).GetComponent<SpriteRenderer>().sprite = sprite;
			((Renderer)((Component)val3).GetComponent<SpriteRenderer>()).material = ab.GetPlayerInfo().playerMaterial;
			val3.Scale = (Fix)0.3f * body.fixtrans.Scale;
			Fix val5 = Fix.One + (body.fixtrans.Scale - Fix.One) / (Fix)2L;
			((Component)val3).GetComponent<IPlayerIdHolder>().SetPlayerId(ab.GetPlayerInfo().playerId);
			inputVector = Vec2.Normalized(inputVector);
			((Renderer)((Component)val3).GetComponent<SpriteRenderer>()).material = ab.GetPlayerInfo().playerMaterial;
			val3.StartVelocity = actualInputVector * (Fix)bulletSpeed * Fix.One * val5;
			((Component)val3).GetComponent<Projectile>().DelayedEnableHurtOwner((Fix)0.03f);
			val3.gravityScale = (Fix)bulletGravity;
			hasFired = true;
			val3.rotation = body.rotation;
			val3.up = body.up;
			val3.right = body.right;
			((AbilityMonoBehaviour)ab).ExitAbility(val);
		}

		public void ExitAbility(AbilityExitInfo info)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			((Behaviour)this).enabled = false;
			playerPhysics.gravity_modifier = Fix.One;
			spriteRenderer.flipX = false;
			spriteRenderer.flipY = false;
			((AbilityMonoBehaviour)ab).ExitAbility(info);
		}

		public Vec2 CurrentFirePoint()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			return body.position + FirePointOffSetY * Vec2.Normalized(player.AimVector()) * body.fixtrans.Scale + FirePointOffsetX * Vec2.Normalized(player.AimVector()) * body.fixtrans.Scale * (Fix)1.5f;
		}

		public void OnScaleChanged(Fix scaleMultiplier)
		{
			throw new NotImplementedException();
		}
	}
}
namespace AbilityApi.Internal
{
	[BepInPlugin("com.AbilityAPITeam.AbilityAPI", "Ability API", "1.0.0")]
	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, ref SpriteRenderer ___spriteRen)
			{
				//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.GetSpriteRen()).material.SetVector("_CircleExtents", new Vector4(0f, 0f, 0f, 0f));
				}
				else
				{
					((Renderer)__instance.GetSpriteRen()).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, ref NamedSpriteList ___localAbilityIcons)
			{
				if (__instance.AbilityIcons.sprites.Count == defaultAbilityCount)
				{
					__instance.AbilityIcons.sprites.AddRange(Api.Sprites);
					___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), "AddAdditionalAbility")]
		public class AddMoreAbilityPatch
		{
			public static bool Prefix(SlimeController __instance, Fix[] ___abilityCooldownTimers, AbilityMonoBehaviour ability, PlayerCollision ___playerCollision, Sprite indicatorSprite, GameObject abilityPrefab)
			{
				//IL_00b4: 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_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_033d: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_0423: 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_02ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_025c: Unknown result type (might be due to invalid IL or missing references)
				Debug.Log((object)"Added Additional");
				NamedSpriteList abilityIcons = SteamManager.instance.abilityIcons;
				Player player = PlayerHandler.Get().GetPlayer(__instance.playerNumber);
				if (__instance.abilities.Count == 3)
				{
					__instance.abilities[2] = ability;
					PlayerHandler.Get().GetPlayer(__instance.playerNumber).CurrentAbilities[2] = abilityPrefab;
					if (Object.op_Implicit((Object)(object)((Component)ability).GetComponentInParent<DummyAbility>()))
					{
						Texture2D val = Api.OverlayBackround(indicatorSprite.texture, BackroundSprites[player.Team]);
						Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
						__instance.AbilityReadyIndicators[2].SetSprite(val2, true);
						Debug.Log((object)"custom");
					}
					else
					{
						__instance.AbilityReadyIndicators[2].SetSprite(indicatorSprite, true);
					}
					__instance.AbilityReadyIndicators[2].ResetAnimation();
					___abilityCooldownTimers[2] = (Fix)100000L;
				}
				else if (__instance.abilities.Count > 0 && (Object)(object)__instance.AbilityReadyIndicators[0] != (Object)null)
				{
					__instance.abilities.Add(ability);
					PlayerHandler.Get().GetPlayer(__instance.playerNumber).CurrentAbilities.Add(abilityPrefab);
					int num = __instance.abilities.Count - 1;
					if (num >= __instance.AbilityReadyIndicators.Length || (Object)(object)__instance.AbilityReadyIndicators[num] == (Object)null)
					{
						GameObject val3 = ___playerCollision.reviveEffectPrefab.AbilityReadyIndicators[num];
						AbilityReadyIndicator[] array = (AbilityReadyIndicator[])(object)new AbilityReadyIndicator[__instance.abilities.Count];
						for (int i = 0; i < num; i++)
						{
							array[i] = __instance.AbilityReadyIndicators[i];
						}
						__instance.AbilityReadyIndicators = array;
						__instance.AbilityReadyIndicators[num] = Object.Instantiate<GameObject>(val3).GetComponent<AbilityReadyIndicator>();
						__instance.AbilityReadyIndicators[num].SetSprite(indicatorSprite, true);
						__instance.AbilityReadyIndicators[num].Init();
						__instance.AbilityReadyIndicators[num].SetColor(___playerCollision.reviveEffectPrefab.teamColors.teamColors[player.Team].fill);
						((Component)__instance.AbilityReadyIndicators[num]).GetComponent<FollowTransform>().Leader = ((Component)__instance).transform;
					}
					__instance.AbilityReadyIndicators[num].SetSprite(indicatorSprite, true);
					__instance.AbilityReadyIndicators[num].ResetAnimation();
					___abilityCooldownTimers[num] = (Fix)100000L;
					for (int j = 0; j < __instance.abilities.Count; j++)
					{
						if ((Object)(object)__instance.abilities[j] == (Object)null || ((MonoUpdatable)__instance.abilities[j]).IsDestroyed)
						{
							return false;
						}
						((Component)__instance.AbilityReadyIndicators[j]).gameObject.SetActive(true);
						__instance.AbilityReadyIndicators[j].InstantlySyncTransform();
					}
				}
				else
				{
					GameObject val4 = FixTransform.InstantiateFixed(abilityPrefab, Vec2.zero);
					val4.gameObject.SetActive(false);
					__instance.abilities = new List<AbilityMonoBehaviour>();
					__instance.abilities.Add(val4.GetComponent<AbilityMonoBehaviour>());
					AbilityReadyIndicator[] array2 = (AbilityReadyIndicator[])(object)new AbilityReadyIndicator[1];
					GameObject val5 = ___playerCollision.reviveEffectPrefab.AbilityReadyIndicators[0];
					Player player2 = PlayerHandler.Get().GetPlayer(__instance.playerNumber);
					array2[0] = Object.Instantiate<GameObject>(val5).GetComponent<AbilityReadyIndicator>();
					array2[0].SetSprite(indicatorSprite, true);
					array2[0].Init();
					array2[0].SetColor(___playerCollision.reviveEffectPrefab.teamColors.teamColors[player2.Team].fill);
					((Component)array2[0]).GetComponent<FollowTransform>().Leader = ((Component)__instance).transform;
					((Component)array2[0]).gameObject.SetActive(true);
					array2[0].InstantlySyncTransform();
					___abilityCooldownTimers[0] = (Fix)100L;
					__instance.AbilityReadyIndicators = array2;
				}
				AudioManager.Get().Play("abilityPickup");
				return false;
			}
		}

		[HarmonyPatch(typeof(SlimeController), "DropAbilities")]
		public static class SlimeControllerDropAbilitiesPatch
		{
			public static bool Prefix(SlimeController __instance, ref DynamicAbilityPickup ___abilityPickupPrefab)
			{
				//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0112: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Unknown result type (might be due to invalid IL or missing references)
				//IL_011c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_014d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_021c: 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_0212: Unknown result type (might be due to invalid IL or missing references)
				//IL_0217: Unknown result type (might be due to invalid IL or missing references)
				if (!GameSession.IsInitialized() || GameSessionHandler.HasGameEnded() || __instance.abilities.Count <= 0)
				{
					return false;
				}
				NamedSpriteList abilityIcons = SteamManager.instance.abilityIcons;
				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;
				}
				if (!hasDied)
				{
					Vec2 val = Vec2.NormalizedSafe(Vec2.up + new Vec2(Updater.RandomFix((Fix)(-0.3f), (Fix)0.3f), (Fix)0L));
					DynamicAbilityPickup val2 = FixTransform.InstantiateFixed<DynamicAbilityPickup>(___abilityPickupPrefab, __instance.body.position);
					Sprite val3 = __instance.AbilityReadyIndicators[num].GetPrimarySprite();
					NamedSprite val4 = default(NamedSprite);
					if (__instance.abilityIconsFull.IndexOf(val3) != -1)
					{
						val4 = __instance.abilityIconsFull.sprites[__instance.abilityIconsFull.IndexOf(val3)];
						Debug.Log((object)"droping normal ability");
					}
					else
					{
						Debug.Log((object)"Dropping custom ability");
						val4 = Api.CustomAbilitySpritesWithBackroundList.sprites[Api.CustomAbilitySpritesWithBackroundList.IndexOf(val3)];
						val3 = Api.CustomAbilitySpritesWithoutBackroundList.sprites[Api.CustomAbilitySpritesWithBackroundList.IndexOf(val3)].sprite;
					}
					if ((Object)(object)val4.associatedGameObject == (Object)null)
					{
						val4 = __instance.abilityIconsDemo.sprites[__instance.abilityIconsDemo.IndexOf(val3)];
					}
					val2.InitPickup(val4.associatedGameObject, val3, val);
				}
				if (hasDied)
				{
					hasDied = false;
				}
				else
				{
					hasDied = true;
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(PlayerCollision), "SpawnClone")]
		public static class PlayerCollisionPatch
		{
			public static bool Prefix()
			{
				return false;
			}

			public static void Postfix(PlayerCollision __instance, Player player, SlimeController slimeContToRevive, Vec2 targetPosition, ref SlimeController __result)
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0240: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
				if (player.playersAndClonesStillAlive < Constants.MaxClones + 1)
				{
					int playersAndClonesStillAlive = player.playersAndClonesStillAlive;
					if (!player.stillAliveThisRound)
					{
						return;
					}
					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;
						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(GameSessionHandler), "SpawnPlayers")]
		public static class SpawnPlayerPatch
		{
			public static void Prefix()
			{
				hasDied = false;
			}
		}

		[HarmonyPatch(typeof(PlayerCollision), "killPlayer")]
		public static class PlayerCollisionPatchOnKill
		{
			public static void Prefix(PlayerCollision __instance, IPlayerIdHolder ___playerIdHolder)
			{
				Player player = PlayerHandler.Get().GetPlayer(___playerIdHolder.GetPlayerId());
				if (player.playersAndClonesStillAlive > 1)
				{
					player.playersAndClonesStillAlive -= 1;
				}
			}
		}

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

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

			public static bool Prefix(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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_012f: 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_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_015e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0181: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0279: Unknown result type (might be due to invalid IL or missing references)
				//IL_0297: Unknown result type (might be due to invalid IL or missing references)
				//IL_021e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0229: Unknown result type (might be due to invalid IL or missing references)
				//IL_024c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0257: Unknown result type (might be due to invalid IL or missing references)
				NamedSpriteList abilityIcons = SteamManager.instance.abilityIcons;
				Player val = new Player
				{
					Id = id,
					Color = playerColors.playerColors[color].playerMaterial,
					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(ref Player __result)
			{
				__result = playerToReturn;
			}
		}

		[HarmonyPatch(typeof(Arrow), "OnCollide")]
		public static class Arrow_OnCollide_Patch
		{
			public static bool Prefix(Arrow __instance)
			{
				if (((Object)((Component)__instance).gameObject).name == "bullet-api")
				{
					Updater.DestroyFix(((Component)__instance).gameObject);
					return false;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(CharacterSelectHandler), "TryStartGame_inner")]
		public static class CharacterSelectHandlerPatch
		{
			public static bool Prefix(CharacterSelectHandler __instance, ref bool ___allReadyForMoreThanOneFrame, ref PlayerColors ___playerColors)
			{
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Invalid comparison between Unknown and I4
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: 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_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: 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_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ca: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f3: Expected O, but got Unknown
				//IL_0101: 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_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_018d: 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_0148: 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_016b: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0205: Unknown result type (might be due to invalid IL or missing references)
				//IL_0267: 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_0222: 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_0245: Unknown result type (might be due to invalid IL or missing references)
				//IL_035d: 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_02bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d9: 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_0342: 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_02fd: 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_0320: Unknown result type (might be due to invalid IL or missing references)
				if (CharacterSelectHandler.startButtonAvailable & ___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)
						{
							Color = ___playerColors[playerInit.color].playerMaterial,
							UsesKeyboardAndMouse = playerInit.usesKeyboardMouse,
							CanUseAbilities = true,
							inputDevice = playerInit.inputDevice,
							Abilities = new List<GameObject>(3),
							AbilityIcons = new List<Sprite>(3)
						};
						val2.Abilities.Add(abilityIcons.sprites[playerInit.ability0].associatedGameObject);
						if (Api.Sprites.Contains(abilityIcons.sprites[playerInit.ability0]))
						{
							List<NamedSprite> list2 = Api.CustomAbilitySpritesWithBackrounds[abilityIcons.sprites[playerInit.ability0]];
							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;
			}
		}

		private GameObject BowObject;

		public static BoplBody Arrow;

		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 GunAbility testAbilityPrefab;

		public static Texture2D testAbilityTex;

		public static Sprite testSprite;

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

		public static bool hasDied = false;

		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)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin AbilityApi is loaded!");
			Harmony val = new Harmony("com.David_Loves_JellyCar_Worlds.AbilityApi");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"harmony created");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"AbilityApi Patch Complete!");
			new Harmony("AbilityApi").PatchAll(Assembly.GetExecutingAssembly());
			directoryToModFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			BackroundSprites.Add(Api.LoadImageFromResources("Ability_Api", "BlueTeam.png"));
			BackroundSprites.Add(Api.LoadImageFromResources("Ability_Api", "OrangeTeam.png"));
			BackroundSprites.Add(Api.LoadImageFromResources("Ability_Api", "GreenTeam.png"));
			BackroundSprites.Add(Api.LoadImageFromResources("Ability_Api", "PinkTeam.png"));
			GameObject[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
			GameObject[] array2 = array;
			GameObject[] array3 = array2;
			foreach (GameObject val2 in array3)
			{
				if (((Object)val2).name == "Bow")
				{
					BowObject = val2;
					break;
				}
			}
			Component component = BowObject.GetComponent(typeof(BowTransform));
			BowTransform obj = (BowTransform)((component is BowTransform) ? component : null);
			Arrow = (BoplBody)AccessTools.Field(typeof(BowTransform), "Arrow").GetValue(obj);
		}
	}
}