Decompiled source of ChildrenOfKaliber v4.0.14

plugins/Items.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
using Alexandria.CharacterAPI;
using Alexandria.DungeonAPI;
using Alexandria.EnemyAPI;
using Alexandria.ItemAPI;
using Alexandria.Misc;
using Alexandria.NPCAPI;
using Alexandria.PrefabAPI;
using BepInEx;
using BepInEx.Bootstrap;
using BreakAbleAPI;
using Dungeonator;
using FullSerializer;
using Gungeon;
using InControl;
using Ionic.Zip;
using MonoMod.RuntimeDetour;
using MonoMod.Utils;
using Pathfinding;
using SaveAPI;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Items")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Items")]
[assembly: AssemblyCopyright("Copyright ©  2019")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ffba1617-0851-4332-b99d-65e9086fa8ac")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal class AdvancedGunBehaviour : MonoBehaviour, IGunInheritable, ILevelLoadedListener
{
	private bool pickedUpLast = false;

	private GameActor lastOwner = null;

	public bool everPickedUpByPlayer = false;

	public bool everPickedUp = false;

	protected Gun gun;

	private bool hasReloaded = true;

	public bool preventNormalFireAudio;

	public bool preventNormalReloadAudio;

	public string overrideNormalFireAudio;

	public string overrideReloadSwitchGroup;

	public string overrideNormalReloadAudio;

	public bool usesOverrideHeroSwordCooldown;

	public float overrideHeroSwordCooldown;

	private static FieldInfo heroSwordCooldown = typeof(Gun).GetField("HeroSwordCooldown", BindingFlags.Instance | BindingFlags.NonPublic);

	public bool PickedUp => (Object)(object)gun.CurrentOwner != (Object)null;

	public PlayerController Player
	{
		get
		{
			if (gun.CurrentOwner is PlayerController)
			{
				GameActor currentOwner = gun.CurrentOwner;
				return (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
			}
			return null;
		}
	}

	public float HeroSwordCooldown
	{
		get
		{
			if ((Object)(object)gun != (Object)null)
			{
				return (float)heroSwordCooldown.GetValue(gun);
			}
			return -1f;
		}
		set
		{
			if ((Object)(object)gun != (Object)null)
			{
				heroSwordCooldown.SetValue(gun, value);
			}
		}
	}

	public GameActor Owner => gun.CurrentOwner;

	public bool PickedUpByPlayer => (Object)(object)Player != (Object)null;

	protected virtual void Update()
	{
		if ((Object)(object)Player != (Object)null && !everPickedUpByPlayer)
		{
			everPickedUpByPlayer = true;
		}
		if ((Object)(object)Owner != (Object)null && !everPickedUp)
		{
			everPickedUp = true;
		}
		if ((Object)(object)lastOwner != (Object)(object)Owner)
		{
			lastOwner = Owner;
		}
		if ((Object)(object)Owner != (Object)null && !pickedUpLast)
		{
			OnPickup(Owner);
			pickedUpLast = true;
		}
		if ((Object)(object)Owner == (Object)null && pickedUpLast)
		{
			if ((Object)(object)lastOwner != (Object)null)
			{
				OnPostDrop(lastOwner);
				lastOwner = null;
			}
			pickedUpLast = false;
		}
		if ((Object)(object)gun != (Object)null && !gun.IsReloading && !hasReloaded)
		{
			hasReloaded = true;
			if ((Object)(object)Owner != (Object)null)
			{
				GameActor owner = Owner;
				OnReloadEnded((PlayerController)(object)((owner is PlayerController) ? owner : null), gun);
			}
		}
		gun.PreventNormalFireAudio = preventNormalFireAudio;
		gun.OverrideNormalFireAudioEvent = overrideNormalFireAudio;
	}

	public virtual void InheritData(Gun source)
	{
		AdvancedGunBehaviour component = ((Component)source).GetComponent<AdvancedGunBehaviour>();
		if ((Object)(object)component != (Object)null)
		{
			preventNormalFireAudio = component.preventNormalFireAudio;
			preventNormalReloadAudio = component.preventNormalReloadAudio;
			overrideNormalReloadAudio = component.overrideNormalReloadAudio;
			overrideNormalFireAudio = component.overrideNormalFireAudio;
			everPickedUpByPlayer = component.everPickedUpByPlayer;
			everPickedUp = component.everPickedUp;
			usesOverrideHeroSwordCooldown = component.usesOverrideHeroSwordCooldown;
			overrideHeroSwordCooldown = component.overrideHeroSwordCooldown;
			overrideReloadSwitchGroup = component.overrideReloadSwitchGroup;
		}
	}

	public virtual void MidGameSerialize(List<object> data, int dataIndex)
	{
		data.Add(preventNormalFireAudio);
		data.Add(preventNormalReloadAudio);
		data.Add(overrideNormalReloadAudio);
		data.Add(overrideNormalFireAudio);
		data.Add(everPickedUpByPlayer);
		data.Add(everPickedUp);
		data.Add(usesOverrideHeroSwordCooldown);
		data.Add(overrideHeroSwordCooldown);
		data.Add(overrideReloadSwitchGroup);
	}

	public virtual void MidGameDeserialize(List<object> data, ref int dataIndex)
	{
		preventNormalFireAudio = (bool)data[dataIndex];
		preventNormalReloadAudio = (bool)data[dataIndex + 1];
		overrideNormalReloadAudio = (string)data[dataIndex + 2];
		overrideNormalFireAudio = (string)data[dataIndex + 3];
		everPickedUpByPlayer = (bool)data[dataIndex + 4];
		everPickedUp = (bool)data[dataIndex + 5];
		usesOverrideHeroSwordCooldown = (bool)data[dataIndex + 6];
		overrideHeroSwordCooldown = (float)data[dataIndex + 7];
		overrideReloadSwitchGroup = (string)data[dataIndex + 8];
		dataIndex += 9;
	}

	public virtual void Start()
	{
		gun = ((Component)this).GetComponent<Gun>();
		Gun obj = gun;
		obj.OnInitializedWithOwner = (Action<GameActor>)Delegate.Combine(obj.OnInitializedWithOwner, new Action<GameActor>(OnInitializedWithOwner));
		if ((Object)(object)gun.CurrentOwner != (Object)null)
		{
			OnInitializedWithOwner(gun.CurrentOwner);
		}
		Gun obj2 = gun;
		obj2.PostProcessProjectile = (Action<Projectile>)Delegate.Combine(obj2.PostProcessProjectile, new Action<Projectile>(PostProcessProjectile));
		Gun obj3 = gun;
		obj3.PostProcessVolley = (Action<ProjectileVolleyData>)Delegate.Combine(obj3.PostProcessVolley, new Action<ProjectileVolleyData>(PostProcessVolley));
		Gun obj4 = gun;
		obj4.OnDropped = (Action)Delegate.Combine(obj4.OnDropped, new Action(OnDropped));
		Gun obj5 = gun;
		obj5.OnAutoReload = (Action<PlayerController, Gun>)Delegate.Combine(obj5.OnAutoReload, new Action<PlayerController, Gun>(OnAutoReload));
		Gun obj6 = gun;
		obj6.OnReloadPressed = (Action<PlayerController, Gun, bool>)Delegate.Combine(obj6.OnReloadPressed, new Action<PlayerController, Gun, bool>(OnReloadPressed));
		Gun obj7 = gun;
		obj7.OnFinishAttack = (Action<PlayerController, Gun>)Delegate.Combine(obj7.OnFinishAttack, new Action<PlayerController, Gun>(OnFinishAttack));
		Gun obj8 = gun;
		obj8.OnPostFired = (Action<PlayerController, Gun>)Delegate.Combine(obj8.OnPostFired, new Action<PlayerController, Gun>(OnPostFired));
		Gun obj9 = gun;
		obj9.OnAmmoChanged = (Action<PlayerController, Gun>)Delegate.Combine(obj9.OnAmmoChanged, new Action<PlayerController, Gun>(OnAmmoChanged));
		Gun obj10 = gun;
		obj10.OnBurstContinued = (Action<PlayerController, Gun>)Delegate.Combine(obj10.OnBurstContinued, new Action<PlayerController, Gun>(OnBurstContinued));
		Gun obj11 = gun;
		obj11.OnPreFireProjectileModifier = (Func<Gun, Projectile, ProjectileModule, Projectile>)Delegate.Combine(obj11.OnPreFireProjectileModifier, new Func<Gun, Projectile, ProjectileModule, Projectile>(OnPreFireProjectileModifier));
		((MonoBehaviour)this).StartCoroutine(UpdateCR());
	}

	public virtual void BraveOnLevelWasLoaded()
	{
	}

	private IEnumerator UpdateCR()
	{
		while (true)
		{
			NonCurrentGunUpdate();
			yield return null;
		}
	}

	protected virtual void NonCurrentGunUpdate()
	{
	}

	public virtual void OnInitializedWithOwner(GameActor actor)
	{
	}

	public virtual void PostProcessProjectile(Projectile projectile)
	{
	}

	public virtual void PostProcessVolley(ProjectileVolleyData volley)
	{
	}

	public virtual void OnDropped()
	{
	}

	public virtual void OnAutoReload(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnAutoReloadSafe(player, gun);
		}
	}

	public virtual void OnAutoReloadSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnReloadPressed(PlayerController player, Gun gun, bool manualReload)
	{
		if (hasReloaded && gun.IsReloading)
		{
			OnReload(player, gun);
			hasReloaded = false;
		}
		if ((Object)(object)player != (Object)null)
		{
			OnReloadPressedSafe(player, gun, manualReload);
		}
	}

	public virtual void OnGunsChanged(Gun previous, Gun current, bool newGun)
	{
		if ((Object)(object)previous != (Object)(object)gun && (Object)(object)current == (Object)(object)gun)
		{
			OnSwitchedToThisGun();
		}
		if ((Object)(object)previous == (Object)(object)gun && (Object)(object)current != (Object)(object)gun)
		{
			OnSwitchedAwayFromThisGun();
		}
	}

	public virtual void OnSwitchedToThisGun()
	{
	}

	public virtual void OnSwitchedAwayFromThisGun()
	{
	}

	public virtual void OnReloadPressedSafe(PlayerController player, Gun gun, bool manualReload)
	{
		if (hasReloaded && gun.IsReloading)
		{
			OnReloadSafe(player, gun);
			hasReloaded = false;
		}
	}

	public virtual void OnReload(PlayerController player, Gun gun)
	{
		if (preventNormalReloadAudio)
		{
			AkSoundEngine.PostEvent("Stop_WPN_All", ((Component)this).gameObject);
			if (!string.IsNullOrEmpty(overrideNormalReloadAudio))
			{
				AkSoundEngine.PostEvent(overrideNormalReloadAudio, ((Component)this).gameObject);
			}
		}
	}

	public virtual void OnReloadEnded(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnReloadEndedSafe(player, gun);
		}
	}

	public virtual void OnReloadEndedSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnReloadSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnFinishAttack(PlayerController player, Gun gun)
	{
	}

	public virtual void OnPostFired(PlayerController player, Gun gun)
	{
		if (gun.IsHeroSword && HeroSwordCooldown == 0.5f)
		{
			OnHeroSwordCooldownStarted(player, gun);
		}
	}

	public virtual void OnHeroSwordCooldownStarted(PlayerController player, Gun gun)
	{
		if (usesOverrideHeroSwordCooldown)
		{
			HeroSwordCooldown = overrideHeroSwordCooldown;
		}
	}

	public virtual void OnAmmoChanged(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnAmmoChangedSafe(player, gun);
		}
	}

	public virtual void OnAmmoChangedSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnBurstContinued(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnBurstContinuedSafe(player, gun);
		}
	}

	public virtual void OnBurstContinuedSafe(PlayerController player, Gun gun)
	{
	}

	public virtual Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod)
	{
		return projectile;
	}

	protected virtual void OnPickup(GameActor owner)
	{
		if (owner is PlayerController)
		{
			OnPickedUpByPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
		}
		if (owner is AIActor)
		{
			OnPickedUpByEnemy((AIActor)(object)((owner is AIActor) ? owner : null));
		}
	}

	protected virtual void OnPostDrop(GameActor owner)
	{
		if (owner is PlayerController)
		{
			OnPostDroppedByPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
		}
		if (owner is AIActor)
		{
			OnPostDroppedByEnemy((AIActor)(object)((owner is AIActor) ? owner : null));
		}
	}

	protected virtual void OnPickedUpByPlayer(PlayerController player)
	{
		player.GunChanged += OnGunsChanged;
	}

	protected virtual void OnPostDroppedByPlayer(PlayerController player)
	{
	}

	protected virtual void OnPickedUpByEnemy(AIActor enemy)
	{
	}

	protected virtual void OnPostDroppedByEnemy(AIActor enemy)
	{
	}
}
public class EnemyGuidDatabase
{
	public static Dictionary<string, string> Entries { get; set; } = new Dictionary<string, string>
	{
		{ "bullet_kin", "01972dee89fc4404a5c408d50007dad5" },
		{ "ak47_bullet_kin", "db35531e66ce41cbb81d507a34366dfe" },
		{ "bandana_bullet_kin", "88b6b6a93d4b4234a67844ef4728382c" },
		{ "veteran_bullet_kin", "70216cae6c1346309d86d4a0b4603045" },
		{ "treadnaughts_bullet_kin", "df7fb62405dc4697b7721862c7b6b3cd" },
		{ "minelet", "3cadf10c489b461f9fb8814abc1a09c1" },
		{ "cardinal", "8bb5578fba374e8aae8e10b754e61d62" },
		{ "shroomer", "e5cffcfabfae489da61062ea20539887" },
		{ "ashen_bullet_kin", "1a78cfb776f54641b832e92c44021cf2" },
		{ "mutant_bullet_kin", "d4a9836f8ab14f3fadd0f597438b1f1f" },
		{ "fallen_bullet_kin", "5f3abc2d561b4b9c9e72b879c6f10c7e" },
		{ "hooded_bullet", "844657ad68894a4facb1b8e1aef1abf9" },
		{ "office_bullet_kin", "906d71ccc1934c02a6f4ff2e9c07c9ec" },
		{ "office_bullette_kin", "9eba44a0ea6c4ea386ff02286dd0e6bd" },
		{ "brollet", "05cb719e0178478685dc610f8b3e8bfc" },
		{ "western_bullet_kin", "5861e5a077244905a8c25c2b7b4d6ebb" },
		{ "pirate_bullet_kin", "6f818f482a5c47fd8f38cce101f6566c" },
		{ "armored_bullet_kin", "39e6f47a16ab4c86bec4b12984aece4c" },
		{ "key_bullet_kin", "699cd24270af4cd183d671090d8323a1" },
		{ "chance_bullet_kin", "a446c626b56d4166915a4e29869737fd" },
		{ "hollowpoint", "4db03291a12144d69fe940d5a01de376" },
		{ "spectre", "56f5a0f2c1fc4bc78875aea617ee31ac" },
		{ "skullet", "336190e29e8a4f75ab7486595b700d4a" },
		{ "skullmet", "95ec774b5a75467a9ab05fa230c0c143" },
		{ "gummy", "5288e86d20184fa69c91ceb642d31474" },
		{ "spent", "249db525a9464e5282d02162c88e0357" },
		{ "gummy_spent", "e21ac9492110493baef6df02a2682a0d" },
		{ "red_shotgun_kin", "128db2f0781141bcb505d8f00f9e4d47" },
		{ "blue_shotgun_kin", "b54d89f9e802455cbb2b8a96a31e8259" },
		{ "veteran_shotgun_kin", "2752019b770f473193b08b4005dc781f" },
		{ "mutant_shotgun_kin", "7f665bd7151347e298e4d366f8818284" },
		{ "executioner", "b1770e0f1c744d9d887cc16122882b4f" },
		{ "ashen_shotgun_kin", "1bd8e49f93614e76b140077ff2e33f2b" },
		{ "shotgrub", "044a9f39712f456597b9762893fbc19c" },
		{ "creech", "37340393f97f41b2822bc02d14654172" },
		{ "western_shotgun_kin", "ddf12a4881eb43cfba04f36dd6377abb" },
		{ "pirate_shotgun_kin", "86dfc13486ee4f559189de53cfb84107" },
		{ "blobulon", "0239c0680f9f467dbe5c4aab7dd1eca6" },
		{ "blobuloid", "042edb1dfb614dc385d5ad1b010f2ee3" },
		{ "blobulin", "42be66373a3d4d89b91a35c9ff8adfec" },
		{ "poisbulon", "e61cab252cfb435db9172adc96ded75f" },
		{ "poisbuloid", "fe3fe59d867347839824d5d9ae87f244" },
		{ "poisbulin", "b8103805af174924b578c98e95313074" },
		{ "blizzbulon", "022d7c822bc146b58fe3b0287568aaa2" },
		{ "leadbulon", "ccf6d241dad64d989cbcaca2a8477f01" },
		{ "bloodbulon", "062b9b64371e46e195de17b6f10e47c8" },
		{ "poopulon", "116d09c26e624bca8cca09fc69c714b3" },
		{ "cubulon", "864ea5a6a9324efc95a0dd2407f42810" },
		{ "cubulead", "0b547ac6b6fc4d68876a241a88f5ca6a" },
		{ "chancebulon", "1bc2a07ef87741be90c37096910843ab" },
		{ "skusket", "af84951206324e349e1f13f9b7b60c1a" },
		{ "black_skusket", "1cec0cdf383e42b19920787798353e46" },
		{ "skusket_head", "c2f902b7cbe745efb3db4399927eab34" },
		{ "shelleton", "21dd14e5ca2a4a388adab5b11b69a1e1" },
		{ "revolvenant", "d5a7b95774cd41f080e517bea07bf495" },
		{ "gunreaper", "88f037c3f93b4362a040a87b30770407" },
		{ "bullat", "2feb50a6a40f4f50982e89fd276f6f15" },
		{ "shotgat", "2d4f8b5404614e7d8b235006acde427a" },
		{ "grenat", "b4666cb6ef4f4b038ba8924fd8adf38f" },
		{ "spirat", "7ec3e8146f634c559a7d58b19191cd43" },
		{ "king_bullat", "1a4872dafdb34fd29fe8ac90bd2cea67" },
		{ "gargoyle", "981d358ffc69419bac918ca1bdf0c7f7" },
		{ "apprentice_gunjurer", "206405acad4d4c33aac6717d184dc8d4" },
		{ "gunjurer", "c4fba8def15e47b297865b18e36cbef8" },
		{ "high_gunjurer", "9b2cf2949a894599917d4d391a0b7394" },
		{ "lore_gunjurer", "56fb939a434140308b8f257f0f447829" },
		{ "bookllet", "c0ff3744760c4a2eb0bb52ac162056e6" },
		{ "blue_bookllet", "6f22935656c54ccfb89fca30ad663a64" },
		{ "green_bookllet", "a400523e535f41ac80a43ff6b06dc0bf" },
		{ "necronomicon", "216fd3dfb9da439d9bd7ba53e1c76462" },
		{ "tablet_bookllett", "78e0951b097b46d89356f004dda27c42" },
		{ "mountain_cube", "f155fd2759764f4a9217db29dd21b7eb" },
		{ "lead_cube", "33b212b856b74ff09252bf4f2e8b8c57" },
		{ "flesh_cube", "3f2026dc3712490289c4658a2ba4a24b" },
		{ "brown_chest_mimic", "2ebf8ef6728648089babb507dec4edb7" },
		{ "blue_chest_mimic", "d8d651e3484f471ba8a2daa4bf535ce6" },
		{ "green_chest_mimic", "abfb454340294a0992f4173d6e5898a8" },
		{ "red_chest_mimic", "d8fd592b184b4ac9a3be217bc70912a2" },
		{ "black_chest_mimic", "6450d20137994881aff0ddd13e3d40c8" },
		{ "rat_chest_mimic", "ac9d345575444c9a8d11b799e8719be0" },
		{ "pedestal_mimic", "796a7ed4ad804984859088fc91672c7f" },
		{ "wall_mimic", "479556d05c7c44f3b6abb3b2067fc778" },
		{ "gun_nut", "ec8ea75b557d4e7b8ceeaacdf6f8238c" },
		{ "chain_gunner", "463d16121f884984abe759de38418e48" },
		{ "spectral_gun_nut", "383175a55879441d90933b5c4e60cf6f" },
		{ "det", "ac986dabc5a24adab11d48a4bccf4cb1" },
		{ "x_det", "48d74b9c65f44b888a94f9e093554977" },
		{ "diagonal_x_det", "c5a0fd2774b64287bf11127ca59dd8b4" },
		{ "vertical_det", "b67ffe82c66742d1985e5888fd8e6a03" },
		{ "diagonal_det", "d9632631a18849539333a92332895ebd" },
		{ "horizontal_det", "1898f6fe1ee0408e886aaf05c23cc216" },
		{ "vertical_x_det", "abd816b0bcbf4035b95837ca931169df" },
		{ "horizontal_x_det", "07d06d2b23cc48fe9f95454c839cb361" },
		{ "gunsinger", "cf2b7021eac44e3f95af07db9a7c442c" },
		{ "aged_gunsinger", "c50a862d19fc4d30baeba54795e8cb93" },
		{ "ammomancer", "b1540990a4f1480bbcb3bea70d67f60d" },
		{ "jammomancer", "8b4a938cdbc64e64822e841e482ba3d2" },
		{ "jamerlengo", "ba657723b2904aa79f9e51bce7d23872" },
		{ "gun_cultist", "57255ed50ee24794b7aac1ac3cfb8a95" },
		{ "gat", "9b4fb8a2a60a457f90dcf285d34143ac" },
		{ "grey_cylinder", "d4f4405e0ff34ab483966fd177f2ece3" },
		{ "red_cylinder", "534f1159e7cf4f6aa00aeea92459065e" },
		{ "bullet_mech", "2b6854c0849b4b8fb98eb15519d7db1c" },
		{ "grenade_kin", "4d37ce3d666b4ddda8039929225b7ede" },
		{ "dynamite_kin", "c0260c286c8d4538a697c5bf24976ccf" },
		{ "bombshee", "19b420dec96d4e9ea4aebc3398c0ba7a" },
		{ "m80_kin", "5f15093e6f684f4fb09d3e7e697216b4" },
		{ "rubber_kin", "6b7ef9e5d05b4f96b04f05ef4a0d1b18" },
		{ "tazie", "98fdf153a4dd4d51bf0bafe43f3c77ff" },
		{ "sniper_shell", "31a3ea0c54a745e182e22ea54844a82d" },
		{ "professional", "c5b11bfc065d417b9c4d03a5e385fe2c" },
		{ "muzzle_wisp", "ffdc8680bdaa487f8f31995539f74265" },
		{ "muzzle_flare", "d8a445ea4d944cc1b55a40f22821ae69" },
		{ "wizbang", "43426a2e39584871b287ac31df04b544" },
		{ "coaler", "9d50684ce2c044e880878e86dbada919" },
		{ "fungun", "f905765488874846b7ff257ff81d6d0c" },
		{ "bullet_shark", "72d2f44431da43b8a3bae7d8a114a46d" },
		{ "arrow_head", "05891b158cd542b1a5f3df30fb67a7ff" },
		{ "pot_fairy", "c182a5cb704d460d9d099a47af49c913" },
		{ "musketball", "226fd90be3a64958a5b13cb0a4f43e97" },
		{ "western_cactus", "3b0bd258b4c9432db3339665cc61c356" },
		{ "candle_kin", "37de0df92697431baa47894a075ba7e9" },
		{ "gigi", "ed37fa13e0fa4fcf8239643957c51293" },
		{ "misfire_beast", "45192ff6d6cb43ed8f1a874ab6bef316" },
		{ "phaser_spider", "98ca70157c364750a60f5e0084f9d3e2" },
		{ "gunzookie", "6e972cd3b11e4b429b888b488e308551" },
		{ "gunzockie", "8a9e9bedac014a829a48735da6daf3da" },
		{ "chameleon", "80ab6cd15bfc46668a8844b2975c6c26" },
		{ "bird_parrot", "4b21a913e8c54056bc05cafecf9da880" },
		{ "western_snake", "e861e59012954ab2b9b6977da85cb83c" },
		{ "kalibullet", "ff4f54ce606e4604bf8d467c1279be3e" },
		{ "kbullet", "f020570a42164e2699dcf57cac8a495c" },
		{ "blue_fish_bullet_kin", "tit" },
		{ "green_fish_bullet_kin", "143be8c9bbb84e3fb3ab98bcd4cf5e5b" },
		{ "tarnisher", "475c20c1fd474dfbad54954e7cba29c1" },
		{ "agonizer", "3f6d6b0c4a7c4690807435c7b37c35a5" },
		{ "lead_maiden", "cd4a4b7f612a4ba9a720b9f97c52f38c" },
		{ "grip_master", "22fc2c2c45fb47cf9fb5f7b043a70122" },
		{ "shambling_round", "98ea2fe181ab4323ab6e9981955a9bca" },
		{ "great_bullet_shark", "b70cbd875fea498aa7fd14b970248920" },
		{ "killithid", "3e98ccecf7334ff2800188c417e67c15" },
		{ "spogre", "eed5addcc15148179f300cc0d9ee7f94" },
		{ "fridge_maiden", "9215d1a221904c7386b481a171e52859" },
		{ "titan_bullet_kin", "c4cf0620f71c4678bb8d77929fd4feff" },
		{ "titan_bullet_kin_boss", "1f290ea06a4c416cabc52d6b3cf47266" },
		{ "titaness_bullet_kin_boss", "df4e9fedb8764b5a876517431ca67b86" },
		{ "beadie", "7b0b1b6d9ce7405b86b75ce648025dd6" },
		{ "tombstoner", "cf27dd464a504a428d87a8b2560ad40a" },
		{ "ammoconda_ball", "f38686671d524feda75261e469f30e0b" },
		{ "summoned_treadnaughts_bullet_kin", "47bdfec22e8e4568a619130a267eab5b" },
		{ "mine_flayers_bell", "78a8ee40dff2477e9c2134f6990ef297" },
		{ "mine_flayers_claymore", "566ecca5f3b04945ac6ce1f26dedbf4f" },
		{ "candle_guy", "eeb33c3a5a8e4eaaaaf39a743e8767bc" },
		{ "bullet_kings_toadie", "b5e699a0abb94666bda567ab23bd91c4" },
		{ "bullet_kings_toadie_revenge", "d4dd2b2bbda64cc9bcec534b4e920518" },
		{ "old_kings_toadie", "02a14dec58ab45fb8aacde7aacd25b01" },
		{ "fusebot", "4538456236f64ea79f483784370bc62f" },
		{ "mouser", "be0683affb0e41bbb699cb7125fdded6" },
		{ "draguns_knife", "78eca975263d4482a4bfa4c07b32e252" },
		{ "dragun_knife_advanced", "2e6223e42e574775b56c6349921f42cb" },
		{ "marines_past_imp", "a9cc6a4e9b3d46ea871e70a03c9f77d4" },
		{ "convicts_past_soldier", "556e9f2a10f9411cb9dbfd61e0e0f1e1" },
		{ "robots_past_terminator", "12a054b8a6e549dcac58a82b89e319e5" },
		{ "blockner_rematch", "edc61b105ddd4ce18302b82efdc47178" },
		{ "fuselier", "39de9bd6a863451a97906d949c103538" },
		{ "shadow_agunim", "db97e486ef02425280129e1e27c33118" },
		{ "bullet_king", "ffca09398635467da3b1f4a54bcfda80" },
		{ "blobulord", "1b5810fafbec445d89921a4efb4e42b7" },
		{ "old_king", "5729c8b5ffa7415bb3d01205663a33ef" },
		{ "cannonbalrog", "5e0af7f7d9de4755a68d2fd3bbc15df4" },
		{ "door_lord", "9189f46c47564ed588b9108965f975c9" },
		{ "lich", "cd88c3ce60c442e9aa5b3904d31652bc" },
		{ "megalich", "68a238ed6a82467ea85474c595c49c6e" },
		{ "infinilich", "7c5d5f09911e49b78ae644d2b50ff3bf" },
		{ "chicken", "76bc43539fc24648bff4568c75c686d1" },
		{ "poopulons_corn", "0ff278534abb4fbaaa65d3f638003648" },
		{ "snake", "1386da0f42fb4bcabc5be8feb16a7c38" },
		{ "tiny_blobulord", "d1c9781fdac54d9e8498ed89210a0238" },
		{ "robots_past_critter_1", "95ea1a31fc9e4415a5f271b9aedf9b15" },
		{ "robots_past_critter_2", "42432592685e47c9941e339879379d3a" },
		{ "robots_past_critter_3", "4254a93fc3c84c0dbe0a8f0dddf48a5a" },
		{ "rat", "6ad1cafc268f4214a101dca7af61bc91" },
		{ "rat_candle", "14ea47ff46b54bb4a98f91ffcffb656d" },
		{ "dragun_egg_slimeguy", "8b43a5c59b854eb780f9ab669ec26b7a" },
		{ "ammoconda", "da797878d215453abba824ff902e21b4" }
	};

}
public class AdvancedGunBehaviourMultiActive : MonoBehaviour, IGunInheritable, ILevelLoadedListener
{
	private bool pickedUpLast = false;

	private GameActor lastOwner = null;

	public bool everPickedUpByPlayer = false;

	public bool everPickedUp = false;

	public Gun gun;

	private bool hasReloaded = true;

	public bool preventNormalFireAudio;

	public bool preventNormalReloadAudio;

	public string overrideNormalFireAudio;

	public string overrideReloadSwitchGroup;

	public string overrideNormalReloadAudio;

	public bool usesOverrideHeroSwordCooldown;

	public float overrideHeroSwordCooldown;

	private static FieldInfo heroSwordCooldown = typeof(Gun).GetField("HeroSwordCooldown", BindingFlags.Instance | BindingFlags.NonPublic);

	public bool PickedUp => (Object)(object)gun.CurrentOwner != (Object)null;

	public PlayerController Player
	{
		get
		{
			if (gun.CurrentOwner is PlayerController)
			{
				GameActor currentOwner = gun.CurrentOwner;
				return (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
			}
			return null;
		}
	}

	public float HeroSwordCooldown
	{
		get
		{
			if ((Object)(object)gun != (Object)null)
			{
				return (float)heroSwordCooldown.GetValue(gun);
			}
			return -1f;
		}
		set
		{
			if ((Object)(object)gun != (Object)null)
			{
				heroSwordCooldown.SetValue(gun, value);
			}
		}
	}

	public GameActor Owner => gun.CurrentOwner;

	public bool PickedUpByPlayer => (Object)(object)Player != (Object)null;

	public virtual void Update()
	{
		if ((Object)(object)Player != (Object)null && !everPickedUpByPlayer)
		{
			everPickedUpByPlayer = true;
		}
		if ((Object)(object)Owner != (Object)null && !everPickedUp)
		{
			everPickedUp = true;
		}
		if ((Object)(object)lastOwner != (Object)(object)Owner)
		{
			lastOwner = Owner;
		}
		if ((Object)(object)Owner != (Object)null && !pickedUpLast)
		{
			OnPickup(Owner);
			pickedUpLast = true;
		}
		if ((Object)(object)Owner == (Object)null && pickedUpLast)
		{
			if ((Object)(object)lastOwner != (Object)null)
			{
				OnPostDrop(lastOwner);
				lastOwner = null;
			}
			pickedUpLast = false;
		}
		if ((Object)(object)gun != (Object)null && !gun.IsReloading && !hasReloaded)
		{
			hasReloaded = true;
			if ((Object)(object)Owner != (Object)null)
			{
				GameActor owner = Owner;
				OnReloadEnded((PlayerController)(object)((owner is PlayerController) ? owner : null), gun);
			}
		}
		gun.PreventNormalFireAudio = preventNormalFireAudio;
		gun.OverrideNormalFireAudioEvent = overrideNormalFireAudio;
	}

	public virtual void InheritData(Gun source)
	{
		AdvancedGunBehaviourMultiActive component = ((Component)source).GetComponent<AdvancedGunBehaviourMultiActive>();
		if ((Object)(object)component != (Object)null)
		{
			preventNormalFireAudio = component.preventNormalFireAudio;
			preventNormalReloadAudio = component.preventNormalReloadAudio;
			overrideNormalReloadAudio = component.overrideNormalReloadAudio;
			overrideNormalFireAudio = component.overrideNormalFireAudio;
			everPickedUpByPlayer = component.everPickedUpByPlayer;
			everPickedUp = component.everPickedUp;
			usesOverrideHeroSwordCooldown = component.usesOverrideHeroSwordCooldown;
			overrideHeroSwordCooldown = component.overrideHeroSwordCooldown;
			overrideReloadSwitchGroup = component.overrideReloadSwitchGroup;
		}
	}

	public virtual void MidGameSerialize(List<object> data, int dataIndex)
	{
		data.Add(preventNormalFireAudio);
		data.Add(preventNormalReloadAudio);
		data.Add(overrideNormalReloadAudio);
		data.Add(overrideNormalFireAudio);
		data.Add(everPickedUpByPlayer);
		data.Add(everPickedUp);
		data.Add(usesOverrideHeroSwordCooldown);
		data.Add(overrideHeroSwordCooldown);
		data.Add(overrideReloadSwitchGroup);
	}

	public virtual void MidGameDeserialize(List<object> data, ref int dataIndex)
	{
		preventNormalFireAudio = (bool)data[dataIndex];
		preventNormalReloadAudio = (bool)data[dataIndex + 1];
		overrideNormalReloadAudio = (string)data[dataIndex + 2];
		overrideNormalFireAudio = (string)data[dataIndex + 3];
		everPickedUpByPlayer = (bool)data[dataIndex + 4];
		everPickedUp = (bool)data[dataIndex + 5];
		usesOverrideHeroSwordCooldown = (bool)data[dataIndex + 6];
		overrideHeroSwordCooldown = (float)data[dataIndex + 7];
		overrideReloadSwitchGroup = (string)data[dataIndex + 8];
		dataIndex += 9;
	}

	public virtual void Start()
	{
		gun = ((Component)this).GetComponent<Gun>();
		Gun obj = gun;
		obj.OnInitializedWithOwner = (Action<GameActor>)Delegate.Combine(obj.OnInitializedWithOwner, new Action<GameActor>(OnInitializedWithOwner));
		if ((Object)(object)gun.CurrentOwner != (Object)null)
		{
			OnInitializedWithOwner(gun.CurrentOwner);
		}
		Gun obj2 = gun;
		obj2.PostProcessProjectile = (Action<Projectile>)Delegate.Combine(obj2.PostProcessProjectile, new Action<Projectile>(PostProcessProjectile));
		Gun obj3 = gun;
		obj3.PostProcessVolley = (Action<ProjectileVolleyData>)Delegate.Combine(obj3.PostProcessVolley, new Action<ProjectileVolleyData>(PostProcessVolley));
		Gun obj4 = gun;
		obj4.OnDropped = (Action)Delegate.Combine(obj4.OnDropped, new Action(OnDropped));
		Gun obj5 = gun;
		obj5.OnAutoReload = (Action<PlayerController, Gun>)Delegate.Combine(obj5.OnAutoReload, new Action<PlayerController, Gun>(OnAutoReload));
		Gun obj6 = gun;
		obj6.OnReloadPressed = (Action<PlayerController, Gun, bool>)Delegate.Combine(obj6.OnReloadPressed, new Action<PlayerController, Gun, bool>(OnReloadPressed));
		Gun obj7 = gun;
		obj7.OnFinishAttack = (Action<PlayerController, Gun>)Delegate.Combine(obj7.OnFinishAttack, new Action<PlayerController, Gun>(OnFinishAttack));
		Gun obj8 = gun;
		obj8.OnPostFired = (Action<PlayerController, Gun>)Delegate.Combine(obj8.OnPostFired, new Action<PlayerController, Gun>(OnPostFired));
		Gun obj9 = gun;
		obj9.OnAmmoChanged = (Action<PlayerController, Gun>)Delegate.Combine(obj9.OnAmmoChanged, new Action<PlayerController, Gun>(OnAmmoChanged));
		Gun obj10 = gun;
		obj10.OnBurstContinued = (Action<PlayerController, Gun>)Delegate.Combine(obj10.OnBurstContinued, new Action<PlayerController, Gun>(OnBurstContinued));
		Gun obj11 = gun;
		obj11.OnPreFireProjectileModifier = (Func<Gun, Projectile, ProjectileModule, Projectile>)Delegate.Combine(obj11.OnPreFireProjectileModifier, new Func<Gun, Projectile, ProjectileModule, Projectile>(OnPreFireProjectileModifier));
		((MonoBehaviour)this).StartCoroutine(UpdateCR());
	}

	public virtual void BraveOnLevelWasLoaded()
	{
	}

	private IEnumerator UpdateCR()
	{
		while (true)
		{
			NonCurrentGunUpdate();
			yield return null;
		}
	}

	public virtual void NonCurrentGunUpdate()
	{
	}

	public virtual void OnInitializedWithOwner(GameActor actor)
	{
	}

	public virtual void PostProcessProjectile(Projectile projectile)
	{
	}

	public virtual void PostProcessVolley(ProjectileVolleyData volley)
	{
	}

	public virtual void OnDropped()
	{
	}

	public virtual void OnAutoReload(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnAutoReloadSafe(player, gun);
		}
	}

	public virtual void OnAutoReloadSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnReloadPressed(PlayerController player, Gun gun, bool manualReload)
	{
		if (hasReloaded && gun.IsReloading)
		{
			OnReload(player, gun);
			hasReloaded = false;
		}
		if ((Object)(object)player != (Object)null)
		{
			OnReloadPressedSafe(player, gun, manualReload);
		}
	}

	public virtual void OnGunsChanged(Gun previous, Gun current, bool newGun)
	{
		if ((Object)(object)previous != (Object)(object)gun && (Object)(object)current == (Object)(object)gun)
		{
			OnSwitchedToThisGun();
		}
		if ((Object)(object)previous == (Object)(object)gun && (Object)(object)current != (Object)(object)gun)
		{
			OnSwitchedAwayFromThisGun();
		}
	}

	public virtual void OnSwitchedToThisGun()
	{
	}

	public virtual void OnSwitchedAwayFromThisGun()
	{
	}

	public virtual void OnReloadPressedSafe(PlayerController player, Gun gun, bool manualReload)
	{
		if (hasReloaded && gun.IsReloading)
		{
			OnReloadSafe(player, gun);
			hasReloaded = false;
		}
	}

	public virtual void OnReload(PlayerController player, Gun gun)
	{
		if (preventNormalReloadAudio)
		{
			AkSoundEngine.PostEvent("Stop_WPN_All", ((Component)this).gameObject);
			if (!string.IsNullOrEmpty(overrideNormalReloadAudio))
			{
				AkSoundEngine.PostEvent(overrideNormalReloadAudio, ((Component)this).gameObject);
			}
		}
	}

	public virtual void OnReloadEnded(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnReloadEndedSafe(player, gun);
		}
	}

	public virtual void OnReloadEndedSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnReloadSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnFinishAttack(PlayerController player, Gun gun)
	{
	}

	public virtual void OnPostFired(PlayerController player, Gun gun)
	{
		if (gun.IsHeroSword && HeroSwordCooldown == 0.5f)
		{
			OnHeroSwordCooldownStarted(player, gun);
		}
	}

	public virtual void OnHeroSwordCooldownStarted(PlayerController player, Gun gun)
	{
		if (usesOverrideHeroSwordCooldown)
		{
			HeroSwordCooldown = overrideHeroSwordCooldown;
		}
	}

	public virtual void OnAmmoChanged(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnAmmoChangedSafe(player, gun);
		}
	}

	public virtual void OnAmmoChangedSafe(PlayerController player, Gun gun)
	{
	}

	public virtual void OnBurstContinued(PlayerController player, Gun gun)
	{
		if ((Object)(object)player != (Object)null)
		{
			OnBurstContinuedSafe(player, gun);
		}
	}

	public virtual void OnBurstContinuedSafe(PlayerController player, Gun gun)
	{
	}

	public virtual Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod)
	{
		return projectile;
	}

	public virtual void OnPickup(GameActor owner)
	{
		if (owner is PlayerController)
		{
			OnPickedUpByPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
		}
		if (owner is AIActor)
		{
			OnPickedUpByEnemy((AIActor)(object)((owner is AIActor) ? owner : null));
		}
	}

	public virtual void OnPostDrop(GameActor owner)
	{
		if (owner is PlayerController)
		{
			OnPostDroppedByPlayer((PlayerController)(object)((owner is PlayerController) ? owner : null));
		}
		if (owner is AIActor)
		{
			OnPostDroppedByEnemy((AIActor)(object)((owner is AIActor) ? owner : null));
		}
	}

	public virtual void OnPickedUpByPlayer(PlayerController player)
	{
		player.GunChanged += OnGunsChanged;
	}

	public virtual void OnPostDroppedByPlayer(PlayerController player)
	{
	}

	public virtual void OnPickedUpByEnemy(AIActor enemy)
	{
	}

	public virtual void OnPostDroppedByEnemy(AIActor enemy)
	{
	}
}
public class AdvancedGunBehavior : MonoBehaviour
{
	private bool pickedUpLast = false;

	private PlayerController lastPlayer = null;

	public bool everPickedUpByPlayer = false;

	public Gun gun;

	private bool hasReloaded = true;

	public bool preventNormalFireAudio;

	public bool preventNormalReloadAudio;

	public string overrrideNormalFireAudio;

	public string overrideNormalReloadAudio;

	private static FieldInfo heroSwordCooldown = typeof(Gun).GetField("HeroSwordCooldown", BindingFlags.Instance | BindingFlags.NonPublic);

	public bool PickedUp => (Object)(object)gun.CurrentOwner != (Object)null;

	public PlayerController Player
	{
		get
		{
			if (gun.CurrentOwner is PlayerController)
			{
				GameActor currentOwner = gun.CurrentOwner;
				return (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
			}
			return null;
		}
	}

	public float HeroSwordCooldown
	{
		get
		{
			if ((Object)(object)gun != (Object)null)
			{
				return (float)heroSwordCooldown.GetValue(gun);
			}
			return -1f;
		}
		set
		{
			if ((Object)(object)gun != (Object)null)
			{
				heroSwordCooldown.SetValue(gun, value);
			}
		}
	}

	public GameActor Owner => gun.CurrentOwner;

	public bool OwnerIsPlayer => (Object)(object)Player != (Object)null;

	public virtual void Update()
	{
		if ((Object)(object)Player != (Object)null)
		{
			lastPlayer = Player;
			if (!everPickedUpByPlayer)
			{
				everPickedUpByPlayer = true;
			}
		}
		if ((Object)(object)Player != (Object)null && !pickedUpLast)
		{
			OnPickup(Player);
			pickedUpLast = true;
		}
		if ((Object)(object)Player == (Object)null && pickedUpLast)
		{
			if ((Object)(object)lastPlayer != (Object)null)
			{
				OnPostDrop(lastPlayer);
				lastPlayer = null;
			}
			pickedUpLast = false;
		}
		if ((Object)(object)gun != (Object)null && !gun.IsReloading && !hasReloaded)
		{
			hasReloaded = true;
		}
		gun.PreventNormalFireAudio = preventNormalFireAudio;
		gun.OverrideNormalFireAudioEvent = overrrideNormalFireAudio;
	}

	public virtual void Start()
	{
		gun = ((Component)this).GetComponent<Gun>();
		Gun val = gun;
		val.OnInitializedWithOwner = (Action<GameActor>)Delegate.Combine(val.OnInitializedWithOwner, new Action<GameActor>(OnInitializedWithOwner));
		Gun val2 = gun;
		val2.PostProcessProjectile = (Action<Projectile>)Delegate.Combine(val2.PostProcessProjectile, new Action<Projectile>(PostProcessProjectile));
		Gun val3 = gun;
		val3.PostProcessVolley = (Action<ProjectileVolleyData>)Delegate.Combine(val3.PostProcessVolley, new Action<ProjectileVolleyData>(PostProcessVolley));
		Gun val4 = gun;
		val4.OnDropped = (Action)Delegate.Combine(val4.OnDropped, new Action(OnDropped));
		Gun val5 = gun;
		val5.OnAutoReload = (Action<PlayerController, Gun>)Delegate.Combine(val5.OnAutoReload, new Action<PlayerController, Gun>(OnAutoReload));
		Gun val6 = gun;
		val6.OnReloadPressed = (Action<PlayerController, Gun, bool>)Delegate.Combine(val6.OnReloadPressed, new Action<PlayerController, Gun, bool>(OnReloadPressed));
		Gun val7 = gun;
		val7.OnFinishAttack = (Action<PlayerController, Gun>)Delegate.Combine(val7.OnFinishAttack, new Action<PlayerController, Gun>(OnFinishAttack));
		Gun val8 = gun;
		val8.OnPostFired = (Action<PlayerController, Gun>)Delegate.Combine(val8.OnPostFired, new Action<PlayerController, Gun>(OnPostFired));
		Gun val9 = gun;
		val9.OnAmmoChanged = (Action<PlayerController, Gun>)Delegate.Combine(val9.OnAmmoChanged, new Action<PlayerController, Gun>(OnAmmoChanged));
		Gun val10 = gun;
		val10.OnBurstContinued = (Action<PlayerController, Gun>)Delegate.Combine(val10.OnBurstContinued, new Action<PlayerController, Gun>(OnBurstContinued));
		Gun val11 = gun;
		val11.OnPreFireProjectileModifier = (Func<Gun, Projectile, ProjectileModule, Projectile>)Delegate.Combine(val11.OnPreFireProjectileModifier, new Func<Gun, Projectile, ProjectileModule, Projectile>(OnPreFireProjectileModifier));
		Gun val12 = gun;
	}

	public virtual void OnInitializedWithOwner(GameActor actor)
	{
	}

	public virtual void PostProcessProjectile(Projectile projectile)
	{
	}

	public virtual void PostProcessVolley(ProjectileVolleyData volley)
	{
	}

	public virtual void OnDropped()
	{
	}

	public virtual void OnAutoReload(PlayerController player, Gun gun)
	{
	}

	public virtual void OnReloadPressed(PlayerController player, Gun gun, bool bSOMETHING)
	{
		if (hasReloaded)
		{
			OnReload(player, gun);
			hasReloaded = false;
		}
	}

	public virtual void OnReload(PlayerController player, Gun gun)
	{
		if (preventNormalReloadAudio)
		{
			AkSoundEngine.PostEvent("Stop_WPN_All", ((Component)this).gameObject);
			if (!string.IsNullOrEmpty(overrideNormalReloadAudio))
			{
				AkSoundEngine.PostEvent(overrideNormalReloadAudio, ((Component)this).gameObject);
			}
		}
	}

	public virtual void OnFinishAttack(PlayerController player, Gun gun)
	{
	}

	public virtual void OnPostFired(PlayerController player, Gun gun)
	{
		if (gun.IsHeroSword && (float)heroSwordCooldown.GetValue(gun) == 0.5f)
		{
			OnHeroSwordCooldownStarted(player, gun);
		}
	}

	public virtual void OnHeroSwordCooldownStarted(PlayerController player, Gun gun)
	{
	}

	public virtual void OnAmmoChanged(PlayerController player, Gun gun)
	{
	}

	public virtual void OnBurstContinued(PlayerController player, Gun gun)
	{
	}

	public virtual Projectile OnPreFireProjectileModifier(Gun gun, Projectile projectile, ProjectileModule mod)
	{
		return projectile;
	}

	public virtual void OnPickup(PlayerController player)
	{
	}

	public virtual void OnPostDrop(PlayerController player)
	{
	}
}
internal class IronHeart : PlayerItem
{
	public static void Init()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		string text = "Iron Heart";
		string text2 = "Items/Resources/ItemSprites/Actives/iron_heart.png";
		GameObject val = new GameObject();
		IronHeart ironHeart = val.AddComponent<IronHeart>();
		ItemBuilder.AddSpriteToObject(text, text2, val, (Assembly)null);
		string text3 = "Proof You Have a Heart";
		string text4 = "Removes all but one heart container and gives double the amount in armor, plus 2 extra.\n\nThis heart-shaped pin converts all iron, carbon, and other 'necessary' trace metals that scientists claim are 'vital for human survival' and 'required for bodily functions' into an ultimate shield!";
		ItemBuilder.SetupItem((PickupObject)(object)ironHeart, text3, text4, "ck");
		ItemBuilder.SetCooldownType((PlayerItem)(object)ironHeart, (CooldownType)0, 1.5f);
		((PlayerItem)ironHeart).consumable = true;
		((PickupObject)ironHeart).quality = (ItemQuality)3;
		((BraveBehaviour)ironHeart).sprite.IsPerpendicular = true;
	}

	public override void DoEffect(PlayerController user)
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: 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_0085: Expected O, but got Unknown
		float maxHealth = ((BraveBehaviour)user).healthHaver.GetMaxHealth();
		float num = maxHealth - 1f;
		AkSoundEngine.PostEvent("Play_OBJ_dead_again_01", ((Component)this).gameObject);
		HealthHaver healthHaver = ((BraveBehaviour)user).healthHaver;
		healthHaver.Armor += maxHealth * 2f;
		if (user.HasPickupID(314))
		{
			HealthHaver healthHaver2 = ((BraveBehaviour)user).healthHaver;
			healthHaver2.Armor += 3f;
		}
		StatModifier item = new StatModifier
		{
			statToBoost = (StatType)3,
			amount = 0f - num,
			modifyType = (ModifyMethod)0
		};
		user.ownerlessStatModifiers.Add(item);
		user.stats.RecalculateStats(user, false, false);
	}

	public override void Pickup(PlayerController player)
	{
		if (!base.m_pickedUp)
		{
			((PlayerItem)this).Pickup(player);
		}
	}

	public DebrisObject Drop(PlayerController player)
	{
		DebrisObject val = ((PlayerItem)this).Drop(player, 4f);
		((PlayerItem)((Component)val).GetComponent<IronHeart>()).m_pickedUpThisRun = true;
		return val;
	}
}
namespace BasicGun
{
	public class BasicGun : GunBehaviour
	{
		public static void Add()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			Gun val = Databases.Items.NewGun("Basic Gun", "jpxfrd");
			Game.Items.Rename("outdated_gun_mods:basic_gun", "kp:basic_gun");
			((Component)val).gameObject.AddComponent<BasicGun>();
			GunExt.SetShortDescription((PickupObject)(object)val, "Impressionable");
			GunExt.SetLongDescription((PickupObject)(object)val, "A gun left unfinished and abandoned by its creator. It still has great potential.");
			GunExt.SetupSprite(val, (tk2dSpriteCollectionData)null, "jpxfrd_idle_001", 8);
			GunExt.SetAnimationFPS(val, val.shootAnimation, 24);
			GunExt.AddProjectileModuleFrom(val, "ak-47", false, true);
			val.DefaultModule.ammoCost = 1;
			val.DefaultModule.shootStyle = (ShootStyle)0;
			val.DefaultModule.sequenceStyle = (ProjectileSequenceStyle)0;
			val.reloadTime = 1.1f;
			val.DefaultModule.cooldownTime = 0.1f;
			val.DefaultModule.numberOfShotsInClip = 6;
			val.SetBaseMaxAmmo(250);
			((PickupObject)val).quality = (ItemQuality)1;
			((BraveBehaviour)val).encounterTrackable.EncounterGuid = "change this for different guns, so the game doesn't think they're the same gun";
			Databases.Items.Add(((Component)val).GetComponent<PickupObject>(), false, "ANY");
		}

		public override void PostProcessProjectile(Projectile projectile)
		{
			GameActor currentOwner = base.gun.CurrentOwner;
			PlayerController val = (PlayerController)(object)((currentOwner is PlayerController) ? currentOwner : null);
			if ((Object)(object)val == (Object)null)
			{
				base.gun.ammo = base.gun.GetBaseMaxAmmo();
			}
			ProjectileData baseData = projectile.baseData;
			baseData.damage *= 1.1f;
			ProjectileData baseData2 = projectile.baseData;
			baseData2.speed *= 1f;
			base.gun.DefaultModule.ammoCost = 1;
			((GunBehaviour)this).PostProcessProjectile(projectile);
		}

		public override void OnPostFired(PlayerController player, Gun gun)
		{
			gun.PreventNormalFireAudio = true;
			AkSoundEngine.PostEvent("Play_WPN_smileyrevolver_shot_01", ((Component)this).gameObject);
		}
	}
}
namespace CustomItems
{
	public class BabyGoodBlob : CompanionItem
	{
		public class RandomGoopTrailBehaviour : CompanionController
		{
			private int goopIndex;

			private float lastSwitch = 0f;

			private const float switchTime = 10f;

			private GoopDefinition currentGoop;

			private Color tint = Color.white;

			private void Start()
			{
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				AssetBundle val = ResourceManager.LoadAssetBundle("shared_auto_001");
				BabyGoodBlob.goopDefs = new List<GoopDefinition>();
				string[] goops = BabyGoodBlob.goops;
				foreach (string text in goops)
				{
					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", "");
					BabyGoodBlob.goopDefs.Add(val3);
				}
				List<GoopDefinition> goopDefs = BabyGoodBlob.goopDefs;
				PickupObject byId = PickupObjectDatabase.GetById(310);
				goopDefs.Add((byId == null) ? null : ((Component)byId).GetComponent<WingsItem>()?.RollGoop);
				SetGoopIndex(0);
				((BraveBehaviour)this).sprite.color = tints[0];
				((BraveBehaviour)this).spriteAnimator.Play("idle");
			}

			private void FixedUpdate()
			{
				//IL_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: 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)
				if (Time.time - lastSwitch > 10f)
				{
					SetGoopIndex(Random.Range(1, goopDefs.Count));
					lastSwitch = Time.time;
					AIActor aiActor = ((BraveBehaviour)this).aiActor;
					PlayerController owner = base.m_owner;
					object overrideTarget;
					if (owner == null)
					{
						overrideTarget = null;
					}
					else
					{
						RoomHandler currentRoom = owner.CurrentRoom;
						if (currentRoom == null)
						{
							overrideTarget = null;
						}
						else
						{
							AIActor randomActiveEnemy = currentRoom.GetRandomActiveEnemy(false);
							overrideTarget = ((randomActiveEnemy != null) ? ((BraveBehaviour)randomActiveEnemy).specRigidbody : null);
						}
					}
					aiActor.OverrideTarget = (SpeculativeRigidbody)overrideTarget;
				}
				if (!base.m_owner.IsInCombat)
				{
					SetGoopIndex(0);
				}
				((BraveBehaviour)this).sprite.color = Color.Lerp(((BraveBehaviour)this).sprite.color, tint, 0.1f);
				float num = 0.5f;
				if (PassiveItem.IsFlagSetForCharacter(base.m_owner, typeof(BattleStandardItem)))
				{
					num *= 2f;
				}
				DeadlyDeadlyGoopManager goopManagerForGoopType = DeadlyDeadlyGoopManager.GetGoopManagerForGoopType(currentGoop);
				goopManagerForGoopType.AddGoopCircle(((BraveBehaviour)this).sprite.WorldCenter, num, -1, false, -1);
			}

			private void SetGoopIndex(int index)
			{
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				goopIndex = index;
				currentGoop = goopDefs[index];
				tint = tints[index];
			}
		}

		public static GameObject blobPrefab;

		private static readonly string guid = "baby_good_blob";

		private static string[] spritePaths = new string[6] { "CustomItems/Resources/P2/blob/blob_001", "CustomItems/Resources/P2/blob/blob_002", "CustomItems/Resources/P2/blob/blob_003", "CustomItems/Resources/P2/blob/blob_004", "CustomItems/Resources/P2/blob/blob_005", "CustomItems/Resources/P2/blob/blob_006" };

		private static tk2dSpriteCollectionData blobCollection;

		private static string[] goops = new string[3] { "assets/data/goops/blobulongoop.asset", "assets/data/goops/napalmgoopthatworks.asset", "assets/data/goops/poison goop.asset" };

		private static Color[] tints = (Color[])(object)new Color[4]
		{
			new Color(0.9f, 0.34f, 0.45f),
			new Color(1f, 0.5f, 0.35f),
			new Color(0.7f, 0.9f, 0.7f),
			new Color(0.9f, 0.4f, 0.8f)
		};

		private static List<GoopDefinition> goopDefs;

		public static void Init()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			string text = "Baby Good Blob";
			string text2 = "CustomItems/Resources/P2/baby_blob";
			GameObject val = new GameObject();
			BabyGoodBlob babyGoodBlob = val.AddComponent<BabyGoodBlob>();
			ItemBuilder.AddSpriteToObject(text, text2, val, (Assembly)null);
			string text3 = "Scourge of the Empire";
			string text4 = "This young blobulin was injected with a serum that gave him ultimate power.\n\nAfraid that he would grow too powerful to control, the chief blobulonians made an attempt on his life.\n\nWrong move.";
			ItemBuilder.SetupItem((PickupObject)(object)babyGoodBlob, text3, text4, "kts");
			((PickupObject)babyGoodBlob).quality = (ItemQuality)4;
			((CompanionItem)babyGoodBlob).CompanionGuid = guid;
			((CompanionItem)babyGoodBlob).Synergies = (CompanionTransformSynergy[])(object)new CompanionTransformSynergy[0];
			BuildPrefab();
		}

		public static void BuildPrefab()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: 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_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Expected O, but got Unknown
			if ((Object)(object)blobPrefab != (Object)null || CompanionBuilder.companionDictionary.ContainsKey(guid))
			{
				ETGModConsole.Log((object)"Tried to make the same Blob prefab twice!", false);
				return;
			}
			blobPrefab = CompanionBuilder.BuildPrefab("Baby Good Blob", guid, spritePaths[0], new IntVector2(1, 0), new IntVector2(9, 9));
			RandomGoopTrailBehaviour randomGoopTrailBehaviour = blobPrefab.AddComponent<RandomGoopTrailBehaviour>();
			AIAnimator component = blobPrefab.GetComponent<AIAnimator>();
			DirectionalAnimation val = new DirectionalAnimation();
			val.AnimNames = new string[1] { "idle" };
			val.Type = (DirectionType)0;
			component.MoveAnimation = val;
			component.IdleAnimation = component.MoveAnimation;
			if ((Object)(object)blobCollection == (Object)null)
			{
				blobCollection = SpriteBuilder.ConstructCollection(blobPrefab, "Baby_Good_Blob_Collection", false);
				Object.DontDestroyOnLoad((Object)(object)blobCollection);
				for (int i = 0; i < spritePaths.Length; i++)
				{
					SpriteBuilder.AddSpriteToCollection(spritePaths[i], blobCollection, (Assembly)null);
				}
				SpriteBuilder.AddAnimation(((BraveBehaviour)randomGoopTrailBehaviour).spriteAnimator, blobCollection, new List<int> { 0, 1, 2, 3, 4, 5 }, "idle", (WrapMode)0, 15f).fps = 5f;
			}
			BehaviorSpeculator component2 = blobPrefab.GetComponent<BehaviorSpeculator>();
			List<MovementBehaviorBase> movementBehaviors = component2.MovementBehaviors;
			CompanionFollowPlayerBehavior val2 = new CompanionFollowPlayerBehavior();
			val2.IdleAnimations = new string[1] { "idle" };
			movementBehaviors.Add((MovementBehaviorBase)(object)val2);
			component2.MovementBehaviors.Add((MovementBehaviorBase)new SeekTargetBehavior
			{
				LineOfSight = false,
				StopWhenInRange = true,
				CustomRange = 1f
			});
			((BraveBehaviour)randomGoopTrailBehaviour).aiActor.MovementSpeed = 7f;
			Object.DontDestroyOnLoad((Object)(object)blobPrefab);
			FakePrefab.MarkAsFakePrefab(blobPrefab);
			blobPrefab.SetActive(false);
		}
	}
}
namespace SaveAPI
{
	[fsObject]
	public class AdvancedGameStats
	{
		[fsProperty]
		private Dictionary<CustomTrackedStats, float> stats;

		[fsProperty]
		private Dictionary<CustomTrackedMaximums, float> maxima;

		[fsProperty]
		public HashSet<CustomCharacterSpecificGungeonFlags> m_flags;

		public AdvancedGameStats()
		{
			m_flags = new HashSet<CustomCharacterSpecificGungeonFlags>();
			stats = new Dictionary<CustomTrackedStats, float>(new CustomTrackedStatsComparer());
			maxima = new Dictionary<CustomTrackedMaximums, float>(new CustomTrackedMaximumsComparer());
		}

		public float GetStatValue(CustomTrackedStats statToCheck)
		{
			if (!stats.ContainsKey(statToCheck))
			{
				return 0f;
			}
			return stats[statToCheck];
		}

		public float GetMaximumValue(CustomTrackedMaximums maxToCheck)
		{
			if (!maxima.ContainsKey(maxToCheck))
			{
				return 0f;
			}
			return maxima[maxToCheck];
		}

		public bool GetFlag(CustomCharacterSpecificGungeonFlags flag)
		{
			if (flag == CustomCharacterSpecificGungeonFlags.NONE)
			{
				Debug.LogError((object)"Something is attempting to get a NONE character-specific save flag!");
				return false;
			}
			return m_flags.Contains(flag);
		}

		public void SetStat(CustomTrackedStats stat, float val)
		{
			if (stats.ContainsKey(stat))
			{
				stats[stat] = val;
			}
			else
			{
				stats.Add(stat, val);
			}
		}

		public void SetMax(CustomTrackedMaximums max, float val)
		{
			if (maxima.ContainsKey(max))
			{
				maxima[max] = Mathf.Max(maxima[max], val);
			}
			else
			{
				maxima.Add(max, val);
			}
		}

		public void SetFlag(CustomCharacterSpecificGungeonFlags flag, bool value)
		{
			if (flag == CustomCharacterSpecificGungeonFlags.NONE)
			{
				Debug.LogError((object)"Something is attempting to set a NONE character-specific save flag!");
			}
			else if (value)
			{
				m_flags.Add(flag);
			}
			else
			{
				m_flags.Remove(flag);
			}
		}

		public void IncrementStat(CustomTrackedStats stat, float val)
		{
			if (stats.ContainsKey(stat))
			{
				stats[stat] += val;
			}
			else
			{
				stats.Add(stat, val);
			}
		}

		public void AddStats(AdvancedGameStats otherStats)
		{
			foreach (KeyValuePair<CustomTrackedStats, float> stat in otherStats.stats)
			{
				IncrementStat(stat.Key, stat.Value);
			}
			foreach (KeyValuePair<CustomTrackedMaximums, float> item in otherStats.maxima)
			{
				SetMax(item.Key, item.Value);
			}
			foreach (CustomCharacterSpecificGungeonFlags flag in otherStats.m_flags)
			{
				m_flags.Add(flag);
			}
		}

		public void ClearAllState()
		{
			List<CustomTrackedStats> list = new List<CustomTrackedStats>();
			foreach (KeyValuePair<CustomTrackedStats, float> stat in stats)
			{
				list.Add(stat.Key);
			}
			foreach (CustomTrackedStats item in list)
			{
				stats[item] = 0f;
			}
			List<CustomTrackedMaximums> list2 = new List<CustomTrackedMaximums>();
			foreach (KeyValuePair<CustomTrackedMaximums, float> item2 in maxima)
			{
				list2.Add(item2.Key);
			}
			foreach (CustomTrackedMaximums item3 in list2)
			{
				maxima[item3] = 0f;
			}
		}
	}
	[fsObject]
	internal class AdvancedGameStatsManager
	{
		private static AdvancedGameStatsManager m_instance;

		[fsProperty]
		public HashSet<CustomDungeonFlags> m_flags;

		[fsProperty]
		public string midGameSaveGuid;

		[fsProperty]
		public Dictionary<PlayableCharacters, AdvancedGameStats> m_characterStats;

		private AdvancedGameStats m_sessionStats;

		private AdvancedGameStats m_savedSessionStats;

		private PlayableCharacters m_sessionCharacter;

		private int m_numCharacters;

		[fsIgnore]
		public int cachedHuntIndex;

		[fsIgnore]
		public SaveSlot cachedSaveSlot;

		[fsIgnore]
		public bool IsInSession => m_sessionStats != null;

		public static bool HasInstance => m_instance != null;

		public static AdvancedGameStatsManager Instance => m_instance;

		public AdvancedGameStatsManager()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			m_flags = new HashSet<CustomDungeonFlags>(new CustomDungeonFlagsComparer());
			m_characterStats = new Dictionary<PlayableCharacters, AdvancedGameStats>((IEqualityComparer<PlayableCharacters>?)new PlayableCharactersComparer());
			m_numCharacters = -1;
			cachedHuntIndex = -1;
		}

		public static void Unload()
		{
			m_instance = null;
		}

		public void SetCharacterSpecificFlag(PlayableCharacters character, CustomCharacterSpecificGungeonFlags flag, bool value)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (flag == CustomCharacterSpecificGungeonFlags.NONE)
			{
				Debug.LogError((object)"Something is attempting to set a NONE character-specific save flag!");
				return;
			}
			if (!m_characterStats.ContainsKey(character))
			{
				m_characterStats.Add(character, new AdvancedGameStats());
			}
			if (m_sessionStats != null && m_sessionCharacter == character)
			{
				m_sessionStats.SetFlag(flag, value);
			}
			else
			{
				m_characterStats[character].SetFlag(flag, value);
			}
		}

		public void SetStat(CustomTrackedStats stat, float value)
		{
			if (!float.IsNaN(value) && !float.IsInfinity(value) && m_sessionStats != null)
			{
				m_sessionStats.SetStat(stat, value);
			}
		}

		public void UpdateMaximum(CustomTrackedMaximums maximum, float val)
		{
			if (!float.IsNaN(val) && !float.IsInfinity(val) && m_sessionStats != null)
			{
				m_sessionStats.SetMax(maximum, val);
			}
		}

		public bool GetCharacterSpecificFlag(CustomCharacterSpecificGungeonFlags flag)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GetCharacterSpecificFlag(m_sessionCharacter, flag);
		}

		public bool GetCharacterSpecificFlag(PlayableCharacters character, CustomCharacterSpecificGungeonFlags flag)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (flag == CustomCharacterSpecificGungeonFlags.NONE)
			{
				Debug.LogError((object)"Something is attempting to get a NONE character-specific save flag!");
				return false;
			}
			if (m_sessionStats != null && m_sessionCharacter == character)
			{
				if (m_sessionStats.GetFlag(flag))
				{
					return true;
				}
				if (m_savedSessionStats.GetFlag(flag))
				{
					return true;
				}
			}
			AdvancedGameStats value;
			return m_characterStats.TryGetValue(character, out value) && value.GetFlag(flag);
		}

		public static void DoMidgameSave()
		{
			string text = Guid.NewGuid().ToString();
			AdvancedMidGameSaveData advancedMidGameSaveData = new AdvancedMidGameSaveData(text);
			SaveManager.Save<AdvancedMidGameSaveData>(advancedMidGameSaveData, SaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null);
			Instance.midGameSaveGuid = text;
			Save();
		}

		public void RegisterStatChange(CustomTrackedStats stat, float value)
		{
			if (m_sessionStats == null)
			{
				Debug.LogError((object)"No session stats active and we're registering a stat change!");
			}
			else if (!float.IsNaN(value) && !float.IsInfinity(value) && !(Mathf.Abs(value) > 10000f))
			{
				m_sessionStats.IncrementStat(stat, value);
			}
		}

		public static void InvalidateMidgameSave(bool saveStats)
		{
			AdvancedMidGameSaveData midgameSave = null;
			if (VerifyAndLoadMidgameSave(out midgameSave, checkValidity: false))
			{
				midgameSave.Invalidate();
				SaveManager.Save<AdvancedMidGameSaveData>(midgameSave, SaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null);
				GameStatsManager.Instance.midGameSaveGuid = midgameSave.midGameSaveGuid;
				if (saveStats)
				{
					GameStatsManager.Save();
				}
			}
		}

		public static void RevalidateMidgameSave(bool saveStats)
		{
			AdvancedMidGameSaveData midgameSave = null;
			if (VerifyAndLoadMidgameSave(out midgameSave, checkValidity: false))
			{
				midgameSave.Revalidate();
				SaveManager.Save<AdvancedMidGameSaveData>(midgameSave, SaveAPIManager.AdvancedMidGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null);
				GameStatsManager.Instance.midGameSaveGuid = midgameSave.midGameSaveGuid;
				if (saveStats)
				{
					GameStatsManager.Save();
				}
			}
		}

		public static bool VerifyAndLoadMidgameSave(out AdvancedMidGameSaveData midgameSave, bool checkValidity = true)
		{
			if (!SaveManager.Load<AdvancedMidGameSaveData>(SaveAPIManager.AdvancedGameSave, ref midgameSave, true, 0u, (Func<string, uint, string>)null, (SaveSlot?)null))
			{
				Debug.LogError((object)"No mid game save found");
				return false;
			}
			if (midgameSave == null)
			{
				Debug.LogError((object)"Failed to load mid game save (0)");
				return false;
			}
			if (checkValidity && !midgameSave.IsValid())
			{
				return false;
			}
			if (GameStatsManager.Instance.midGameSaveGuid == null || GameStatsManager.Instance.midGameSaveGuid != midgameSave.midGameSaveGuid)
			{
				Debug.LogError((object)"Failed to load mid game save (1)");
				return false;
			}
			return true;
		}

		public void ClearAllStatsGlobal()
		{
			m_sessionStats.ClearAllState();
			m_savedSessionStats.ClearAllState();
			if (m_numCharacters <= 0)
			{
				m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length;
			}
			for (int i = 0; i < m_numCharacters; i++)
			{
				if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value))
				{
					value.ClearAllState();
				}
			}
		}

		public void ClearStatValueGlobal(CustomTrackedStats stat)
		{
			m_sessionStats.SetStat(stat, 0f);
			m_savedSessionStats.SetStat(stat, 0f);
			if (m_numCharacters <= 0)
			{
				m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length;
			}
			for (int i = 0; i < m_numCharacters; i++)
			{
				if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value))
				{
					value.SetStat(stat, 0f);
				}
			}
		}

		private PlayableCharacters GetCurrentCharacter()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			return GameManager.Instance.PrimaryPlayer.characterIdentity;
		}

		public float GetPlayerMaximum(CustomTrackedMaximums maximum)
		{
			if (m_numCharacters <= 0)
			{
				m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length;
			}
			float num = 0f;
			if (m_sessionStats != null)
			{
				num = Mathf.Max(new float[3]
				{
					num,
					m_sessionStats.GetMaximumValue(maximum),
					m_savedSessionStats.GetMaximumValue(maximum)
				});
			}
			for (int i = 0; i < m_numCharacters; i++)
			{
				if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value))
				{
					num = Mathf.Max(num, value.GetMaximumValue(maximum));
				}
			}
			return num;
		}

		public float GetPlayerStatValue(CustomTrackedStats stat)
		{
			if (m_numCharacters <= 0)
			{
				m_numCharacters = Enum.GetValues(typeof(PlayableCharacters)).Length;
			}
			float num = 0f;
			if (m_sessionStats != null)
			{
				num += m_sessionStats.GetStatValue(stat);
			}
			for (int i = 0; i < m_numCharacters; i++)
			{
				if (m_characterStats.TryGetValue((PlayableCharacters)i, out var value))
				{
					num += value.GetStatValue(stat);
				}
			}
			return num;
		}

		public void SetCharacterSpecificFlag(CustomCharacterSpecificGungeonFlags flag, bool value)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			SetCharacterSpecificFlag(m_sessionCharacter, flag, value);
		}

		public float GetSessionStatValue(CustomTrackedStats stat)
		{
			return m_sessionStats.GetStatValue(stat) + m_savedSessionStats.GetStatValue(stat);
		}

		public float GetCharacterStatValue(CustomTrackedStats stat)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			return GetCharacterStatValue(GetCurrentCharacter(), stat);
		}

		public AdvancedGameStats MoveSessionStatsToSavedSessionStats()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (!IsInSession)
			{
				return null;
			}
			if (m_sessionStats != null)
			{
				if (m_characterStats.ContainsKey(m_sessionCharacter))
				{
					m_characterStats[m_sessionCharacter].AddStats(m_sessionStats);
				}
				m_savedSessionStats.AddStats(m_sessionStats);
				m_sessionStats.ClearAllState();
			}
			return m_savedSessionStats;
		}

		public float GetCharacterStatValue(PlayableCharacters character, CustomTrackedStats stat)
		{
			//IL_0008: 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_002b: 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)
			float num = 0f;
			if (m_sessionCharacter == character)
			{
				num += m_sessionStats.GetStatValue(stat);
			}
			if (m_characterStats.ContainsKey(character))
			{
				num += m_characterStats[character].GetStatValue(stat);
			}
			return num;
		}

		public void BeginNewSession(PlayerController player)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (m_characterStats == null)
			{
				m_characterStats = new Dictionary<PlayableCharacters, AdvancedGameStats>((IEqualityComparer<PlayableCharacters>?)new PlayableCharactersComparer());
			}
			if (IsInSession)
			{
				m_sessionCharacter = player.characterIdentity;
				if (!m_characterStats.ContainsKey(player.characterIdentity))
				{
					m_characterStats.Add(player.characterIdentity, new AdvancedGameStats());
				}
				return;
			}
			m_sessionCharacter = player.characterIdentity;
			m_sessionStats = new AdvancedGameStats();
			m_savedSessionStats = new AdvancedGameStats();
			if (!m_characterStats.ContainsKey(player.characterIdentity))
			{
				m_characterStats.Add(player.characterIdentity, new AdvancedGameStats());
			}
		}

		public void EndSession(bool recordSessionStats)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			if (IsInSession && m_sessionStats != null)
			{
				if (recordSessionStats && m_characterStats.ContainsKey(m_sessionCharacter))
				{
					m_characterStats[m_sessionCharacter].AddStats(m_sessionStats);
				}
				m_sessionStats = null;
				m_savedSessionStats = null;
			}
		}

		public static void Load()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			SaveManager.Init();
			bool flag = false;
			SaveSlot? val = null;
			int num = -1;
			if (m_instance != null)
			{
				flag = true;
				val = m_instance.cachedSaveSlot;
				num = m_instance.cachedHuntIndex;
			}
			if (!SaveManager.Load<AdvancedGameStatsManager>(SaveAPIManager.AdvancedGameSave, ref m_instance, true, 0u, (Func<string, uint, string>)null, (SaveSlot?)null))
			{
				m_instance = new AdvancedGameStatsManager();
			}
			m_instance.cachedSaveSlot = SaveManager.CurrentSaveSlot;
			if (flag && val.HasValue && m_instance.cachedSaveSlot == val.Value)
			{
				m_instance.cachedHuntIndex = num;
			}
			else
			{
				m_instance.cachedHuntIndex = -1;
			}
		}

		public static void DANGEROUS_ResetAllStats()
		{
			m_instance = new AdvancedGameStatsManager();
			SaveManager.DeleteAllBackups(SaveAPIManager.AdvancedGameSave, (SaveSlot?)null);
		}

		public bool GetFlag(CustomDungeonFlags flag)
		{
			if (flag == CustomDungeonFlags.NONE)
			{
				Debug.LogError((object)"Something is attempting to get a NONE save flag!");
				return false;
			}
			return m_flags.Contains(flag);
		}

		public void SetFlag(CustomDungeonFlags flag, bool value)
		{
			if (flag == CustomDungeonFlags.NONE)
			{
				Debug.LogError((object)"Something is attempting to set a NONE save flag!");
			}
			else if (value)
			{
				m_flags.Add(flag);
			}
			else
			{
				m_flags.Remove(flag);
			}
		}

		public static bool Save()
		{
			bool result = false;
			try
			{
				result = SaveManager.Save<AdvancedGameStatsManager>(m_instance, SaveAPIManager.AdvancedGameSave, GameStatsManager.Instance.PlaytimeMin, 0u, (SaveSlot?)null);
			}
			catch (Exception ex)
			{
				Debug.LogErrorFormat("SAVE FAILED: {0}", new object[1] { ex });
			}
			return result;
		}

		public void AssignMidGameSavedSessionStats(AdvancedGameStats source)
		{
			if (IsInSession && m_savedSessionStats != null)
			{
				m_savedSessionStats.AddStats(source);
			}
		}
	}
	public class AdvancedMidGameSaveData
	{
		[fsProperty]
		public AdvancedGameStats PriorSessionStats;

		[fsProperty]
		public string midGameSaveGuid;

		[fsProperty]
		public bool invalidated;

		public AdvancedMidGameSaveData(string midGameSaveGuid)
		{
			this.midGameSaveGuid = midGameSaveGuid;
			PriorSessionStats = AdvancedGameStatsManager.Instance.MoveSessionStatsToSavedSessionStats();
		}

		public bool IsValid()
		{
			return !invalidated;
		}

		public void Invalidate()
		{
			invalidated = true;
		}

		public void Revalidate()
		{
			invalidated = false;
		}

		public void LoadDataFromMidGameSave()
		{
			AdvancedGameStatsManager.Instance.AssignMidGameSavedSessionStats(PriorSessionStats);
		}
	}
	public static class BreachShopTool
	{
		public class DoubleMetaShopTier
		{
			private MetaShopTier m_topTier;

			private MetaShopTier m_bottomTier;

			public DoubleMetaShopTier(MetaShopTier topTier, MetaShopTier bottomTier)
			{
				m_topTier = topTier;
				m_bottomTier = bottomTier;
			}

			public DoubleMetaShopTier(DoubleMetaShopTier other)
			{
				m_topTier = other.m_topTier;
				m_bottomTier = other.m_bottomTier;
			}

			public MetaShopTier GetTopTier()
			{
				return m_topTier;
			}

			public MetaShopTier GetBottomTier()
			{
				return m_topTier;
			}

			public List<MetaShopTier> GetTierList()
			{
				return new List<MetaShopTier> { m_topTier, m_bottomTier };
			}
		}

		public static MetaShopController BaseMetaShopController;

		public static GenericLootTable TrorcMetaShopItems;

		public static GenericLootTable GooptonMetaShopItems;

		public static GenericLootTable DougMetaShopItems;

		private static FieldInfo ItemControllersInfo = typeof(ShopController).GetField("m_itemControllers", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo BaseItemControllersInfo = typeof(BaseShopController).GetField("m_itemControllers", BindingFlags.Instance | BindingFlags.NonPublic);

		private static Hook pickupObjectEncounterableHook;

		private static Hook baseShopSetupHook;

		private static Hook metaShopSetupHook;

		private static Hook metaShopCurrentTierHook;

		private static Hook metaShopProximateTierHook;

		public static Dictionary<WeightedGameObjectCollection, List<WeightedGameObject>> baseShopAddedItems;

		public static List<MetaShopTier> metaShopAddedTiers;

		private static bool m_loaded;

		public static void DoSetup()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			if (!m_loaded)
			{
				BaseMetaShopController = SaveTools.LoadAssetFromAnywhere<GameObject>("Foyer_MetaShop").GetComponent<MetaShopController>();
				TrorcMetaShopItems = SaveTools.LoadAssetFromAnywhere<GenericLootTable>("Shop_Truck_Meta");
				GooptonMetaShopItems = SaveTools.LoadAssetFromAnywhere<GenericLootTable>("Shop_Goop_Meta");
				DougMetaShopItems = SaveTools.LoadAssetFromAnywhere<GenericLootTable>("Shop_Beetle_Meta");
				pickupObjectEncounterableHook = new Hook((MethodBase)typeof(PickupObject).GetMethod("HandleEncounterable", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("HandleEncounterableHook"));
				baseShopSetupHook = new Hook((MethodBase)typeof(BaseShopController).GetMethod("DoSetup", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("BaseShopSetupHook"));
				metaShopSetupHook = new Hook((MethodBase)typeof(MetaShopController).GetMethod("DoSetup", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("MetaSetupHook"));
				metaShopCurrentTierHook = new Hook((MethodBase)typeof(MetaShopController).GetMethod("GetCurrentTier", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("MetaShopCurrentTierHook"));
				metaShopProximateTierHook = new Hook((MethodBase)typeof(MetaShopController).GetMethod("GetProximateTier", BindingFlags.Instance | BindingFlags.NonPublic), typeof(BreachShopTool).GetMethod("MetaShopProximateTierHook"));
				m_loaded = true;
			}
		}

		public static void Unload()
		{
			if (!m_loaded)
			{
				return;
			}
			if (baseShopAddedItems != null)
			{
				for (int i = 0; i < baseShopAddedItems.Keys.Count; i++)
				{
					WeightedGameObjectCollection val = baseShopAddedItems.Keys.ToList()[i];
					if (val == null || baseShopAddedItems[val] == null)
					{
						continue;
					}
					for (int j = 0; j < baseShopAddedItems[val].Count; j++)
					{
						WeightedGameObject val2 = baseShopAddedItems[val][j];
						if (val2 != null && val.elements.Contains(val2))
						{
							val.elements.Remove(val2);
						}
					}
				}
				baseShopAddedItems.Clear();
				baseShopAddedItems = null;
			}
			if (metaShopAddedTiers != null)
			{
				for (int k = 0; k < metaShopAddedTiers.Count; k++)
				{
					MetaShopTier val3 = metaShopAddedTiers[k];
					if (val3 != null && BaseMetaShopController.metaShopTiers.Contains(val3))
					{
						BaseMetaShopController.metaShopTiers.Remove(val3);
					}
				}
				metaShopAddedTiers.Clear();
				metaShopAddedTiers = null;
			}
			BaseMetaShopController = null;
			TrorcMetaShopItems = null;
			GooptonMetaShopItems = null;
			DougMetaShopItems = null;
			Hook obj = pickupObjectEncounterableHook;
			if (obj != null)
			{
				obj.Dispose();
			}
			Hook obj2 = baseShopSetupHook;
			if (obj2 != null)
			{
				obj2.Dispose();
			}
			Hook obj3 = metaShopSetupHook;
			if (obj3 != null)
			{
				obj3.Dispose();
			}
			Hook obj4 = metaShopCurrentTierHook;
			if (obj4 != null)
			{
				obj4.Dispose();
			}
			Hook obj5 = metaShopProximateTierHook;
			if (obj5 != null)
			{
				obj5.Dispose();
			}
			m_loaded = false;
		}

		public static void HandleEncounterableHook(Action<PickupObject, PlayerController> orig, PickupObject po, PlayerController player)
		{
			orig(po, player);
			if ((Object)(object)po != (Object)null && (Object)(object)((Component)po).GetComponent<SpecialPickupObject>() != (Object)null && ((Component)po).GetComponent<SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition != 0)
			{
				AdvancedGameStatsManager.Instance.SetFlag(((Component)po).GetComponent<SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition, value: true);
			}
		}

		public static void BaseShopSetupHook(Action<BaseShopController> orig, BaseShopController self)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			orig(self);
			if ((int)self.baseShopType != 6 || !((Object)(object)self.ExampleBlueprintPrefab != (Object)null))
			{
				return;
			}
			List<ShopItemController> list = (List<ShopItemController>)BaseItemControllersInfo.GetValue(self);
			if (list == null)
			{
				return;
			}
			foreach (ShopItemController item in list)
			{
				if (!((Object)(object)item != (Object)null) || !((Object)(object)item.item != (Object)null) || !((Object)(object)((BraveBehaviour)item.item).encounterTrackable != (Object)null) || ((BraveBehaviour)item.item).encounterTrackable.journalData == null)
				{
					continue;
				}
				PickupObject blueprintUnlockedItem = GetBlueprintUnlockedItem(((BraveBehaviour)item.item).encounterTrackable);
				if (!((Object)(object)blueprintUnlockedItem != (Object)null) || !((Object)(object)((BraveBehaviour)blueprintUnlockedItem).encounterTrackable != (Object)null) || ((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites == null)
				{
					continue;
				}
				CustomDungeonFlags customDungeonFlags = CustomDungeonFlags.NONE;
				for (int i = 0; i < ((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites.Length; i++)
				{
					if (((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType == CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG)
					{
						customDungeonFlags = (((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck;
					}
				}
				if (customDungeonFlags != 0)
				{
					((Component)item.item).gameObject.AddComponent<SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition = customDungeonFlags;
				}
			}
		}

		public static void MetaSetupHook(Action<MetaShopController> orig, MetaShopController meta)
		{
			orig(meta);
			List<ShopItemController> list = (List<ShopItemController>)ItemControllersInfo.GetValue(meta);
			if (list == null)
			{
				return;
			}
			foreach (ShopItemController item in list)
			{
				if (!((Object)(object)item != (Object)null) || !((Object)(object)item.item != (Object)null) || !((Object)(object)((BraveBehaviour)item.item).encounterTrackable != (Object)null) || ((BraveBehaviour)item.item).encounterTrackable.journalData == null)
				{
					continue;
				}
				PickupObject blueprintUnlockedItem = GetBlueprintUnlockedItem(((BraveBehaviour)item.item).encounterTrackable);
				if (!((Object)(object)blueprintUnlockedItem != (Object)null) || !((Object)(object)((BraveBehaviour)blueprintUnlockedItem).encounterTrackable != (Object)null) || ((BraveBehaviour)blueprintUnlockedItem).encounterTrackable.prerequisites == null)
				{
					continue;
				}
				CustomDungeonFlags customFlagFromTargetItem = GetCustomFlagFromTargetItem(blueprintUnlockedItem.PickupObjectId);
				if (customFlagFromTargetItem != 0)
				{
					((Component)item.item).gameObject.AddComponent<SpecialPickupObject>().CustomSaveFlagToSetOnAcquisition = customFlagFromTargetItem;
					if (AdvancedGameStatsManager.Instance.GetFlag(customFlagFromTargetItem))
					{
						item.ForceOutOfStock();
					}
				}
			}
		}

		private static bool GetMetaItemUnlockedAdvanced(int pickupObjectId)
		{
			CustomDungeonFlags customFlagFromTargetItem = GetCustomFlagFromTargetItem(pickupObjectId);
			if (customFlagFromTargetItem == CustomDungeonFlags.NONE)
			{
				return true;
			}
			return AdvancedGameStatsManager.Instance.GetFlag(customFlagFromTargetItem);
		}

		public static MetaShopTier MetaShopCurrentTierHook(Func<MetaShopController, MetaShopTier> orig, MetaShopController self)
		{
			MetaShopTier val = null;
			for (int i = 0; i < self.metaShopTiers.Count; i++)
			{
				if (!GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId1) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId2) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId3))
				{
					val = self.metaShopTiers[i];
					break;
				}
			}
			List<MetaShopTier> metaShopTiers = self.metaShopTiers;
			List<MetaShopTier> list = new List<MetaShopTier>();
			for (int j = 0; j < metaShopTiers.Count; j++)
			{
				if (metaShopTiers[j] != null && (!ItemConditionsFulfilled(metaShopTiers[j].itemId1) || !ItemConditionsFulfilled(metaShopTiers[j].itemId2) || !ItemConditionsFulfilled(metaShopTiers[j].itemId3) || j == metaShopTiers.Count - 1))
				{
					list.Add(metaShopTiers[j]);
				}
			}
			self.metaShopTiers = list;
			MetaShopTier val2 = orig(self);
			self.metaShopTiers = metaShopTiers;
			if (val == null)
			{
				return val2;
			}
			if (val2 == null)
			{
				return val;
			}
			return (self.metaShopTiers.IndexOf(val) < self.metaShopTiers.IndexOf(val2)) ? val : val2;
		}

		public static MetaShopTier MetaShopProximateTierHook(Func<MetaShopController, MetaShopTier> orig, MetaShopController self)
		{
			MetaShopTier val = null;
			for (int i = 0; i < self.metaShopTiers.Count - 1; i++)
			{
				if (!GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId1) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId2) || !GetMetaItemUnlockedAdvanced(self.metaShopTiers[i].itemId3))
				{
					val = self.metaShopTiers[i + 1];
					break;
				}
			}
			List<MetaShopTier> metaShopTiers = self.metaShopTiers;
			List<MetaShopTier> list = new List<MetaShopTier>();
			for (int j = 0; j < metaShopTiers.Count; j++)
			{
				if (metaShopTiers[j] != null && (!ItemConditionsFulfilled(metaShopTiers[j].itemId1) || !ItemConditionsFulfilled(metaShopTiers[j].itemId2) || !ItemConditionsFulfilled(metaShopTiers[j].itemId3)))
				{
					list.Add(metaShopTiers[j]);
				}
			}
			self.metaShopTiers = list;
			MetaShopTier val2 = orig(self);
			self.metaShopTiers = metaShopTiers;
			if (val == null)
			{
				return val2;
			}
			if (val2 == null)
			{
				return val;
			}
			return (self.metaShopTiers.IndexOf(val) < self.metaShopTiers.IndexOf(val2)) ? val : val2;
		}

		public static CustomDungeonFlags GetCustomFlagFromTargetItem(int shopItemId)
		{
			CustomDungeonFlags result = CustomDungeonFlags.NONE;
			PickupObject byId = PickupObjectDatabase.GetById(shopItemId);
			for (int i = 0; i < ((BraveBehaviour)byId).encounterTrackable.prerequisites.Length; i++)
			{
				if (((BraveBehaviour)byId).encounterTrackable.prerequisites[i] is CustomDungeonPrerequisite && (((BraveBehaviour)byId).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).advancedPrerequisiteType == CustomDungeonPrerequisite.AdvancedPrerequisiteType.CUSTOM_FLAG)
				{
					result = (((BraveBehaviour)byId).encounterTrackable.prerequisites[i] as CustomDungeonPrerequisite).customFlagToCheck;
				}
			}
			return result;
		}

		public static GungeonFlags GetFlagFromTargetItem(int shopItemId)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			GungeonFlags result = (GungeonFlags)0;
			PickupObject byId = PickupObjectDatabase.GetById(shopItemId);
			for (int i = 0; i < ((BraveBehaviour)byId).encounterTrackable.prerequisites.Length; i++)
			{
				if ((int)((BraveBehaviour)byId).encounterTrackable.prerequisites[i].prerequisiteType == 4)
				{
					result = ((BraveBehaviour)byId).encounterTrackable.prerequisites[i].saveFlagToCheck;
				}
			}
			return result;
		}

		public static bool ItemConditionsFulfilled(int shopItemId)
		{
			return (Object)(object)PickupObjectDatabase.GetById(shopItemId) != (Object)null && PickupObjectDatabase.GetById(shopItemId).PrerequisitesMet();
		}

		public static PickupObject GetBlueprintUnlockedItem(EncounterTrackable blueprintTrackable)
		{
			for (int i = 0; i < ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects.Count; i++)
			{
				PickupObject val = ((ObjectDatabase<PickupObject>)(object)PickupObjectDatabase.Instance).Objects[i];
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				EncounterTrackable encounterTrackable = ((BraveBehaviour)val).encounterTrackable;
				if (!Object.op_Implicit((Object)(object)encounterTrackable))
				{
					continue;
				}
				string primaryDisplayName = encounterTrackable.journalData.PrimaryDisplayName;
				if (!primaryDisplayName.Equals(blueprintTrackable.journalData.PrimaryDisplayName, StringComparison.OrdinalIgnoreCase))
				{
					continue;
				}
				string notificationPanelDescription = encounterTrackable.journalData.NotificationPanelDescription;
				if (!notificationPanelDescription.Equals(blueprintTrackable.journalData.NotificationPanelDescription, StringComparison.OrdinalIgnoreCase))
				{
					continue;
				}
				string ammonomiconFullEntry = encounterTrackable.journalData.AmmonomiconFullEntry;
				if (ammonomiconFullEntry.Equals(blueprintTrackable.journalData.AmmonomiconFullEntry, StringComparison.OrdinalIgnoreCase))
				{
					string ammonomiconSprite = encounterTrackable.journalData.AmmonomiconSprite;
					if (ammonomiconSprite.Equals(blueprintTrackable.journalData.AmmonomiconSprite, StringComparison.OrdinalIgnoreCase))
					{
						return val;
					}
				}
			}
			return null;
		}

		public static WeightedGameObject AddItemToTrorcMetaShop(this PickupObject po, int cost, int? index = null)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)TrorcMetaShopItems == (Object)null)
			{
				DoSetup();
			}
			WeightedGameObject val = new WeightedGameObject();
			val.rawGameObject = null;
			val.pickupId = po.PickupObjectId;
			val.weight = cost;
			val.forceDuplicatesPossible = false;
			val.additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0];
			WeightedGameObject val2 = val;
			if (!index.HasValue)
			{
				TrorcMetaShopItems.defaultItemDrops.elements.Add(val2);
			}
			else if (index.Value < 0)
			{
				TrorcMetaShopItems.defaultItemDrops.elements.Add(val2);
			}
			else
			{
				TrorcMetaShopItems.defaultItemDrops.elements.InsertOrAdd(index.Value, val2);
			}
			RegisterBaseShopControllerAddedItem(val2, TrorcMetaShopItems.defaultItemDrops);
			return val2;
		}

		public static WeightedGameObject AddItemToGooptonMetaShop(this PickupObject po, int cost, int? index = null)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)GooptonMetaShopItems == (Object)null)
			{
				DoSetup();
			}
			WeightedGameObject val = new WeightedGameObject();
			val.rawGameObject = null;
			val.pickupId = po.PickupObjectId;
			val.weight = cost;
			val.forceDuplicatesPossible = false;
			val.additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0];
			WeightedGameObject val2 = val;
			if (!index.HasValue)
			{
				GooptonMetaShopItems.defaultItemDrops.elements.Add(val2);
			}
			else if (index.Value < 0)
			{
				TrorcMetaShopItems.defaultItemDrops.elements.Add(val2);
			}
			else
			{
				GooptonMetaShopItems.defaultItemDrops.elements.InsertOrAdd(index.Value, val2);
			}
			RegisterBaseShopControllerAddedItem(val2, GooptonMetaShopItems.defaultItemDrops);
			return val2;
		}

		public static WeightedGameObject AddItemToDougMetaShop(this PickupObject po, int cost, int? index = null)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			if ((Object)(object)DougMetaShopItems == (Object)null)
			{
				DoSetup();
			}
			WeightedGameObject val = new WeightedGameObject();
			val.rawGameObject = null;
			val.pickupId = po.PickupObjectId;
			val.weight = cost;
			val.forceDuplicatesPossible = false;
			val.additionalPrerequisites = (DungeonPrerequisite[])(object)new DungeonPrerequisite[0];
			WeightedGameObject val2 = val;
			if (!index.HasValue)
			{
				DougMetaShopItems.defaultItemDrops.elements.Add(val2);
			}
			else if (index.Value < 0)
			{
				DougMetaShopItems.defaultItemDrops.elements.Add(val2);
			}
			else
			{
				DougMetaShopItems.defaultItemDrops.elements.InsertOrAdd(index.Value, val2);
			}
			RegisterBaseShopControllerAddedItem(val2, DougMetaShopItems.defaultItemDrops);
			return val2;
		}

		private static void RegisterBaseShopControllerAddedItem(WeightedGameObject obj, WeightedGameObjectCollection collection)
		{
			if (baseShopAddedItems == null)
			{
				baseShopAddedItems = new Dictionary<WeightedGameObjectCollection, List<WeightedGameObject>>();
			}
			if (!baseShopAddedItems.ContainsKey(collection))
			{
				baseShopAddedItems.Add(collection, new List<WeightedGameObject>());
			}
			if (baseShopAddedItems[collection] == null)
			{
				baseShopAddedItems[collection] = new List<WeightedGameObject>();
			}
			baseShopAddedItems[collection].Add(obj);
		}

		public static List<MetaShopTier> AddBaseMetaShopDoubleTier(int topLeftItemId, int topLeftItemPrice, int topMiddleItemId, int topMiddleItemPrice, int topRightItemId, int topRightItemPrice, int bottomLeftItemId, int bottomLeftItemPrice, int bottomMiddleItemId, int bottomMiddleItemPrice, int bottomRightItemId, int bottomRightItemPrice, int? index = null)
		{
			//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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			//IL_007a: Expected O, but got Unknown
			return AddBaseMetaShopDoubleTier(new DoubleMetaShopTier(new MetaShopTier
			{
				itemId1 = topLeftItemId,
				overrideItem1Cost = topLeftItemPrice,
				itemId2 = topMiddleItemId,
				overrideItem2Cost = topMiddleItemPrice,
				itemId3 = topRightItemId,
				overrideItem3Cost = topRightItemPrice,
				overrideTierCost = topLeftItemId
			}, new MetaShopTier
			{
				itemId1 = bottomLeftItemId,
				overrideItem1Cost = bottomLeftItemPrice,
				itemId2 = bottomMiddleItemId,
				overrideItem2Cost = bottomMiddleItemPrice,
				itemId3 = bottomRightItemId,
				overrideItem3Cost = bottomRightItemPrice,
				overrideTierCost = topLeftItemId
			}), index);
		}

		public static List<MetaShopTier> AddBaseMetaShopDoubleTier(int topLeftItemId, int topLeftItemPrice, int topMiddleItemId, int topMiddleItemPrice, int topRightItemId, int topRightItemPrice, int bottomLeftItemId, int bottomLeftItemPrice, int bottomMiddleItemId, int bottomMiddleItemPrice, int? index = null)
		{
			//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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_0078: Expected O, but got Unknown
			//IL_0078: Expected O, but got Unknown
			return AddBaseMetaShopDoubleTier(new DoubleMetaShopTier(new MetaShopTier
			{
				itemId1 = topLeftItemId,
				overrideItem1Cost = topLeftItemPrice,
				itemId2 = topMiddleItemId,
				overrideItem2Cost = topMiddleItemPrice,
				itemId3 = topRightItemId,
				overrideItem3Cost = topRightItemPrice,
				overrideTierCost = topLeftItemId
			}, new MetaShopTier
			{
				itemId1 = bottomLeftItemId,
				overrideItem1Cost = bottomLeftItemPrice,
				itemId2 = bottomMiddleItemId,
				overrideItem2Cost = bottomMiddleItemPrice,
				itemId3 = -1,
				overrideItem3Cost = -1,
				overrideTierCost = topLeftItemId
			}), index);
		}

		public static List<MetaShopTier> AddBaseMetaShopDoubleTier(int topLeftItemId, int topLeftItemPrice, int topMiddleItemId, int topMiddleItemPrice, int topRightItemId, int topRightItemPrice, int bottomLeftItemId, int bottomLeftItemPrice, int? index = null)
		{
			//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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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_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_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_0076: Expected O, but got Unknown
			return AddBaseMetaShopDoubleTier(new DoubleMetaShopTier(new MetaShopTier
			{
				itemId1 = topLeftItemId,
				overrideItem1Cost = topLeftItemPrice,
				itemId2 = topMiddleItemId,
				overrideItem2Cost = topMiddleItemPrice,
				itemId3 = topRightItemId,
				overrideItem3Cost = topRightItemPrice,
				overrideTierCost = topLeftItemId
			}, new MetaShopTier
			{
				itemId1 = bottomLeftItemId,
				overrideItem1Cost = bottomLeftItemPrice,
				itemId2 = -1,
				overrideItem2Cost = -1,
				itemId3 = -1,
				overrideItem3Cost = -1,
				overrideTierCost = topLeftItemId
			}), index);
		}

		public static MetaShopTier AddBaseMetaShopTier(int leftItemId, int leftItemPrice, int middleItemId, int middleItemPrice, int rightItemId, int rightItemPrice, int? index = null)
		{
			//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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			return AddBaseMetaShopTier(new MetaShopTier
			{
				itemId1 = leftItemId,
				overrideItem1Cost = leftItemPrice,
				itemId2 = middleItemId,
				overrideItem2Cost = middleItemPrice,
				itemId3 = rightItemId,
				overrideItem3Cost = rightItemPrice,
				overrideTierCost = leftItemPrice
			}, index);
		}

		public static MetaShopTier AddBaseMetaShopTier(int leftItemId, int leftItemPrice, int middleItemId, int middleItemPrice, int? index = null)
		{
			//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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			return AddBaseMetaShopTier(new MetaShopTier
			{
				itemId1 = leftItemId,
				overrideItem1Cost = leftItemPrice,
				itemId2 = middleItemId,
				overrideItem2Cost = middleItemPrice,
				itemId3 = -1,
				overrideItem3Cost = -1,
				overrideTierCost = leftItemPrice
			}, index);
		}

		public static MetaShopTier AddBaseMetaShopTier(int leftItemId, int leftItemPrice, int? index = null)
		{
			//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_0014: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			return AddBaseMetaShopTier(new MetaShopTier
			{
				itemId1 = leftItemId,
				overrideItem1Cost = leftItemPrice,
				itemId2 = -1,
				overrideItem2Cost = -1,
				itemId3 = -1,
				overrideItem3Cost = -1,
				ov