Decompiled source of Gatling Run v1.3.0

plugins/GatlingRun.dll

Decompiled 6 days ago
using System;
using System.Collections;
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.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using Dungeonator;
using GatlingRun;
using GungeonAPI;
using ItemAPI;
using Mod;
using MonoMod.RuntimeDetour;
using Pathfinding;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod")]
[assembly: AssemblyCopyright("Copyright ©  2020")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("57445610-0892-47c3-be16-453172104123")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Mod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("somebunny.etg.gatlingrun", "Gatling Run", "1.3.0")]
	public class GullModule : BaseUnityPlugin
	{
		public const string GUID = "somebunny.etg.gatlingrun";

		public const string NAME = "Gatling Run";

		public const string VERSION = "1.3.0";

		public const string TEXT_COLOR = "#c73800";

		public static AIActor FakeGull_Static;

		public static AIActor ExtantFakeGull_Static;

		private static GameObject vfx;

		public static bool Enabled = false;

		private static RoomHandler lastEnteredRoom;

		public static Coroutine coroutine;

		public static List<AIActor> Gulls = new List<AIActor>();

		public void Start()
		{
			ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
		}

		public void GMStart(GameManager g)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			ConfigSetup.configurationFile = ((BaseUnityPlugin)this).Config;
			Hooks.Init();
			SmiteGull.Init();
			ShrineFactory.Init();
			ShrineFakePrefabHooks.Init();
			Dumbbells.Add();
			AIActor orLoadByGuid = EnemyDatabase.GetOrLoadByGuid("ec6b674e0acd4553b47ee94493d66422");
			AIActor component = Object.Instantiate<GameObject>(((Component)orLoadByGuid).gameObject).GetComponent<AIActor>();
			Object.DontDestroyOnLoad((Object)(object)((Component)component).gameObject);
			FakePrefab.MarkAsFakePrefab(((Component)component).gameObject);
			((BraveBehaviour)component).healthHaver.IsVulnerable = false;
			((BraveBehaviour)component).healthHaver.AllDamageMultiplier = 0f;
			((BraveBehaviour)component).healthHaver.bossHealthBar = (BossBarType)0;
			component.IgnoreForRoomClear = true;
			GatlingGullIntroDoer component2 = ((Component)component).gameObject.GetComponent<GatlingGullIntroDoer>();
			Object.Destroy((Object)(object)component2);
			GatlingGullDeathController component3 = ((Component)component).gameObject.GetComponent<GatlingGullDeathController>();
			Object.Destroy((Object)(object)component3);
			((BraveBehaviour)component).behaviorSpeculator.AttackBehaviorGroup.AttackBehaviors[5].Probability = 0f;
			AttackBehaviorBase behavior = ((BraveBehaviour)component).behaviorSpeculator.AttackBehaviorGroup.AttackBehaviors[4].Behavior;
			GatlingGullLeapBehavior val = (GatlingGullLeapBehavior)(object)((behavior is GatlingGullLeapBehavior) ? behavior : null);
			((BasicAttackBehavior)val).RequiresLineOfSight = false;
			((BasicAttackBehavior)val).Range = 1000f;
			((Component)component).gameObject.AddComponent<GullPitDeathController>();
			FakeGull_Static = component;
			ETGModConsole.Commands.AddGroup("gtr", (Action<string[]>)delegate
			{
			});
			ETGModConsole.Commands.GetGroup("gtr").AddUnit("smite", (Action<string[]>)Smite);
			ETGModConsole.Commands.GetGroup("gtr").AddUnit("spawngull", (Action<string[]>)Spawn);
			ETGModConsole.Commands.GetGroup("gtr").AddUnit("toggle_gatlingrun", (Action<string[]>)ToggleGatlingRun);
			GameObject skyRocket = ((Component)EnemyDatabase.GetOrLoadByGuid("05b8afe0b6cc4fffa9dc6036fa24c8ec")).GetComponent<DraGunController>().skyRocket;
			Component[] componentsInChildren = skyRocket.GetComponentsInChildren(typeof(Component));
			foreach (Component val2 in componentsInChildren)
			{
				SkyRocket val3 = (SkyRocket)(object)((val2 is SkyRocket) ? val2 : null);
				if (val3 != null)
				{
					vfx = val3.LandingTargetSprite;
				}
			}
			Hooks.OnPostDungeonGeneration += LevelLoaded;
			Log("Gatling Run v1.3.0 started successfully.", "#c73800");
		}

		private void LevelLoaded()
		{
			ExtantFakeGull_Static = null;
			lastEnteredRoom = null;
		}

		public void Update()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			if (!Enabled)
			{
				return;
			}
			PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer;
			Dungeon dungeon = GameManager.Instance.Dungeon;
			if ((Object)(object)bestActivePlayer != (Object)null && (Object)(object)dungeon != (Object)null && (int)dungeon.LevelOverrideType != 1 && lastEnteredRoom != bestActivePlayer.CurrentRoom)
			{
				lastEnteredRoom = bestActivePlayer.CurrentRoom;
				if (lastEnteredRoom != null && lastEnteredRoom != dungeon.data.Entrance && (Object)(object)ExtantFakeGull_Static == (Object)null)
				{
					SpawnWithDelay();
				}
			}
		}

		private void ToggleGatlingRun(string[] obj)
		{
			Enabled = !Enabled;
			string text = (Enabled ? "enabled." : "disabled.");
			Log("Gatling Run is now: " + text, "#c73800");
		}

		public void SpawnWithDelay()
		{
			if (coroutine == null)
			{
				coroutine = ((MonoBehaviour)GameManager.Instance).StartCoroutine(DelayedSpawn(2f));
			}
		}

		public static IEnumerator DelayedSpawn(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)GameManager.Instance.PrimaryPlayer != (Object)null)
			{
				RoomHandler absoluteRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom;
				IntVector2? randomAvailableCell = absoluteRoom.GetRandomAvailableCell((IntVector2?)(IntVector2.One * 4), (CellTypes?)(CellTypes)2, false, (CellValidator)null);
				IntVector2? intVector = ((!randomAvailableCell.HasValue) ? null : new IntVector2?(randomAvailableCell.GetValueOrDefault() + IntVector2.One));
				GameObject obj = vfx;
				IntVector2 value = intVector.Value;
				GameObject eff = Object.Instantiate<GameObject>(obj, ((IntVector2)(ref value)).ToCenterVector3(0f), Quaternion.identity);
				tk2dSpriteAnimator component2 = eff.GetComponent<tk2dSpriteAnimator>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.ignoreTimeScale = true;
					component2.AlwaysIgnoreTimeScale = true;
					component2.AnimateDuringBossIntros = true;
					component2.alwaysUpdateOffscreen = true;
					component2.playAutomatically = true;
				}
				Object.Destroy((Object)(object)eff, 2f);
				yield return (object)new WaitForSeconds(1.75f);
				AIActor aiactor = (ExtantFakeGull_Static = AIActor.Spawn(FakeGull_Static, intVector.Value, GameManager.Instance.PrimaryPlayer.CurrentRoom, true, (AwakenAnimationType)1, true));
				((Component)aiactor).gameObject.SetActive(true);
				((BraveBehaviour)aiactor).healthHaver.IsVulnerable = false;
				((BraveBehaviour)aiactor).healthHaver.AllDamageMultiplier = 0f;
				aiactor.CollisionDamage = 0f;
				((GameActor)aiactor).SetResistance((EffectResistanceType)0, 1f);
				((GameActor)aiactor).SetResistance((EffectResistanceType)4, 1f);
				((GameActor)aiactor).SetResistance((EffectResistanceType)2, 1f);
				((GameActor)aiactor).SetResistance((EffectResistanceType)1, 1f);
				((GameActor)aiactor).SetResistance((EffectResistanceType)3, 0.7f);
				GullNeutalizer t = ((Component)aiactor).gameObject.AddComponent<GullNeutalizer>();
				t.GullCel = aiactor;
				((BraveBehaviour)aiactor).aiAnimator.PlayUntilFinished("land", false, (string)null, -1f, false);
				Gulls.Add(aiactor);
				AkSoundEngine.PostEvent("Play_ANM_Gull_Descend_01", ((Component)aiactor).gameObject);
				yield return (object)new WaitForSeconds(1f);
				if (ConfigSetup.CanBeJammed != null && !ConfigSetup.CanBeJammed.Value && aiactor.IsBlackPhantom)
				{
					aiactor.UnbecomeBlackPhantom();
				}
				((MonoBehaviour)GameManager.Instance).StartCoroutine(GullingTime(aiactor));
				coroutine = null;
			}
			else
			{
				Debug.Log((object)"Cannot spawn Gull because player is NULL!");
			}
		}

		private void Spawn(string[] obj)
		{
			//IL_002a: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			if ((Object)(object)GameManager.Instance.PrimaryPlayer != (Object)null)
			{
				RoomHandler currentRoom = GameManager.Instance.PrimaryPlayer.CurrentRoom;
				IntVector2? randomAvailableCell = currentRoom.GetRandomAvailableCell((IntVector2?)(IntVector2.One * 4), (CellTypes?)(CellTypes)2, false, (CellValidator)null);
				IntVector2? val = ((!randomAvailableCell.HasValue) ? null : new IntVector2?(randomAvailableCell.GetValueOrDefault() + IntVector2.One));
				AIActor val2 = AIActor.Spawn(FakeGull_Static, val.Value, GameManager.Instance.PrimaryPlayer.CurrentRoom, true, (AwakenAnimationType)1, true);
				((Component)val2).gameObject.SetActive(true);
				((BraveBehaviour)val2).healthHaver.IsVulnerable = false;
				((BraveBehaviour)val2).healthHaver.AllDamageMultiplier = 0f;
				val2.CollisionDamage = 0f;
				((GameActor)val2).SetResistance((EffectResistanceType)0, 1f);
				((GameActor)val2).SetResistance((EffectResistanceType)4, 1f);
				((GameActor)val2).SetResistance((EffectResistanceType)2, 1f);
				((GameActor)val2).SetResistance((EffectResistanceType)1, 1f);
				((GameActor)val2).SetResistance((EffectResistanceType)3, 0.7f);
				GullNeutalizer gullNeutalizer = ((Component)val2).gameObject.AddComponent<GullNeutalizer>();
				gullNeutalizer.GullCel = val2;
				if (ConfigSetup.CanBeJammed != null && !ConfigSetup.CanBeJammed.Value && val2.IsBlackPhantom)
				{
					val2.UnbecomeBlackPhantom();
				}
				Gulls.Add(val2);
				((BraveBehaviour)val2).aiAnimator.PlayUntilFinished("land", false, (string)null, -1f, false);
				AkSoundEngine.PostEvent("Play_ANM_Gull_Descend_01", ((Component)val2).gameObject);
				((MonoBehaviour)GameManager.Instance).StartCoroutine(GullingTime(val2));
			}
			else
			{
				Debug.Log((object)"Cannot spawn Gull because player is NULL!");
			}
		}

		private void Smite(string[] obj)
		{
			if (Gulls.Count == 0)
			{
				ETGModConsole.Log((object)"No Gulls to smite.", false);
				return;
			}
			ETGModConsole.Log((object)"Smited all Gulls.", false);
			foreach (AIActor gull in Gulls)
			{
				if ((Object)(object)gull != (Object)null)
				{
					gull.ExecuteTheGuy();
				}
			}
			Gulls.Clear();
		}

		public static IEnumerator GullingTime(AIActor gull)
		{
			((BraveBehaviour)gull).aiAnimator.PlayUntilFinished("smug", false, (string)null, -1f, false);
			((Behaviour)((BraveBehaviour)gull).behaviorSpeculator).enabled = true;
			gull.State = (ActorState)2;
			yield break;
		}

		public static void Log(string text, string color = "FFFFFF")
		{
			ETGModConsole.Log((object)("<color=" + color + ">" + text + "</color>"), false);
		}
	}
}
namespace GatlingRun
{
	public class ConfigSetup
	{
		public static ConfigEntry<bool> Enabled;

		public static ConfigEntry<bool> CanBeJammed;

		public static ConfigFile configurationFile;

		public static void Init()
		{
			CreateConfig(configurationFile);
		}

		public static void CreateConfig(ConfigFile config)
		{
			Enabled = config.Bind<bool>("Gatling Run:", "Enabled", false, "Is Enabled OR Not.");
			CanBeJammed = config.Bind<bool>("Gatling Run:", "Can Be Jammed", false, "Dictates whether the Gatling Gull can spawn Jammed.");
		}
	}
	public class DubbellTextController : MonoBehaviour
	{
		private SimpleShrine self;

		public void Start()
		{
			self = ((Component)this).GetComponent<SimpleShrine>();
		}

		public void Update()
		{
			if ((Object)(object)self != (Object)null)
			{
				self.text = (GullModule.Enabled ? "A rack of dumbbells. Someone with a death wish seems to have displaced a dumbbell." : "A rack of dumbbells. On the side is carved 'PROPERTY OF GATLING GULL. DO NOT TOUCH'.");
				self.acceptText = (GullModule.Enabled ? "Put the dumbbell back." : "Displace a dumbbell from the rack");
				self.declineText = (GullModule.Enabled ? "Leave it be." : "Leave.");
			}
		}
	}
	public static class Dumbbells
	{
		private static int DisabledID;

		private static int EnabledID;

		public static void Add()
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			ShrineFactory shrineFactory = new ShrineFactory();
			shrineFactory.name = "Dumbbell";
			shrineFactory.modID = "gtr";
			shrineFactory.text = "A rack of dumbbells. On the side is carved 'PROPERTY OF GATLING GULL. DO NOT TOUCH'.";
			shrineFactory.spritePath = "GatlingRun/Resources/weight_1.png";
			shrineFactory.acceptText = "Displace a dumbbell from the rack.";
			shrineFactory.declineText = "Leave.";
			shrineFactory.OnAccept = Accept;
			shrineFactory.OnDecline = null;
			shrineFactory.offset = new Vector3(45f, 43.8125f, 42.3125f);
			shrineFactory.talkPointOffset = new Vector3(5f, 2f, 0f);
			shrineFactory.isToggle = false;
			shrineFactory.isBreachShrine = true;
			shrineFactory.AdditionalComponent = typeof(DubbellTextController);
			shrineFactory.shadowPath = "GatlingRun/Resources/shadow.png";
			shrineFactory.ShadowOffsetX = -0.25f;
			shrineFactory.ShadowOffsetY = -0.25f;
			ShrineFactory shrineFactory2 = shrineFactory;
			GameObject val = shrineFactory2.Build();
			SpriteBuilder.AddSpriteToCollection("GatlingRun/Resources/kill_me.png", SpriteBuilder.ammonomiconCollection);
			DisabledID = SpriteBuilder.AddSpriteToCollection("GatlingRun/Resources/weight_1.png", val.GetComponent<tk2dBaseSprite>().Collection);
			EnabledID = SpriteBuilder.AddSpriteToCollection("GatlingRun/Resources/weight_2.png", val.GetComponent<tk2dBaseSprite>().Collection);
		}

		public static void Accept(PlayerController player, GameObject shrine)
		{
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00ab: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			GullModule.Enabled = !GullModule.Enabled;
			shrine.GetComponent<tk2dBaseSprite>().SetSprite(GullModule.Enabled ? EnabledID : DisabledID);
			Notify("GATLING RUN IS NOW", GullModule.Enabled ? "ENABLED." : "DISABLED.");
			GameObject val = (GameObject)Object.Instantiate(ResourceCache.Acquire("Global VFX/VFX_Synergy_Poof_001"), Vector2.op_Implicit(GullModule.Enabled ? shrine.GetComponent<tk2dBaseSprite>().WorldBottomLeft : shrine.GetComponent<tk2dBaseSprite>().WorldCenter), Quaternion.identity);
			tk2dBaseSprite component = val.GetComponent<tk2dBaseSprite>();
			component.PlaceAtPositionByAnchor(Vector2.op_Implicit(GullModule.Enabled ? shrine.GetComponent<tk2dBaseSprite>().WorldBottomLeft : shrine.GetComponent<tk2dBaseSprite>().WorldCenter), (Anchor)4);
			component.HeightOffGround = 35f;
			component.UpdateZDepth();
			tk2dSpriteAnimator component2 = ((Component)component).GetComponent<tk2dSpriteAnimator>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.playAutomatically = true;
				((BraveBehaviour)component2).sprite.usesOverrideMaterial = true;
				((BraveBehaviour)((BraveBehaviour)component2).sprite).renderer.material.shader = ShaderCache.Acquire("Brave/LitTk2dCustomFalloffTintableTiltedCutoutEmissive");
				((BraveBehaviour)((BraveBehaviour)component2).sprite).renderer.material.EnableKeyword("BRIGHTNESS_CLAMP_ON");
				((BraveBehaviour)((BraveBehaviour)component2).sprite).renderer.material.SetFloat("_EmissivePower", 1f);
				((BraveBehaviour)((BraveBehaviour)component2).sprite).renderer.material.SetFloat("_EmissiveColorPower", 0.1f);
				((BraveBehaviour)((BraveBehaviour)component2).sprite).renderer.material.SetColor("_OverrideColor", Color.gray);
				((BraveBehaviour)((BraveBehaviour)component2).sprite).renderer.material.SetColor("_EmissiveColor", Color.gray);
			}
			AkSoundEngine.PostEvent("Play_WPN_seriouscannon_impact_01", shrine);
			Object.Destroy((Object)(object)val, 1.5f);
			if (GullModule.Enabled)
			{
				AkSoundEngine.PostEvent("Play_ANM_Gull_Flex_01", shrine);
			}
		}

		private static void Notify(string header, string text)
		{
			tk2dSpriteCollectionData encounterIconCollection = AmmonomiconController.Instance.EncounterIconCollection;
			int spriteIdByName = encounterIconCollection.GetSpriteIdByName("GatlingRun/Resources/kill_me");
			GameUIRoot.Instance.notificationController.DoCustomNotification(header, text, encounterIconCollection, spriteIdByName, (NotificationColor)1, false, false);
		}
	}
	public class GullPitDeathController : BraveBehaviour
	{
		private bool IsUndertaling = false;

		public float minDistFromPlayer = 4f;

		public float radius = 15f;

		public void Start()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			((BraveBehaviour)this).aiActor.CustomPitDeathHandling += new CustomPitHandlingDelegate(CustomPitDeathHandling);
		}

		public void Update()
		{
			if (((GameActor)((BraveBehaviour)this).aiActor).IsFalling && ((Behaviour)((BraveBehaviour)this).behaviorSpeculator).enabled)
			{
				((BraveBehaviour)this).behaviorSpeculator.InterruptAndDisable();
			}
		}

		private void CustomPitDeathHandling(AIActor actor, ref bool suppressDeath)
		{
			suppressDeath = true;
			TileSpriteClipper[] componentsInChildren = ((Component)this).GetComponentsInChildren<TileSpriteClipper>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				Object.Destroy((Object)(object)componentsInChildren[i]);
			}
			if (!IsUndertaling)
			{
				IsUndertaling = true;
				((GameActor)((BraveBehaviour)this).aiActor).RecoverFromFall();
				((MonoBehaviour)this).StartCoroutine(RegenerateFromNothingCR());
			}
		}

		private IEnumerator RegenerateFromNothingCR()
		{
			ETGModConsole.Log((object)1, false);
			((BraveBehaviour)this).behaviorSpeculator.InterruptAndDisable();
			((BraveBehaviour)this).aiActor.ClearPath();
			((BraveBehaviour)this).knockbackDoer.SetImmobile(true, "ShelletonRespawnController");
			((BraveBehaviour)this).aiAnimator.PlayUntilFinished("leap", false, (string)null, -1f, false);
			yield return (object)new WaitForSeconds(0.5f);
			if (((GameActor)((BraveBehaviour)this).aiActor).HasShadow && Object.op_Implicit((Object)(object)((GameActor)((BraveBehaviour)this).aiActor).ShadowObject))
			{
				((GameActor)((BraveBehaviour)this).aiActor).ShadowObject.GetComponent<Renderer>().enabled = false;
			}
			Reposition();
			((BraveBehaviour)((BraveBehaviour)this).aiActor).renderer.enabled = false;
			((BraveBehaviour)this).aiActor.SetOutlines(false);
			yield return (object)new WaitForSeconds(0.125f);
			((BraveBehaviour)this).aiAnimator.PlayUntilFinished("land", false, (string)null, -1f, false);
			((BraveBehaviour)((BraveBehaviour)this).aiActor).renderer.enabled = true;
			((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.Reinitialize();
			((GameActor)((BraveBehaviour)this).aiActor).RecoverFromFall();
			((BraveBehaviour)this).aiAnimator.Start();
			yield return (object)new WaitForSeconds(0.5f);
			((Behaviour)((BraveBehaviour)this).behaviorSpeculator).enabled = true;
			((Behaviour)((BraveBehaviour)this).aiAnimator).enabled = true;
			IsUndertaling = false;
		}

		private void Reposition()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Invalid comparison between Unknown and I4
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_01e0: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = Vector2.op_Implicit(BraveUtility.ViewportToWorldpoint(new Vector2(0f, 0f), (ViewportType)1));
			Vector2 val2 = Vector2.op_Implicit(BraveUtility.ViewportToWorldpoint(new Vector2(1f, 1f), (ViewportType)1));
			IntVector2 bottomLeft = Vector2Extensions.ToIntVector2(val, (VectorConversions)1);
			IntVector2 topRight = Vector2Extensions.ToIntVector2(val2, (VectorConversions)0) - IntVector2.One;
			PlayerController bestActivePlayer = GameManager.Instance.BestActivePlayer;
			Vector2 playerLowerLeft = ((BraveBehaviour)bestActivePlayer).specRigidbody.HitboxPixelCollider.UnitBottomLeft;
			Vector2 playerUpperRight = ((BraveBehaviour)bestActivePlayer).specRigidbody.HitboxPixelCollider.UnitTopRight;
			bool hasOtherPlayer = false;
			Vector2 otherPlayerLowerLeft = Vector2.zero;
			Vector2 otherPlayerUpperRight = Vector2.zero;
			if ((int)GameManager.Instance.CurrentGameType == 1)
			{
				PlayerController otherPlayer = GameManager.Instance.GetOtherPlayer(bestActivePlayer);
				if (Object.op_Implicit((Object)(object)otherPlayer) && Object.op_Implicit((Object)(object)((BraveBehaviour)otherPlayer).healthHaver) && ((BraveBehaviour)otherPlayer).healthHaver.IsAlive)
				{
					hasOtherPlayer = true;
					otherPlayerLowerLeft = ((BraveBehaviour)otherPlayer).specRigidbody.HitboxPixelCollider.UnitBottomLeft;
					otherPlayerUpperRight = ((BraveBehaviour)otherPlayer).specRigidbody.HitboxPixelCollider.UnitTopRight;
				}
			}
			CellValidator val3 = (CellValidator)delegate(IntVector2 c)
			{
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cf: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: 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_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_015c: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0187: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				for (int i = 0; i < ((BraveBehaviour)this).aiActor.Clearance.x; i++)
				{
					for (int j = 0; j < ((BraveBehaviour)this).aiActor.Clearance.y; j++)
					{
						if (GameManager.Instance.Dungeon.data.isTopWall(c.x + i, c.y + j))
						{
							return false;
						}
					}
				}
				PixelCollider hitboxPixelCollider = ((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.HitboxPixelCollider;
				Vector2 val5 = default(Vector2);
				((Vector2)(ref val5))..ctor((float)c.x + 0.5f * ((float)((BraveBehaviour)this).aiActor.Clearance.x - hitboxPixelCollider.UnitWidth), (float)c.y);
				Vector2 val6 = val5 + hitboxPixelCollider.UnitDimensions;
				return BraveMathCollege.AABBDistanceSquared(val5, val6, playerLowerLeft, playerUpperRight) >= minDistFromPlayer && (!hasOtherPlayer || BraveMathCollege.AABBDistanceSquared(val5, val6, otherPlayerLowerLeft, otherPlayerUpperRight) >= minDistFromPlayer) && c.x >= bottomLeft.x && c.y >= bottomLeft.y && c.x + ((BraveBehaviour)this).aiActor.Clearance.x - 1 <= topRight.x && c.y + ((BraveBehaviour)this).aiActor.Clearance.y - 1 <= topRight.y;
			};
			Vector2 val4 = ((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.UnitCenter - Vector3Extensions.XY(((BraveBehaviour)((BraveBehaviour)this).aiActor).transform.position);
			IntVector2? randomAvailableCell = ((BraveBehaviour)this).aiActor.ParentRoom.GetRandomAvailableCell((IntVector2?)((BraveBehaviour)this).aiActor.Clearance, (CellTypes?)((BraveBehaviour)this).aiActor.PathableTiles, false, val3);
			if (randomAvailableCell.HasValue)
			{
				((BraveBehaviour)((BraveBehaviour)this).aiActor).transform.position = Vector2.op_Implicit(Pathfinder.GetClearanceOffset(randomAvailableCell.Value, ((BraveBehaviour)this).aiActor.Clearance) - val4);
				((BraveBehaviour)((BraveBehaviour)this).aiActor).specRigidbody.Reinitialize();
			}
			else
			{
				Debug.LogWarning((object)"TELEPORT FAILED!", (Object)(object)((BraveBehaviour)this).aiActor);
			}
		}
	}
	public static class FakePrefabHooks
	{
		public delegate TResult Func<T1, T2, T3, T4, T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);

		public static void Init()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Expected O, but got Unknown
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_0206: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Expected O, but got Unknown
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Expected O, but got Unknown
			Hook val = new Hook((MethodBase)typeof(PlayerController).GetMethod("AcquirePassiveItemPrefabDirectly"), typeof(FakePrefabHooks).GetMethod("AcquirePassiveItemPrefabDirectly"));
			Hook val2 = new Hook((MethodBase)typeof(PlayerItem).GetMethod("Pickup"), typeof(FakePrefabHooks).GetMethod("ActivePickup"));
			Hook val3 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[3]
			{
				typeof(Object),
				typeof(Transform),
				typeof(bool)
			}), typeof(FakePrefabHooks).GetMethod("InstantiateOPI"));
			Hook val4 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[2]
			{
				typeof(Object),
				typeof(Transform)
			}), typeof(FakePrefabHooks).GetMethod("InstantiateOP"));
			Hook val5 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[1] { typeof(Object) }), typeof(FakePrefabHooks).GetMethod("InstantiateO"));
			Hook val6 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[3]
			{
				typeof(Object),
				typeof(Vector3),
				typeof(Quaternion)
			}), typeof(FakePrefabHooks).GetMethod("InstantiateOPR"));
			Hook val7 = new Hook((MethodBase)typeof(Object).GetMethod("Instantiate", new Type[4]
			{
				typeof(Object),
				typeof(Vector3),
				typeof(Quaternion),
				typeof(Transform)
			}), typeof(FakePrefabHooks).GetMethod("InstantiateOPRP"));
			Hook val8 = new Hook((MethodBase)typeof(Object).GetMethod("orig_Instantiate", new Type[1] { typeof(Object) }), typeof(FakePrefabHooks).GetMethod("InstantiateO"));
		}

		public static void AcquirePassiveItemPrefabDirectly(Action<PlayerController, PassiveItem> orig, PlayerController self, PassiveItem item)
		{
			bool flag = FakePrefab.IsFakePrefab((Object)(object)((Component)item).gameObject);
			if (flag)
			{
				((Component)item).gameObject.SetActive(true);
			}
			orig(self, item);
			if (flag)
			{
				((Component)item).gameObject.SetActive(false);
			}
		}

		public static void ActivePickup(Action<PlayerItem, PlayerController> orig, PlayerItem self, PlayerController player)
		{
			bool flag = FakePrefab.IsFakePrefab((Object)(object)((Component)self).gameObject);
			if (flag)
			{
				((Component)self).gameObject.SetActive(true);
			}
			orig(self, player);
			if (flag)
			{
				((Component)self).gameObject.SetActive(false);
			}
		}

		public static Object InstantiateOPI(Func<Object, Transform, bool, Object> orig, Object original, Transform parent, bool instantiateInWorldSpace)
		{
			return FakePrefab.Instantiate(original, orig(original, parent, instantiateInWorldSpace));
		}

		public static Object InstantiateOP(Func<Object, Transform, Object> orig, Object original, Transform parent)
		{
			return FakePrefab.Instantiate(original, orig(original, parent));
		}

		public static Object InstantiateO(Func<Object, Object> orig, Object original)
		{
			return FakePrefab.Instantiate(original, orig(original));
		}

		public static Object InstantiateOPR(Func<Object, Vector3, Quaternion, Object> orig, Object original, Vector3 position, Quaternion rotation)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return FakePrefab.Instantiate(original, orig(original, position, rotation));
		}

		public static Object InstantiateOPRP(Func<Object, Vector3, Quaternion, Transform, Object> orig, Object original, Vector3 position, Quaternion rotation, Transform parent)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			return FakePrefab.Instantiate(original, orig(original, position, rotation, parent));
		}
	}
	public class FakePrefab : Component
	{
		internal static HashSet<GameObject> ExistingFakePrefabs = new HashSet<GameObject>();

		public static bool IsFakePrefab(Object o)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (o is GameObject)
			{
				return ExistingFakePrefabs.Contains((GameObject)o);
			}
			if (o is Component)
			{
				return ExistingFakePrefabs.Contains(((Component)o).gameObject);
			}
			return false;
		}

		public static void MarkAsFakePrefab(GameObject obj)
		{
			obj.SetActive(false);
			ExistingFakePrefabs.Add(obj);
			Object.DontDestroyOnLoad((Object)(object)obj);
		}

		public static GameObject Clone(GameObject obj)
		{
			bool flag = IsFakePrefab((Object)(object)obj);
			bool activeSelf = obj.activeSelf;
			if (activeSelf)
			{
				obj.SetActive(false);
			}
			GameObject val = Object.Instantiate<GameObject>(obj);
			if (activeSelf)
			{
				obj.SetActive(true);
			}
			ExistingFakePrefabs.Add(val);
			Object.DontDestroyOnLoad((Object)(object)val);
			return val;
		}

		public static Object Instantiate(Object o, Object new_o)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0022: 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_0057: Unknown result type (might be due to invalid IL or missing references)
			if (o is GameObject && ExistingFakePrefabs.Contains((GameObject)o))
			{
				((GameObject)new_o).SetActive(true);
			}
			else if (o is Component && ExistingFakePrefabs.Contains(((Component)o).gameObject))
			{
				((Component)new_o).gameObject.SetActive(true);
			}
			return new_o;
		}
	}
	public class GullNeutalizer : MonoBehaviour
	{
		public AIActor GullCel;

		private bool isPunch;

		public void Update()
		{
			if (isPunch != PunchoutController.IsActive)
			{
				isPunch = PunchoutController.IsActive;
				if (isPunch)
				{
					GullCel.LocalTimeScale = 0f;
				}
				else
				{
					GullCel.LocalTimeScale = 1f;
				}
			}
		}
	}
	public class Hooks
	{
		private static GameManager targetInstance;

		public static FieldInfo m_assignedFlow = typeof(LoopDungeonGenerator).GetField("m_assignedFlow", BindingFlags.Instance | BindingFlags.NonPublic);

		public static event Action OnPostDungeonGeneration;

		public static event Action OnFoyerAwake;

		public static event Action<LoopDungeonGenerator, Dungeon, DungeonFlow, int> OnPreDungeonGeneration;

		public static void Init()
		{
			//IL_0044: 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)
			new Hook((MethodBase)typeof(LoopDungeonGenerator).GetConstructor(new Type[2]
			{
				typeof(Dungeon),
				typeof(int)
			}), typeof(Hooks).GetMethod("LoopGenConstructor"));
			new Hook((MethodBase)typeof(MainMenuFoyerController).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic), typeof(Hooks).GetMethod("FoyerAwake"));
		}

		public static void FoyerAwake(Action<MainMenuFoyerController> orig, MainMenuFoyerController self)
		{
			orig(self);
			Hooks.OnFoyerAwake?.Invoke();
		}

		public static void LoopGenConstructor(Action<LoopDungeonGenerator, Dungeon, int> orig, LoopDungeonGenerator self, Dungeon dungeon, int dungeonSeed)
		{
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			orig(self, dungeon, dungeonSeed);
			if ((Object)(object)GameManager.Instance != (Object)null && (Object)(object)GameManager.Instance != (Object)(object)targetInstance)
			{
				targetInstance = GameManager.Instance;
				targetInstance.OnNewLevelFullyLoaded += OnLevelLoad;
			}
			DungeonFlow arg = (DungeonFlow)m_assignedFlow.GetValue(self);
			Hooks.OnPreDungeonGeneration?.Invoke(self, dungeon, arg, dungeonSeed);
			dungeon = null;
		}

		public static void OnLevelLoad()
		{
			Hooks.OnPostDungeonGeneration?.Invoke();
		}
	}
	public static class SmiteGull
	{
		public class MourningStarVFXController : BraveBehaviour
		{
			public Action<GameObject> OnBeamStart;

			public Action<GameObject, float> OnBeamUpdate;

			public Action<GameObject> OnBeamDie;

			private float TimeExtant;

			public bool DoesSound = true;

			public bool DoesEmbers = true;

			private bool isbeingTossed;

			public List<tk2dSprite> BeamSections;

			public tk2dSprite BurstSprite;

			public GameObject InitialImpactVFX;

			public string SectionStartAnimation;

			public string SectionAnimation;

			public string SectionEndAnimation;

			public string CapAnimation;

			public string CapEndAnimation;

			private float m_particleCounter;

			public static MourningStarVFXController SpawnMourningStar(Vector2 position, float lifeTime = -1f, Transform parent = null)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				MourningStarVFXController component = Object.Instantiate<GameObject>(MourningStarLaser, Vector2.op_Implicit(position), Quaternion.identity, parent).GetComponent<MourningStarVFXController>();
				if (lifeTime != -1f && lifeTime > 0f)
				{
					((MonoBehaviour)component).Invoke("Dissipate", lifeTime);
				}
				return component;
			}

			private void Start()
			{
				isbeingTossed = false;
				TimeExtant = 0f;
				for (int i = 0; i < BeamSections.Count; i++)
				{
					tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)BeamSections[i]).spriteAnimator;
					if (Object.op_Implicit((Object)(object)spriteAnimator))
					{
						spriteAnimator.alwaysUpdateOffscreen = true;
						spriteAnimator.PlayForDuration(SectionStartAnimation, -1f, SectionAnimation, false);
						if (DoesSound)
						{
							AkSoundEngine.PostEvent("Play_WPN_dawnhammer_loop_01", ((Component)this).gameObject);
							AkSoundEngine.PostEvent("Play_State_Volume_Lower_01", ((Component)this).gameObject);
						}
					}
				}
				if (OnBeamStart != null)
				{
					OnBeamStart(((Component)this).gameObject);
				}
				((BraveBehaviour)this).spriteAnimator.alwaysUpdateOffscreen = true;
				((tk2dBaseSprite)BurstSprite).UpdateZDepth();
				((BraveBehaviour)((BraveBehaviour)this).sprite).renderer.enabled = false;
			}

			public void Update()
			{
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Invalid comparison between Unknown and I4
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Invalid comparison between Unknown and I4
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e8: Invalid comparison between Unknown and I4
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Unknown result type (might be due to invalid IL or missing references)
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0142: Unknown result type (might be due to invalid IL or missing references)
				if (isbeingTossed)
				{
					return;
				}
				TimeExtant += BraveTime.DeltaTime;
				((BraveBehaviour)this).sprite.UpdateZDepth();
				for (int i = 0; i < BeamSections.Count; i++)
				{
					((tk2dBaseSprite)BeamSections[i]).UpdateZDepth();
				}
				((tk2dBaseSprite)BurstSprite).UpdateZDepth();
				if (!((BraveBehaviour)BurstSprite).renderer.enabled)
				{
					((BraveBehaviour)((BraveBehaviour)this).sprite).renderer.enabled = true;
					((BraveBehaviour)this).spriteAnimator.Play(CapAnimation);
				}
				if (DoesEmbers && ((int)GameManager.Options.ShaderQuality == 1 || (int)GameManager.Options.ShaderQuality == 2))
				{
					int num = (((int)GameManager.Options.ShaderQuality != 2) ? 50 : 125);
					m_particleCounter += BraveTime.DeltaTime * (float)num;
					if (m_particleCounter > 1f)
					{
						GlobalSparksDoer.DoRadialParticleBurst(Mathf.FloorToInt(m_particleCounter), Vector2.op_Implicit(((BraveBehaviour)this).sprite.WorldBottomLeft), Vector2.op_Implicit(((BraveBehaviour)this).sprite.WorldTopRight), 30f, 2f, 1f, (float?)null, (float?)null, (Color?)null, (SparksType)4);
						m_particleCounter %= 1f;
					}
				}
				if (OnBeamUpdate != null)
				{
					OnBeamUpdate(((Component)this).gameObject, TimeExtant);
				}
			}

			public void Dissipate()
			{
				isbeingTossed = true;
				if (OnBeamDie != null)
				{
					OnBeamDie(((Component)this).gameObject);
				}
				((BraveBehaviour)((BraveBehaviour)this).sprite).renderer.enabled = true;
				ParticleSystem componentInChildren = ((Component)this).GetComponentInChildren<ParticleSystem>();
				if (Object.op_Implicit((Object)(object)componentInChildren))
				{
					BraveUtility.EnableEmission(componentInChildren, false);
				}
				for (int i = 0; i < BeamSections.Count; i++)
				{
					((BraveBehaviour)BeamSections[i]).spriteAnimator.Play(SectionEndAnimation);
				}
				((BraveBehaviour)this).spriteAnimator.PlayAndDestroyObject(CapEndAnimation, (Action)null);
				Object.Destroy((Object)(object)((Component)this).gameObject, 1f);
				if (DoesSound)
				{
					AkSoundEngine.PostEvent("Stop_WPN_gun_loop_01", ((Component)this).gameObject);
					AkSoundEngine.PostEvent("Stop_State_Volume_Lower_01", ((Component)this).gameObject);
				}
			}

			public override void OnDestroy()
			{
				if (DoesSound)
				{
					AkSoundEngine.PostEvent("Stop_WPN_gun_loop_01", ((Component)this).gameObject);
					AkSoundEngine.PostEvent("Stop_State_Volume_Lower_01", ((Component)this).gameObject);
				}
				((BraveBehaviour)this).OnDestroy();
			}

			public float TimeAlive()
			{
				return TimeExtant;
			}
		}

		public static GameObject MourningStarLaser;

		public static void Init()
		{
			PickupObject byId = PickupObjectDatabase.GetById(515);
			MourningStarLaser = FakePrefab.Clone(((Gun)((byId is Gun) ? byId : null)).DefaultModule.projectiles[0].bleedEffect.vfxExplosion);
			MourningStarVFXController mourningStarVFXController = MourningStarLaser.AddComponent<MourningStarVFXController>();
			HammerOfDawnController component = MourningStarLaser.GetComponent<HammerOfDawnController>();
			mourningStarVFXController.BeamSections = component.BeamSections;
			mourningStarVFXController.BurstSprite = component.BurstSprite;
			mourningStarVFXController.SectionStartAnimation = component.SectionStartAnimation;
			mourningStarVFXController.SectionAnimation = component.SectionAnimation;
			mourningStarVFXController.SectionEndAnimation = component.SectionEndAnimation;
			mourningStarVFXController.CapAnimation = component.CapAnimation;
			mourningStarVFXController.CapEndAnimation = component.CapEndAnimation;
			mourningStarVFXController.InitialImpactVFX = component.InitialImpactVFX;
			Object.Destroy((Object)(object)component);
		}

		public static void ExecuteTheGuy(this AIActor EnemyBlessed)
		{
			//IL_0056: 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_00a1: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)EnemyBlessed == (Object)null)
			{
				return;
			}
			BehaviorSpeculator behaviorSpeculator = ((BraveBehaviour)EnemyBlessed).behaviorSpeculator;
			if (behaviorSpeculator != null)
			{
				behaviorSpeculator.Stun(1000f, false);
			}
			EnemyBlessed.MovementSpeed *= 0f;
			EnemyBlessed.LocalTimeScale *= 0f;
			MourningStarVFXController mourningStarVFXController = MourningStarVFXController.SpawnMourningStar(((BraveBehaviour)EnemyBlessed).sprite.WorldCenter);
			((Component)mourningStarVFXController).gameObject.SetActive(true);
			mourningStarVFXController.DoesSound = true;
			mourningStarVFXController.DoesEmbers = false;
			Shader val = ShaderCache.Acquire("Brave/LitCutoutUber");
			((tk2dBaseSprite)mourningStarVFXController.BurstSprite).usesOverrideMaterial = true;
			Material val2 = new Material(val);
			((tk2dBaseSprite)mourningStarVFXController.BurstSprite).SortingOrder = -2;
			val2.EnableKeyword("TINTING_ON");
			val2.mainTexture = ((BraveBehaviour)mourningStarVFXController.BurstSprite).renderer.material.mainTexture;
			val2.SetColor("_OverrideColor", new Color(5f, 5f, 5f, 1f));
			val2.SetTexture("_MainTexture", ((BraveBehaviour)mourningStarVFXController.BurstSprite).renderer.material.mainTexture);
			val2.SetFloat("_EmissivePower", 5f);
			((BraveBehaviour)mourningStarVFXController.BurstSprite).renderer.material = val2;
			((BraveBehaviour)mourningStarVFXController).sprite.SortingOrder = -2;
			((BraveBehaviour)mourningStarVFXController).sprite.usesOverrideMaterial = true;
			Material val3 = new Material(val);
			val3.mainTexture = ((BraveBehaviour)((BraveBehaviour)mourningStarVFXController).sprite).renderer.material.mainTexture;
			val3.EnableKeyword("TINTING_ON");
			val3.SetColor("_OverrideColor", new Color(5f, 5f, 5f, 1f));
			val3.SetTexture("_MainTexture", ((BraveBehaviour)((BraveBehaviour)mourningStarVFXController).sprite).renderer.material.mainTexture);
			val3.SetFloat("_EmissivePower", 5f);
			((BraveBehaviour)((BraveBehaviour)mourningStarVFXController).sprite).renderer.material = val3;
			for (int i = 0; i < mourningStarVFXController.BeamSections.Count; i++)
			{
				tk2dSpriteAnimator spriteAnimator = ((BraveBehaviour)mourningStarVFXController.BeamSections[i]).spriteAnimator;
				if (Object.op_Implicit((Object)(object)spriteAnimator))
				{
					((BraveBehaviour)spriteAnimator).sprite.SortingOrder = -2;
					((BraveBehaviour)spriteAnimator).sprite.usesOverrideMaterial = true;
					Material val4 = new Material(val);
					val4.mainTexture = ((BraveBehaviour)((BraveBehaviour)spriteAnimator).sprite).renderer.material.mainTexture;
					val4.EnableKeyword("TINTING_ON");
					val4.SetColor("_OverrideColor", new Color(5f, 5f, 5f, 1f));
					val4.SetTexture("_MainTexture", ((BraveBehaviour)((BraveBehaviour)spriteAnimator).sprite).renderer.material.mainTexture);
					val4.SetFloat("_EmissivePower", 5f);
					((BraveBehaviour)((BraveBehaviour)spriteAnimator).sprite).renderer.material = val4;
				}
			}
			((GameActor)EnemyBlessed).DeregisterOverrideColor("tint");
			((BraveBehaviour)((BraveBehaviour)EnemyBlessed).sprite).renderer.material.shader = Shader.Find("Brave/PlayerShaderEevee");
			((BraveBehaviour)((BraveBehaviour)EnemyBlessed).sprite).renderer.material.SetTexture("_EeveeTex", (Texture)null);
			((BraveBehaviour)((BraveBehaviour)EnemyBlessed).sprite).renderer.material.SetFloat("_StencilVal", 0f);
			((BraveBehaviour)((BraveBehaviour)EnemyBlessed).sprite).renderer.material.SetFloat("_FlatColor", 0f);
			((BraveBehaviour)((BraveBehaviour)EnemyBlessed).sprite).renderer.material.SetFloat("_Perpendicular", 0f);
			((MonoBehaviour)GameManager.Instance).StartCoroutine(DoKill(EnemyBlessed, mourningStarVFXController));
		}

		private static IEnumerator DoKill(AIActor EnemyBlessed, MourningStarVFXController mourningStarVFXController)
		{
			float e = 0f;
			Bounds bounds = ((BraveBehaviour)EnemyBlessed).sprite.GetBounds();
			_ = ((Bounds)(ref bounds)).size;
			Vector3 vec1 = ((BraveBehaviour)EnemyBlessed).transform.position;
			Vector2 vec2 = ((BraveBehaviour)EnemyBlessed).sprite.WorldBottomCenter;
			yield return (object)new WaitForSeconds(0.125f);
			while (e < 1f)
			{
				((BraveBehaviour)EnemyBlessed).transform.localScale = Vector3.Lerp(Vector3.one, new Vector3(0f, 3f), e);
				((BraveBehaviour)EnemyBlessed).sprite.SortingOrder = -1000;
				((BraveBehaviour)EnemyBlessed).sprite.HeightOffGround = Mathf.Lerp(2f, 20f, e);
				((BraveBehaviour)EnemyBlessed).transform.position = Vector3.Lerp(vec1, Vector2.op_Implicit(vec2), e);
				((BraveBehaviour)EnemyBlessed).specRigidbody.Reinitialize();
				e += Time.deltaTime * 2f;
				yield return null;
			}
			Object.Destroy((Object)(object)((Component)EnemyBlessed).gameObject);
			mourningStarVFXController.Dissipate();
		}
	}
}
namespace ItemAPI
{
	public static class ResourceExtractor
	{
		private static string spritesDirectory = Path.Combine(ETGMod.ResourcesDirectory, "sprites");

		public static List<Texture2D> GetTexturesFromDirectory(string directoryPath)
		{
			if (!Directory.Exists(directoryPath))
			{
				Tools.PrintError(directoryPath + " not found.");
				return null;
			}
			List<Texture2D> list = new List<Texture2D>();
			string[] files = Directory.GetFiles(directoryPath);
			foreach (string text in files)
			{
				if (text.EndsWith(".png"))
				{
					Texture2D item = BytesToTexture(File.ReadAllBytes(text), Path.GetFileName(text).Replace(".png", ""));
					list.Add(item);
				}
			}
			return list;
		}

		public static Texture2D GetTextureFromFile(string fileName, string extension = ".png")
		{
			fileName = fileName.Replace(extension, "");
			string text = Path.Combine(spritesDirectory, fileName + extension);
			if (!File.Exists(text))
			{
				Tools.PrintError(text + " not found.");
				return null;
			}
			return BytesToTexture(File.ReadAllBytes(text), fileName);
		}

		public static List<string> GetCollectionFiles()
		{
			List<string> list = new List<string>();
			string[] files = Directory.GetFiles(spritesDirectory);
			foreach (string text in files)
			{
				if (text.EndsWith(".png"))
				{
					list.Add(Path.GetFileName(text).Replace(".png", ""));
				}
			}
			return list;
		}

		public static Texture2D BytesToTexture(byte[] bytes, string resourceName)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, bytes);
			((Texture)val).filterMode = (FilterMode)0;
			((Object)val).name = resourceName;
			return val;
		}

		public static string[] GetLinesFromEmbeddedResource(string filePath)
		{
			string text = BytesToString(ExtractEmbeddedResource(filePath));
			return text.Split(new char[1] { '\n' });
		}

		public static string[] GetLinesFromFile(string filePath)
		{
			string text = BytesToString(File.ReadAllBytes(filePath));
			return text.Split(new char[1] { '\n' });
		}

		public static string BytesToString(byte[] bytes)
		{
			return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
		}

		public static List<string> GetResourceFolders()
		{
			List<string> list = new List<string>();
			string path = Path.Combine(ETGMod.ResourcesDirectory, "sprites");
			if (Directory.Exists(path))
			{
				string[] directories = Directory.GetDirectories(path);
				foreach (string path2 in directories)
				{
					list.Add(Path.GetFileName(path2));
				}
			}
			return list;
		}

		public static byte[] ExtractEmbeddedResource(string filePath)
		{
			filePath = filePath.Replace("/", ".");
			filePath = filePath.Replace("\\", ".");
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			using Stream stream = callingAssembly.GetManifestResourceStream(filePath);
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			stream.Read(array, 0, array.Length);
			return array;
		}

		public static Texture2D GetTextureFromResource(string resourceName)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			byte[] array = ExtractEmbeddedResource(resourceName);
			if (array == null)
			{
				Tools.PrintError("No bytes found in " + resourceName);
				return null;
			}
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			string text = resourceName.Substring(0, resourceName.LastIndexOf('.'));
			if (text.LastIndexOf('.') >= 0)
			{
				text = text.Substring(text.LastIndexOf('.') + 1);
			}
			((Object)val).name = text;
			return val;
		}

		public static Texture2D AnotherGetTextureFromResource(string resourceName)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			byte[] array = ExtractEmbeddedResource(resourceName);
			if (array == null)
			{
				Tools.PrintError("No bytes found in " + resourceName);
				return null;
			}
			Texture2D val = new Texture2D(1, 1, (TextureFormat)20, false);
			ImageConversion.LoadImage(val, array);
			((Texture)val).filterMode = (FilterMode)0;
			string text = resourceName.Substring(0, resourceName.LastIndexOf('.'));
			if (text.LastIndexOf('.') >= 0)
			{
				text = text.Substring(text.LastIndexOf('.') + 1);
			}
			((Object)val).name = text;
			return val;
		}

		public static string[] GetResourceNames()
		{
			Assembly callingAssembly = Assembly.GetCallingAssembly();
			string[] manifestResourceNames = callingAssembly.GetManifestResourceNames();
			if (manifestResourceNames == null)
			{
				ETGModConsole.Log((object)"No manifest resources found.", false);
				return null;
			}
			return manifestResourceNames;
		}
	}
	public static class SpriteBuilder
	{
		public static tk2dSpriteCollectionData itemCollection = ((BraveBehaviour)PickupObjectDatabase.GetById(155)).sprite.Collection;

		public static tk2dSpriteCollectionData ammonomiconCollection = AmmonomiconController.ForceInstance.EncounterIconCollection;

		private static tk2dSprite baseSprite = ((Component)PickupObjectDatabase.GetById(155)).GetComponent<tk2dSprite>();

		public static GameObject SpriteFromFile(string spriteName, GameObject obj = null)
		{
			string fileName = spriteName.Replace(".png", "");
			Texture2D textureFromFile = ResourceExtractor.GetTextureFromFile(fileName);
			if ((Object)(object)textureFromFile == (Object)null)
			{
				return null;
			}
			return SpriteFromTexture(textureFromFile, spriteName, obj);
		}

		public static GameObject SpriteFromResource(string spriteName, GameObject obj = null, bool v = false)
		{
			string text = ((!spriteName.EndsWith(".png")) ? ".png" : "");
			string text2 = spriteName + text;
			Texture2D textureFromResource = ResourceExtractor.GetTextureFromResource(text2);
			if ((Object)(object)textureFromResource == (Object)null)
			{
				return null;
			}
			return SpriteFromTexture(textureFromResource, text2, obj);
		}

		public static GameObject SpriteFromTexture(Texture2D texture, string spriteName, GameObject obj = null)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			if ((Object)(object)obj == (Object)null)
			{
				obj = new GameObject();
			}
			tk2dSprite val = obj.AddComponent<tk2dSprite>();
			int num = AddSpriteToCollection(spriteName, itemCollection);
			((tk2dBaseSprite)val).SetSprite(itemCollection, num);
			((tk2dBaseSprite)val).SortingOrder = 0;
			((tk2dBaseSprite)val).IsPerpendicular = true;
			obj.GetComponent<BraveBehaviour>().sprite = (tk2dBaseSprite)(object)val;
			return obj;
		}

		public static int AddSpriteToCollection(string resourcePath, tk2dSpriteCollectionData collection)
		{
			string text = ((!resourcePath.EndsWith(".png")) ? ".png" : "");
			resourcePath += text;
			Texture2D textureFromResource = ResourceExtractor.GetTextureFromResource(resourcePath);
			tk2dSpriteDefinition val = ConstructDefinition(textureFromResource);
			val.name = ((Object)textureFromResource).name;
			return AddSpriteToCollection(val, collection);
		}

		public static int AddSpriteToCollection(tk2dSpriteDefinition spriteDefinition, tk2dSpriteCollectionData collection)
		{
			tk2dSpriteDefinition[] spriteDefinitions = collection.spriteDefinitions;
			tk2dSpriteDefinition[] array = (collection.spriteDefinitions = spriteDefinitions.Concat((IEnumerable<tk2dSpriteDefinition>)(object)new tk2dSpriteDefinition[1] { spriteDefinition }).ToArray());
			FieldInfo field = typeof(tk2dSpriteCollectionData).GetField("spriteNameLookupDict", BindingFlags.Instance | BindingFlags.NonPublic);
			field.SetValue(collection, null);
			collection.InitDictionary();
			return array.Length - 1;
		}

		public static int AddSpriteToCollectionFromOtherCollection(tk2dSpriteDefinition spriteDefinition, tk2dSpriteCollectionData collectionToTakeFrom, tk2dSpriteCollectionData collection)
		{
			tk2dSpriteDefinition[] spriteDefinitions = collectionToTakeFrom.spriteDefinitions;
			tk2dSpriteDefinition[] array = (collection.spriteDefinitions = spriteDefinitions.Concat((IEnumerable<tk2dSpriteDefinition>)(object)new tk2dSpriteDefinition[1] { spriteDefinition }).ToArray());
			FieldInfo field = typeof(tk2dSpriteCollectionData).GetField("spriteNameLookupDict", BindingFlags.Instance | BindingFlags.NonPublic);
			field.SetValue(collection, null);
			collection.InitDictionary();
			return array.Length - 1;
		}

		public static int AddToAmmonomicon(tk2dSpriteDefinition spriteDefinition)
		{
			return AddSpriteToCollection(spriteDefinition, ammonomiconCollection);
		}

		public static tk2dSpriteAnimationClip AddAnimation(tk2dSpriteAnimator animator, tk2dSpriteCollectionData collection, List<int> spriteIDs, string clipName, WrapMode wrapMode = 1)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if ((Object)(object)animator.Library == (Object)null)
			{
				animator.Library = ((Component)animator).gameObject.AddComponent<tk2dSpriteAnimation>();
				animator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0];
				((Behaviour)animator.Library).enabled = true;
			}
			List<tk2dSpriteAnimationFrame> list = new List<tk2dSpriteAnimationFrame>();
			for (int i = 0; i < spriteIDs.Count; i++)
			{
				tk2dSpriteDefinition val = collection.spriteDefinitions[spriteIDs[i]];
				if (val.Valid)
				{
					list.Add(new tk2dSpriteAnimationFrame
					{
						spriteCollection = collection,
						spriteId = spriteIDs[i]
					});
				}
			}
			tk2dSpriteAnimationClip val2 = new tk2dSpriteAnimationClip();
			val2.name = clipName;
			val2.fps = 15f;
			val2.wrapMode = wrapMode;
			Array.Resize(ref animator.Library.clips, animator.Library.clips.Length + 1);
			animator.Library.clips[animator.Library.clips.Length - 1] = val2;
			val2.frames = list.ToArray();
			return val2;
		}

		public static tk2dSpriteAnimationClip AddAnimationDebug(tk2dSpriteAnimator animator, tk2dSpriteCollectionData collection, List<int> spriteIDs, string clipName, WrapMode wrapMode = 1)
		{
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_0203: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Expected O, but got Unknown
			ETGModConsole.Log((object)"Starting null checks", false);
			if ((Object)(object)animator == (Object)null)
			{
				ETGModConsole.Log((object)"animator is NULL.", false);
			}
			if ((Object)(object)collection == (Object)null)
			{
				ETGModConsole.Log((object)"collection is NULL.", false);
			}
			if (spriteIDs == null)
			{
				ETGModConsole.Log((object)"spriteIDs List is NULL.", false);
			}
			if (clipName == null)
			{
				ETGModConsole.Log((object)"clipName is NULL.", false);
			}
			ETGModConsole.Log((object)("Starting AddAnimation of clip name: " + clipName), false);
			if ((Object)(object)animator.Library == (Object)null)
			{
				ETGModConsole.Log((object)"Library is NULL, constructing new one.", false);
				animator.Library = ((Component)animator).gameObject.AddComponent<tk2dSpriteAnimation>();
				animator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0];
				((Behaviour)animator.Library).enabled = true;
				ETGModConsole.Log((object)"Library created.", false);
			}
			ETGModConsole.Log((object)"Starting to add frames.", false);
			List<tk2dSpriteAnimationFrame> list = new List<tk2dSpriteAnimationFrame>();
			ETGModConsole.Log((object)"Created new List<tk2dSpriteAnimationFrame>", false);
			for (int i = 0; i < spriteIDs.Count; i++)
			{
				tk2dSpriteDefinition val = collection.spriteDefinitions[spriteIDs[i]];
				if (collection.spriteDefinitions == null)
				{
					ETGModConsole.Log((object)"collection.spriteDefinitions is NULL.", false);
				}
				if (val == null)
				{
					ETGModConsole.Log((object)("Frame " + i + "is NULL."), false);
				}
				if (val.Valid)
				{
					if ((Object)(object)collection == (Object)null)
					{
						ETGModConsole.Log((object)"collection is NULL.", false);
					}
					list.Add(new tk2dSpriteAnimationFrame
					{
						spriteCollection = collection,
						spriteId = spriteIDs[i]
					});
				}
				ETGModConsole.Log((object)("Frame " + i + "of animation added"), false);
			}
			ETGModConsole.Log((object)"Creating new clip", false);
			tk2dSpriteAnimationClip val2 = new tk2dSpriteAnimationClip();
			val2.name = clipName;
			val2.fps = 15f;
			val2.wrapMode = wrapMode;
			Array.Resize(ref animator.Library.clips, animator.Library.clips.Length + 1);
			animator.Library.clips[animator.Library.clips.Length - 1] = val2;
			ETGModConsole.Log((object)"Adding frames", false);
			val2.frames = list.ToArray();
			ETGModConsole.Log((object)"Finsihed adding frames, returning CLIP", false);
			return val2;
		}

		public static tk2dSpriteAnimationClip AddAnimation(tk2dSpriteAnimator targetAnimator, tk2dSpriteCollectionData collection, List<string> spriteNameList, string clipName, WrapMode wrapMode = 2, int frameRate = 15, int loopStart = 0, float minFidgetDuration = 0.5f, float maxFidgetDuration = 1f)
		{
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)targetAnimator.Library))
			{
				targetAnimator.Library = ((Component)targetAnimator).gameObject.AddComponent<tk2dSpriteAnimation>();
				targetAnimator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0];
			}
			List<tk2dSpriteAnimationFrame> list = new List<tk2dSpriteAnimationFrame>();
			for (int i = 0; i < spriteNameList.Count; i++)
			{
				tk2dSpriteDefinition spriteDefinition = collection.GetSpriteDefinition(spriteNameList[i]);
				if (spriteDefinition != null && spriteDefinition.Valid)
				{
					list.Add(new tk2dSpriteAnimationFrame
					{
						spriteCollection = collection,
						spriteId = collection.GetSpriteIdByName(spriteNameList[i]),
						invulnerableFrame = false,
						groundedFrame = true,
						requiresOffscreenUpdate = false,
						eventAudio = string.Empty,
						eventVfx = string.Empty,
						eventStopVfx = string.Empty,
						eventLerpEmissive = false,
						eventLerpEmissiveTime = 0.5f,
						eventLerpEmissivePower = 30f,
						forceMaterialUpdate = false,
						finishedSpawning = false,
						triggerEvent = false,
						eventInfo = string.Empty,
						eventInt = 0,
						eventFloat = 0f,
						eventOutline = (OutlineModifier)0
					});
				}
			}
			if (list.Count <= 0)
			{
				ETGModConsole.Log((object)"[ExpandTheGungeon] AddAnimation: ERROR! Animation list is empty! No valid sprites found in specified list!", false);
				return null;
			}
			tk2dSpriteAnimationClip val = new tk2dSpriteAnimationClip
			{
				name = clipName,
				frames = list.ToArray(),
				fps = frameRate,
				wrapMode = wrapMode,
				loopStart = loopStart,
				minFidgetDuration = minFidgetDuration,
				maxFidgetDuration = maxFidgetDuration
			};
			Array.Resize(ref targetAnimator.Library.clips, targetAnimator.Library.clips.Length + 1);
			targetAnimator.Library.clips[targetAnimator.Library.clips.Length - 1] = val;
			return val;
		}

		public static tk2dSpriteAnimationClip AddAnimationDebug(tk2dSpriteAnimator animator, tk2dSpriteCollectionData collection, List<int> spriteIDs, string clipName, WrapMode wrapMode = 1, bool Debug = false)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if ((Object)(object)animator.Library == (Object)null)
			{
				animator.Library = ((Component)animator).gameObject.AddComponent<tk2dSpriteAnimation>();
				animator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0];
				((Behaviour)animator.Library).enabled = true;
			}
			List<tk2dSpriteAnimationFrame> list = new List<tk2dSpriteAnimationFrame>();
			for (int i = 0; i < spriteIDs.Count; i++)
			{
				tk2dSpriteDefinition val = collection.spriteDefinitions[spriteIDs[i]];
				if (val.Valid)
				{
					list.Add(new tk2dSpriteAnimationFrame
					{
						spriteCollection = collection,
						spriteId = spriteIDs[i]
					});
				}
			}
			tk2dSpriteAnimationClip val2 = new tk2dSpriteAnimationClip();
			val2.name = clipName;
			val2.fps = 15f;
			val2.wrapMode = wrapMode;
			Array.Resize(ref animator.Library.clips, animator.Library.clips.Length + 1);
			animator.Library.clips[animator.Library.clips.Length - 1] = val2;
			val2.frames = list.ToArray();
			return val2;
		}

		public static SpeculativeRigidbody SetUpSpeculativeRigidbody(this tk2dSprite sprite, IntVector2 offset, IntVector2 dimensions)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			SpeculativeRigidbody orAddComponent = GameObjectExtensions.GetOrAddComponent<SpeculativeRigidbody>(((Component)sprite).gameObject);
			PixelCollider val = new PixelCollider();
			val.ColliderGenerationMode = (PixelColliderGeneration)0;
			val.CollisionLayer = (CollisionLayer)3;
			val.ManualWidth = dimensions.x;
			val.ManualHeight = dimensions.y;
			val.ManualOffsetX = offset.x;
			val.ManualOffsetY = offset.y;
			orAddComponent.PixelColliders = new List<PixelCollider> { val };
			return orAddComponent;
		}

		public static tk2dSpriteDefinition ConstructDefinition(Texture2D texture)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: 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_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			RuntimeAtlasSegment val = Assets.Packer.Pack(texture, false);
			Material val2 = new Material(ShaderCache.Acquire(PlayerController.DefaultShaderName));
			val2.mainTexture = (Texture)(object)val.texture;
			int width = ((Texture)texture).width;
			int height = ((Texture)texture).height;
			float num = 0f;
			float num2 = 0f;
			float num3 = (float)width / 16f;
			float num4 = (float)height / 16f;
			tk2dSpriteDefinition val3 = new tk2dSpriteDefinition();
			val3.normals = (Vector3[])(object)new Vector3[4]
			{
				new Vector3(0f, 0f, -1f),
				new Vector3(0f, 0f, -1f),
				new Vector3(0f, 0f, -1f),
				new Vector3(0f, 0f, -1f)
			};
			val3.tangents = (Vector4[])(object)new Vector4[4]
			{
				new Vector4(1f, 0f, 0f, 1f),
				new Vector4(1f, 0f, 0f, 1f),
				new Vector4(1f, 0f, 0f, 1f),
				new Vector4(1f, 0f, 0f, 1f)
			};
			val3.texelSize = new Vector2(0.0625f, 0.0625f);
			val3.extractRegion = false;
			val3.regionX = 0;
			val3.regionY = 0;
			val3.regionW = 0;
			val3.regionH = 0;
			val3.flipped = (FlipMode)0;
			val3.complexGeometry = false;
			val3.physicsEngine = (PhysicsEngine)0;
			val3.colliderType = (ColliderType)1;
			val3.collisionLayer = (CollisionLayer)6;
			val3.position0 = new Vector3(num, num2, 0f);
			val3.position1 = new Vector3(num + num3, num2, 0f);
			val3.position2 = new Vector3(num, num2 + num4, 0f);
			val3.position3 = new Vector3(num + num3, num2 + num4, 0f);
			val3.material = val2;
			val3.materialInst = val2;
			val3.materialId = 0;
			val3.uvs = val.uvs;
			val3.boundsDataCenter = new Vector3(num3 / 2f, num4 / 2f, 0f);
			val3.boundsDataExtents = new Vector3(num3, num4, 0f);
			val3.untrimmedBoundsDataCenter = new Vector3(num3 / 2f, num4 / 2f, 0f);
			val3.untrimmedBoundsDataExtents = new Vector3(num3, num4, 0f);
			tk2dSpriteDefinition val4 = val3;
			val4.name = ((Object)texture).name;
			return val4;
		}

		public static tk2dSpriteCollectionData ConstructCollection(GameObject obj, string name)
		{
			tk2dSpriteCollectionData val = obj.AddComponent<tk2dSpriteCollectionData>();
			Object.DontDestroyOnLoad((Object)(object)val);
			val.assetName = name;
			val.spriteCollectionGUID = name;
			val.spriteCollectionName = name;
			val.spriteDefinitions = (tk2dSpriteDefinition[])(object)new tk2dSpriteDefinition[0];
			return val;
		}

		public static T CopyFrom<T>(this Component comp, T other) where T : Component
		{
			Type type = ((object)comp).GetType();
			if ((object)type != ((object)other).GetType())
			{
				return default(T);
			}
			PropertyInfo[] properties = type.GetProperties();
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				if (propertyInfo.CanWrite)
				{
					try
					{
						propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
					}
					catch
					{
					}
				}
			}
			FieldInfo[] fields = type.GetFields();
			FieldInfo[] array2 = fields;
			foreach (FieldInfo fieldInfo in array2)
			{
				fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
			}
			return (T)(object)((comp is T) ? comp : null);
		}

		public static void SetColor(this tk2dSprite sprite, Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			((BraveBehaviour)sprite).renderer.material.SetColor("_OverrideColor", color);
		}

		public static T AddComponent<T>(this GameObject go, T toAdd) where T : Component
		{
			return ((Component)(object)go.AddComponent<T>()).CopyFrom(toAdd);
		}

		public static tk2dSpriteAnimationClip AddAnimation(tk2dSpriteAnimator animator, tk2dSpriteCollectionData collection, List<int> spriteIDs, string clipName, WrapMode wrapMode = 0, float fps = 15f)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			if ((Object)(object)animator.Library == (Object)null)
			{
				animator.Library = ((Component)animator).gameObject.AddComponent<tk2dSpriteAnimation>();
				animator.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0];
				((Behaviour)animator.Library).enabled = true;
			}
			List<tk2dSpriteAnimationFrame> list = new List<tk2dSpriteAnimationFrame>();
			for (int i = 0; i < spriteIDs.Count; i++)
			{
				tk2dSpriteDefinition val = collection.spriteDefinitions[spriteIDs[i]];
				if (val.Valid)
				{
					list.Add(new tk2dSpriteAnimationFrame
					{
						spriteCollection = collection,
						spriteId = spriteIDs[i]
					});
				}
			}
			tk2dSpriteAnimationClip val2 = new tk2dSpriteAnimationClip
			{
				name = clipName,
				fps = fps,
				wrapMode = wrapMode
			};
			Array.Resize(ref animator.Library.clips, animator.Library.clips.Length + 1);
			animator.Library.clips[animator.Library.clips.Length - 1] = val2;
			val2.frames = list.ToArray();
			return val2;
		}
	}
	public static class Tools
	{
		public static bool verbose = false;

		private static string defaultLog = Path.Combine(ETGMod.ResourcesDirectory, "gatlingRun.txt");

		public static string modID = "GatlingRun";

		public static AssetBundle sharedAuto1 = ResourceManager.LoadAssetBundle("shared_auto_001");

		public static AssetBundle sharedAuto2 = ResourceManager.LoadAssetBundle("shared_auto_002");

		public static void Init()
		{
		}

		public static void ConstructOffsetsFromAnchor(this tk2dSpriteDefinition def, Anchor anchor, Vector2? scale = null, bool fixesScale = false, bool changesCollider = true)
		{
			//IL_0013: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Invalid comparison between Unknown and I4
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Invalid comparison between Unknown and I4
			//IL_006a: 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_0085: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Invalid comparison between Unknown and I4
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Invalid comparison between Unknown and I4
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Invalid comparison between Unknown and I4
			//IL_00c2: 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_00dd: Invalid comparison between Unknown and I4
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_00ef: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Invalid comparison between Unknown and I4
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Invalid comparison between Unknown and I4
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Invalid comparison between Unknown and I4
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Invalid comparison between Unknown and I4
			//IL_0194: 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_016b: Invalid comparison between Unknown and I4
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Invalid comparison between Unknown and I4
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Invalid comparison between Unknown and I4
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Invalid comparison between Unknown and I4
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Invalid comparison between Unknown and I4
			//IL_01f9: 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_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_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Invalid comparison between Unknown and I4
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			if (!scale.HasValue)
			{
				scale = Vector2.op_Implicit(def.position3);
			}
			if (fixesScale)
			{
				Vector2 value = scale.Value - Vector3Extensions.XY(def.position0);
				scale = value;
			}
			float num = 0f;
			if ((int)anchor == 1 || (int)anchor == 4 || (int)anchor == 7)
			{
				num = 0f - scale.Value.x / 2f;
			}
			else if ((int)anchor == 2 || (int)anchor == 5 || (int)anchor == 8)
			{
				num = 0f - scale.Value.x;
			}
			float num2 = 0f;
			if ((int)anchor == 3 || (int)anchor == 4 || (int)anchor == 3)
			{
				num2 = 0f - scale.Value.y / 2f;
			}
			else if ((int)anchor == 6 || (int)anchor == 7 || (int)anchor == 8)
			{
				num2 = 0f - scale.Value.y;
			}
			def.MakeOffset(new Vector2(num, num2));
			if (changesCollider && def.colliderVertices != null && def.colliderVertices.Length != 0)
			{
				float num3 = 0f;
				if ((int)anchor == 0 || (int)anchor == 3 || (int)anchor == 6)
				{
					num3 = scale.Value.x / 2f;
				}
				else if ((int)anchor == 2 || (int)anchor == 5 || (int)anchor == 8)
				{
					num3 = 0f - scale.Value.x / 2f;
				}
				float num4 = 0f;
				if ((int)anchor == 0 || (int)anchor == 1 || (int)anchor == 2)
				{
					num4 = scale.Value.y / 2f;
				}
				else if ((int)anchor == 6 || (int)anchor == 7 || (int)anchor == 8)
				{
					num4 = 0f - scale.Value.y / 2f;
				}
				ref Vector3 reference = ref def.colliderVertices[0];
				reference += new Vector3(num3, num4, 0f);
			}
		}

		public static void MakeOffset(this tk2dSpriteDefinition def, Vector2 offset, bool changesCollider = false)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00b3: 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_00bf: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: 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_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_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			float x = offset.x;
			float y = offset.y;
			def.position0 += new Vector3(x, y, 0f);
			def.position1 += new Vector3(x, y, 0f);
			def.position2 += new Vector3(x, y, 0f);
			def.position3 += new Vector3(x, y, 0f);
			def.boundsDataCenter += new Vector3(x, y, 0f);
			def.boundsDataExtents += new Vector3(x, y, 0f);
			def.untrimmedBoundsDataCenter += new Vector3(x, y, 0f);
			def.untrimmedBoundsDataExtents += new Vector3(x, y, 0f);
			if (def.colliderVertices != null && def.colliderVertices.Length != 0 && changesCollider)
			{
				ref Vector3 reference = ref def.colliderVertices[0];
				reference += new Vector3(x, y, 0f);
			}
		}

		public static void Print<T>(T obj, string color = "FFFFFF", bool force = false)
		{
			if (verbose || force)
			{
				ETGModConsole.Log((object)("<color=#" + color + ">" + modID + ": " + obj.ToString() + "</color>"), false);
			}
			Log(obj.ToString());
		}

		public static void PrintRaw<T>(T obj, bool force = false)
		{
			if (verbose || force)
			{
				ETGModConsole.Log((object)obj.ToString(), false);
			}
			Log(obj.ToString());
		}

		public static void PrintError<T>(T obj, string color = "FF0000")
		{
			ETGModConsole.Log((object)("<color=#" + color + ">" + modID + ": " + obj.ToString() + "</color>"), false);
			Log(obj.ToString());
		}

		public static void PrintException(Exception e, string color = "FF0000")
		{
			ETGModConsole.Log((object)("<color=#" + color + ">" + modID + ": " + e.Message + "</color>"), false);
			ETGModConsole.Log((object)e.StackTrace, false);
			Log(e.Message);
			Log("\t" + e.StackTrace);
		}

		public static void Log<T>(T obj)
		{
			using StreamWriter streamWriter = new StreamWriter(Path.Combine(ETGMod.ResourcesDirectory, defaultLog), append: true);
			streamWriter.WriteLine(obj.ToString());
		}

		public static void Log<T>(T obj, string fileName)
		{
			if (!verbose)
			{
				return;
			}
			using StreamWriter streamWriter = new StreamWriter(Path.Combine(ETGMod.ResourcesDirectory, fileName), append: true);
			streamWriter.WriteLine(obj.ToString());
		}

		public static void Dissect(this GameObject obj)
		{
			Print(((Object)obj).name + " Components:");
			Component[] components = obj.GetComponents<Component>();
			foreach (Component val in components)
			{
				Print("    " + ((object)val).GetType());
			}
		}

		public static void ShowHitBox(this SpeculativeRigidbody body)
		{
			//IL_004e: 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_007b: 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_00a3: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			PixelCollider hitboxPixelCollider = body.HitboxPixelCollider;
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val).name = "HitboxDisplay";
			val.transform.SetParent(((BraveBehaviour)body).transform);
			Print(((Object)body).name ?? "");
			Print($"    Offset: {hitboxPixelCollider.Offset}, Dimesions: {hitboxPixelCollider.Dimensions}");
			val.transform.localScale = new Vector3((float)hitboxPixelCollider.Dimensions.x / 16f, (float)hitboxPixelCollider.Dimensions.y / 16f, 1f);
			Vector3 localPosition = new Vector3((float)hitboxPixelCollider.Offset.x + (float)hitboxPixelCollider.Dimensions.x * 0.5f, (float)hitboxPixelCollider.Offset.y + (float)hitboxPixelCollider.Dimensions.y * 0.5f, -16f) / 16f;
			val.transform.localPosition = localPosition;
		}

		public static void HideHitBox(this SpeculativeRigidbody body)
		{
			Transform val = ((BraveBehaviour)body).transform.Find("HitboxDisplay");
			if (Object.op_Implicit((Object)(object)val))
			{
				Object.Destroy((Object)(object)val);
			}
		}

		public static void ExportTexture(Texture texture)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			File.WriteAllBytes(Path.Combine(ETGMod.ResourcesDirectory, ((Object)texture).name + ".png"), ImageConversion.EncodeToPNG((Texture2D)texture));
		}

		public static void LogPropertiesAndFields<T>(this T obj, string header = "", bool debug = false)
		{
			ETGModConsole.Log((object)header, debug);
			ETGModConsole.Log((object)"=======================", debug);
			if (obj == null)
			{
				ETGModConsole.Log((object)"LogPropertiesAndFields: Null object", debug);
				return;
			}
			Type type = obj.GetType();
			ETGModConsole.Log((object)$"Type: {type}", debug);
			PropertyInfo[] properties = type.GetProperties();
			ETGModConsole.Log((object)$"{typeof(T)} Properties: ", debug);
			PropertyInfo[] array = properties;
			foreach (PropertyInfo propertyInfo in array)
			{
				try
				{
					object value = propertyInfo.GetValue(obj, null);
					string text = value.ToString();
					if ((object)obj?.GetType().GetGenericTypeDefinition() == typeof(List<>))
					{
						List<object> list = value as List<object>;
						text = $"List[{list.Count}]";
						foreach (object item in list)
						{
							text = text + "\n\t\t" + item.ToString();
						}
					}
					ETGModConsole.Log((object)("\t" + propertyInfo.Name + ": " + text), debug);
				}
				catch
				{
				}
			}
			ETGModConsole.Log((object)$"{typeof(T)} Fields: ", debug);
			FieldInfo[] fields = type.GetFields();
			FieldInfo[] array2 = fields;
			foreach (FieldInfo fieldInfo in array2)
			{
				ETGModConsole.Log((object)$"\t{fieldInfo.Name}: {fieldInfo.GetValue(obj)}", debug);
			}
		}
	}
}
namespace GungeonAPI
{
	public static class HitboxMonitor
	{
		public class HitBoxDisplay : BraveBehaviour
		{
			private GameObject hitboxDisplay = null;

			private PixelCollider collider;

			private void Start()
			{
				CreateDisplay();
			}

			public void CreateDisplay()
			{
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				collider = ((BraveBehaviour)this).specRigidbody.HitboxPixelCollider;
				string name = "HitboxDisplay";
				if ((Object)(object)hitboxDisplay == (Object)null)
				{
					hitboxDisplay = GameObject.CreatePrimitive((PrimitiveType)3);
				}
				hitboxDisplay.GetComponent<Renderer>().material.color = new Color(1f, 0f, 1f, 0.75f);
				((Object)hitboxDisplay).name = name;
				hitboxDisplay.transform.SetParent(((BraveBehaviour)((BraveBehaviour)this).specRigidbody).transform);
			}

			private void FixedUpdate()
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: 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_0063: 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_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				hitboxDisplay.transform.localScale = new Vector3((float)collider.Dimensions.x / pixelsPerUnit, (float)collider.Dimensions.y / pixelsPerUnit, 1f);
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor((float)collider.Offset.x + (float)collider.Dimensions.x * 0.5f, (float)collider.Offset.y + (float)collider.Dimensions.y * 0.5f, 0f - pixelsPerUnit);
				val /= pixelsPerUnit;
				hitboxDisplay.transform.localPosition = val;
			}

			public override void OnDestroy()
			{
				if (Object.op_Implicit((Object)(object