Decompiled source of Little Guy Companion v1.3.0

LittleGuy.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Dungeonator;
using FullInspector;
using Gungeon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SGUI;
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("LittleGuy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LittleGuy")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f7ab9b37-be65-43f9-beab-dc74262852bc")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LittleGuy
{
	public class HealOnTakingDamage : BraveBehaviour
	{
		public void Start()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			if ((Object)(object)((BraveBehaviour)this).healthHaver != (Object)null)
			{
				((BraveBehaviour)this).healthHaver.OnDamaged += new OnDamagedEvent(HandleDamaged);
			}
		}

		public void HandleDamaged(float resultValue, float maxValue, CoreDamageTypes damageTypes, DamageCategory damageCategory, Vector2 damageDirection)
		{
			((BraveBehaviour)this).healthHaver.FullHeal();
		}
	}
	public class HeavyWeightSynergyForBoxingGlove : GunBehaviour
	{
		public override void PostProcessProjectile(Projectile projectile)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((GunBehaviour)this).PlayerOwner != (Object)null && ((GunBehaviour)this).PlayerOwner.HasActiveBonusSynergy(Plugin.heavyweightSynergy, false))
			{
				ProjectileData baseData = projectile.baseData;
				baseData.damage *= 1.5f;
			}
		}
	}
	public class HeavyWeightSynergyForLittleGuy : BraveBehaviour
	{
		public AIActor ai;

		public PlayerController p;

		public float origcontact;

		public void Start()
		{
			ai = ((BraveBehaviour)this).aiActor;
			if ((Object)(object)ai != (Object)null)
			{
				p = ai.CompanionOwner;
				origcontact = ai.CollisionDamage;
			}
		}

		public void Update()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)ai != (Object)null)
			{
				if ((Object)(object)p != (Object)null && p.HasActiveBonusSynergy(Plugin.heavyweightSynergy, false))
				{
					ai.CollisionDamage = origcontact * 2f;
				}
				else
				{
					ai.CollisionDamage = origcontact;
				}
			}
		}
	}
	public class LittleGalDoStuffBehavior : BehaviorBase
	{
		private float idleTimer;

		private bool hadPlayedAnimThisIdle;

		private bool wasPlayingIdle;

		public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter)
		{
			((BehaviorBase)this).Init(gameObject, aiActor, aiShooter);
			base.m_aiAnimator.OverrideIdleAnimation = (BraveUtility.RandomBool() ? "idle2" : null);
		}

		public override BehaviorResult Update()
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = IsPlayingIdle();
			if (base.m_aiAnimator.IsPlaying("pet_end"))
			{
				base.m_aiActor.ClearPath();
			}
			if (base.m_aiAnimator.IsPlaying("removehelmet"))
			{
				base.m_aiActor.ClearPath();
			}
			else if (flag && !base.m_aiActor.CompanionOwner.IsInCombat)
			{
				if (!hadPlayedAnimThisIdle)
				{
					idleTimer += base.m_deltaTime;
					if (idleTimer > 8f)
					{
						base.m_aiAnimator.PlayUntilFinished("removehelmet", false, (string)null, -1f, false);
						hadPlayedAnimThisIdle = true;
					}
				}
			}
			else
			{
				idleTimer = 0f;
				hadPlayedAnimThisIdle = false;
			}
			if (flag)
			{
				wasPlayingIdle = true;
			}
			else
			{
				if (wasPlayingIdle)
				{
					base.m_aiAnimator.OverrideIdleAnimation = (BraveUtility.RandomBool() ? "idle2" : null);
				}
				wasPlayingIdle = false;
			}
			return ((BehaviorBase)this).Update();
		}

		public bool IsPlayingIdle()
		{
			return base.m_aiAnimator.IsPlaying("idle_right") || base.m_aiAnimator.IsPlaying("idle_left") || base.m_aiAnimator.IsPlaying("idle2_right") || base.m_aiAnimator.IsPlaying("idle2_left");
		}
	}
	public class LittleGuyFindBehavior : BehaviorBase
	{
		private float m_findTimer;

		private float idleTimer;

		private bool hadSleptThisIdle;

		public float FindChance = 0.0475f;

		public float FindChanceSynergy = 0.07f;

		public float CChance = 0.189f;

		public float BChance = 0.063f;

		public float AChance = 0.017f;

		public float SChance = 0.015f;

		public float chanceMult = 0.95f;

		public float HighTierSynergyMult = 7f;

		public float CTierSynergyMult = 0.37f;

		private int failedAttempts;

		public override void Start()
		{
			((BehaviorBase)this).Start();
			if ((Object)(object)base.m_aiActor.CompanionOwner != (Object)null)
			{
				base.m_aiActor.CompanionOwner.OnRoomClearEvent += HandleRoomCleared;
			}
		}

		public override void Destroy()
		{
			if ((Object)(object)base.m_aiActor.CompanionOwner != (Object)null)
			{
				base.m_aiActor.CompanionOwner.OnRoomClearEvent -= HandleRoomCleared;
			}
			((BehaviorBase)this).Destroy();
		}

		private IEnumerator DelayedSpawnItem(Vector2 spawnPoint, GameObject item)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSeconds(2.84f);
			LootEngine.SpawnItem(item, Vector2.op_Implicit(spawnPoint), Vector2.down, 1f, true, false, false);
		}

		public GameObject GetItemForPlayer(PlayerController player, GenericLootTable tableToUse, ItemQuality targetQuality, List<GameObject> excludedObjects, Predicate<PickupObject> itemselect, bool ignorePlayerTraits = false, Random safeRandom = null, bool bossStyle = false, List<GameObject> additionalExcludedObjects = null, bool forceSynergyCompletion = false, RewardSource rewardSource = 0)
		{
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Invalid comparison between Unknown and I4
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_052e: 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_00ea: Invalid comparison between Unknown and I4
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Invalid comparison between Unknown and I4
			//IL_0206: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Invalid comparison between Unknown and I4
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			bool flag = false;
			while ((int)targetQuality >= 0)
			{
				if ((int)targetQuality > 0)
				{
					flag = true;
				}
				List<WeightedGameObject> compiledRawItems = tableToUse.GetCompiledRawItems();
				List<KeyValuePair<WeightedGameObject, float>> list = new List<KeyValuePair<WeightedGameObject, float>>();
				float num = 0f;
				List<KeyValuePair<WeightedGameObject, float>> list2 = new List<KeyValuePair<WeightedGameObject, float>>();
				float num2 = 0f;
				for (int i = 0; i < compiledRawItems.Count; i++)
				{
					if (!((Object)(object)compiledRawItems[i].gameObject != (Object)null))
					{
						continue;
					}
					PickupObject component = compiledRawItems[i].gameObject.GetComponent<PickupObject>();
					if ((Object)(object)component == (Object)null || (bossStyle && component is GungeonMapItem) || (itemselect != null && !itemselect(component)))
					{
						continue;
					}
					bool flag2 = RewardManager.CheckQualityForItem(component, player, targetQuality, forceSynergyCompletion, rewardSource);
					if ((component.ItemSpansBaseQualityTiers || component.ItemRespectsHeartMagnificence) && (int)targetQuality != 1 && (int)targetQuality != 0 && (int)targetQuality != 5)
					{
						flag2 = true;
					}
					if (!ignorePlayerTraits && component is SpiceItem && Object.op_Implicit((Object)(object)player) && player.spiceCount > 0)
					{
						Debug.Log((object)"BAM spicing it up");
						flag2 = true;
					}
					if (!((Object)(object)component != (Object)null) || !flag2)
					{
						continue;
					}
					bool flag3 = true;
					float num3 = compiledRawItems[i].weight;
					if ((excludedObjects != null && excludedObjects.Contains(((Component)component).gameObject)) || (additionalExcludedObjects != null && additionalExcludedObjects.Contains(((Component)component).gameObject)))
					{
						continue;
					}
					if (!component.PrerequisitesMet())
					{
						flag3 = false;
					}
					if (component is Gun)
					{
						Gun val = (Gun)(object)((component is Gun) ? component : null);
						if (val.InfiniteAmmo && !((PickupObject)val).CanBeDropped && (int)((PickupObject)val).quality == -50)
						{
							continue;
						}
						GunClass gunClass = val.gunClass;
						if (!ignorePlayerTraits && (int)gunClass > 0)
						{
							int num4 = ((!((Object)(object)player == (Object)null) && player.inventory != null) ? player.inventory.ContainsGunOfClass(gunClass, true) : 0);
							float modifierForClass = LootDataGlobalSettings.Instance.GetModifierForClass(gunClass);
							num3 *= Mathf.Pow(modifierForClass, (float)num4);
						}
					}
					if (!ignorePlayerTraits)
					{
						float multiplierForItem = RewardManager.GetMultiplierForItem(component, player, forceSynergyCompletion);
						num3 *= multiplierForItem;
					}
					bool flag4 = !GameManager.Instance.IsSeeded;
					EncounterTrackable component2 = ((Component)component).GetComponent<EncounterTrackable>();
					if ((Object)(object)component2 != (Object)null && flag4)
					{
						int num5 = 0;
						if (Application.isPlaying)
						{
							num5 = GameStatsManager.Instance.QueryEncounterableDifferentiator(component2);
						}
						if (num5 > 0 || (Application.isPlaying && GameManager.Instance.ExtantShopTrackableGuids.Contains(component2.EncounterGuid)))
						{
							flag3 = false;
							num2 += num3;
							KeyValuePair<WeightedGameObject, float> item = new KeyValuePair<WeightedGameObject, float>(compiledRawItems[i], num3);
							list2.Add(item);
						}
						else if (Application.isPlaying && GameStatsManager.Instance.QueryEncounterable(component2) == 0 && GameStatsManager.Instance.QueryEncounterableAnnouncement(component2.EncounterGuid))
						{
							num3 *= 10f;
						}
					}
					if (component.ItemSpansBaseQualityTiers || component.ItemRespectsHeartMagnificence)
					{
						if (RewardManager.AdditionalHeartTierMagnificence >= 3f)
						{
							num3 *= GameManager.Instance.RewardManager.ThreeOrMoreHeartMagMultiplier;
						}
						else if (RewardManager.AdditionalHeartTierMagnificence >= 1f)
						{
							num3 *= GameManager.Instance.RewardManager.OneOrTwoHeartMagMultiplier;
						}
					}
					if (flag3)
					{
						num += num3;
						KeyValuePair<WeightedGameObject, float> item2 = new KeyValuePair<WeightedGameObject, float>(compiledRawItems[i], num3);
						list.Add(item2);
					}
				}
				if (list.Count == 0 && list2.Count > 0)
				{
					list = list2;
					num = num2;
				}
				if (num > 0f && list.Count > 0)
				{
					float num7;
					if (ignorePlayerTraits)
					{
						float num6 = (float)safeRandom.NextDouble();
						Debug.LogError((object)("safe random: " + num6));
						num7 = num * num6;
					}
					else
					{
						num7 = num * Random.value;
					}
					for (int j = 0; j < list.Count; j++)
					{
						num7 -= list[j].Value;
						if (num7 <= 0f)
						{
							return list[j].Key.gameObject;
						}
					}
					return list[list.Count - 1].Key.gameObject;
				}
				targetQuality = (ItemQuality)(targetQuality - 1);
				if ((int)targetQuality < 0 && !flag)
				{
					targetQuality = (ItemQuality)1;
				}
			}
			return null;
		}

		private void HandleRoomCleared(PlayerController obj)
		{
			//IL_009b: 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_012b: 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_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: 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_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			int num = failedAttempts;
			if (PassiveItem.IsFlagSetAtAll(typeof(BattleStandardItem)))
			{
				num += 15;
			}
			if ((Object)(object)obj != (Object)null && obj.inventory != null && obj.inventory.AllGuns != null && obj.inventory.AllGuns.Exists((Gun x) => x.IsLuteCompanionBuff))
			{
				num += 15;
			}
			if (Random.value * Mathf.Pow(chanceMult, (float)num) < (base.m_aiActor.CompanionOwner.HasActiveBonusSynergy(Plugin.heavyweightSynergy, false) ? FindChanceSynergy : FindChance))
			{
				if (Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)base.m_aiActor).transform.position) != base.m_aiActor.CompanionOwner.CurrentRoom || base.m_aiAnimator.IsPlaying("sleep"))
				{
					base.m_aiActor.CompanionWarp(Vector2.op_Implicit(((GameActor)base.m_aiActor.CompanionOwner).CenterPosition));
				}
				float value = Random.value;
				ItemQuality targetQuality = (ItemQuality)1;
				bool flag = base.m_aiActor.CompanionOwner.HasActiveBonusSynergy(Plugin.rareLootSynergy, false);
				float num2 = 1f;
				if (flag)
				{
					num2 = HighTierSynergyMult;
				}
				if (value < SChance * num2)
				{
					targetQuality = (ItemQuality)5;
				}
				else if (value < SChance * num2 + AChance * num2)
				{
					targetQuality = (ItemQuality)4;
				}
				else if (value < SChance * num2 + AChance * num2 + BChance * num2)
				{
					targetQuality = (ItemQuality)3;
				}
				else if (value < SChance * num2 + AChance * num2 + BChance * num2 + CChance * (flag ? CTierSynergyMult : 1f))
				{
					targetQuality = (ItemQuality)2;
				}
				m_findTimer = 2.6f;
				base.m_aiAnimator.PlayUntilFinished("find", false, (string)null, -1f, false);
				GameObject itemForPlayer = GetItemForPlayer(base.m_aiActor.CompanionOwner, GameManager.Instance.RewardManager.ItemsLootTable, targetQuality, null, (PickupObject x) => x is PlayerItem, ignorePlayerTraits: false, null, bossStyle: false, null, forceSynergyCompletion: false, (RewardSource)0);
				((MonoBehaviour)GameManager.Instance.Dungeon).StartCoroutine(DelayedSpawnItem(((GameActor)base.m_aiActor).CenterPosition, itemForPlayer));
				failedAttempts = 0;
				AkSoundEngine.PostEvent("Play_PET_dog_bark_01", ((Component)base.m_aiActor).gameObject);
			}
			else
			{
				failedAttempts++;
			}
		}

		public override BehaviorResult Update()
		{
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			if (m_findTimer > 0f)
			{
				((BehaviorBase)this).DecrementTimer(ref m_findTimer, false);
				base.m_aiActor.ClearPath();
			}
			if ((base.m_aiAnimator.IsPlaying("idle_right") || base.m_aiAnimator.IsPlaying("idle_left")) && !base.m_aiAnimator.IsPlaying("sleep") && !hadSleptThisIdle && !base.m_aiActor.CompanionOwner.IsInCombat)
			{
				idleTimer += base.m_deltaTime;
				if (idleTimer > 8f)
				{
					base.m_aiAnimator.PlayUntilFinished("sleep", false, (string)null, -1f, false);
					hadSleptThisIdle = true;
				}
			}
			else if (base.m_aiAnimator.IsPlaying("sleep"))
			{
				base.m_aiActor.ClearPath();
			}
			else if ((!base.m_aiAnimator.IsPlaying("idle_right") && !base.m_aiAnimator.IsPlaying("idle_left") && !base.m_aiAnimator.IsPlaying("sleep")) || base.m_aiActor.CompanionOwner.IsInCombat)
			{
				idleTimer = 0f;
				hadSleptThisIdle = false;
			}
			if (base.m_aiAnimator.IsPlaying("pet_end"))
			{
				base.m_aiActor.ClearPath();
			}
			return ((BehaviorBase)this).Update();
		}
	}
	[HarmonyPatch]
	public class PetOffsetHolder : MonoBehaviour
	{
		public Vector2 petOffsetRight;

		public Vector2 petOffsetLeft;

		[HarmonyPatch(typeof(CompanionController), "DoPet")]
		[HarmonyPostfix]
		public static void UnhardTheCode(CompanionController __instance, PlayerController player)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			PetOffsetHolder component = ((Component)__instance).GetComponent<PetOffsetHolder>();
			if ((Object)(object)component != (Object)null)
			{
				if (((BraveBehaviour)__instance).specRigidbody.UnitCenter.x > ((BraveBehaviour)player).specRigidbody.UnitCenter.x)
				{
					__instance.m_petOffset = component.petOffsetRight;
				}
				else
				{
					__instance.m_petOffset = component.petOffsetLeft;
				}
			}
		}
	}
	[BepInPlugin("spapi.etg.littleguy", "Little Guy", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "spapi.etg.littleguy";

		public static AssetBundle bundle;

		public static Texture2D lilguybosscard;

		public static Texture2D lilguybosscard2;

		public static CustomSynergyType heavyweightSynergy;

		public static CustomSynergyType rareLootSynergy;

		public static CustomSynergyType notEnoughSynergy;

		public static CustomSynergyType wholeZooSynergy;

		public static GungeonFlags completedSinisterCountdown;

		public void Awake()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LittleGuy.LittleGuy.Assets.AssetBundles.littleguybundle"))
			{
				bundle = AssetBundle.LoadFromStream(stream);
			}
			lilguybosscard = bundle.LoadAsset<Texture2D>("little_guy_bosscard_001");
			lilguybosscard2 = bundle.LoadAsset<Texture2D>("little_guy_and_gal_bosscard_001");
			ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
			new Harmony("spapi.etg.littleguy").PatchAll();
		}

		public void GMStart(GameManager manager)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: 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_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Expected O, but got Unknown
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_043c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_048b: Expected O, but got Unknown
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Expected O, but got Unknown
			//IL_04f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0501: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_0520: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_061e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_062d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0637: Expected O, but got Unknown
			//IL_05b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Expected O, but got Unknown
			//IL_0582: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_058c: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Unknown result type (might be due to invalid IL or missing references)
			//IL_059c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a6: Expected O, but got Unknown
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_071f: Expected O, but got Unknown
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0730: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_074d: Expected O, but got Unknown
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0674: Unknown result type (might be due to invalid IL or missing references)
			//IL_0679: Unknown result type (might be due to invalid IL or missing references)
			//IL_0699: Expected O, but got Unknown
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c7: Expected O, but got Unknown
			completedSinisterCountdown = ETGModCompatibility.ExtendEnum<GungeonFlags>("spapi.etg.littleguy", "SINISTER_COUNTDOWN_COMPLETE");
			bool flag = GameStatsManager.HasInstance && GameStatsManager.Instance.GetFlag(completedSinisterCountdown);
			StrangeRoot.Init();
			((IEnumerable<AdvancedSynergyEntry>)GameManager.Instance.SynergyManager.synergies).FirstOrDefault((Func<AdvancedSynergyEntry, bool>)((AdvancedSynergyEntry x) => x.bonusSynergies.Contains((CustomSynergyType)372))).OptionalItemIDs.Add(StrangeRoot.rootid);
			((IEnumerable<AdvancedSynergyEntry>)GameManager.Instance.SynergyManager.synergies).FirstOrDefault((Func<AdvancedSynergyEntry, bool>)((AdvancedSynergyEntry x) => x.bonusSynergies.Contains((CustomSynergyType)243))).OptionalItemIDs.Add(StrangeRoot.rootid);
			GameManager.Instance.SynergyManager.synergies = CollectionExtensions.AddRangeToArray<AdvancedSynergyEntry>(GameManager.Instance.SynergyManager.synergies, (AdvancedSynergyEntry[])(object)new AdvancedSynergyEntry[4]
			{
				new AdvancedSynergyEntry
				{
					NameKey = "#LG_HEAVYWEIGHT",
					MandatoryItemIDs = new List<int> { StrangeRoot.rootid },
					OptionalItemIDs = new List<int> { 133 },
					OptionalGunIDs = new List<int> { 539 },
					bonusSynergies = new List<CustomSynergyType> { heavyweightSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "HEAVYWEIGHT") },
					statModifiers = new List<StatModifier>()
				},
				new AdvancedSynergyEntry
				{
					NameKey = "#LG_RARELOOT",
					MandatoryItemIDs = new List<int> { StrangeRoot.rootid },
					OptionalItemIDs = new List<int> { 605, 289 },
					bonusSynergies = new List<CustomSynergyType> { rareLootSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "RARE_LOOT") },
					statModifiers = new List<StatModifier>()
				},
				new AdvancedSynergyEntry
				{
					NameKey = "#LG_NOTENOUGHSPACE",
					MandatoryItemIDs = new List<int> { StrangeRoot.rootid },
					OptionalItemIDs = new List<int> { 155 },
					OptionalGunIDs = new List<int> { 169 },
					bonusSynergies = new List<CustomSynergyType> { notEnoughSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "NOT_ENOUGH_SPACE") },
					statModifiers = new List<StatModifier> { StatModifier.Create((StatType)8, (ModifyMethod)0, 2f) }
				},
				new AdvancedSynergyEntry
				{
					NameKey = "#LG_WHOLEZOO",
					MandatoryItemIDs = new List<int> { StrangeRoot.rootid },
					OptionalGunIDs = new List<int> { 369, 176, 599, 406 },
					bonusSynergies = new List<CustomSynergyType> { wholeZooSynergy = ETGModCompatibility.ExtendEnum<CustomSynergyType>("spapi.etg.littleguy", "WHOLE_ZOO") },
					statModifiers = new List<StatModifier>
					{
						StatModifier.Create((StatType)5, (ModifyMethod)1, 0.75f),
						StatModifier.Create((StatType)2, (ModifyMethod)1, 1.1f)
					},
					ActiveWhenGunUnequipped = false
				}
			});
			Databases.Strings.Synergy.Set("#LG_HEAVYWEIGHT", "Heavy Weight");
			Databases.Strings.Synergy.Set("#LG_RARELOOT", "Rare Loot");
			Databases.Strings.Synergy.Set("#LG_NOTENOUGHSPACE", "Not Enough Space");
			Databases.Strings.Synergy.Set("#LG_WHOLEZOO", "Whole Zoo");
			((Component)PickupObjectDatabase.GetById(539)).gameObject.AddComponent<HeavyWeightSynergyForBoxingGlove>();
			((Component)PickupObjectDatabase.GetById(369)).gameObject.AddComponent<WholeZooSynergy>();
			((Component)PickupObjectDatabase.GetById(176)).gameObject.AddComponent<WholeZooSynergy>();
			((Component)PickupObjectDatabase.GetById(599)).gameObject.AddComponent<WholeZooSynergy>();
			((Component)PickupObjectDatabase.GetById(406)).gameObject.AddComponent<WholeZooSynergy>();
			string text = "Little Guy has successfully infiltrated the game.";
			if (flag)
			{
				text = "Little Guy (and Little Gal) have successfully infiltrated the game.";
			}
			int num = 48;
			SGroup val = new SGroup
			{
				Size = new Vector2(20000f, (float)num),
				AutoLayoutPadding = 0f,
				Background = Color.clear,
				AutoLayout = (SGroup x) => x.AutoLayoutHorizontal
			};
			float num2 = 0.3f;
			Color32 val2 = default(Color32);
			((Color32)(ref val2))..ctor((byte)93, (byte)174, (byte)13, byte.MaxValue);
			Color32 val3 = default(Color32);
			((Color32)(ref val3))..ctor((byte)177, (byte)202, (byte)19, byte.MaxValue);
			if (flag)
			{
				((Color32)(ref val3))..ctor((byte)0, (byte)140, (byte)198, byte.MaxValue);
			}
			Gradient val4 = new Gradient();
			val4.colorKeys = (GradientColorKey[])(object)new GradientColorKey[3]
			{
				new GradientColorKey(Color32.op_Implicit(val2), 0f),
				new GradientColorKey(Color32.op_Implicit(val3), 0.5f),
				new GradientColorKey(Color32.op_Implicit(val2), 1f)
			};
			Gradient val5 = val4;
			for (int i = 0; i < text.Length; i++)
			{
				char c = text[i];
				Color foreground = val5.Evaluate((float)i / (float)(text.Length - 1) / 2f);
				if (c == ' ')
				{
					((SElement)val).Children.Add((SElement)new SRect(Color.clear)
					{
						Size = Vector2.one * 10f
					});
				}
				else
				{
					((SElement)val).Children.Add((SElement)new SLabel(c.ToString())
					{
						Foreground = foreground,
						With = { (SModifier)(object)new GradientThingy(val5, (float)i / (float)(text.Length - 1) / 2f) }
					});
				}
			}
			((SElement)val).Children.Add((SElement)new SRect(Color.clear)
			{
				Size = Vector2.one * 10f
			});
			if (flag)
			{
				Texture2D val6 = bundle.LoadAsset<Texture2D>("gal");
				((SElement)val).Children.Add((SElement)new SLabel
				{
					Icon = (Texture)(object)val6,
					IconScale = Vector2.one * num2,
					With = { (SModifier)(object)new MovementThingy(0.5f, 2.5f) }
				});
				((SElement)val).Children.Add((SElement)new SRect(Color.clear)
				{
					Size = new Vector2((float)((Texture)val6).width * num2, (float)num)
				});
			}
			Texture2D val7 = bundle.LoadAsset<Texture2D>("guy");
			((SElement)val).Children.Add((SElement)new SLabel
			{
				Icon = (Texture)(object)val7,
				IconScale = Vector2.one * num2,
				With = { (SModifier)(object)new MovementThingy(0f, 2.5f) }
			});
			((SElement)val).Children.Add((SElement)new SRect(Color.clear)
			{
				Size = new Vector2((float)((Texture)val7).width * num2, (float)num)
			});
			((SElement)((ETGModMenu)ETGModConsole.Instance).GUI)[0].Children.Add((SElement)(object)val);
		}
	}
	public class GradientThingy : SModifier
	{
		public Gradient gradient;

		public float offs;

		public GradientThingy(Gradient gradient, float offs)
		{
			this.gradient = gradient;
			this.offs = offs;
			((SModifier)this)..ctor();
		}

		public override void Update()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			base.Elem.Foreground = gradient.Evaluate((Time.realtimeSinceStartup * 0.25f + offs) % 1f);
		}
	}
	public class MovementThingy : SModifier
	{
		public float offs;

		public float amplitude;

		public MovementThingy(float offs, float amplitude)
		{
			this.offs = offs;
			this.amplitude = amplitude;
			((SModifier)this)..ctor();
		}

		public override void Update()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			base.Elem.Position = Vector2Extensions.WithY(base.Elem.Position, Mathf.Sin((Time.realtimeSinceStartup * 0.5f + offs) * (float)Math.PI * 2f) * amplitude);
		}
	}
	public class StayFartherAwayOutsideCombat : BehaviorBase
	{
		private CompanionFollowPlayerBehavior follow;

		public float CombatDistance;

		public float OutOfCombatDistance;

		public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter)
		{
			((BehaviorBase)this).Init(gameObject, aiActor, aiShooter);
			if ((Object)(object)aiActor != (Object)null && (Object)(object)((BraveBehaviour)aiActor).behaviorSpeculator != (Object)null && ((BraveBehaviour)aiActor).behaviorSpeculator.MovementBehaviors != null)
			{
				follow = ((BraveBehaviour)aiActor).behaviorSpeculator.MovementBehaviors.OfType<CompanionFollowPlayerBehavior>().FirstOrDefault();
			}
		}

		public override BehaviorResult Update()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			if (follow != null)
			{
				follow.IdealRadius = (base.m_aiActor.CompanionOwner.IsInCombat ? CombatDistance : OutOfCombatDistance);
			}
			return ((BehaviorBase)this).Update();
		}
	}
	public class StrangeRoot : CompanionItem
	{
		public class LittleGuyEntry : EnemyDatabaseEntry
		{
			public override AssetBundle assetBundle => Plugin.bundle;
		}

		public static GameObject guy;

		public static GameObject gal;

		public static int rootid;

		public static int rootsid;

		public static tk2dSpriteCollectionData rootscoll;

		public GameObject littlegal;

		public bool hasgal;

		public float timer = 450f;

		public float lastSinisterCountdownTime = 450f;

		public bool doSinisterCooldown;

		public bool cachedCanBeDropped;

		public static Dictionary<float, string> sinisterCountdown = new Dictionary<float, string>
		{
			{ 1f, "1 SECOND" },
			{ 2f, "2 SECONDS" },
			{ 3f, "3 SECONDS" },
			{ 4f, "4 SECONDS" },
			{ 5f, "5 SECONDS" },
			{ 6f, "6 SECONDS" },
			{ 7f, "7 SECONDS" },
			{ 8f, "8 SECONDS" },
			{ 9f, "9 SECONDS" },
			{ 10f, "10 SECONDS" },
			{ 60f, "1 MINUTE" },
			{ 180f, "3 MINUTES" },
			{ 300f, "5 MINUTES" }
		};

		public static void Init()
		{
			string name = "Strange Root";
			string shortdesc = "Little Guy";
			string longdesc = "Grants you two more active item slots and occasionally finds an active item after room completion.\n\nA young fox squire, born in a far-away land ravaged by ruthless diplomacy and warfare. Although he is still too inexperienced for combat, he has gotten used to lugging around the heavy equipment of his former master, and has a great eye for finding loot in the battlefield...";
			StrangeRoot strangeRoot = BuildStrangeRoot(name, shortdesc, longdesc, (ItemQuality)4, 2);
			((CompanionItem)strangeRoot).CompanionGuid = BuildGuy();
			BuildGal();
			rootid = ((PickupObject)strangeRoot).PickupObjectId;
			rootsid = ((tk2dBaseSprite)((Component)strangeRoot).GetComponent<tk2dSprite>()).spriteId;
			rootscoll = ((tk2dBaseSprite)((Component)strangeRoot).GetComponent<tk2dSprite>()).Collection;
		}

		public override void Pickup(PlayerController player)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			((CompanionItem)this).Pickup(player);
			player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Combine(player.OnNewFloorLoaded, new Action<PlayerController>(HandleNewFloorGal));
			CreateGal(player);
			if (!GameStatsManager.Instance.GetFlag(Plugin.completedSinisterCountdown))
			{
				cachedCanBeDropped = ((PickupObject)this).CanBeDropped;
				doSinisterCooldown = true;
				((PickupObject)this).CanBeDropped = false;
			}
		}

		public void HandleNewFloorGal(PlayerController obj)
		{
			DestroyGal();
			if (!base.PreventRespawnOnFloorLoad)
			{
				CreateGal(obj);
			}
		}

		public override void DisableEffect(PlayerController player)
		{
			DestroyGal();
			if ((Object)(object)player != (Object)null)
			{
				player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(HandleNewFloorGal));
			}
			if (doSinisterCooldown && (Object)(object)GameManager.Instance.Dungeon != (Object)null)
			{
				RenderSettings.ambientIntensity = GameManager.Instance.Dungeon.TargetAmbientIntensity;
				Pixelator.Instance.pointLightMultiplier = 1f;
			}
		}

		public override DebrisObject Drop(PlayerController player)
		{
			DestroyGal();
			player.OnNewFloorLoaded = (Action<PlayerController>)Delegate.Remove(player.OnNewFloorLoaded, new Action<PlayerController>(HandleNewFloorGal));
			return ((CompanionItem)this).Drop(player);
		}

		public void DestroyGal()
		{
			if (Object.op_Implicit((Object)(object)littlegal))
			{
				Object.Destroy((Object)(object)littlegal);
				littlegal = null;
			}
		}

		public override void Update()
		{
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			((CompanionItem)this).Update();
			if (!((PassiveItem)this).PickedUp || !((Object)(object)((PassiveItem)this).Owner != (Object)null) || hasgal || !(timer > 0f))
			{
				return;
			}
			timer -= BraveTime.DeltaTime;
			if (doSinisterCooldown)
			{
				foreach (KeyValuePair<float, string> item in sinisterCountdown)
				{
					if (item.Key >= timer && item.Key < lastSinisterCountdownTime)
					{
						lastSinisterCountdownTime = item.Key;
						GameUIRoot.Instance.notificationController.ForceHide();
						GameUIRoot.Instance.notificationController.DoCustomNotification("YOU HAVE", item.Value, ((BraveBehaviour)this).sprite.Collection, ((BraveBehaviour)this).sprite.spriteId, (NotificationColor)2, true, false);
						AkSoundEngine.PostEvent("Play_WPN_kthulu_blast_01", ((Component)this).gameObject);
						break;
					}
				}
			}
			if (timer <= 0f)
			{
				Vector3? positionOverride = null;
				if (((PassiveItem)this).Owner.CurrentRoom != null)
				{
					CameraController cam = GameManager.Instance.MainCameraController;
					DungeonData dungeondata = GameManager.Instance.Dungeon.data;
					IEnumerable<IntVector2> enumerable = (from r in ((PassiveItem)this).Owner.CurrentRoom.connectedRooms.Concat((IEnumerable<RoomHandler>)(object)new RoomHandler[1] { ((PassiveItem)this).Owner.CurrentRoom })
						select r.Cells.Where(delegate(IntVector2 x)
						{
							//IL_0006: Unknown result type (might be due to invalid IL or missing references)
							//IL_0014: Unknown result type (might be due to invalid IL or missing references)
							//IL_001a: Unknown result type (might be due to invalid IL or missing references)
							//IL_002d: Unknown result type (might be due to invalid IL or missing references)
							//IL_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_0065: 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_0084: Unknown result type (might be due to invalid IL or missing references)
							//IL_0089: Unknown result type (might be due to invalid IL or missing references)
							//IL_008b: Unknown result type (might be due to invalid IL or missing references)
							//IL_0091: Unknown result type (might be due to invalid IL or missing references)
							//IL_0094: Invalid comparison between Unknown and I4
							bool flag = dungeondata.CheckInBoundsAndValid(x) && !dungeondata.isTopWall(x.x, x.y) && !dungeondata.isWall(x);
							bool flag2 = flag;
							if (flag2)
							{
								bool flag3 = !cam.PointIsVisible(Vector2.op_Implicit(((IntVector2)(ref x)).ToVector3()));
								bool flag4 = flag3;
								if (!flag4)
								{
									bool flag5 = dungeondata.GetRoomFromPosition(x) != null;
									bool flag6 = flag5;
									if (flag6)
									{
										VisibilityStatus visibility = dungeondata.GetRoomFromPosition(x).visibility;
										bool flag7 = (((int)visibility == 0 || (int)visibility == 3) ? true : false);
										flag6 = flag7;
									}
									flag4 = flag6;
								}
								flag2 = flag4;
							}
							return flag2;
						})).SelectMany((IEnumerable<IntVector2> x) => x);
					if (enumerable.Any())
					{
						float closest = -1f;
						CollectionExtensions.Do<IntVector2>(enumerable, (Action<IntVector2>)delegate(IntVector2 x)
						{
							//IL_0003: 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_005f: Unknown result type (might be due to invalid IL or missing references)
							float num2 = Vector3.Distance(((IntVector2)(ref x)).ToVector3(), Vector2.op_Implicit(((GameActor)((PassiveItem)this).Owner).CenterPosition));
							if (closest < 0f || num2 < closest)
							{
								closest = num2;
								positionOverride = ((IntVector2)(ref x)).ToVector3();
							}
						});
					}
				}
				hasgal = true;
				DestroyGal();
				CreateGal(((PassiveItem)this).Owner, positionOverride);
				if (doSinisterCooldown)
				{
					((PickupObject)this).CanBeDropped = cachedCanBeDropped;
					RenderSettings.ambientIntensity = GameManager.Instance.Dungeon.TargetAmbientIntensity;
					Pixelator.Instance.pointLightMultiplier = 1f;
					doSinisterCooldown = false;
					GameStatsManager.Instance.SetFlag(Plugin.completedSinisterCountdown, true);
				}
			}
			else if (timer <= 10f && doSinisterCooldown)
			{
				float num = 0.5f + Mathf.Ceil(timer) * 0.05f;
				RenderSettings.ambientIntensity = Mathf.Min(num * GameManager.Instance.Dungeon.TargetAmbientIntensity, RenderSettings.ambientIntensity);
				Pixelator.Instance.pointLightMultiplier = num;
			}
		}

		public void CreateGal(PlayerController owner, Vector3? overridePosition = null)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			if (hasgal)
			{
				littlegal = Object.Instantiate<GameObject>(((Component)EnemyDatabase.GetOrLoadByGuid("lg_lilgal")).gameObject, (Vector3)(((??)overridePosition) ?? (((BraveBehaviour)owner).transform.position + Vector3.right)), Quaternion.identity);
				CompanionController orAddComponent = GameObjectExtensions.GetOrAddComponent<CompanionController>(littlegal);
				orAddComponent.Initialize(owner);
				if ((Object)(object)((BraveBehaviour)orAddComponent).specRigidbody != (Object)null)
				{
					PhysicsEngine.Instance.RegisterOverlappingGhostCollisionExceptions(((BraveBehaviour)orAddComponent).specRigidbody, (int?)null, false);
				}
			}
		}

		public static StrangeRoot BuildStrangeRoot(string name, string shortdesc, string longdesc, ItemQuality quality, int slotsToAdd)
		{
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Plugin.bundle.LoadAsset<GameObject>("strangeroot");
			StrangeRoot strangeRoot = val.AddComponent<StrangeRoot>();
			Databases.Items.SetupItem((PickupObject)(object)strangeRoot, name);
			tk2dSpriteDefinition currentSpriteDef = ((BraveBehaviour)strangeRoot).sprite.GetCurrentSpriteDef();
			if ((Object)(object)currentSpriteDef.material != (Object)null)
			{
				currentSpriteDef.material.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTintableTilted");
			}
			if ((Object)(object)currentSpriteDef.materialInst != (Object)null)
			{
				currentSpriteDef.materialInst.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTintableTilted");
			}
			tk2dSpriteDefinition val2 = CopyDefinitionFrom(((BraveBehaviour)strangeRoot).sprite.GetCurrentSpriteDef());
			if ((Object)(object)val2.material != (Object)null)
			{
				val2.material.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTilted");
			}
			if ((Object)(object)val2.materialInst != (Object)null)
			{
				val2.materialInst.shader = ShaderCache.Acquire("tk2d/CutoutVertexColorTilted");
			}
			tk2dSpriteCollectionData encounterIconCollection = AmmonomiconController.ForceInstance.EncounterIconCollection;
			encounterIconCollection.spriteDefinitions = CollectionExtensions.AddToArray<tk2dSpriteDefinition>(encounterIconCollection.spriteDefinitions, val2);
			encounterIconCollection.spriteNameLookupDict = null;
			encounterIconCollection.InitDictionary();
			((BraveBehaviour)strangeRoot).encounterTrackable.journalData.AmmonomiconSprite = ((BraveBehaviour)strangeRoot).sprite.GetCurrentSpriteDef().name;
			GunExt.SetShortDescription((PickupObject)(object)strangeRoot, shortdesc);
			GunExt.SetLongDescription((PickupObject)(object)strangeRoot, longdesc);
			Game.Items.Add("lg:" + ETGMod.ToID(name), (PickupObject)(object)strangeRoot);
			Databases.Items.AddSpecific((PickupObject)(object)strangeRoot, false, "ANY");
			((PickupObject)strangeRoot).quality = quality;
			((PassiveItem)strangeRoot).passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { StatModifier.Create((StatType)8, (ModifyMethod)0, (float)slotsToAdd) };
			return strangeRoot;
		}

		public static string BuildGal()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//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_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_018a: 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)
			//IL_019f: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Expected O, but got Unknown
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Expected O, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Expected O, but got Unknown
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Expected O, but got Unknown
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Expected O, but got Unknown
			//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Expected O, but got Unknown
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Expected O, but got Unknown
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_0518: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: Unknown result type (might be due to invalid IL or missing references)
			//IL_052f: Expected O, but got Unknown
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_057c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0587: Unknown result type (might be due to invalid IL or missing references)
			//IL_0597: Expected O, but got Unknown
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_067a: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			string text = "lg_lilgal";
			GameObject val = Plugin.bundle.LoadAsset<GameObject>("littlegal");
			SpeculativeRigidbody val2 = val.AddComponent<SpeculativeRigidbody>();
			val2.PixelColliders = new List<PixelCollider>
			{
				new PixelCollider
				{
					ColliderGenerationMode = (PixelColliderGeneration)0,
					CollisionLayer = (CollisionLayer)1,
					ManualWidth = 8,
					ManualHeight = 14,
					ManualOffsetX = 2,
					ManualOffsetY = 0
				},
				new PixelCollider
				{
					ColliderGenerationMode = (PixelColliderGeneration)0,
					CollisionLayer = (CollisionLayer)0,
					ManualWidth = 10,
					ManualHeight = 16,
					ManualOffsetX = 1,
					ManualOffsetY = 0
				}
			};
			AIActor val3 = val.AddComponent<AIActor>();
			val3.EnemyGuid = text;
			val3.CanDropCurrency = false;
			val3.CollisionDamage = 0.5f;
			val3.IgnoreForRoomClear = true;
			val3.IsNormalEnemy = false;
			val3.MovementSpeed = 6f;
			((GameActor)val3).ActorName = "Little Gal";
			((GameActor)val3).DoDustUps = true;
			((GameActor)val3).DustUpInterval = 0.125f;
			((GameActor)val3).HasShadow = true;
			val.AddComponent<HitEffectHandler>();
			HealthHaver val4 = val.AddComponent<HealthHaver>();
			val4.SetHealthMaximum(15000f, (float?)null, true);
			KnockbackDoer val5 = val.AddComponent<KnockbackDoer>();
			val5.shouldBounce = false;
			val5.weight = 35f;
			AIAnimator val6 = val.AddComponent<AIAnimator>();
			val6.facingType = (FacingType)2;
			DirectionalAnimation val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "idle";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			val6.IdleAnimation = val7;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "move";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			val6.MoveAnimation = val7;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[0];
			val7.Prefix = "";
			val7.Flipped = (FlipType[])(object)new FlipType[0];
			val7.Type = (DirectionType)0;
			val6.FlightAnimation = val7;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "hit";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			val6.HitAnimation = val7;
			List<NamedDirectionalAnimation> list = new List<NamedDirectionalAnimation>();
			NamedDirectionalAnimation val8 = new NamedDirectionalAnimation();
			val8.name = "removehelmet";
			NamedDirectionalAnimation obj = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "removehelmet";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj.anim = val7;
			list.Add(val8);
			val8 = new NamedDirectionalAnimation();
			val8.name = "pet";
			NamedDirectionalAnimation obj2 = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "pet";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj2.anim = val7;
			list.Add(val8);
			val8 = new NamedDirectionalAnimation();
			val8.name = "pet_end";
			NamedDirectionalAnimation obj3 = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "pet_end";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj3.anim = val7;
			list.Add(val8);
			val8 = new NamedDirectionalAnimation();
			val8.name = "idle2";
			NamedDirectionalAnimation obj4 = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "idle2";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj4.anim = val7;
			list.Add(val8);
			val6.OtherAnimations = list;
			val.AddComponent<ObjectVisibilityManager>();
			BehaviorSpeculator val9 = val.AddComponent<BehaviorSpeculator>();
			List<MovementBehaviorBase> list2 = new List<MovementBehaviorBase>();
			CompanionFollowPlayerBehavior val10 = new CompanionFollowPlayerBehavior();
			val10.CanRollOverPits = false;
			val10.CatchUpAccelTime = 3f;
			val10.CatchUpAnimation = "";
			val10.CatchUpMaxSpeed = 10f;
			val10.CatchUpOutAnimation = "";
			val10.CatchUpRadius = 8f;
			val10.CatchUpSpeed = 6f;
			val10.DisableInCombat = true;
			val10.IdealRadius = 3f;
			val10.IdleAnimations = new string[0];
			val10.RollAnimation = "";
			val10.PathInterval = 0.25f;
			val10.TemporarilyDisabled = false;
			list2.Add((MovementBehaviorBase)(object)val10);
			list2.Add((MovementBehaviorBase)new SeekTargetBehavior
			{
				CustomRange = 2f,
				ExternalCooldownSource = false,
				LineOfSight = true,
				PathInterval = 0.25f,
				ReturnToSpawn = true,
				SpawnTetherDistance = 0f,
				StopWhenInRange = true
			});
			val9.MovementBehaviors = list2;
			val9.OtherBehaviors = new List<BehaviorBase> { (BehaviorBase)(object)new LittleGalDoStuffBehavior() };
			val9.TargetBehaviors = new List<TargetBehaviorBase> { (TargetBehaviorBase)new TargetPlayerBehavior
			{
				LineOfSight = true,
				ObjectPermanence = true,
				PauseOnTargetSwitch = true,
				PauseTime = 0.25f,
				Radius = 35f,
				SearchInterval = 0.25f
			} };
			val9.AttackBehaviors = new List<AttackBehaviorBase>();
			((ISerializedObject)val9).SerializedObjectReferences = new List<Object>(0);
			((ISerializedObject)val9).SerializedStateKeys = new List<string> { "OverrideBehaviors", "OtherBehaviors", "TargetBehaviors", "AttackBehaviors", "MovementBehaviors" };
			((ISerializedObject)val9).SerializedStateValues = new List<string> { "", "", "", "", "" };
			CompanionController val11 = val.AddComponent<CompanionController>();
			val11.CanBePet = true;
			val11.CanInterceptBullets = true;
			PetOffsetHolder petOffsetHolder = val.AddComponent<PetOffsetHolder>();
			petOffsetHolder.petOffsetLeft = new Vector2(-0.6875f, -0.3125f);
			petOffsetHolder.petOffsetRight = new Vector2(0.5f, -0.3125f);
			val.AddComponent<HealOnTakingDamage>();
			((AssetBundleDatabase<AIActor, EnemyDatabaseEntry>)(object)EnemyDatabase.Instance).Entries.Add((EnemyDatabaseEntry)(object)new LittleGuyEntry
			{
				difficulty = (PlaceableDifficulty)0,
				encounterGuid = text,
				ForcedPositionInAmmonomicon = 0,
				isInBossTab = false,
				isNormalEnemy = false,
				myGuid = text,
				path = ((Object)val).name,
				placeableHeight = 1,
				placeableWidth = 1,
				unityGuid = text
			});
			Game.Enemies.Add("lg:little_gal", val3);
			gal = val;
			return text;
		}

		public static string BuildGuy()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//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_0063: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_018a: 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)
			//IL_019f: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Expected O, but got Unknown
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Expected O, but got Unknown
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Expected O, but got Unknown
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f2: Expected O, but got Unknown
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Expected O, but got Unknown
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Expected O, but got Unknown
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Expected O, but got Unknown
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Expected O, but got Unknown
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_043d: Expected O, but got Unknown
			//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			string text = "lg_lilguy";
			GameObject val = Plugin.bundle.LoadAsset<GameObject>("littleguy");
			SpeculativeRigidbody val2 = val.AddComponent<SpeculativeRigidbody>();
			val2.PixelColliders = new List<PixelCollider>
			{
				new PixelCollider
				{
					ColliderGenerationMode = (PixelColliderGeneration)0,
					CollisionLayer = (CollisionLayer)3,
					ManualWidth = 8,
					ManualHeight = 14,
					ManualOffsetX = 6,
					ManualOffsetY = 0
				},
				new PixelCollider
				{
					ColliderGenerationMode = (PixelColliderGeneration)0,
					CollisionLayer = (CollisionLayer)2,
					ManualWidth = 10,
					ManualHeight = 16,
					ManualOffsetX = 5,
					ManualOffsetY = 0
				}
			};
			AIActor val3 = val.AddComponent<AIActor>();
			val3.EnemyGuid = text;
			val3.CanDropCurrency = false;
			val3.CollisionDamage = 0.5f;
			val3.IgnoreForRoomClear = true;
			val3.IsNormalEnemy = false;
			val3.MovementSpeed = 6f;
			((GameActor)val3).ActorName = "Little Guy";
			((GameActor)val3).DoDustUps = true;
			((GameActor)val3).DustUpInterval = 0.125f;
			((GameActor)val3).HasShadow = true;
			val.AddComponent<HitEffectHandler>();
			HealthHaver val4 = val.AddComponent<HealthHaver>();
			val4.SetHealthMaximum(15000f, (float?)null, true);
			KnockbackDoer val5 = val.AddComponent<KnockbackDoer>();
			val5.shouldBounce = false;
			val5.weight = 35f;
			AIAnimator val6 = val.AddComponent<AIAnimator>();
			val6.facingType = (FacingType)2;
			DirectionalAnimation val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "idle";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			val6.IdleAnimation = val7;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "move";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			val6.MoveAnimation = val7;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[0];
			val7.Prefix = "";
			val7.Flipped = (FlipType[])(object)new FlipType[0];
			val7.Type = (DirectionType)0;
			val6.FlightAnimation = val7;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[0];
			val7.Prefix = "";
			val7.Flipped = (FlipType[])(object)new FlipType[0];
			val7.Type = (DirectionType)0;
			val6.HitAnimation = val7;
			List<NamedDirectionalAnimation> list = new List<NamedDirectionalAnimation>();
			NamedDirectionalAnimation val8 = new NamedDirectionalAnimation();
			val8.name = "find";
			NamedDirectionalAnimation obj = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "finditem";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj.anim = val7;
			list.Add(val8);
			val8 = new NamedDirectionalAnimation();
			val8.name = "sleep";
			NamedDirectionalAnimation obj2 = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "sleep";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj2.anim = val7;
			list.Add(val8);
			val8 = new NamedDirectionalAnimation();
			val8.name = "pet";
			NamedDirectionalAnimation obj3 = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "pet";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj3.anim = val7;
			list.Add(val8);
			val8 = new NamedDirectionalAnimation();
			val8.name = "pet_end";
			NamedDirectionalAnimation obj4 = val8;
			val7 = new DirectionalAnimation();
			val7.AnimNames = new string[2] { "", "" };
			val7.Prefix = "pet_end";
			val7.Flipped = (FlipType[])(object)new FlipType[2];
			val7.Type = (DirectionType)2;
			obj4.anim = val7;
			list.Add(val8);
			val6.OtherAnimations = list;
			val.AddComponent<ObjectVisibilityManager>();
			BehaviorSpeculator val9 = val.AddComponent<BehaviorSpeculator>();
			List<MovementBehaviorBase> list2 = new List<MovementBehaviorBase>();
			CompanionFollowPlayerBehavior val10 = new CompanionFollowPlayerBehavior();
			val10.CanRollOverPits = false;
			val10.CatchUpAccelTime = 3f;
			val10.CatchUpAnimation = "";
			val10.CatchUpMaxSpeed = 10f;
			val10.CatchUpOutAnimation = "";
			val10.CatchUpRadius = 8f;
			val10.CatchUpSpeed = 6f;
			val10.DisableInCombat = false;
			val10.IdealRadius = 3f;
			val10.IdleAnimations = new string[0];
			val10.RollAnimation = "";
			val10.PathInterval = 0.25f;
			val10.TemporarilyDisabled = false;
			list2.Add((MovementBehaviorBase)(object)val10);
			val9.MovementBehaviors = list2;
			val9.OtherBehaviors = new List<BehaviorBase>
			{
				(BehaviorBase)(object)new LittleGuyFindBehavior(),
				(BehaviorBase)(object)new StayFartherAwayOutsideCombat
				{
					CombatDistance = 3f,
					OutOfCombatDistance = 4f
				}
			};
			((ISerializedObject)val9).SerializedObjectReferences = new List<Object>(0);
			((ISerializedObject)val9).SerializedStateKeys = new List<string> { "OverrideBehaviors", "OtherBehaviors", "TargetBehaviors", "AttackBehaviors", "MovementBehaviors" };
			((ISerializedObject)val9).SerializedStateValues = new List<string> { "", "", "", "", "" };
			CompanionController val11 = val.AddComponent<CompanionController>();
			val11.CanBePet = true;
			val.AddComponent<HeavyWeightSynergyForLittleGuy>();
			PetOffsetHolder petOffsetHolder = val.AddComponent<PetOffsetHolder>();
			petOffsetHolder.petOffsetLeft = new Vector2(-0.8125f, -0.4375f);
			petOffsetHolder.petOffsetRight = new Vector2(0.625f, -0.4375f);
			((AssetBundleDatabase<AIActor, EnemyDatabaseEntry>)(object)EnemyDatabase.Instance).Entries.Add((EnemyDatabaseEntry)(object)new LittleGuyEntry
			{
				difficulty = (PlaceableDifficulty)0,
				encounterGuid = text,
				ForcedPositionInAmmonomicon = 0,
				isInBossTab = false,
				isNormalEnemy = false,
				myGuid = text,
				path = ((Object)val).name,
				placeableHeight = 1,
				placeableWidth = 1,
				unityGuid = text
			});
			Game.Enemies.Add("lg:little_guy", val3);
			guy = val;
			return text;
		}

		public static tk2dSpriteDefinition CopyDefinitionFrom(tk2dSpriteDefinition other)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: 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_015f: 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_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: 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_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_0328: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Expected O, but got Unknown
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Unknown result type (might be due to invalid IL or missing references)
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_043a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			tk2dSpriteDefinition val = new tk2dSpriteDefinition
			{
				boundsDataCenter = new Vector3
				{
					x = other.boundsDataCenter.x,
					y = other.boundsDataCenter.y,
					z = other.boundsDataCenter.z
				},
				boundsDataExtents = new Vector3
				{
					x = other.boundsDataExtents.x,
					y = other.boundsDataExtents.y,
					z = other.boundsDataExtents.z
				},
				colliderConvex = other.colliderConvex,
				colliderSmoothSphereCollisions = other.colliderSmoothSphereCollisions,
				colliderType = other.colliderType,
				colliderVertices = other.colliderVertices,
				collisionLayer = other.collisionLayer,
				complexGeometry = other.complexGeometry,
				extractRegion = other.extractRegion,
				flipped = other.flipped,
				indices = other.indices,
				material = new Material(other.material),
				materialId = other.materialId,
				materialInst = new Material(other.materialInst),
				metadata = other.metadata,
				name = other.name,
				normals = other.normals,
				physicsEngine = other.physicsEngine,
				position0 = new Vector3
				{
					x = other.position0.x,
					y = other.position0.y,
					z = other.position0.z
				},
				position1 = new Vector3
				{
					x = other.position1.x,
					y = other.position1.y,
					z = other.position1.z
				},
				position2 = new Vector3
				{
					x = other.position2.x,
					y = other.position2.y,
					z = other.position2.z
				},
				position3 = new Vector3
				{
					x = other.position3.x,
					y = other.position3.y,
					z = other.position3.z
				},
				regionH = other.regionH,
				regionW = other.regionW,
				regionX = other.regionX,
				regionY = other.regionY,
				tangents = other.tangents,
				texelSize = new Vector2
				{
					x = other.texelSize.x,
					y = other.texelSize.y
				},
				untrimmedBoundsDataCenter = new Vector3
				{
					x = other.untrimmedBoundsDataCenter.x,
					y = other.untrimmedBoundsDataCenter.y,
					z = other.untrimmedBoundsDataCenter.z
				},
				untrimmedBoundsDataExtents = new Vector3
				{
					x = other.untrimmedBoundsDataExtents.x,
					y = other.untrimmedBoundsDataExtents.y,
					z = other.untrimmedBoundsDataExtents.z
				}
			};
			if (other.uvs != null)
			{
				List<Vector2> list = new List<Vector2>();
				Vector2[] uvs = other.uvs;
				foreach (Vector2 val2 in uvs)
				{
					list.Add(new Vector2
					{
						x = val2.x,
						y = val2.y
					});
				}
				val.uvs = list.ToArray();
			}
			else
			{
				val.uvs = null;
			}
			if (other.colliderVertices != null)
			{
				List<Vector3> list2 = new List<Vector3>();
				Vector3[] colliderVertices = other.colliderVertices;
				foreach (Vector3 val3 in colliderVertices)
				{
					list2.Add(new Vector3
					{
						x = val3.x,
						y = val3.y,
						z = val3.z
					});
				}
				val.colliderVertices = list2.ToArray();
			}
			else
			{
				val.colliderVertices = null;
			}
			return val;
		}
	}
	[HarmonyPatch]
	public class TheBosscardPatch
	{
		[HarmonyPatch]
		public static class ThePatchThatNeedsATranspiler
		{
			[HarmonyTargetMethod]
			public static MethodBase Method()
			{
				return AccessTools.Method(coopslidetype, "MoveNext", (Type[])null, (Type[])null);
			}

			[HarmonyPatch]
			[HarmonyTranspiler]
			public static IEnumerable<CodeInstruction> AddTheStuff(IEnumerable<CodeInstruction> instructions)
			{
				int encounteredvisiblecount = 0;
				foreach (CodeInstruction i in instructions)
				{
					yield return i;
					if (CodeInstructionExtensions.Calls(i, visiblethingy))
					{
						encounteredvisiblecount++;
						if (encounteredvisiblecount == 2)
						{
							yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
							yield return new CodeInstruction(OpCodes.Ldfld, (object)thisincoopslide);
							yield return new CodeInstruction(OpCodes.Call, (object)changebosscard);
						}
					}
				}
			}
		}

		public static Type coopslidetype = AccessTools.TypeByName("BossCardUIController+<HandleCharacterSlides>c__Iterator5");

		public static MethodInfo visiblethingy = AccessTools.PropertySetter(typeof(dfControl), "IsVisible");

		public static MethodInfo changebosscard = AccessTools.Method(typeof(TheBosscardPatch), "MaybeChangeCoopBosscard", (Type[])null, (Type[])null);

		public static FieldInfo thisincoopslide = AccessTools.Field(coopslidetype, "$this");

		[HarmonyPatch(typeof(SpawnObjectPlayerItem), "DoSpawn")]
		[HarmonyPostfix]
		public static void ThisIsTechnicallyNotABosscardPatchButShhhhh(SpawnObjectPlayerItem __instance)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (((PickupObject)__instance).PickupObjectId == 155 && (Object)(object)((PlayerItem)__instance).LastOwner != (Object)null && ((PlayerItem)__instance).LastOwner.HasActiveBonusSynergy(Plugin.notEnoughSynergy, false) && (Object)(object)__instance.spawnedPlayerObject != (Object)null && (Object)(object)__instance.spawnedPlayerObject.GetComponent<BlackHoleDoer>() != (Object)null)
			{
				BlackHoleDoer component = __instance.spawnedPlayerObject.GetComponent<BlackHoleDoer>();
				component.coreDuration += 2f;
			}
		}

		[HarmonyPatch(typeof(CompanionController), "StopPet")]
		[HarmonyPrefix]
		public static void AnotherNonBosscardPatch(CompanionController __instance)
		{
			if ((Object)(object)__instance.m_pettingDoer != (Object)null && (Object)(object)((BraveBehaviour)__instance).aiActor != (Object)null && (((BraveBehaviour)__instance).aiActor.EnemyGuid == "lg_lilguy" || ((BraveBehaviour)__instance).aiActor.EnemyGuid == "lg_lilgal"))
			{
				((BraveBehaviour)__instance).aiAnimator.PlayUntilFinished("pet_end", false, (string)null, -1f, false);
			}
		}

		public static void MaybeChangeCoopBosscard(BossCardUIController ui)
		{
			if (HasLittleGuy(out var hasgal))
			{
				bool isVisible = ((dfControl)ui.playerSprite).IsVisible;
				bool isVisible2 = ((dfControl)ui.coopSprite).IsVisible;
				if (!(isVisible && isVisible2))
				{
					dfTextureSprite val = ((!isVisible) ? ui.playerSprite : ui.coopSprite);
					val.texture = (Texture)(object)(hasgal ? Plugin.lilguybosscard2 : Plugin.lilguybosscard);
					((dfControl)val).IsVisible = true;
					((dfControl)val).ZOrder = ((dfControl)ui.bossSprite).ZOrder + 1;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BossCardUIController), "HandleDelayedCoopCharacterSlide")]
		public static IEnumerator Slide(IEnumerator rat, BossCardUIController __instance)
		{
			if ((int)GameManager.Instance.CurrentGameType == 0 && HasLittleGuy(out var _))
			{
				float initialMoveDuration = __instance.CHARACTER_INITIAL_MOVE_DURATION;
				float slideDuration = __instance.CHARACTER_SLIDE_DURATION - __instance.CHARACTER_INITIAL_MOVE_DURATION;
				float elapsed3 = 0f;
				Vector3 playerVec = __instance.playerTarget.position - __instance.playerStart.position;
				((Component)__instance.coopSprite).transform.position = __instance.playerStart.position + __instance.GetCoopOffset();
				float p2u = ((dfControl)__instance.playerSprite).PixelsToUnits();
				while (elapsed3 < initialMoveDuration)
				{
					elapsed3 += ((TimeInvariantMonoBehaviour)__instance).m_deltaTime;
					float num = elapsed3 / initialMoveDuration;
					Vector3 calcedPlayerPos = Vector3.Lerp(__instance.playerStart.position, __instance.playerTarget.position, num);
					((Component)__instance.coopSprite).transform.position = calcedPlayerPos + __instance.GetCoopOffset();
					yield return null;
				}
				elapsed3 = 0f;
				Vector3 currentRealPlayerPosition = __instance.playerTarget.position;
				while (elapsed3 < slideDuration)
				{
					elapsed3 += ((TimeInvariantMonoBehaviour)__instance).m_deltaTime;
					currentRealPlayerPosition += ((Vector3)(ref playerVec)).normalized * ((TimeInvariantMonoBehaviour)__instance).m_deltaTime * __instance.BOSS_SLIDE_SPEED;
					((Component)__instance.coopSprite).transform.position = dfVectorExtensions.Quantize(currentRealPlayerPosition, p2u) + __instance.GetCoopOffset();
					yield return null;
				}
				playerVec = default(Vector3);
			}
			else
			{
				yield return rat;
			}
		}

		public static bool HasLittleGuy(out bool hasgal)
		{
			if (GameManager.HasInstance && GameManager.Instance.AllPlayers != null)
			{
				PlayerController[] allPlayers = GameManager.Instance.AllPlayers;
				foreach (PlayerController val in allPlayers)
				{
					if (!((Object)(object)val != (Object)null) || !((Object)(object)((BraveBehaviour)val).healthHaver != (Object)null) || ((BraveBehaviour)val).healthHaver.IsDead)
					{
						continue;
					}
					foreach (PassiveItem passiveItem in val.passiveItems)
					{
						if ((Object)(object)passiveItem != (Object)null && passiveItem is StrangeRoot strangeRoot)
						{
							GameObject extantCompanion = ((CompanionItem)strangeRoot).ExtantCompanion;
							if ((Object)(object)extantCompanion != (Object)null && (Object)(object)extantCompanion.GetComponent<AIActor>() != (Object)null && extantCompanion.GetComponent<AIActor>().EnemyGuid == "lg_lilguy")
							{
								hasgal = (Object)(object)strangeRoot.littlegal != (Object)null;
								return true;
							}
						}
					}
				}
			}
			hasgal = false;
			return false;
		}
	}
	public class WholeZooSynergy : GunBehaviour
	{
		public override void PostProcessVolley(ProjectileVolleyData volley)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((GunBehaviour)this).PlayerOwner != (Object)null && ((GunBehaviour)this).PlayerOwner.HasActiveBonusSynergy(Plugin.wholeZooSynergy, false))
			{
				int count = volley.projectiles.Count;
				for (int i = 0; i < count; i++)
				{
					ProjectileModule val = volley.projectiles[i];
					ProjectileModule val2 = ProjectileModule.CreateClone(val, false, (val.CloneSourceIndex >= 0) ? val.CloneSourceIndex : i);
					val2.ignoredForReloadPurposes = true;
					val2.ammoCost = 0;
					volley.projectiles.Add(val2);
				}
			}
		}
	}
}