Decompiled source of JuneLib v1.0.8

plugins/JuneLib.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using Alexandria.ItemAPI;
using Alexandria.Misc;
using Alexandria.NPCAPI;
using Alexandria.PrefabAPI;
using BepInEx;
using Dungeonator;
using Gungeon;
using HarmonyLib;
using JuneLib;
using JuneLib.Items;
using JuneLib.Status;
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("d6d7a494-722e-4763-959b-c2d6b6a42b01")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[HarmonyPatch]
public static class JunePlayerEvents
{
	internal static void Init()
	{
		CustomActions.OnNewPlayercontrollerSpawned = (Action<PlayerController>)Delegate.Combine(CustomActions.OnNewPlayercontrollerSpawned, (Action<PlayerController>)delegate(PlayerController player)
		{
			((Component)player).gameObject.AddComponent<JEventsComponent>();
		});
	}

	internal static JEventsComponent GetJEvents(this PlayerController player)
	{
		return ((Component)player).GetComponent<JEventsComponent>();
	}

	[HarmonyPatch(typeof(Gun), "ShootSingleProjectile")]
	[HarmonyPrefix]
	internal static bool OverrideShootSingleProjectile(Gun __instance, ProjectileModule mod, ProjectileData overrideProjectileData = null, GameObject overrideBulletObject = null)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Invalid comparison between Unknown and I4
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Invalid comparison between Unknown and I4
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0266: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0884: Unknown result type (might be due to invalid IL or missing references)
		//IL_0896: Unknown result type (might be due to invalid IL or missing references)
		//IL_089c: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_08be: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a84: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ba6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bab: Unknown result type (might be due to invalid IL or missing references)
		GameActor owner = __instance.m_owner;
		PlayerController val = (PlayerController)(object)((owner is PlayerController) ? owner : null);
		GameActor owner2 = __instance.m_owner;
		AIActor val2 = (AIActor)(object)((owner2 is AIActor) ? owner2 : null);
		Projectile val3 = null;
		ChargeProjectile val4 = null;
		if (Object.op_Implicit((Object)(object)overrideBulletObject))
		{
			val3 = overrideBulletObject.GetComponent<Projectile>();
		}
		else if ((int)mod.shootStyle == 3)
		{
			val4 = mod.GetChargeProjectile(__instance.m_moduleData[mod].chargeTime);
			if (val4 != null)
			{
				val3 = val4.Projectile;
				val3.pierceMinorBreakables = true;
			}
		}
		else
		{
			val3 = mod.GetCurrentProjectile(__instance.m_moduleData[mod], __instance.CurrentOwner);
		}
		if (!Object.op_Implicit((Object)(object)val3))
		{
			ModuleShootData obj = __instance.m_moduleData[mod];
			obj.numberShotsFired++;
			ModuleShootData obj2 = __instance.m_moduleData[mod];
			obj2.numberShotsFiredThisBurst++;
			if (__instance.m_moduleData[mod].numberShotsActiveReload > 0)
			{
				ModuleShootData obj3 = __instance.m_moduleData[mod];
				obj3.numberShotsActiveReload--;
			}
			if (mod.GetModNumberOfShotsInClip(__instance.CurrentOwner) > 0 && __instance.m_moduleData[mod].numberShotsFired >= mod.GetModNumberOfShotsInClip(__instance.CurrentOwner))
			{
				__instance.m_moduleData[mod].needsReload = true;
			}
			if ((int)mod.shootStyle != 3)
			{
				mod.IncrementShootCount();
			}
			return false;
		}
		if (Object.op_Implicit((Object)(object)val))
		{
			if (val.OnPreFireProjectileModifier != null)
			{
				val3 = val.OnPreFireProjectileModifier(__instance, val3);
			}
			JEventsComponent jEvents = val.GetJEvents();
			if (Object.op_Implicit((Object)(object)jEvents) && jEvents.OnPreFireContextProjectileModifer != null)
			{
				val3 = jEvents.OnPreFireContextProjectileModifer(__instance, val3, mod);
			}
		}
		if (__instance.m_isCritting && Object.op_Implicit((Object)(object)__instance.CriticalReplacementProjectile))
		{
			val3 = __instance.CriticalReplacementProjectile;
		}
		if (__instance.OnPreFireProjectileModifier != null)
		{
			val3 = __instance.OnPreFireProjectileModifier(__instance, val3, mod);
		}
		if (GameManager.Instance.InTutorial && (Object)(object)val != (Object)null)
		{
			GameManager.BroadcastRoomTalkDoerFsmEvent("playerFiredGun");
		}
		Vector3 val5 = __instance.barrelOffset.position;
		((Vector3)(ref val5))..ctor(val5.x, val5.y, -1f);
		float num = ((!((Object)(object)val != (Object)null)) ? 1f : val.stats.GetStatValue((StatType)2));
		num = ((!(__instance.m_owner is DumbGunShooter) || !((DumbGunShooter)/*isinst with value type is only supported in some contexts*/).overridesInaccuracy) ? num : ((DumbGunShooter)/*isinst with value type is only supported in some contexts*/).inaccuracyFraction);
		float angleForShot = mod.GetAngleForShot(__instance.m_moduleData[mod].alternateAngleSign, num, (float?)null);
		if (__instance.m_moduleData[mod].numberShotsActiveReload > 0 && __instance.activeReloadData.usesOverrideAngleVariance)
		{
			ProjectileModule val6 = mod;
			float num2 = num;
			angleForShot = val6.GetAngleForShot(1f, num2, (float?)__instance.activeReloadData.overrideAngleVariance);
		}
		if (mod.alternateAngle)
		{
			ModuleShootData obj4 = __instance.m_moduleData[mod];
			obj4.alternateAngleSign *= -1f;
		}
		if (__instance.LockedHorizontalOnCharge && __instance.LockedHorizontalCenterFireOffset >= 0f)
		{
			val5 = Vector2.op_Implicit(((BraveBehaviour)__instance.m_owner).specRigidbody.HitboxPixelCollider.UnitCenter + BraveMathCollege.DegreesToVector(__instance.gunAngle, __instance.LockedHorizontalCenterFireOffset));
		}
		GameObject val7 = SpawnManager.SpawnProjectile(((Component)val3).gameObject, val5 + Quaternion.Euler(0f, 0f, __instance.gunAngle) * mod.positionOffset, Quaternion.Euler(0f, 0f, __instance.gunAngle + angleForShot), true);
		Projectile val8 = (__instance.LastProjectile = val7.GetComponent<Projectile>());
		val8.Owner = __instance.m_owner;
		val8.Shooter = ((BraveBehaviour)__instance.m_owner).specRigidbody;
		ProjectileData baseData = val8.baseData;
		baseData.damage += (float)__instance.damageModifier;
		val8.Inverted = mod.inverted;
		if (__instance.m_owner is PlayerController && (__instance.LocalActiveReload || (val.IsPrimaryPlayer && Gun.ActiveReloadActivated) || (!val.IsPrimaryPlayer && Gun.ActiveReloadActivatedPlayerTwo)))
		{
			ProjectileData baseData2 = val8.baseData;
			baseData2.damage *= __instance.m_moduleData[mod].activeReloadDamageModifier;
		}
		if (Object.op_Implicit((Object)(object)((BraveBehaviour)__instance.m_owner).aiShooter))
		{
			val8.collidesWithEnemies = ((BraveBehaviour)__instance.m_owner).aiShooter.CanShootOtherEnemies;
		}
		if (__instance.rampBullets)
		{
			val8.Ramp(__instance.rampStartHeight, __instance.rampTime);
			TrailController componentInChildren = val7.GetComponentInChildren<TrailController>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				componentInChildren.rampHeight = true;
				componentInChildren.rampStartHeight = __instance.rampStartHeight;
				componentInChildren.rampTime = __instance.rampTime;
			}
		}
		if (__instance.m_owner is PlayerController)
		{
			PlayerStats stats = val.stats;
			ProjectileData baseData3 = val8.baseData;
			baseData3.damage *= stats.GetStatValue((StatType)5);
			ProjectileData baseData4 = val8.baseData;
			baseData4.speed *= stats.GetStatValue((StatType)6);
			ProjectileData baseData5 = val8.baseData;
			baseData5.force *= stats.GetStatValue((StatType)12);
			ProjectileData baseData6 = val8.baseData;
			baseData6.range *= stats.GetStatValue((StatType)26);
			if (val.inventory.DualWielding)
			{
				ProjectileData baseData7 = val8.baseData;
				baseData7.damage *= Gun.s_DualWieldFactor;
			}
			if (__instance.CanSneakAttack && ((GameActor)val).IsStealthed)
			{
				ProjectileData baseData8 = val8.baseData;
				baseData8.damage *= __instance.SneakAttackDamageMultiplier;
			}
			if (__instance.m_isCritting)
			{
				ProjectileData baseData9 = val8.baseData;
				baseData9.damage *= __instance.CriticalDamageMultiplier;
				val8.IsCritical = true;
			}
			if (__instance.UsesBossDamageModifier)
			{
				if (__instance.CustomBossDamageModifier >= 0f)
				{
					val8.BossDamageMultiplier = __instance.CustomBossDamageModifier;
				}
				else
				{
					val8.BossDamageMultiplier = 0.8f;
				}
			}
		}
		if ((Object)(object)__instance.Volley != (Object)null && __instance.Volley.UsesShotgunStyleVelocityRandomizer)
		{
			ProjectileData baseData10 = val8.baseData;
			baseData10.speed *= __instance.Volley.GetVolleySpeedMod();
		}
		if ((Object)(object)val2 != (Object)null && val2.IsBlackPhantom)
		{
			ProjectileData baseData11 = val8.baseData;
			baseData11.speed *= val2.BlackPhantomProperties.BulletSpeedMultiplier;
		}
		if (__instance.m_moduleData[mod].numberShotsActiveReload > 0)
		{
			if (!__instance.activeReloadData.ActiveReloadStacks)
			{
				ProjectileData baseData12 = val8.baseData;
				baseData12.damage *= __instance.activeReloadData.damageMultiply;
			}
			ProjectileData baseData13 = val8.baseData;
			baseData13.force *= __instance.activeReloadData.knockbackMultiply;
		}
		if (overrideProjectileData != null)
		{
			val8.baseData.SetAll(overrideProjectileData);
		}
		__instance.LastShotIndex = __instance.m_moduleData[mod].numberShotsFired;
		val8.PlayerProjectileSourceGameTimeslice = Time.time;
		if (!__instance.IsMinusOneGun)
		{
			__instance.ApplyCustomAmmunitionsToProjectile(val8);
			if (__instance.m_owner is PlayerController)
			{
				val.DoPostProcessProjectile(val8);
				JEventsComponent jEvents2 = val.GetJEvents();
				if (Object.op_Implicit((Object)(object)jEvents2) && jEvents2.PostProcessProjectileMod != null)
				{
					jEvents2.PostProcessProjectileMod(val8, __instance, mod);
				}
			}
			if (__instance.PostProcessProjectile != null)
			{
				__instance.PostProcessProjectile(val8);
			}
		}
		if (mod.mirror)
		{
			val7 = SpawnManager.SpawnProjectile(((Component)val3).gameObject, val5 + Quaternion.Euler(0f, 0f, __instance.gunAngle) * mod.InversePositionOffset, Quaternion.Euler(0f, 0f, __instance.gunAngle - angleForShot), true);
			Projectile val9 = (__instance.LastProjectile = val7.GetComponent<Projectile>());
			val9.Inverted = true;
			val9.Owner = __instance.m_owner;
			val9.Shooter = ((BraveBehaviour)__instance.m_owner).specRigidbody;
			if (Object.op_Implicit((Object)(object)((BraveBehaviour)__instance.m_owner).aiShooter))
			{
				val9.collidesWithEnemies = ((BraveBehaviour)__instance.m_owner).aiShooter.CanShootOtherEnemies;
			}
			if (__instance.rampBullets)
			{
				val9.Ramp(__instance.rampStartHeight, __instance.rampTime);
				TrailController componentInChildren2 = val7.GetComponentInChildren<TrailController>();
				if (Object.op_Implicit((Object)(object)componentInChildren2))
				{
					componentInChildren2.rampHeight = true;
					componentInChildren2.rampStartHeight = __instance.rampStartHeight;
					componentInChildren2.rampTime = __instance.rampTime;
				}
			}
			val9.PlayerProjectileSourceGameTimeslice = Time.time;
			if (!__instance.IsMinusOneGun)
			{
				__instance.ApplyCustomAmmunitionsToProjectile(val9);
				if (__instance.m_owner is PlayerController)
				{
					val.DoPostProcessProjectile(val9);
				}
				if (__instance.PostProcessProjectile != null)
				{
					__instance.PostProcessProjectile(val9);
				}
			}
			val9.baseData.SetAll(val8.baseData);
			val9.IsCritical = val8.IsCritical;
		}
		if ((Object)(object)__instance.modifiedFinalVolley != (Object)null && mod == __instance.modifiedFinalVolley.projectiles[0])
		{
			mod = __instance.DefaultModule;
		}
		if (val4 != null && val4.ReflectsIncomingBullets && Object.op_Implicit((Object)(object)__instance.barrelOffset))
		{
			if (val4.MegaReflection)
			{
				int num3 = PassiveReflectItem.ReflectBulletsInRange(Vector3Extensions.XY(__instance.barrelOffset.position), 2.66f, true, __instance.m_owner, 30f, 1.25f, 1.5f, true);
				if (num3 > 0)
				{
					AkSoundEngine.PostEvent("Play_WPN_duelingpistol_impact_01", ((Component)__instance).gameObject);
					AkSoundEngine.PostEvent("Play_PET_junk_punch_01", ((Component)__instance).gameObject);
				}
			}
			else
			{
				int num4 = PassiveReflectItem.ReflectBulletsInRange(Vector3Extensions.XY(__instance.barrelOffset.position), 2.66f, true, __instance.m_owner, 30f, 1f, 1f, true);
				if (num4 > 0)
				{
					AkSoundEngine.PostEvent("Play_WPN_duelingpistol_impact_01", ((Component)__instance).gameObject);
					AkSoundEngine.PostEvent("Play_PET_junk_punch_01", ((Component)__instance).gameObject);
				}
			}
		}
		__instance.IncrementModuleFireCountAndMarkReload(mod, val4);
		if (__instance.m_owner is PlayerController)
		{
			GameStatsManager.Instance.RegisterStatChange((TrackedStats)0, 1f);
			if ((Object)(object)val3 != (Object)null && val3.AppliesKnockbackToPlayer)
			{
				((BraveBehaviour)val).knockbackDoer.ApplyKnockback(-1f * BraveMathCollege.DegreesToVector(__instance.gunAngle, 1f), val3.PlayerKnockbackForce, false);
			}
		}
		return false;
	}
}
public class JEventsComponent : BraveBehaviour
{
	public Action<PlayerController, Gun, ProjectileVolleyData, RegeneratingVolleyModifiers.ModifyProjArgs> ConstantModifyGunVolley;

	public Func<Gun, Projectile, ProjectileModule, Projectile> OnPreFireContextProjectileModifer;

	public Action<Projectile, Gun, ProjectileModule> PostProcessProjectileMod;
}
public abstract class BaseAdvancedGrappleModule
{
	protected bool isDone = false;

	protected bool m_hitTile;

	protected SpeculativeRigidbody collidedBody;

	public float grappleSpeed;

	public GameObject hookPrefab;

	protected GameObject m_hookObject;

	protected PlayerController m_user;

	private Coroutine currentCoroutine;

	[SerializeField]
	public BaseAdvancedGrappleModule()
	{
		grappleSpeed = 20f;
	}

	public static GameObject GenerateHookPrefab(string name, IntVector2 hookDimensions, string hookSprite, string chainSprite, Assembly assembly = null)
	{
		//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_002f: 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_003b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: 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_006b: Expected O, but got Unknown
		if ((object)assembly == null)
		{
			assembly = Assembly.GetCallingAssembly();
		}
		GameObject val = PrefabBuilder.BuildObject(name);
		SpeculativeRigidbody val2 = val.AddComponent<SpeculativeRigidbody>();
		PixelCollider item = new PixelCollider
		{
			IsTrigger = false,
			ManualWidth = hookDimensions.x,
			ManualHeight = hookDimensions.y,
			ColliderGenerationMode = (PixelColliderGeneration)0,
			CollisionLayer = (CollisionLayer)4,
			ManualOffsetX = 0,
			ManualOffsetY = 0,
			BagleUseFirstFrameOnly = false
		};
		val2.PixelColliders = new List<PixelCollider> { item };
		int num = SpriteBuilder.AddSpriteToCollection(hookSprite, Databases.Items.ProjectileCollection, assembly);
		tk2dSprite orAddComponent = GameObjectExtensions.GetOrAddComponent<tk2dSprite>(val.gameObject);
		((tk2dBaseSprite)orAddComponent).SetSprite(Databases.Items.ProjectileCollection, num);
		GameObject val3 = PrefabBuilder.BuildObject(name);
		val3.transform.parent = val.transform;
		int num2 = SpriteBuilder.AddSpriteToCollection(chainSprite, Databases.Items.ProjectileCollection, assembly);
		tk2dTiledSprite orAddComponent2 = GameObjectExtensions.GetOrAddComponent<tk2dTiledSprite>(val3.gameObject);
		((tk2dBaseSprite)orAddComponent2).SetSprite(Databases.Items.ProjectileCollection, num2);
		tk2dSpriteDefinition currentSpriteDef = ((tk2dBaseSprite)orAddComponent2).GetCurrentSpriteDef();
		GunTools.ConstructOffsetsFromAnchor(currentSpriteDef, (Anchor)3, (Vector2?)null, false, true);
		return val;
	}

	public void Trigger(PlayerController user)
	{
		//IL_0033: 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)
		m_user = user;
		collidedBody = null;
		m_hitTile = false;
		m_hookObject = Object.Instantiate<GameObject>(hookPrefab);
		m_hookObject.transform.position = Vector2Extensions.ToVector3ZUp(((GameActor)user).CenterPosition, 0f);
		currentCoroutine = ((MonoBehaviour)user).StartCoroutine(UseGrapple(user));
	}

	protected IEnumerator UseGrapple(PlayerController user)
	{
		SpeculativeRigidbody hookRigidBody = m_hookObject.GetComponent<SpeculativeRigidbody>();
		OnPreFireHook(user, hookRigidBody);
		Vector2 startPoint = ((GameActor)user).CenterPosition;
		Vector2 aimDirection = Vector3Extensions.XY(user.unadjustedAimPoint) - startPoint;
		hookRigidBody.Velocity = ((Vector2)(ref aimDirection)).normalized * grappleSpeed;
		hookRigidBody.Reinitialize();
		OnPreRigidbodyCollisionDelegate onPreRigidbodyCollision = hookRigidBody.OnPreRigidbodyCollision;
		BaseAdvancedGrappleModule baseAdvancedGrappleModule = this;
		hookRigidBody.OnPreRigidbodyCollision = (OnPreRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)onPreRigidbodyCollision, (Delegate?)new OnPreRigidbodyCollisionDelegate(baseAdvancedGrappleModule.OnPreRigidBodyCollision));
		OnRigidbodyCollisionDelegate onRigidbodyCollision = hookRigidBody.OnRigidbodyCollision;
		BaseAdvancedGrappleModule baseAdvancedGrappleModule2 = this;
		hookRigidBody.OnRigidbodyCollision = (OnRigidbodyCollisionDelegate)Delegate.Combine((Delegate?)(object)onRigidbodyCollision, (Delegate?)new OnRigidbodyCollisionDelegate(baseAdvancedGrappleModule2.OnRigidBodyCollision));
		OnTileCollisionDelegate onTileCollision = hookRigidBody.OnTileCollision;
		BaseAdvancedGrappleModule baseAdvancedGrappleModule3 = this;
		hookRigidBody.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)onTileCollision, (Delegate?)new OnTileCollisionDelegate(baseAdvancedGrappleModule3.OnRigidBodyCollision));
		tk2dTiledSprite chainSprite = ((Component)hookRigidBody).GetComponentInChildren<tk2dTiledSprite>();
		chainSprite.dimensions = new Vector2(3f, 3f);
		chainSprite.anchor = (Anchor)5;
		while (!isDone)
		{
			if (!Object.op_Implicit((Object)(object)m_hookObject))
			{
				yield break;
			}
			Vector2 currentDirVec = hookRigidBody.UnitCenter - ((GameActor)user).CenterPosition;
			int pixelsWide = Mathf.RoundToInt(((Vector2)(ref currentDirVec)).magnitude / 0.0625f);
			chainSprite.dimensions = new Vector2((float)pixelsWide, chainSprite.dimensions.y);
			float currentChainSpriteAngle = BraveMathCollege.Atan2Degrees(currentDirVec);
			((BraveBehaviour)hookRigidBody).transform.rotation = Quaternion.Euler(0f, 0f, currentChainSpriteAngle);
			UpdateHook(currentDirVec, hookRigidBody);
			yield return null;
			currentDirVec = default(Vector2);
		}
		m_user = null;
		Object.Destroy((Object)(object)m_hookObject);
		m_hookObject = null;
	}

	protected virtual void OnPreRigidBodyCollision(SpeculativeRigidbody myRigidbody, PixelCollider myCollider, SpeculativeRigidbody otherRigidbody, PixelCollider otherCollider)
	{
		if (Object.op_Implicit((Object)(object)collidedBody) || m_hitTile)
		{
			PhysicsEngine.SkipCollision = true;
		}
		else if ((Object)(object)((Component)otherRigidbody).GetComponent<PlayerController>() != (Object)null)
		{
			PhysicsEngine.SkipCollision = true;
		}
	}

	protected virtual void OnRigidBodyCollision(CollisionData rigidbodyCollision)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		m_hitTile = true;
		rigidbodyCollision.MyRigidbody.Velocity = Vector2.zero;
	}

	protected virtual void UpdateHook(Vector2 Direction, SpeculativeRigidbody hookbody)
	{
		//IL_000f: 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_0020: 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_0036: Unknown result type (might be due to invalid IL or missing references)
		if (m_hitTile)
		{
			hookbody.Velocity = ((Vector2)(ref Direction)).normalized * (0f - grappleSpeed);
			if (Vector2.Distance(((BraveBehaviour)m_user).specRigidbody.UnitCenter, hookbody.UnitCenter) < 1.5f)
			{
				isDone = true;
			}
		}
	}

	protected abstract void OnPreFireHook(PlayerController user, SpeculativeRigidbody hook);
}
[HarmonyPatch]
public class CustomChargeTypeItem : PlayerItem
{
	public float specialCooldown;

	protected float remainingSpecialCooldown;

	public float RemainingSpecialCooldown
	{
		get
		{
			return remainingSpecialCooldown;
		}
		set
		{
			remainingSpecialCooldown = Math.Max(value, 0f);
		}
	}

	internal static bool GetCustomChargeTypeItemIsOnCooldown(PlayerItem item)
	{
		if (item is CustomChargeTypeItem customChargeTypeItem)
		{
			return customChargeTypeItem.RemainingSpecialCooldown > 0f;
		}
		return false;
	}

	internal float CooldownPercentageHook()
	{
		if (((PlayerItem)this).IsCurrentlyActive)
		{
			return ((PlayerItem)this).ActivePercentage;
		}
		if (!((PlayerItem)this).IsOnCooldown)
		{
			return 0f;
		}
		return remainingSpecialCooldown / specialCooldown;
	}

	[HarmonyPatch(typeof(PlayerItem), "ApplyCooldown")]
	[HarmonyPostfix]
	public static void ApplyCooldownHook(PlayerItem __instance)
	{
		if (__instance is CustomChargeTypeItem customChargeTypeItem)
		{
			customChargeTypeItem.remainingSpecialCooldown = customChargeTypeItem.specialCooldown;
		}
	}
}
public static class EnemyHelpers
{
	public static void AddPermanentCharm(this AIActor actor, GameActorCharmEffect charm = null)
	{
		if (charm == null)
		{
			((GameActor)actor).ApplyEffect((GameActorEffect)(object)GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultPermanentCharmEffect, 1f, (Projectile)null);
		}
		else
		{
			((GameActor)actor).ApplyEffect((GameActorEffect)(object)charm, 1f, (Projectile)null);
		}
		((Component)actor).gameObject.AddComponent<KillOnRoomClear>();
		actor.IsHarmlessEnemy = true;
		actor.IgnoreForRoomClear = true;
		if (Object.op_Implicit((Object)(object)((Component)actor).gameObject.GetComponent<SpawnEnemyOnDeath>()))
		{
			Object.Destroy((Object)(object)((Component)actor).gameObject.GetComponent<SpawnEnemyOnDeath>());
		}
	}
}
public static class ItemHelpers
{
	public static void AddFlagsToPlayer(this PlayerController player, Type type)
	{
		if (!PassiveItem.ActiveFlagItems.ContainsKey(player))
		{
			PassiveItem.ActiveFlagItems.Add(player, new Dictionary<Type, int>());
		}
		if (!PassiveItem.ActiveFlagItems[player].ContainsKey(type))
		{
			PassiveItem.ActiveFlagItems[player].Add(type, 1);
		}
		else
		{
			PassiveItem.ActiveFlagItems[player][type] = PassiveItem.ActiveFlagItems[player][type] + 1;
		}
	}

	public static void RemoveFlagsFromPlayer(this PlayerController player, Type type)
	{
		if (Object.op_Implicit((Object)(object)player) && PassiveItem.ActiveFlagItems.ContainsKey(player) && PassiveItem.ActiveFlagItems[player].ContainsKey(type))
		{
			PassiveItem.ActiveFlagItems[player][type] = Mathf.Max(0, PassiveItem.ActiveFlagItems[player][type] - 1);
			if (PassiveItem.ActiveFlagItems[player][type] == 0)
			{
				PassiveItem.ActiveFlagItems[player].Remove(type);
			}
		}
	}

	public static bool PlayerHasActiveSynergy(this PlayerController player, string synergyNameToCheck)
	{
		foreach (int activeExtraSynergy in player.ActiveExtraSynergies)
		{
			AdvancedSynergyEntry val = GameManager.Instance.SynergyManager.synergies[activeExtraSynergy];
			if (val.NameKey == synergyNameToCheck)
			{
				return true;
			}
		}
		return false;
	}

	public static bool SynergyActiveAtAll(string synergyNameToCheck)
	{
		for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++)
		{
			PlayerController player = GameManager.Instance.AllPlayers[i];
			if (player.PlayerHasActiveSynergy(synergyNameToCheck))
			{
				return true;
			}
		}
		return false;
	}

	public static void PlaceItemInAmmonomiconAfterItemById(this PickupObject item, int id)
	{
		item.ForcedPositionInAmmonomicon = PickupObjectDatabase.GetById(id).ForcedPositionInAmmonomicon;
	}

	public static void MakeBulletMod(this PickupObject item)
	{
		AlexandriaTags.SetTag(item, "bullet_modifier");
		item.PlaceItemInAmmonomiconAfterItemById(524);
	}

	public static void AddStat(this PassiveItem item, StatType statType, float amount, ModifyMethod method = 0)
	{
		//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_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0030: 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)
		StatModifier val = new StatModifier
		{
			amount = amount,
			statToBoost = statType,
			modifyType = method
		};
		StatModifier[] passiveStatModifiers = item.passiveStatModifiers;
		foreach (StatModifier val2 in passiveStatModifiers)
		{
			if (val2.statToBoost == statType)
			{
				return;
			}
		}
		if (item.passiveStatModifiers == null)
		{
			item.passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { val };
		}
		else
		{
			item.passiveStatModifiers = item.passiveStatModifiers.Concat((IEnumerable<StatModifier>)(object)new StatModifier[1] { val }).ToArray();
		}
	}

	public static void RemoveStat(this PassiveItem item, StatType statType)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		List<StatModifier> list = new List<StatModifier>();
		for (int i = 0; i < item.passiveStatModifiers.Length; i++)
		{
			if (item.passiveStatModifiers[i].statToBoost != statType)
			{
				list.Add(item.passiveStatModifiers[i]);
			}
		}
		item.passiveStatModifiers = list.ToArray();
	}

	public static void AddStat(this PlayerItem item, StatType statType, float amount, ModifyMethod method = 0)
	{
		//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_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0030: 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)
		StatModifier val = new StatModifier
		{
			amount = amount,
			statToBoost = statType,
			modifyType = method
		};
		StatModifier[] passiveStatModifiers = item.passiveStatModifiers;
		foreach (StatModifier val2 in passiveStatModifiers)
		{
			if (val2.statToBoost == statType)
			{
				return;
			}
		}
		if (item.passiveStatModifiers == null)
		{
			item.passiveStatModifiers = (StatModifier[])(object)new StatModifier[1] { val };
		}
		else
		{
			item.passiveStatModifiers = item.passiveStatModifiers.Concat((IEnumerable<StatModifier>)(object)new StatModifier[1] { val }).ToArray();
		}
	}

	public static void RemoveStat(this PlayerItem item, StatType statType)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		List<StatModifier> list = new List<StatModifier>();
		for (int i = 0; i < item.passiveStatModifiers.Length; i++)
		{
			if (item.passiveStatModifiers[i].statToBoost != statType)
			{
				list.Add(item.passiveStatModifiers[i]);
			}
		}
		item.passiveStatModifiers = list.ToArray();
	}
}
public static class RegHelpers
{
	public static void CopyAll<T>(T source, T target)
	{
		Type typeFromHandle = typeof(T);
		PropertyInfo[] properties = typeFromHandle.GetProperties();
		foreach (PropertyInfo propertyInfo in properties)
		{
			PropertyInfo property = typeFromHandle.GetProperty(propertyInfo.Name);
			property.SetValue(target, propertyInfo.GetValue(source, null), null);
		}
		FieldInfo[] fields = typeFromHandle.GetFields();
		foreach (FieldInfo fieldInfo in fields)
		{
			FieldInfo field = typeFromHandle.GetField(fieldInfo.Name);
			field.SetValue(target, fieldInfo.GetValue(source));
		}
	}

	public static T Next<T>(this T src) where T : struct
	{
		if (!typeof(T).IsEnum)
		{
			throw new ArgumentException($"Argument {typeof(T).FullName} is not an Enum");
		}
		T[] array = (T[])Enum.GetValues(src.GetType());
		int num = Array.IndexOf(array, src) + 1;
		return (array.Length == num) ? array[0] : array[num];
	}

	public static T Previous<T>(this T src) where T : struct
	{
		if (!typeof(T).IsEnum)
		{
			throw new ArgumentException($"Argument {typeof(T).FullName} is not an Enum");
		}
		T[] array = (T[])Enum.GetValues(src.GetType());
		int num = Array.IndexOf(array, src) - 1;
		return (num < 0) ? array[^1] : array[num];
	}
}
namespace newKatmod
{
	internal static class SimpleCompanionBehaviours
	{
		public class SimpleCompanionApproach : MovementBehaviorBase
		{
			public float PathInterval = 0.25f;

			public float DesiredDistance;

			private float repathTimer;

			private List<AIActor> roomEnemies = new List<AIActor>();

			private bool isInRange;

			private PlayerController Owner;

			public SimpleCompanionApproach(int desiredDistance)
			{
				DesiredDistance = desiredDistance;
			}

			public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter)
			{
				((BehaviorBase)this).Init(gameObject, aiActor, aiShooter);
			}

			public override void Upkeep()
			{
				((MovementBehaviorBase)this).Upkeep();
				((BehaviorBase)this).DecrementTimer(ref repathTimer, false);
			}

			public override BehaviorResult Update()
			{
				//IL_00bd: 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_00a9: 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_0175: 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_0100: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)Owner == (Object)null)
				{
					if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.CompanionOwner))
					{
						Owner = ((BehaviorBase)this).m_aiActor.CompanionOwner;
					}
					else
					{
						Owner = GameManager.Instance.BestActivePlayer;
					}
				}
				SpeculativeRigidbody overrideTarget = ((BehaviorBase)this).m_aiActor.OverrideTarget;
				if (repathTimer > 0f)
				{
					return (BehaviorResult)((!((Object)(object)overrideTarget == (Object)null)) ? 1 : 0);
				}
				if ((Object)(object)overrideTarget == (Object)null)
				{
					PickNewTarget();
					return (BehaviorResult)0;
				}
				isInRange = Vector2.Distance(((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.UnitCenter, overrideTarget.UnitCenter) <= DesiredDistance;
				if ((Object)(object)overrideTarget != (Object)null && !isInRange)
				{
					((BehaviorBase)this).m_aiActor.PathfindToPosition(overrideTarget.UnitCenter, (Vector2?)null, false, (CellValidator)null, (ExtraWeightingFunction)null, (CellTypes?)null, false);
					repathTimer = PathInterval;
					return (BehaviorResult)1;
				}
				if ((Object)(object)overrideTarget != (Object)null && repathTimer >= 0f)
				{
					((BehaviorBase)this).m_aiActor.ClearPath();
					repathTimer = -1f;
				}
				return (BehaviorResult)0;
			}

			private void PickNewTarget()
			{
				if (!((Object)(object)((BehaviorBase)this).m_aiActor != (Object)null))
				{
					return;
				}
				if ((Object)(object)Owner == (Object)null)
				{
					if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.CompanionOwner))
					{
						Owner = ((BehaviorBase)this).m_aiActor.CompanionOwner;
					}
					else
					{
						Owner = GameManager.Instance.BestActivePlayer;
					}
				}
				Owner.CurrentRoom.GetActiveEnemies((ActiveEnemyType)1, ref roomEnemies);
				for (int i = 0; i < roomEnemies.Count; i++)
				{
					AIActor val = roomEnemies[i];
					if (val.IsHarmlessEnemy || !val.IsNormalEnemy || ((BraveBehaviour)val).healthHaver.IsDead || (Object)(object)val == (Object)(object)((BehaviorBase)this).m_aiActor || val.EnemyGuid == "ba928393c8ed47819c2c5f593100a5bc")
					{
						roomEnemies.Remove(val);
					}
				}
				if (roomEnemies.Count == 0)
				{
					((BehaviorBase)this).m_aiActor.OverrideTarget = null;
					return;
				}
				AIActor aiActor = ((BehaviorBase)this).m_aiActor;
				AIActor val2 = roomEnemies[Random.Range(0, roomEnemies.Count)];
				aiActor.OverrideTarget = (((Object)(object)val2 != (Object)null) ? ((BraveBehaviour)val2).specRigidbody : null);
			}
		}

		public class CompanionGoesToCursor : MovementBehaviorBase
		{
			private PlayerController Owner;

			public override void Init(GameObject gameObject, AIActor aiActor, AIShooter aiShooter)
			{
				((BehaviorBase)this).Init(gameObject, aiActor, aiShooter);
			}

			public override BehaviorResult Update()
			{
				//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_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_007d: 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_0089: 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_008e: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)(object)Owner == (Object)null)
				{
					if (Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor) && Object.op_Implicit((Object)(object)((BehaviorBase)this).m_aiActor.CompanionOwner))
					{
						Owner = ((BehaviorBase)this).m_aiActor.CompanionOwner;
					}
					else
					{
						Owner = GameManager.Instance.BestActivePlayer;
					}
				}
				Vector2 val = Vector2.op_Implicit(Camera.main.ScreenToWorldPoint(Input.mousePosition));
				bool flag = true;
				((BehaviorBase)this).m_aiActor.FakePathToPosition(val);
				return (BehaviorResult)1;
			}
		}

		public class PingPongAroundBehavior : MovementBehaviorBase
		{
			public enum MotionType
			{
				Diagonals = 10,
				Horizontal = 20,
				Vertical = 30
			}

			public float[] startingAngles;

			public MotionType motionType;

			private bool m_isBouncing;

			private float m_startingAngle;

			private bool ReflectX => motionType == MotionType.Diagonals || motionType == MotionType.Horizontal;

			private bool ReflectY => motionType == MotionType.Diagonals || motionType == MotionType.Vertical;

			public PingPongAroundBehavior()
			{
				startingAngles = new float[4] { 45f, 135f, 225f, 315f };
				motionType = MotionType.Diagonals;
			}

			public override void Start()
			{
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//IL_0045: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Expected O, but got Unknown
				((MovementBehaviorBase)this).Start();
				((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody.AddCollisionLayerOverride(CollisionMask.LayerToMask((CollisionLayer)9));
				SpeculativeRigidbody specRigidbody = ((BraveBehaviour)((BehaviorBase)this).m_aiActor).specRigidbody;
				specRigidbody.OnTileCollision = (OnTileCollisionDelegate)Delegate.Combine((Delegate?)(object)specRigidbody.OnTileCollision, (Delegate?)new OnTileCollisionDelegate(OnCollision));
			}

			public override BehaviorResult Update()
			{
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				m_startingAngle = BraveMathCollege.ClampAngle360(BraveUtility.RandomElement<float>(startingAngles));
				((BehaviorBase)this).m_aiActor.BehaviorOverridesVelocity = true;
				((BehaviorBase)this).m_aiActor.BehaviorVelocity = BraveMathCollege.DegreesToVector(m_startingAngle, ((BehaviorBase)this).m_aiActor.MovementSpeed);
				m_isBouncing = true;
				return (BehaviorResult)3;
			}

			public override ContinuousBehaviorResult ContinuousUpdate()
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				((BehaviorBase)this).ContinuousUpdate();
				return (ContinuousBehaviorResult)((!((BehaviorBase)this).m_aiActor.BehaviorOverridesVelocity) ? 1 : 0);
			}

			public override void EndContinuousUpdate()
			{
				((BehaviorBase)this).EndContinuousUpdate();
				m_isBouncing = false;
			}

			protected virtual void OnCollision(CollisionData collision)
			{
				//IL_0048: 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_00de: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: 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)
				if (m_isBouncing && !Object.op_Implicit((Object)(object)collision.OtherRigidbody) && (collision.CollidedX || collision.CollidedY))
				{
					Vector2 val = collision.MyRigidbody.Velocity;
					if (collision.CollidedX && ReflectX)
					{
						val.x *= -1f;
					}
					if (collision.CollidedY && ReflectY)
					{
						val.y *= -1f;
					}
					if (motionType == MotionType.Horizontal)
					{
						val.y = 0f;
					}
					if (motionType == MotionType.Vertical)
					{
						val.x = 0f;
					}
					val = ((Vector2)(ref val)).normalized * ((BehaviorBase)this).m_aiActor.MovementSpeed;
					PhysicsEngine.PostSliceVelocity = val;
					((BehaviorBase)this).m_aiActor.BehaviorVelocity = val;
				}
			}
		}
	}
}
namespace JuneLib
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("blazeykat.etg.junelib", "JuneLib", "1.0.7")]
	public class JuneLibModule : BaseUnityPlugin
	{
		public const string MOD_NAME = "JuneLib";

		public const string VERSION = "1.0.7";

		public static readonly string TEXT_COLOR = "#FFFFFF";

		public static readonly string ASSEMBLY_NAME = "JuneLib";

		public const string GUID = "blazeykat.etg.junelib";

		public static bool debugLog = true;

		public void Start()
		{
			Debug.Log((object)"junelib jumpscare");
			ETGModMainBehaviour.WaitForGameManagerStart((Action<GameManager>)GMStart);
		}

		public void GMStart(GameManager g)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				new Harmony("blazeykat.etg.junelib").PatchAll();
				Assets.SetupSpritesFromAssembly(Assembly.GetExecutingAssembly(), ASSEMBLY_NAME + "/Resources/GunSprites");
				JuneLibCore.Init();
				ETGModConsole.Log((object)"JuneLib v1.0.7 has successfully started", false);
			}
			catch (Exception ex)
			{
				ETGModConsole.Log((object)ex.ToString(), false);
			}
		}
	}
	public static class ChestActions
	{
		public static void OnPostOpenBullshit(Action<Chest, List<Transform>> orig, Chest self, List<Transform> transforms)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_0240: Unknown result type (might be due to invalid IL or missing references)
			List<DebrisObject> list = new List<DebrisObject>();
			bool isRainbowRun = GameStatsManager.Instance.IsRainbowRun;
			Type typeFromHandle = typeof(Chest);
			if (isRainbowRun && !self.IsRainbowChest && !self.m_forceDropOkayForRainbowRun)
			{
				Vector2 val;
				if ((Object)(object)self.spawnTransform != (Object)null)
				{
					val = Vector2.op_Implicit(self.spawnTransform.position);
				}
				else
				{
					Bounds bounds = ((BraveBehaviour)self).sprite.GetBounds();
					val = Vector2.op_Implicit(((BraveBehaviour)self).transform.position + ((Bounds)(ref bounds)).extents);
				}
				LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, val + new Vector2(-0.5f, -2.25f), self.m_room, true);
			}
			else
			{
				for (int i = 0; i < self.contents.Count; i++)
				{
					List<DebrisObject> list2 = LootEngine.SpewLoot(new List<GameObject> { ((Component)self.contents[i]).gameObject }, transforms[i].position);
					list.AddRange(list2);
					for (int j = 0; j < list2.Count; j++)
					{
						if (Object.op_Implicit((Object)(object)list2[j]))
						{
							list2[j].PreventFallingInPits = true;
						}
						if (!((Object)(object)((Component)list2[j]).GetComponent<Gun>() != (Object)null) && !((Object)(object)((Component)list2[j]).GetComponent<CurrencyPickup>() != (Object)null) && (Object)(object)((BraveBehaviour)list2[j]).specRigidbody != (Object)null)
						{
							((BraveBehaviour)list2[j]).specRigidbody.CollideWithOthers = false;
							DebrisObject val2 = list2[j];
							val2.OnTouchedGround = (Action<DebrisObject>)Delegate.Combine(val2.OnTouchedGround, new Action<DebrisObject>(self.BecomeViableItem));
						}
					}
				}
			}
			if (ChestsCore.OnPostSpawnChestContents != null)
			{
				ChestsCore.OnPostSpawnChestContents(list, self);
			}
			if (self.IsRainbowChest && isRainbowRun && Vector3Extensions.GetAbsoluteRoom(((BraveBehaviour)self).transform.position) == GameManager.Instance.Dungeon.data.Entrance)
			{
				((MonoBehaviour)GameManager.Instance.Dungeon).StartCoroutine(self.HandleRainbowRunLootProcessing(list));
			}
		}
	}
	public static class ChestsCore
	{
		public static Action<List<DebrisObject>, Chest> OnPostSpawnChestContents;

		public static void Init()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Hook val = new Hook((MethodBase)typeof(Chest).GetMethod("SpewContentsOntoGround", BindingFlags.Instance | BindingFlags.NonPublic), typeof(ChestActions).GetMethod("OnPostOpenBullshit"));
		}
	}
	internal static class GoopCore
	{
		public static void Init()
		{
			GenericStatusEffects.InitCustomEffects();
			EasyGoopDefinitions.DefineDefaultGoops();
		}
	}
	public static class ItemsCore
	{
		public static Action<PlayerController, PlayerItem, OverrideItemCanBeUsed.ValidOverrideArgs> OnPreUseItem;

		public static Action<PickupObject, PlayerController, bool, JuneLibLootEngineModificationAPI.ModifyLuckArgs> GetItemChanceMult;

		internal static List<Func<PickupObject, GameObject>> ChangeSpawnedItem = new List<Func<PickupObject, GameObject>>();

		public static void AddChangeSpawnItem(Func<PickupObject, GameObject> func)
		{
			ChangeSpawnedItem.Add(func);
		}

		public static void RemoveChangeSpawnItem(Func<PickupObject, GameObject> func)
		{
			ChangeSpawnedItem.Remove(func);
		}

		public static void Init()
		{
		}
	}
	public static class JuneLibCore
	{
		public static Action<DebrisObject, RoomHandler> OnRoomClearItemDrop;

		public static Action<RoomHandler, JuneLibRoomRewardAPI.ValidRoomRewardContents, float> OnRoomRewardDetermineContents;

		public static Type wmitfTYPE;

		public static Assembly wmitfAssembly;

		public static void Init()
		{
			ConsoleCommandGroup val = ETGModConsole.Commands.AddGroup("junelib", (Action<string[]>)delegate
			{
				ETGModConsole.Log((object)"Please specify a valid command.", false);
			});
			JunePlayerEvents.Init();
			ItemsCore.Init();
			GoopCore.Init();
			UICore.Init();
			ChallengeHelper.Init();
			ETGMod.StartGlobalCoroutine(DelayRunThing());
		}

		public static IEnumerator DelayRunThing()
		{
			yield return null;
			yield return null;
			AppDomain currentDomain = AppDomain.CurrentDomain;
			currentDomain.Load("JuneLib", currentDomain.Evidence);
			Assembly[] assems = currentDomain.GetAssemblies();
			List<Assembly> searchResult = assems.ToList().FindAll((Assembly a) => a.GetName().Name == "WMITF");
			if (searchResult.Count <= 0)
			{
				yield break;
			}
			try
			{
				Type ItemTipsModule = (wmitfAssembly = searchResult.First()).GetType("WMITF.WMITFModule");
				wmitfTYPE = ItemTipsModule;
				FieldInfo _itemDict = wmitfTYPE.GetField("WMITFModItemDict", BindingFlags.Static | BindingFlags.Public);
				Dictionary<PickupObject, Assembly> dict = _itemDict.GetValue(null) as Dictionary<PickupObject, Assembly>;
				Dictionary<PickupObject, Assembly> mergeDict = new Dictionary<PickupObject, Assembly>();
				foreach (KeyValuePair<PickupObject, Assembly> kvp2 in dict)
				{
					if (ItemTemplateManager.keyValuePairs.ContainsKey(kvp2.Key))
					{
						mergeDict.Add(kvp2.Key, ItemTemplateManager.keyValuePairs[kvp2.Key]);
					}
				}
				foreach (KeyValuePair<PickupObject, Assembly> kvp in mergeDict)
				{
					dict[kvp.Key] = kvp.Value;
				}
				_itemDict.SetValue(null, dict);
				MethodInfo _getactualmoditemdict = wmitfTYPE.GetMethod("WMITFGetActualModItemDict", BindingFlags.Static | BindingFlags.Public);
				_getactualmoditemdict.Invoke(null, new object[0]);
			}
			catch (Exception ex)
			{
				ETGModConsole.Log((object)("JuneLib: Failed to override WMITF's item dictionary.\nException:\n" + ex.ToString() + "\n\nBlame June. \n(and to a lesser degree blame SpAPI.)"), false);
			}
		}
	}
	public static class MultiModDictionary
	{
	}
	internal static class UICore
	{
		public static void Init()
		{
		}
	}
	[HarmonyPatch]
	public static class JuneLibLootEngineModificationAPI
	{
		public class ModifyLuckArgs : EventArgs
		{
			public float WeightMult;
		}

		[HarmonyPatch(typeof(RewardManager), "GetMultiplierForItem")]
		[HarmonyPostfix]
		internal static void ModifyItemLuck(PickupObject prefab, PlayerController player, bool completesSynergy, ref float __result)
		{
			if (ItemsCore.GetItemChanceMult != null)
			{
				ModifyLuckArgs modifyLuckArgs = new ModifyLuckArgs
				{
					WeightMult = 1f
				};
				ItemsCore.GetItemChanceMult(prefab, player, completesSynergy, modifyLuckArgs);
				__result *= modifyLuckArgs.WeightMult;
			}
		}

		[HarmonyPatch(typeof(LootEngine), "SpawnItem")]
		[HarmonyPrefix]
		internal static void PreSpawnItemChange(ref GameObject item)
		{
			GameObject val = DoReplacement(item);
			if (Object.op_Implicit((Object)(object)val))
			{
				item = val;
			}
		}

		[HarmonyPatch(typeof(LootEngine), "SpewLoot", new Type[]
		{
			typeof(GameObject),
			typeof(Vector3)
		})]
		[HarmonyPrefix]
		internal static void PreSpewItemChange(ref GameObject itemToSpawn)
		{
			GameObject val = DoReplacement(itemToSpawn);
			if (Object.op_Implicit((Object)(object)val))
			{
				itemToSpawn = val;
			}
		}

		[HarmonyPatch(typeof(ShopItemController), "InitializeInternal")]
		[HarmonyPrefix]
		internal static void ShopItemReplacer(ref PickupObject i)
		{
			GameObject val = DoReplacement(((Component)i).gameObject);
			if (Object.op_Implicit((Object)(object)val))
			{
				i = val.GetComponent<PickupObject>();
			}
		}

		[HarmonyPatch(typeof(CustomShopItemController), "InitializeInternal")]
		[HarmonyPrefix]
		internal static void CustomShopItemReplacer(ref PickupObject i)
		{
			GameObject val = DoReplacement(((Component)i).gameObject);
			if (Object.op_Implicit((Object)(object)val))
			{
				i = val.GetComponent<PickupObject>();
			}
		}

		public static GameObject DoReplacement(GameObject item)
		{
			bool flag = false;
			if ((Object)(object)item.GetComponent<PickupObject>() != (Object)null && ItemsCore.ChangeSpawnedItem.Count != 0)
			{
				PickupObject arg = item.GetComponent<PickupObject>();
				foreach (Func<PickupObject, GameObject> item2 in ItemsCore.ChangeSpawnedItem)
				{
					GameObject val = item2(arg);
					if ((Object)(object)val != (Object)null)
					{
						flag = true;
						item = val;
						PickupObject component = item.GetComponent<PickupObject>();
						if (!Object.op_Implicit((Object)(object)component))
						{
							break;
						}
						arg = component;
					}
				}
			}
			if (flag)
			{
				return item;
			}
			return null;
		}
	}
	[HarmonyPatch]
	public static class OverrideItemCanBeUsed
	{
		public class ValidOverrideArgs : EventArgs
		{
			public enum Priority
			{
				INHERENT_ACTIVE_ITEM_EFFECT,
				PASSIVE_EFFECT_HIGH_PRIORITY,
				PASSIVE_EFFECT_REGULAR_PRIORITY,
				PASSIVE_EFFECT_LOW_PRIORITY,
				NONE
			}

			public bool ShouldBeUseable;

			internal List<Tuple<Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>>> overrideItemsUse;

			public void AddActionWithPriority(Priority priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs> action)
			{
				overrideItemsUse.Add(new Tuple<Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>>(priority, action));
			}
		}

		public class OnUseOverrideArgs : EventArgs
		{
			public bool shouldSkip;
		}

		private class ActionContainer : MonoBehaviour
		{
			public List<Tuple<ValidOverrideArgs.Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>>> overrideItemsUse;

			public bool GuaranteeCheck;
		}

		public static bool SkipOverrideCanUse = false;

		public static bool SkipLogging = true;

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		public static void OverrideCanUse(PlayerItem __instance, ref bool __result)
		{
			if (__instance is CustomChargeTypeItem)
			{
				__result = __result || CustomChargeTypeItem.GetCustomChargeTypeItemIsOnCooldown(__instance);
			}
			else if (!SkipOverrideCanUse)
			{
				ValidOverrideArgs validOverrideArgs = new ValidOverrideArgs();
				validOverrideArgs.ShouldBeUseable = false;
				validOverrideArgs.overrideItemsUse = new List<Tuple<ValidOverrideArgs.Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>>>();
				if (ItemsCore.OnPreUseItem != null)
				{
					ItemsCore.OnPreUseItem(__instance.LastOwner, __instance, validOverrideArgs);
				}
				ActionContainer orAddComponent = GameObjectExtensions.GetOrAddComponent<ActionContainer>(((Component)__instance).gameObject);
				orAddComponent.overrideItemsUse = validOverrideArgs.overrideItemsUse;
				if (validOverrideArgs.ShouldBeUseable || orAddComponent.GuaranteeCheck)
				{
					__result = false;
				}
				if (!SkipLogging)
				{
					ETGModConsole.Log((object)__result, false);
					ETGModConsole.Log((object)orAddComponent.GuaranteeCheck, false);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerItem), "Use")]
		[HarmonyPrefix]
		public static bool PreUseItem(PlayerItem __instance, PlayerController user)
		{
			if (!__instance.InternalIsOnCooldown())
			{
				return true;
			}
			ActionContainer orAddComponent = GameObjectExtensions.GetOrAddComponent<ActionContainer>(((Component)__instance).gameObject);
			if (orAddComponent.overrideItemsUse != null && orAddComponent.overrideItemsUse.Count > 0)
			{
				ValidOverrideArgs.Priority priority;
				for (priority = ValidOverrideArgs.Priority.INHERENT_ACTIVE_ITEM_EFFECT; priority < ValidOverrideArgs.Priority.NONE; priority = priority.Next())
				{
					List<Tuple<ValidOverrideArgs.Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>>> list = orAddComponent.overrideItemsUse.Where((Tuple<ValidOverrideArgs.Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>> hell) => hell.First == priority).ToList();
					if (list.Count > 0)
					{
						OnUseOverrideArgs onUseOverrideArgs = new OnUseOverrideArgs
						{
							shouldSkip = true
						};
						foreach (Tuple<ValidOverrideArgs.Priority, Action<PlayerController, PlayerItem, OnUseOverrideArgs>> item in list)
						{
							item.Second?.Invoke(user, __instance, onUseOverrideArgs);
						}
						orAddComponent.GuaranteeCheck = true;
						return onUseOverrideArgs.shouldSkip;
					}
				}
			}
			return true;
		}

		[HarmonyPatch(typeof(PlayerItem), "Use")]
		[HarmonyPostfix]
		public static void PostUseItem(PlayerItem __instance)
		{
			ActionContainer orAddComponent = GameObjectExtensions.GetOrAddComponent<ActionContainer>(((Component)__instance).gameObject);
			orAddComponent.GuaranteeCheck = false;
		}

		private static bool InternalIsOnCooldown(this PlayerItem item)
		{
			SkipOverrideCanUse = true;
			bool isOnCooldown = item.IsOnCooldown;
			SkipOverrideCanUse = false;
			return isOnCooldown;
		}

		[HarmonyPatch(typeof(GameUIItemController), "UpdateItemSprite")]
		[HarmonyPrefix]
		public static bool UpdateItemSpriteProper(PlayerItem newItem, int itemShift, GameUIItemController __instance)
		{
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Invalid comparison between Unknown and I4
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: 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_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			tk2dSprite component = ((Component)newItem).GetComponent<tk2dSprite>();
			if ((Object)(object)newItem != (Object)(object)__instance.m_cachedItem)
			{
				__instance.DoItemCardFlip(newItem, itemShift);
			}
			__instance.UpdateItemSpriteScale();
			if (!__instance.m_deferCurrentItemSwap)
			{
				if (!((BraveBehaviour)__instance.itemSprite).renderer.enabled)
				{
					__instance.ToggleRenderers(true);
				}
				if (((tk2dBaseSprite)__instance.itemSprite).spriteId != ((tk2dBaseSprite)component).spriteId || (Object)(object)((tk2dBaseSprite)__instance.itemSprite).Collection != (Object)(object)((tk2dBaseSprite)component).Collection)
				{
					((tk2dBaseSprite)__instance.itemSprite).SetSprite(((tk2dBaseSprite)component).Collection, ((tk2dBaseSprite)component).spriteId);
					for (int i = 0; i < __instance.outlineSprites.Length; i++)
					{
						((tk2dBaseSprite)__instance.outlineSprites[i]).SetSprite(((tk2dBaseSprite)component).Collection, ((tk2dBaseSprite)component).spriteId);
						SpriteOutlineManager.ForceUpdateOutlineMaterial((tk2dBaseSprite)(object)__instance.outlineSprites[i], (tk2dBaseSprite)(object)component);
					}
				}
			}
			Vector3 center = ((dfControl)__instance.ItemBoxSprite).GetCenter();
			((BraveBehaviour)__instance.itemSprite).transform.position = center + __instance.GetOffsetVectorForItem(newItem, __instance.m_isCurrentlyFlipping);
			((BraveBehaviour)__instance.itemSprite).transform.position = dfVectorExtensions.Quantize(((BraveBehaviour)__instance.itemSprite).transform.position, ((dfControl)__instance.ItemBoxSprite).PixelsToUnits() * 3f);
			if (newItem.PreventCooldownBar || (!newItem.IsActive && !newItem.InternalIsOnCooldown()) || __instance.m_isCurrentlyFlipping)
			{
				((dfControl)__instance.ItemBoxFillSprite).IsVisible = false;
				((dfControl)__instance.ItemBoxFGSprite).IsVisible = false;
				__instance.ItemBoxSprite.SpriteName = "weapon_box_02";
			}
			else
			{
				((dfControl)__instance.ItemBoxFillSprite).IsVisible = true;
				((dfControl)__instance.ItemBoxFGSprite).IsVisible = true;
				__instance.ItemBoxSprite.SpriteName = "weapon_box_02_cd";
			}
			if (newItem.IsActive)
			{
				__instance.ItemBoxFillSprite.FillAmount = 1f - newItem.ActivePercentage;
			}
			else
			{
				__instance.ItemBoxFillSprite.FillAmount = 1f - newItem.CooldownPercentage;
			}
			PlayerController val = GameManager.Instance.PrimaryPlayer;
			if ((int)GameManager.Instance.CurrentGameType == 1 && __instance.IsRightAligned)
			{
				val = GameManager.Instance.SecondaryPlayer;
			}
			if (newItem.IsOnCooldown || !newItem.CanBeUsed(val))
			{
				Color color = __instance.itemSpriteMaterial.GetColor("_OverrideColor");
				Color val2 = default(Color);
				((Color)(ref val2))..ctor(0f, 0f, 0f, 0.8f);
				if (color != val2)
				{
					__instance.itemSpriteMaterial.SetColor("_OverrideColor", val2);
					tk2dSprite[] outlineSprites = SpriteOutlineManager.GetOutlineSprites((tk2dBaseSprite)(object)__instance.itemSprite);
					Color val3 = default(Color);
					((Color)(ref val3))..ctor(0.4f, 0.4f, 0.4f, 1f);
					for (int j = 0; j < outlineSprites.Length; j++)
					{
						((BraveBehaviour)outlineSprites[j]).renderer.material.SetColor("_OverrideColor", val3);
					}
				}
			}
			else
			{
				Color color2 = __instance.itemSpriteMaterial.GetColor("_OverrideColor");
				Color val4 = default(Color);
				((Color)(ref val4))..ctor(0f, 0f, 0f, 0f);
				if (color2 != val4)
				{
					__instance.itemSpriteMaterial.SetColor("_OverrideColor", val4);
					tk2dSprite[] outlineSprites2 = SpriteOutlineManager.GetOutlineSprites((tk2dBaseSprite)(object)__instance.itemSprite);
					Color white = Color.white;
					for (int k = 0; k < outlineSprites2.Length; k++)
					{
						((BraveBehaviour)outlineSprites2[k]).renderer.material.SetColor("_OverrideColor", white);
					}
				}
			}
			return false;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		public static void Shhh()
		{
			SkipOverrideCanUse = true;
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		public static void No(ref float __result, PlayerItem __instance)
		{
			if (__instance is CustomChargeTypeItem customChargeTypeItem)
			{
				__result = customChargeTypeItem.CooldownPercentageHook();
			}
			SkipOverrideCanUse = false;
		}
	}
	public static class JuneLibRoomRewardAPI
	{
		public class ValidRoomRewardContents : EventArgs
		{
			public List<Action<Vector3, RoomHandler>> overrideFunctionPool;

			public List<Tuple<float, int>> overrideItemPool;
		}

		public static bool GuaranteeRoomClearRewardDrop;

		public static void Init()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			Hook val = new Hook((MethodBase)typeof(RoomHandler).GetMethod("HandleRoomClearReward", BindingFlags.Instance | BindingFlags.Public), typeof(JuneLibRoomRewardAPI).GetMethod("RoomClearRewardHook"));
		}

		public static void RoomClearRewardHook(Action<RoomHandler> orig, RoomHandler self)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Invalid comparison between Unknown and I4
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Invalid comparison between Unknown and I4
			//IL_00d3: 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_00df: Invalid comparison between Unknown and I4
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Invalid comparison between Unknown and I4
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Expected O, but got Unknown
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0661: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0487: Invalid comparison between Unknown and I4
			//IL_06a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_068e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0708: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0725: Unknown result type (might be due to invalid IL or missing references)
			//IL_072a: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Expected O, but got Unknown
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_060d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Type typeFromHandle = typeof(RoomHandler);
				if (GameManager.Instance.IsFoyer || GameManager.Instance.InTutorial || (int)GameManager.Instance.CurrentLevelOverrideState == 5 || self.m_hasGivenReward || (int)self.area.PrototypeRoomCategory == 4)
				{
					return;
				}
				self.m_hasGivenReward = true;
				if ((int)self.area.PrototypeRoomCategory == 3 && (int)self.area.PrototypeRoomBossSubcategory == 0)
				{
					self.HandleBossClearReward();
				}
				else
				{
					if (self.PreventStandardRoomReward)
					{
						return;
					}
					FloorRewardData currentRewardData = GameManager.Instance.RewardManager.CurrentRewardData;
					AmmoDropType val = (AmmoDropType)0;
					bool flag = LootEngine.DoAmmoClipCheck(currentRewardData, ref val);
					string text = (((int)val != 1) ? "Ammo_Pickup" : "Ammo_Pickup_Spread");
					float value = Random.value;
					float chestSystem_ChestChanceLowerBound = currentRewardData.ChestSystem_ChestChanceLowerBound;
					float num = GameManager.Instance.PrimaryPlayer.stats.GetStatValue((StatType)4) / 100f;
					float num2 = 0f - GameManager.Instance.PrimaryPlayer.stats.GetStatValue((StatType)14) / 100f;
					if ((int)GameManager.Instance.CurrentGameType == 1)
					{
						num += GameManager.Instance.SecondaryPlayer.stats.GetStatValue((StatType)4) / 100f;
						num2 -= GameManager.Instance.SecondaryPlayer.stats.GetStatValue((StatType)14) / 100f;
					}
					if (PassiveItem.IsFlagSetAtAll(typeof(ChamberOfEvilItem)))
					{
						num2 *= -2f;
					}
					chestSystem_ChestChanceLowerBound = Mathf.Clamp(chestSystem_ChestChanceLowerBound + GameManager.Instance.PrimaryPlayer.AdditionalChestSpawnChance, currentRewardData.ChestSystem_ChestChanceLowerBound, currentRewardData.ChestSystem_ChestChanceUpperBound) + num + num2;
					bool flag2 = (Object)(object)currentRewardData.SingleItemRewardTable != (Object)null;
					bool flag3 = false;
					float num3 = 0.1f;
					if (!RoomHandler.HasGivenRoomChestRewardThisRun && MetaInjectionData.ForceEarlyChest)
					{
						flag3 = true;
					}
					if (flag3)
					{
						if (!RoomHandler.HasGivenRoomChestRewardThisRun && (GameManager.Instance.CurrentFloor == 1 || GameManager.Instance.CurrentFloor == -1))
						{
							flag2 = false;
							chestSystem_ChestChanceLowerBound += num3;
							if (Object.op_Implicit((Object)(object)GameManager.Instance.PrimaryPlayer) && GameManager.Instance.PrimaryPlayer.NumRoomsCleared > 4)
							{
								chestSystem_ChestChanceLowerBound = 1f;
							}
						}
						if (!RoomHandler.HasGivenRoomChestRewardThisRun && self.distanceFromEntrance < RoomHandler.NumberOfRoomsToPreventChestSpawning)
						{
							GameManager.Instance.Dungeon.InformRoomCleared(false, false);
							return;
						}
					}
					BraveUtility.Log("Current chest spawn chance: " + chestSystem_ChestChanceLowerBound, Color.yellow, (LogVerbosity)1);
					ValidRoomRewardContents validRoomRewardContents = new ValidRoomRewardContents();
					validRoomRewardContents.overrideItemPool = new List<Tuple<float, int>>();
					validRoomRewardContents.overrideFunctionPool = new List<Action<Vector3, RoomHandler>>();
					if (JuneLibCore.OnRoomRewardDetermineContents != null)
					{
						JuneLibCore.OnRoomRewardDetermineContents(self, validRoomRewardContents, chestSystem_ChestChanceLowerBound);
					}
					IntVector2 bestRewardLocation;
					if (validRoomRewardContents.overrideFunctionPool.Count > 0)
					{
						bestRewardLocation = self.GetBestRewardLocation(new IntVector2(1, 1), (RewardLocationStyle)0, true);
						Vector3 arg = ((IntVector2)(ref bestRewardLocation)).ToVector3() + new Vector3(0.25f, 0f, 0f);
						{
							foreach (Action<Vector3, RoomHandler> item in validRoomRewardContents.overrideFunctionPool)
							{
								item?.Invoke(arg, self);
							}
							return;
						}
					}
					if (value > chestSystem_ChestChanceLowerBound && !GuaranteeRoomClearRewardDrop)
					{
						if (flag)
						{
							IntVector2 bestRewardLocation2 = self.GetBestRewardLocation(new IntVector2(1, 1), (RewardLocationStyle)0, true);
							LootEngine.SpawnItem((GameObject)BraveResources.Load(text, ".prefab"), ((IntVector2)(ref bestRewardLocation2)).ToVector3(), Vector2.up, 1f, true, true, false);
						}
						GameManager.Instance.Dungeon.InformRoomCleared(false, false);
						return;
					}
					if (flag2)
					{
						float num4 = currentRewardData.PercentOfRoomClearRewardsThatAreChests;
						if (PassiveItem.IsFlagSetAtAll(typeof(AmazingChestAheadItem)))
						{
							num4 *= 2f;
							num4 = Mathf.Max(0.5f, num4);
						}
						flag2 = Random.value > num4;
					}
					if (flag2)
					{
						float num5 = (((int)GameManager.Instance.CurrentGameType != 1) ? GameManager.Instance.RewardManager.SinglePlayerPickupIncrementModifier : GameManager.Instance.RewardManager.CoopPickupIncrementModifier);
						GameObject val2;
						if (validRoomRewardContents.overrideItemPool.Count <= 0)
						{
							val2 = ((!(Random.value < 1f / num5)) ? ((Random.value >= 0.9f) ? ((Component)GameManager.Instance.RewardManager.FullHeartPrefab).gameObject : ((Component)GameManager.Instance.RewardManager.HalfHeartPrefab).gameObject) : currentRewardData.SingleItemRewardTable.SelectByWeight(false));
						}
						else
						{
							GenericLootTable val3 = LootUtility.CreateLootTable((List<GenericLootTable>)null, (DungeonPrerequisite[])null);
							foreach (Tuple<float, int> item2 in validRoomRewardContents.overrideItemPool)
							{
								LootUtility.AddItemToPool(val3, item2.Second, item2.First);
							}
							val2 = val3.defaultItemDrops.SelectByWeight();
						}
						Debug.Log((object)(((Object)val2).name + "SPAWNED"));
						GameObject obj = val2;
						bestRewardLocation = self.GetBestRewardLocation(new IntVector2(1, 1), (RewardLocationStyle)0, true);
						DebrisObject val4 = LootEngine.SpawnItem(obj, ((IntVector2)(ref bestRewardLocation)).ToVector3() + new Vector3(0.25f, 0f, 0f), Vector2.up, 1f, true, true, false);
						JuneLibCore.OnRoomClearItemDrop?.Invoke(val4, self);
						Exploder.DoRadialPush(Vector2Extensions.ToVector3ZUp(((BraveBehaviour)val4).sprite.WorldCenter, ((BraveBehaviour)val4).sprite.WorldCenter.y), 8f, 3f);
						AkSoundEngine.PostEvent("Play_OBJ_item_spawn_01", ((Component)val4).gameObject);
						GameManager.Instance.Dungeon.InformRoomCleared(true, false);
					}
					else
					{
						IntVector2 bestRewardLocation3 = self.GetBestRewardLocation(new IntVector2(2, 1), (RewardLocationStyle)0, true);
						if (GameStatsManager.Instance.IsRainbowRun)
						{
							LootEngine.SpawnBowlerNote(GameManager.Instance.RewardManager.BowlerNoteChest, ((IntVector2)(ref bestRewardLocation3)).ToCenterVector2(), self, true);
							RoomHandler.HasGivenRoomChestRewardThisRun = true;
						}
						else
						{
							Chest val5 = self.SpawnRoomRewardChest((WeightedGameObjectCollection)null, bestRewardLocation3);
							if (Object.op_Implicit((Object)(object)val5))
							{
								RoomHandler.HasGivenRoomChestRewardThisRun = true;
							}
						}
						GameManager.Instance.Dungeon.InformRoomCleared(true, true);
					}
					if (flag)
					{
						IntVector2 bestRewardLocation4 = self.GetBestRewardLocation(new IntVector2(1, 1), (RewardLocationStyle)0, true);
						Vector3 val6 = ((IntVector2)(ref bestRewardLocation4)).ToVector3() + new Vector3(0.25f, 0f, 0f);
						LootEngine.DelayedSpawnItem(1f, (GameObject)BraveResources.Load(text, ".prefab"), val6, Vector2.up, 1f, true, true, false);
					}
				}
			}
			catch (Exception ex)
			{
				ETGModConsole.Log((object)ex, false);
			}
		}
	}
	public static class PrefixHandler
	{
		internal static Dictionary<Assembly, string> pairs = new Dictionary<Assembly, string>();

		public static void AddPrefixForAssembly(string prefix, Assembly self = null)
		{
			if ((object)self == null)
			{
				self = Assembly.GetCallingAssembly();
			}
			pairs[self] = prefix;
		}
	}
	[HarmonyPatch]
	public static class RegeneratingVolleyModifiers
	{
		public class ModifyProjArgs : EventArgs
		{
			public Dictionary<string, List<ProjectileModule>> projs;
		}

		public static List<string> bonusVolleys = new List<string> { "finalGunVolley", "reloadGunVolley" };

		public static bool SkipCheck = false;

		public static bool Log = false;

		[HarmonyPatch(typeof(Gun), "Update")]
		[HarmonyPostfix]
		public static void InitGun(Gun __instance)
		{
			if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<HasCheckedForGunModifyThing>()))
			{
				((Component)__instance).gameObject.AddComponent<HasCheckedForGunModifyThing>();
				GameActor currentOwner = __instance.CurrentOwner;
				if (Object.op_Implicit((Object)(object)currentOwner) && currentOwner is PlayerController)
				{
					GunModifyHeart gunModifyHeart = ((Component)__instance).gameObject.AddComponent<GunModifyHeart>();
					gunModifyHeart.m_gun = __instance;
				}
			}
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPostfix]
		public static void ModifyReturnedVolley(Gun __instance, ref ProjectileVolleyData __result)
		{
			if ((Object)(object)__instance.CurrentOwner == (Object)null)
			{
				return;
			}
			GameActor currentOwner = __instance.CurrentOwner;
			PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
			if (val == null || (Object)(object)__instance.modifiedVolley == (Object)null || (Object)(object)__result == (Object)(object)__instance.rawVolley || SkipCheck)
			{
				return;
			}
			GunModifyHeart component = ((Component)__instance).gameObject.GetComponent<GunModifyHeart>();
			if (Object.op_Implicit((Object)(object)component))
			{
				ProjectileVolleyData cachedModifiedVolley = component.GetCachedModifiedVolley("baseGunVolley");
				if (Object.op_Implicit((Object)(object)cachedModifiedVolley))
				{
					__result = cachedModifiedVolley;
				}
				else if ((Object)(object)val != (Object)null)
				{
					SkipCheck = true;
					ProjectileVolleyData volley = __instance.Volley;
					volley = component.RunIndividualModifier("baseGunVolley", volley, val, BaseVolleyModifier, __instance);
					__result = volley;
					SkipCheck = false;
					__instance.ReinitializeModuleData(__result);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Gun), "Update")]
		public static void Updately(Gun __instance)
		{
			if ((Object)(object)__instance.CurrentOwner == (Object)null)
			{
				return;
			}
			GameActor currentOwner = __instance.CurrentOwner;
			PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
			if (val == null || (Object)(object)val == (Object)null || ((Object)(object)__instance.modifiedFinalVolley == (Object)null && Object.op_Implicit((Object)(object)__instance.modifiedOptionalReloadVolley)) || SkipCheck)
			{
				return;
			}
			GunModifyHeart component = ((Component)__instance).gameObject.GetComponent<GunModifyHeart>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			foreach (string bonusVolley in bonusVolleys)
			{
				if (Object.op_Implicit((Object)(object)component.GetCachedModifiedVolley(bonusVolley)))
				{
					continue;
				}
				bool flag = bonusVolley == "finalGunVolley";
				ProjectileVolleyData val2 = (flag ? __instance.modifiedFinalVolley : __instance.modifiedOptionalReloadVolley);
				if ((Object)(object)val2 != (Object)null)
				{
					Action<ProjectileModule, GunModifyHeart.IndividualModifier, Gun> runner = FinalVolleyModifier;
					if (!flag)
					{
						runner = ReloadVolleyModifier;
					}
					val2 = component.RunIndividualModifier(bonusVolley, val2, val, runner, __instance);
					__instance.ReinitializeModuleData(val2);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerStats), "RebuildGunVolleys")]
		[HarmonyPrefix]
		public static void ILove()
		{
			SkipCheck = true;
			Log = true;
		}

		[HarmonyPatch(typeof(PlayerStats), "RebuildGunVolleys")]
		[HarmonyPostfix]
		public static void DoingThis()
		{
			SkipCheck = false;
			Log = false;
		}

		public static List<ProjectileModule> AllAvailableModules(ProjectileVolleyData data, Gun gun)
		{
			List<ProjectileModule> list = new List<ProjectileModule>();
			foreach (ProjectileModule projectile in data.projectiles)
			{
				if (!gun.m_moduleData[projectile].onCooldown)
				{
					list.Add(projectile);
				}
			}
			return list;
		}

		public static ProjectileVolleyData OnTheGoModifyVolley(ProjectileVolleyData data, PlayerController owner, Gun gun = null)
		{
			ProjectileVolleyData val = ScriptableObject.CreateInstance<ProjectileVolleyData>();
			val.InitializeFrom(data);
			owner.stats.ModVolley(owner, val);
			ModifyProjArgs modifyProjArgs = new ModifyProjArgs
			{
				projs = new Dictionary<string, List<ProjectileModule>>()
			};
			if (owner.GetJEvents().ConstantModifyGunVolley != null)
			{
				owner.GetJEvents().ConstantModifyGunVolley?.Invoke(owner, gun, val, modifyProjArgs);
				foreach (KeyValuePair<string, List<ProjectileModule>> proj in modifyProjArgs.projs)
				{
					foreach (ProjectileModule item in proj.Value)
					{
						val.projectiles.Add(item);
					}
				}
			}
			return val;
		}

		internal static void FinalVolleyModifier(ProjectileModule mod, GunModifyHeart.IndividualModifier modifier, Gun gun)
		{
			gun.modifiedFinalVolley.projectiles.Remove(mod);
		}

		internal static void ReloadVolleyModifier(ProjectileModule mod, GunModifyHeart.IndividualModifier modifier, Gun gun)
		{
			gun.modifiedOptionalReloadVolley.projectiles.Remove(mod);
		}

		internal static void BaseVolleyModifier(ProjectileModule mod, GunModifyHeart.IndividualModifier modifier, Gun gun)
		{
			gun.Volley.projectiles.Remove(mod);
		}
	}
	internal class GunModifyHeart : BraveBehaviour
	{
		public class IndividualModifier
		{
			internal ProjectileVolleyData cachedModifiedVolley;

			public Dictionary<string, List<ProjectileModule>> projsOnCooldown;

			public GunModifyHeart papa;

			public Action<ProjectileModule, IndividualModifier, Gun> remove;

			internal void UpdateStuff()
			{
				if ((Object)(object)papa.m_gun != (Object)null && projsOnCooldown != null)
				{
					List<string> list = new List<string>();
					foreach (KeyValuePair<string, List<ProjectileModule>> item in projsOnCooldown)
					{
						bool flag = true;
						foreach (ProjectileModule item2 in item.Value)
						{
							if (papa.m_gun.m_moduleData[item2].onCooldown)
							{
								flag = false;
							}
							else
							{
								remove?.Invoke(item2, this, papa.m_gun);
							}
						}
						if (flag)
						{
							list.Add(item.Key);
						}
					}
					foreach (string item3 in list)
					{
						projsOnCooldown.Remove(item3);
					}
				}
				cachedModifiedVolley = null;
			}
		}

		public Dictionary<string, IndividualModifier> modifiers = new Dictionary<string, IndividualModifier>();

		internal Gun m_gun;

		public void InitializeModifier(string idx, ProjectileVolleyData volley, Action<ProjectileModule, IndividualModifier, Gun> modifier)
		{
			IndividualModifier value = new IndividualModifier
			{
				papa = this,
				remove = modifier
			};
			modifiers.Add(idx, value);
		}

		public ProjectileVolleyData GetCachedModifiedVolley(string idx)
		{
			if (modifiers.ContainsKey(idx))
			{
				return modifiers[idx].cachedModifiedVolley;
			}
			return null;
		}

		public ProjectileVolleyData RunIndividualModifier(string idx, ProjectileVolleyData volley, PlayerController player, Action<ProjectileModule, IndividualModifier, Gun> runner, Gun gun = null)
		{
			if (!modifiers.ContainsKey(idx))
			{
				InitializeModifier(idx, volley, runner);
			}
			IndividualModifier individualModifier = modifiers[idx];
			RegeneratingVolleyModifiers.ModifyProjArgs modifyProjArgs = new RegeneratingVolleyModifiers.ModifyProjArgs
			{
				projs = new Dictionary<string, List<ProjectileModule>>()
			};
			if (player.GetJEvents().ConstantModifyGunVolley != null)
			{
				player.GetJEvents().ConstantModifyGunVolley?.Invoke(player, gun, volley, modifyProjArgs);
				Debug.Log((object)("is running the stuff for " + idx));
				if (individualModifier.projsOnCooldown == null)
				{
					individualModifier.projsOnCooldown = new Dictionary<string, List<ProjectileModule>>();
				}
				foreach (KeyValuePair<string, List<ProjectileModule>> item in individualModifier.projsOnCooldown)
				{
					foreach (ProjectileModule item2 in item.Value)
					{
						if (!volley.projectiles.Contains(item2))
						{
							volley.projectiles.Add(item2);
						}
					}
				}
				foreach (KeyValuePair<string, List<ProjectileModule>> proj in modifyProjArgs.projs)
				{
					if (individualModifier.projsOnCooldown.ContainsKey(proj.Key))
					{
						continue;
					}
					foreach (ProjectileModule item3 in proj.Value)
					{
						volley.projectiles.Add(item3);
					}
					individualModifier.projsOnCooldown[proj.Key] = proj.Value;
				}
			}
			individualModifier.cachedModifiedVolley = volley;
			return volley;
		}

		private void FixedUpdate()
		{
			foreach (IndividualModifier value in modifiers.Values)
			{
				value.UpdateStuff();
			}
		}
	}
	internal class HasCheckedForGunModifyThing : BraveBehaviour
	{
	}
	public static class ChallengeHelper
	{
		public static ChallengeManager ChallengeManagerPrefab;

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			ChallengeManagerPrefab = ((GameObject)BraveResources.Load("Global Prefabs/_ChallengeManager", ".prefab")).GetComponent<ChallengeManager>();
		}
	}
	public static class RoomTools
	{
		public static RoomHandler AddCustomRuntimeRoom(Dungeon dungeon, IntVector2 dimensions, GameObject roomPrefab, IntVector2? roomWorldPositionOverride = null, Vector3? roomPrefabPositionOverride = null)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_001c: 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_0169: 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_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: 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_0102: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			IntVector2 value = default(IntVector2);
			((IntVector2)(ref value))..ctor(10, 10);
			if (roomWorldPositionOverride.HasValue)
			{
				value = roomWorldPositionOverride.Value;
			}
			IntVector2 val = default(IntVector2);
			((IntVector2)(ref val))..ctor(dungeon.data.Width + value.x, value.y);
			int num = dungeon.data.Width + value.x + dimensions.x;
			int num2 = Mathf.Max(dungeon.data.Height, dimensions.y + value.y);
			CellData[][] array = BraveUtility.MultidimensionalArrayResize<CellData>(dungeon.data.cellData, dungeon.data.Width, dungeon.data.Height, num, num2);
			CellArea val2 = new CellArea(val, dimensions, 0);
			val2.IsProceduralRoom = true;
			dungeon.data.cellData = array;
			dungeon.data.ClearCachedCellData();
			RoomHandler val3 = new RoomHandler(val2);
			for (int i = 0; i < dimensions.x; i++)
			{
				for (int j = 0; j < dimensions.y; j++)
				{
					IntVector2 val4 = new IntVector2(i, j) + val;
					CellData val5 = new CellData(val4, (CellType)2);
					val5.parentArea = val2;
					val5.parentRoom = val3;
					val5.nearestRoom = val3;
					array[val4.x][val4.y] = val5;
					val3.RuntimeStampCellComplex(val4.x, val4.y, (CellType)2, (DiagonalWallType)0);
				}
			}
			dungeon.data.rooms.Add(val3);
			if (roomPrefabPositionOverride.HasValue)
			{
				float x = roomPrefabPositionOverride.Value.x;
				float x2 = roomPrefabPositionOverride.Value.x;
				Object.Instantiate<GameObject>(roomPrefab, new Vector3((float)val.x + x, (float)val.y + x2, 0f), Quaternion.identity);
			}
			else
			{
				Object.Instantiate<GameObject>(roomPrefab, new Vector3((float)val.x, (float)val.y, 0f), Quaternion.identity);
			}
			DeadlyDeadlyGoopManager.ReinitializeData();
			return val3;
		}

		public static List<IPlayerInteractable> GetNearbyInteractablesREAL(this RoomHandler self, Vector2 position, float distance)
		{
			//IL_0077: 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)
			List<IPlayerInteractable> list = new List<IPlayerInteractable>();
			for (int i = 0; i < RoomHandler.unassignedInteractableObjects.Count; i++)
			{
				IPlayerInteractable val = RoomHandler.unassignedInteractableObjects[i];
				MonoBehaviour val2 = (MonoBehaviour)(object)((val is MonoBehaviour) ? val : null);
				if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Component)val2).gameObject) && val != null && val.GetDistanceToPoint(position) < distance)
				{
					list.Add(val);
				}
			}
			list.AddRange(self.GetNearbyInteractables(position, distance));
			return list;
		}

		public static void DoToNearbyEnemiesBetter(this RoomHandler self, Vector3 pos, float distance, Action<AIActor, float> effect, ActiveEnemyType type = 0)
		{
			//IL_0002: 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_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			List<AIActor> activeEnemies = self.GetActiveEnemies(type);
			for (int i = 0; i < activeEnemies.Count; i++)
			{
				AIActor val = activeEnemies[i];
				if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)((BraveBehaviour)val).specRigidbody))
				{
					continue;
				}
				PixelCollider hitboxPixelCollider = ((BraveBehaviour)val).specRigidbody.HitboxPixelCollider;
				if (hitboxPixelCollider != null)
				{
					Vector2 val2 = BraveMathCollege.ClosestPointOnRectangle(Vector2.op_Implicit(pos), hitboxPixelCollider.UnitBottomLeft, hitboxPixelCollider.UnitDimensions);
					float num = Vector2.Distance(Vector2.op_Implicit(pos), val2);
					if (num < distance)
					{
						effect(val, num);
					}
				}
			}
		}
	}
	public static class ItemBuilderAdditions
	{
		public static GameObject AddSpriteToObjectAssetbundle(string name, int CollectionID, tk2dSpriteCollectionData data, GameObject obj = null)
		{
			GameObject val = SpriteFromBundle(name, CollectionID, data, obj);
			((Object)val).name = name;
			return val;
		}

		public static GameObject SpriteFromBundle(string spriteName, int CollectionID, tk2dSpriteCollectionData data, 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>();
			((tk2dBaseSprite)val).SetSprite(data, CollectionID);
			((tk2dBaseSprite)val).SortingOrder = 0;
			((tk2dBaseSprite)val).IsPerpendicular = true;
			obj.GetComponent<BraveBehaviour>().sprite = (tk2dBaseSprite)(object)val;
			return obj;
		}
	}
	public static class VFXAndAnimationShit
	{
		public static GameObject CreateOverheadVFX(List<string> filepaths, string name, int fps, Assembly assembly = null)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_010d: 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_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			if ((object)assembly == null)
			{
				assembly = Assembly.GetCallingAssembly();
			}
			GameObject val = SpriteBuilder.SpriteFromResource(filepaths[0], new GameObject(name), assembly);
			val.SetActive(false);
			tk2dBaseSprite component = val.GetComponent<tk2dBaseSprite>();
			GunTools.ConstructOffsetsFromAnchor(component.GetCurrentSpriteDef(), (Anchor)1, (Vector2?)Vector2.op_Implicit(component.GetCurrentSpriteDef().position3), false, true);
			FakePrefab.MarkAsFakePrefab(val);
			Object.DontDestroyOnLoad((Object)(object)val);
			tk2dSpriteAnimator val2 = val.AddComponent<tk2dSpriteAnimator>();
			val2.Library = val.AddComponent<tk2dSpriteAnimation>();
			val2.Library.clips = (tk2dSpriteAnimationClip[])(object)new tk2dSpriteAnimationClip[0];
			tk2dSpriteAnimationClip val3 = new tk2dSpriteAnimationClip();
			val3.name = "NewOverheadVFX";
			val3.fps = fps;
			val3.frames = (tk2dSpriteAnimationFrame[])(object)new tk2dSpriteAnimationFrame[0];
			tk2dSpriteAnimationClip val4 = val3;
			foreach (string filepath in filepaths)
			{
				int num = SpriteBuilder.AddSpriteToCollection(filepath, val.GetComponent<tk2dBaseSprite>().Collection, assembly);
				GunTools.ConstructOffsetsFromAnchor(val.GetComponent<tk2dBaseSprite>().Collection.spriteDefinitions[num], (Anchor)1, (Vector2?)null, false, true);
				tk2dSpriteAnimationFrame val5 = new tk2dSpriteAnimationFrame
				{
					spriteId = num,
					spriteCollection = val.GetComponent<tk2dBaseSprite>().Collection
				};
				val4.frames = val4.frames.Concat((IEnumerable<tk2dSpriteAnimationFrame>)(object)new tk2dSpriteAnimationFrame[1] { val5 }).ToArray();
			}
			val2.Library.clips = val2.Library.clips.Concat((IEnumerable<tk2dSpriteAnimationClip>)(object)new tk2dSpriteAnimationClip[1] { val4 }).ToArray();
			val2.playAutomatically = true;
			val2.DefaultClipId = val2.GetClipIdByName("NewOverheadVFX");
			return val;
		}
	}
	public static class JuneUIHeartController
	{
		public static void Init()
		{
		}
	}
}
namespace JuneLib.Status
{
	public static class EasyGoopDefinitions
	{
		public static GoopDefinition FireDef;

		public static GoopDefinition OilDef;

		public static GoopDefinition PoisonDef;

		public static GoopDefinition BlobulonGoopDef;

		public static GoopDefinition WebGoop;

		public static GoopDefinition WaterGoop;

		public static GoopDefinition CharmGoopDef;

		public static GoopDefinition GreenFireDef;

		public static GoopDefinition CheeseDef;

		public static GoopDefinition PlayerFriendlyWebGoop;

		private static string[] goops;

		private static List<GoopDefinition> goopDefs;

		public static void DefineDefaultGoops()
		{
			AssetBundle val = ResourceManager.LoadAssetBundle("shared_auto_001");
			goopDefs = new List<GoopDefinition>();
			string[] array = goops;
			foreach (string text in array)
			{
				GoopDefinition val3;
				try
				{
					Object obj = val.LoadAsset(text);
					GameObject val2 = (GameObject)(object)((obj is GameObject) ? obj : null);
					val3 = val2.GetComponent<GoopDefinition>();
				}
				catch
				{
					Object obj2 = val.LoadAsset(text);
					val3 = (GoopDefinition)(object)((obj2 is GoopDefinition) ? obj2 : null);
				}
				((Object)val3).name = text.Replace("assets/data/goops/", "").Replace(".asset", "");
				goopDefs.Add(val3);
			}
			List<GoopDefinition> list = goopDefs;
			FireDef = goopDefs[0];
			OilDef = goopDefs[1];
			PoisonDef = goopDefs[2];
			BlobulonGoopDef = goopDefs[3];
			WebGoop = goopDefs[4];
			WaterGoop = goopDefs[5];
			GoopDefinition val4 = Object.Instantiate<GoopDefinition>(WebGoop);
			val4.playerStepsChangeLifetime = false;
			val4.SpeedModifierEffect = GenericStatusEffects.FriendlyWebGoopSpeedMod;
			PlayerFriendlyWebGoop = val4;
		}

		public static GoopDefinition GenerateBloodGoop(float dps, Color Color, float lifeSpan = 20f)
		{
			//IL_001d: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0095: Expected O, but got Unknown
			GoopDefinition val = ScriptableObject.CreateInstance<GoopDefinition>();
			val.CanBeIgnited = fals