Decompiled source of LCSplatBombGrenadeMod v1.5.2

LCSplatBombGrenadeMod.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using STSharedAudioLib;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("LCCrashBandicootCratesMod")]
[assembly: AssemblyCompany("LCSplatBombGrenadeMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Replace the visuals and sounds of the Grenades with Bombs from Splatoon!")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyInformationalVersion("1.5.2")]
[assembly: AssemblyProduct("LCSplatBombGrenadeMod")]
[assembly: AssemblyTitle("LCSplatBombGrenadeMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.5.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LCSplatBombGrenadeMod
{
	public class Configs
	{
		public static ConfigEntry<bool> SplatBombConfig;

		public static ConfigEntry<bool> FizzyBombConfig;

		public static ConfigEntry<bool> BurstBombConfig;

		public static ConfigEntry<bool> ScreenSplatters;

		public static ConfigEntry<bool> CratesConfig;

		public static ConfigEntry<bool> LoadingScreenConfig;

		public Configs(ConfigFile cfg)
		{
			SplatBombConfig = cfg.Bind<bool>("Customization", "Splat Bombs", true, "Set whether Splat Bombs replace Stun Grenades.");
			FizzyBombConfig = cfg.Bind<bool>("Customization", "Fizzy Bombs", true, "Set whether Fizzy Bombs replace Homemade Flashbangs.");
			BurstBombConfig = cfg.Bind<bool>("Customization", "Burst Bombs", true, "Set whether Burst Bombs replace Easter Eggs.");
			ScreenSplatters = cfg.Bind<bool>("Customization", "Screen Splatters", true, "Set whether Splat Bombs and Fizzy Bombs replace the grenade's flashbang filter with ink splatters.");
			CratesConfig = cfg.Bind<bool>("Secret", "LCCrashBandicootCratesMod", true, "Enable compatibility to add special crates.");
			LoadingScreenConfig = cfg.Bind<bool>("Secret", "LCSimonTendoPlaylistsMod", true, "Enable compatibility to add loading screen music.");
		}

		public static void DisplayConfigs()
		{
			if (!SplatBombConfig.Value && !BurstBombConfig.Value && !FizzyBombConfig.Value)
			{
				Plugin.Logger.LogInfo((object)"Configs [Splat Bombs], [Fizzy Bombs], and [Burst Bombs] are all set to FALSE. :(");
				return;
			}
			if (SplatBombConfig.Value)
			{
				Plugin.Logger.LogInfo((object)"Config [Splat Bombs] is set to TRUE.  Splat Bombs will replace Stun Grenades.");
			}
			else
			{
				Plugin.Logger.LogInfo((object)"Config [Splat Bombs] is set to FALSE. Stun Grenades will not be replaced.");
			}
			if (FizzyBombConfig.Value)
			{
				Plugin.Logger.LogInfo((object)"Config [Fizzy Bombs] is set to TRUE.  Fizzy Bombs will replace Homemade Flashbangs.");
			}
			else
			{
				Plugin.Logger.LogInfo((object)"Config [Fizzy Bombs] is set to FALSE. Homemade Flashbangs will not be replaced.");
			}
			if (BurstBombConfig.Value)
			{
				Plugin.Logger.LogInfo((object)"Config [Burst Bombs] is set to TRUE.  Burst Bombs will replace Easter Eggs.");
			}
			else
			{
				Plugin.Logger.LogInfo((object)"Config [Burst Bombs] is set to FALSE. Easter Eggs will not be replaced.");
			}
			if (ScreenSplatters.Value)
			{
				Plugin.Logger.LogInfo((object)"Config [Screen Splatters] is set to TRUE. Burst Bombs and Fizzy Bombs will replace the flashbang filter.");
			}
			else
			{
				Plugin.Logger.LogInfo((object)"Config [Screen Splatters] is set to FALSE. The grenade's normal flashbang filter will be used.");
			}
			if (CratesConfig.Value)
			{
				Plugin.Logger.LogDebug((object)"Config [LCCrashBandicootCratesMod] is set to TRUE. Enabling compatibility with crates...");
			}
			if (LoadingScreenConfig.Value)
			{
				Plugin.Logger.LogDebug((object)"Config [LCSimonTendoPlaylistsMod] is set to TRUE. Enabling compatibility with loading screens...");
			}
		}
	}
	public class HarmonyPatches
	{
		[HarmonyPatch(typeof(StartOfRound))]
		public class NewStartOfRound
		{
			[HarmonyPostfix]
			[HarmonyPatch("Awake")]
			public static void AwakePostfix(StartOfRound __instance)
			{
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				GameObject spawnPrefabSplat = null;
				GameObject spawnPrefabBurst = null;
				GameObject spawnPrefabFizzy = null;
				if (Configs.ScreenSplatters.Value)
				{
					GameObject val = new GameObject("LCSplatBombGrenadeMod");
					val.transform.SetParent(Plugin.SearchForObject("SimonTendoManagers", ((Component)StartOfRound.Instance).gameObject.transform.parent).transform);
					val.AddComponent<SplatBehaviour>();
				}
				for (int i = 0; i < __instance.allItemsList.itemsList.Count; i++)
				{
					Item val2 = __instance.allItemsList.itemsList[i];
					if ((Object)(object)val2 == (Object)null)
					{
						continue;
					}
					if (((Object)val2).name == "StunGrenade" && Configs.SplatBombConfig.Value)
					{
						Plugin.Logger.LogDebug((object)"Found stun grenade, setting item properties and terminal text to Splat Bomb...");
						val2.itemName = "Splat Bomb";
						val2.toolTips[0] = "Use Splat Bomb : [LMB]";
						((Vector3)(ref val2.positionOffset)).Set(-0.2f, 0.17f, 0.03f);
						((Vector3)(ref val2.rotationOffset)).Set(180f, -25f, 0f);
						val2.verticalOffset = 0.03f;
						val2.spawnPrefab.GetComponent<MeshFilter>().mesh = ((Component)Plugin.SplatBomb.transform.GetChild(0)).GetComponent<MeshFilter>().mesh;
						((Component)val2.spawnPrefab.transform.GetChild(0)).GetComponent<MeshFilter>().mesh = null;
						StunGrenadeItem component = val2.spawnPrefab.GetComponent<StunGrenadeItem>();
						component.pullPinSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatPullPinSFX.ogg");
						component.explodeSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatExplodeSFX.ogg");
						((GrabbableObject)component).itemProperties.itemIcon = Plugin.SplatBombModAssets.LoadAsset<Sprite>("Assets/ItemIcon.png");
						((GrabbableObject)component).itemProperties.grabSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatGrabSFX.ogg");
						((GrabbableObject)component).itemProperties.pocketSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatPocketSFX.ogg");
						((GrabbableObject)component).itemProperties.dropSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatDropSFX.ogg");
						component.stunGrenadeExplosion = Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/SplatInk/GroundSplatters/SplatBombInkSplattersGround.prefab");
						Plugin.SetSplatBombKeyword();
						if (Configs.CratesConfig.Value)
						{
							spawnPrefabSplat = val2.spawnPrefab;
						}
					}
					else if (((Object)val2).name == "DiyFlashbang" && Configs.FizzyBombConfig.Value)
					{
						Plugin.Logger.LogDebug((object)"Found DIYflashbang, setting item properties to Fizzy Bomb...");
						val2.itemName = "Fizzy Bomb";
						val2.toolTips[0] = "Use Fizzy Bomb : [LMB]";
						((Vector3)(ref val2.positionOffset)).Set(0.07f, 0.1f, -0.09f);
						((Vector3)(ref val2.restingRotation)).Set(0f, 0f, 270f);
						val2.verticalOffset = 0.08f;
						((Component)val2.spawnPrefab.transform.GetChild(0)).GetComponent<MeshFilter>().mesh = null;
						val2.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "Fizzy Bomb";
						val2.spawnPrefab.GetComponent<MeshFilter>().mesh = Plugin.FizzyBomb.GetComponent<MeshFilter>().mesh;
						StunGrenadeItem component2 = val2.spawnPrefab.GetComponent<StunGrenadeItem>();
						component2.pullPinSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/FizzyPullPinSFX.ogg");
						component2.explodeSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/FizzyExplodeSFX.ogg");
						((GrabbableObject)component2).itemProperties.itemIcon = Plugin.SplatBombModAssets.LoadAsset<Sprite>("Assets/FizzyBombAssets/FizzyBombIcon.png");
						((GrabbableObject)component2).itemProperties.grabSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/FizzyGrabSFX.ogg");
						((GrabbableObject)component2).itemProperties.pocketSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/FizzyPocketSFX.ogg");
						((GrabbableObject)component2).itemProperties.dropSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/FizzyDropSFX.ogg");
						component2.stunGrenadeExplosion = Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/SplatInk/GroundSplatters/SplatBombInkSplattersGround.prefab");
						if (Configs.CratesConfig.Value)
						{
							spawnPrefabFizzy = val2.spawnPrefab;
						}
					}
					else if (((Object)val2).name == "EasterEgg" && Configs.BurstBombConfig.Value)
					{
						Plugin.Logger.LogDebug((object)"Found easter egg, setting item properties to Burst Bomb...");
						val2.itemName = "Burst Bomb";
						((Vector3)(ref val2.positionOffset)).Set(-0.03f, 0.08f, -0.09f);
						((Vector3)(ref val2.restingRotation)).Set(180f, 180f, 180f);
						val2.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().headerText = "Burst Bomb";
						val2.spawnPrefab.GetComponent<MeshFilter>().mesh = Plugin.BurstBomb.GetComponent<MeshFilter>().mesh;
						StunGrenadeItem component3 = val2.spawnPrefab.GetComponent<StunGrenadeItem>();
						component3.explodeSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/BurstExplodeSFX.ogg");
						((GrabbableObject)component3).itemProperties.itemIcon = Plugin.SplatBombModAssets.LoadAsset<Sprite>("Assets/BurstBombAssets/BurstBombIcon.png");
						((GrabbableObject)component3).itemProperties.grabSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/BurstGrabSFX.ogg");
						((GrabbableObject)component3).itemProperties.pocketSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/BurstPocketSFX.ogg");
						((GrabbableObject)component3).itemProperties.dropSFX = Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/BurstDropSFX.ogg");
						if (Configs.CratesConfig.Value)
						{
							spawnPrefabBurst = val2.spawnPrefab;
						}
					}
					if (ModCompatibility.CrashBandicootCratesCompatible)
					{
						CheckCrateToSetContent(val2, spawnPrefabSplat, spawnPrefabBurst, spawnPrefabFizzy);
					}
				}
			}

			private static void CheckCrateToSetContent(Item item, GameObject spawnPrefabSplat, GameObject spawnPrefabBurst, GameObject spawnPrefabFizzy)
			{
				if (item.itemName == "Splat Bomb Crate" && (Object)(object)spawnPrefabSplat != (Object)null)
				{
					Plugin.Logger.LogDebug((object)$"Found {item}, setting spawnPrefab to {spawnPrefabSplat}...");
					CreateACrate.GetRuntimeParameters(item).spawnPrefab = spawnPrefabSplat;
					CreateACrate.RegisterProjectile(ModCompatibility.splatBombProjectile.GetComponent<Projectile>(), spawnPrefabSplat.GetComponent<GrabbableObject>());
				}
				else if (item.itemName == "Burst Bomb Crate" && (Object)(object)spawnPrefabBurst != (Object)null)
				{
					Plugin.Logger.LogDebug((object)$"Found {item}, setting spawnPrefab to {spawnPrefabBurst}...");
					CreateACrate.GetRuntimeParameters(item).spawnPrefab = spawnPrefabBurst;
					CreateACrate.RegisterProjectile(ModCompatibility.burstBombProjectile.GetComponent<Projectile>(), spawnPrefabBurst.GetComponent<GrabbableObject>());
				}
				else if (item.itemName == "Fizzy Bomb Crate" && (Object)(object)spawnPrefabFizzy != (Object)null)
				{
					Plugin.Logger.LogDebug((object)$"Found {item}, setting spawnPrefab to {spawnPrefabFizzy}...");
					CreateACrate.GetRuntimeParameters(item).spawnPrefab = spawnPrefabFizzy;
					CreateACrate.RegisterProjectile(ModCompatibility.fizzyBombProjectile.GetComponent<Projectile>(), spawnPrefabFizzy.GetComponent<GrabbableObject>());
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch("Start")]
			public static void StartPrefix(StartOfRound __instance)
			{
				if (ModCompatibility.PlaylistsModCompatible)
				{
					ModCompatibility.CreateSplatBombGrenadeModLoadingScreen();
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager))]
		public class NewRoundManager
		{
			[HarmonyPostfix]
			[HarmonyPatch("GenerateNewLevelClientRpc")]
			public static void GenerateNewLevelClientRpcPostfix()
			{
				if ((Object)(object)StartOfRound.Instance != (Object)null)
				{
					Plugin.Logger.LogDebug((object)$"NewRoundManagerGenerateLevel starting with randomMapSeed {StartOfRound.Instance.randomMapSeed}");
					colorRandomizer = new Random(StartOfRound.Instance.randomMapSeed);
				}
			}
		}

		[HarmonyPatch(typeof(StunGrenadeItem))]
		public class NewStunGrenade
		{
			[HarmonyPostfix]
			[HarmonyPatch("Start")]
			public static void StartPostfix(StunGrenadeItem __instance)
			{
				if ((Object)(object)__instance == (Object)null)
				{
					return;
				}
				if (((Object)__instance).name == "StunGrenade(Clone)" && Configs.SplatBombConfig.Value)
				{
					Object.Instantiate<GameObject>(Plugin.SplatBomb, ((Component)__instance).transform);
				}
				else if (((Object)__instance).name == "DiyFlashbang(Clone)" && Configs.FizzyBombConfig.Value)
				{
					Object.Instantiate<GameObject>(Plugin.FizzyBomb, ((Component)__instance).transform);
				}
				else if (((Object)__instance).name == "EasterEgg(Clone)" && Configs.BurstBombConfig.Value)
				{
					Object.Instantiate<GameObject>(Plugin.BurstBomb, ((Component)__instance).transform);
					int num = 4;
					if (colorRandomizer != null)
					{
						num = colorRandomizer.Next(0, 9);
					}
					Plugin.Logger.LogDebug((object)$"#{((NetworkBehaviour)__instance).NetworkObjectId} | randomNr = {num}");
					((Renderer)((Component)((Component)__instance).transform.GetChild(2)).GetComponent<MeshRenderer>()).material = Plugin.SplatBombModAssets.LoadAsset<Material>($"Assets/BurstBombAssets/BurstBombMaterials/BurstBombMaterial{num}.mat");
					__instance.stunGrenadeExplosion = Plugin.SplatBombModAssets.LoadAsset<GameObject>($"Assets/SplatInk/GroundSplatters/BurstBomb/BurstBombInkSplatters{num}.prefab");
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("SetControlTipForGrenade")]
			public static void SetControlTipForGrenadePostfix(StunGrenadeItem __instance)
			{
				if (((NetworkBehaviour)__instance).IsOwner)
				{
					if (((Object)((Component)__instance).gameObject).name == "StunGrenade(Clone)" && Configs.SplatBombConfig.Value)
					{
						string[] array = ((!__instance.pinPulled) ? new string[1] { "Activate Splat Bomb : [LMB] " } : new string[1] { "Throw Splat Bomb : [LMB]" });
						HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)__instance).itemProperties);
					}
					else if (((Object)((Component)__instance).gameObject).name == "EasterEgg(Clone)" && Configs.BurstBombConfig.Value)
					{
						string[] array2 = new string[1] { "Toss Burst Bomb : [LMB] " };
						HUDManager.Instance.ChangeControlTipMultiple(array2, true, ((GrabbableObject)__instance).itemProperties);
					}
					else if (((Object)((Component)__instance).gameObject).name == "DiyFlashbang(Clone)" && Configs.FizzyBombConfig.Value)
					{
						string[] array3 = new string[1] { "Use Fizzy Bomb : [LMB] " };
						HUDManager.Instance.ChangeControlTipMultiple(array3, true, ((GrabbableObject)__instance).itemProperties);
					}
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch("ExplodeStunGrenade")]
			public static void ExplodeStunGrenadePrefix(StunGrenadeItem __instance)
			{
				object obj;
				if (__instance == null)
				{
					obj = null;
				}
				else
				{
					GameObject gameObject = ((Component)__instance).gameObject;
					obj = ((gameObject != null) ? ((Object)gameObject).name : null);
				}
				if ((string?)obj == "StunGrenade(Clone)" && Configs.SplatBombConfig.Value)
				{
					((Renderer)((Component)((Component)__instance).transform.GetChild(2).GetChild(1)).GetComponent<MeshRenderer>()).material = Plugin.SplatBombEmptyMaterial;
				}
			}

			[HarmonyPostfix]
			[HarmonyPatch("StunExplosion")]
			public static void StunExplosionPostfix(Vector3 explosionPosition)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				if (Configs.ScreenSplatters.Value && (Object)(object)SplatBehaviour.Instance != (Object)null)
				{
					SplatBehaviour.Instance.PerformInkSplatterCheck(explosionPosition);
				}
			}
		}

		public static Random colorRandomizer;
	}
	internal class ModCompatibility
	{
		[HarmonyPatch(typeof(Projectile))]
		public class NewProjectile
		{
			[HarmonyPostfix]
			[HarmonyPatch("CreateProjectile")]
			public static void CreateProjectilePostfix(Projectile __instance)
			{
				if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.firedBy == (Object)null)
				{
					Plugin.Logger.LogDebug((object)"A1");
					return;
				}
				if (((Object)__instance).name != "BazookaProjectileSplatBomb(Clone)" && ((Object)__instance).name != "BazookaProjectileBurstBomb(Clone)" && ((Object)__instance).name != "BazookaProjectileFizzyBomb(Clone)")
				{
					Plugin.Logger.LogDebug((object)"B1");
					return;
				}
				MeshRenderer component = ((Component)__instance).GetComponent<MeshRenderer>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Logger.LogDebug((object)"C1");
					return;
				}
				int num = (((int)__instance.firedBy.playerClientId % 2 == 0) ? 4 : 0);
				((Renderer)component).material = Plugin.SplatBombModAssets.LoadAsset<Material>($"Assets/BurstBombAssets/BurstBombMaterials/BurstBombMaterial{num}.mat");
				Plugin.Logger.LogDebug((object)$"D1: {__instance.firedBy}");
			}

			[HarmonyPrefix]
			[HarmonyPatch("SpawnOnDestroy")]
			public static void SpawnOnDestroyPrefix(Projectile __instance)
			{
				if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.firedBy == (Object)null)
				{
					Plugin.Logger.LogDebug((object)"A2");
					return;
				}
				if (((Object)__instance).name != "BazookaProjectileSplatBomb(Clone)" && ((Object)__instance).name != "BazookaProjectileBurstBomb(Clone)" && ((Object)__instance).name != "BazookaProjectileFizzyBomb(Clone)")
				{
					Plugin.Logger.LogDebug((object)"B2");
					return;
				}
				DecalProjector componentInChildren = __instance.spawnOnDestroy.GetComponentInChildren<DecalProjector>();
				if ((Object)(object)componentInChildren == (Object)null)
				{
					Plugin.Logger.LogDebug((object)"C2");
					return;
				}
				int num = (((int)__instance.firedBy.playerClientId % 2 == 0) ? 4 : 0);
				componentInChildren.material = Plugin.SplatBombModAssets.LoadAsset<Material>($"Assets/SplatInk/GroundSplatters/BurstBomb/BurstBombInkSplattersMaterial{num}.mat");
				Plugin.Logger.LogDebug((object)$"D2: {__instance.firedBy}");
			}
		}

		[HarmonyPatch(typeof(StunGrenadeItem))]
		public class NewStunGrenadeItem
		{
			[HarmonyPrefix]
			[HarmonyPatch("ExplodeStunGrenade")]
			public static bool ExplodeStunGrenadePrefix(StunGrenadeItem __instance)
			{
				if ((Object)(object)__instance == (Object)null || ((Object)__instance).name != "EasterEgg(Clone)" || !__instance.hasCollided)
				{
					return true;
				}
				CrashBandicootCratesManagerScript instance = CrashBandicootCratesManagerScript.Instance;
				if ((Object)(object)instance == (Object)null || instance.allCurrentProjectiles == null || instance.allCurrentProjectiles.Count == 0)
				{
					return true;
				}
				for (int i = 0; i < instance.allCurrentProjectiles.Count; i++)
				{
					Projectile val = instance.allCurrentProjectiles[i];
					if ((Object)(object)val != (Object)null && (Object)(object)val.firedBy == (Object)(object)__instance.playerThrownBy)
					{
						Plugin.Logger.LogDebug((object)$"F: {__instance}");
						__instance.hasExploded = true;
						return false;
					}
				}
				return true;
			}
		}

		public static bool CrashBandicootCratesCompatible;

		private static bool addedCrates;

		public static bool PlaylistsModCompatible;

		private static bool addedLoadingScreen;

		public static GameObject splatBombProjectile;

		public static GameObject burstBombProjectile;

		public static GameObject fizzyBombProjectile;

		public static void CreateSplatBombGrenadeModCrates()
		{
			if (Configs.CratesConfig.Value && CrashBandicootCratesCompatible && !addedCrates)
			{
				if (Configs.SplatBombConfig.Value)
				{
					SplatBombCrate();
				}
				if (Configs.BurstBombConfig.Value)
				{
					BurstBombCrate();
				}
				if (Configs.FizzyBombConfig.Value)
				{
					FizzyBombCrate();
				}
				addedCrates = true;
			}
		}

		private static void SplatBombCrate()
		{
			//IL_004b: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			CrashBandicootCratesAllAssets allAssets = CrashBandicootCratesManagerScript.allAssets;
			Material val = Plugin.SplatBombModAssets.LoadAsset<Material>("Assets/ModCompatibility/CrashCrateRimMatSplat.mat");
			val.mainTexture = allAssets.allCrateMaterials[1].mainTexture;
			Vector4 val2 = default(Vector4);
			((Vector4)(ref val2))..ctor(0.9803f, 0.945f, 0.1725f, 1f);
			val.color = Color.op_Implicit(val2);
			Item val3 = CreateACrate.MakeItem("Splat Bomb Crate", true, true, false, true, 1.3f, false, false, true, false, 100, 50, false, 0f, false, Plugin.SplatBombModAssets.LoadAsset<Sprite>("Assets/ModCompatibility/IconSplatCrate.png"), "HoldLung", (AudioClip)null, (AudioClip)null, (AudioClip)null, false, new string[2] { "Thank you for playing:", "LCSplatBombGrenadeMod" }, 0.01f, 0, true, default(Vector3), default(Vector3), default(Vector3), (Mesh[])null, (Material[])null, false, false);
			CrateData val4 = CreateACrate.MakeCrateData((AudioClip)null, (AudioClip)null, (AudioClip[])null, true, true, false, true, 0.5f, 10f, 2f, (Material[])null, (int[])null, 2f, 10f, 1f, (AnimationCurve)null, -1f, -1f, -1f, false, false, false, false, false, false, false, false, false, false, (GameObject[])null, false, false, 0.2f, -1, 2, -1, -1, false, false, false, true, 0, true, 45f);
			Vector3 val5 = default(Vector3);
			ModdedCrateRuntimeParameters val6 = CreateACrate.MakeModdedCrateRuntimeParameters(val4, val3, (string)null, (Material[])(object)new Material[3]
			{
				val,
				allAssets.allCrateMaterials[0],
				Plugin.SplatBombModAssets.LoadAsset<Material>("Assets/ModCompatibility/CrashCrateMatSplat.mat")
			}, (Mesh)null, val5, (GameObject)null, Color.op_Implicit(val2), (GameObject)null, default(Color), true, (string)null, (string)null, 0.25f, 20f, 0, 4, true, 0, 1, 99, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (GameObject)null, 8, -1f, (GameObject)null);
			CreateACrate.RegisterCrateToAllLevelsWithRarity(val6, 8);
			Projectile val7 = CreateACrate.MakeProjectile(Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/ModCompatibility/BazookaProjectileSplatBomb.prefab"), 3, 8f, 2f, new Vector3(-1f, -1f, -1f), Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/ModCompatibility/BazookaImpactSplat.prefab"), 210f, new int[1] { -1 }, (AudioClip[])(object)new AudioClip[1] { Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatShootSFX.ogg") }, Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatExplodeSFX.ogg"), true, 25f, 1f, new Vector3(0.25f, 0.25f, 0.25f), new Vector3(0.15f, 0.15f, 0.15f), (string[])null, (string[])null);
			ExplosionSpawner val8 = val7.spawnOnDestroy.AddComponent<ExplosionSpawner>();
			val8.explosiveCrate = true;
			val8.explosionKillRange = 4f;
			val8.explosionDamageRange = 8f;
			val8.explosionNonLethalDamage = 20;
			val8.explosionPhysicsForce = 0f;
			val8.stunCrate = false;
			val8.stunAffectAudio = false;
			val8.stunSeverityMultiplier = 0.75f;
			val8.stunEnemyTime = 5f;
			val8.stunDistanceRolloff = 1f;
			splatBombProjectile = ((Component)val7).gameObject;
		}

		private static void BurstBombCrate()
		{
			//IL_004b: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			CrashBandicootCratesAllAssets allAssets = CrashBandicootCratesManagerScript.allAssets;
			Material val = Plugin.SplatBombModAssets.LoadAsset<Material>("Assets/ModCompatibility/CrashCrateRimMatBurst.mat");
			val.mainTexture = allAssets.allCrateMaterials[1].mainTexture;
			Vector4 val2 = default(Vector4);
			((Vector4)(ref val2))..ctor(0.1607f, 0.098f, 0.4823f, 1f);
			val.color = Color.op_Implicit(val2);
			Item val3 = CreateACrate.MakeItem("Burst Bomb Crate", true, true, false, true, 1.1f, false, false, true, false, 150, 50, false, 0f, false, Plugin.SplatBombModAssets.LoadAsset<Sprite>("Assets/ModCompatibility/IconBurstCrate.png"), "HoldLung", (AudioClip)null, (AudioClip)null, (AudioClip)null, false, new string[2] { "Thank you for playing:", "LCSplatBombGrenadeMod" }, 0.01f, 0, true, default(Vector3), default(Vector3), default(Vector3), (Mesh[])null, (Material[])null, false, false);
			CrateData val4 = CreateACrate.MakeCrateData((AudioClip)null, (AudioClip)null, (AudioClip[])null, true, true, false, true, 0.5f, 10f, 2f, (Material[])null, (int[])null, 2f, 10f, 1f, (AnimationCurve)null, -1f, -1f, -1f, false, false, false, false, false, false, false, false, false, false, (GameObject[])null, false, false, 0.1f, -1, 2, -1, -1, false, false, false, false, 0, true, 45f);
			Vector3 val5 = default(Vector3);
			ModdedCrateRuntimeParameters val6 = CreateACrate.MakeModdedCrateRuntimeParameters(val4, val3, (string)null, (Material[])(object)new Material[3]
			{
				val,
				allAssets.allCrateMaterials[0],
				Plugin.SplatBombModAssets.LoadAsset<Material>("Assets/ModCompatibility/CrashCrateMatBurst.mat")
			}, (Mesh)null, val5, (GameObject)null, Color.op_Implicit(val2), (GameObject)null, default(Color), true, (string)null, (string)null, 0.25f, 20f, 0, 4, true, 0, 1, 99, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (GameObject)null, 8, -1f, (GameObject)null);
			CreateACrate.RegisterCrateToAllLevelsWithRarity(val6, 24);
			Projectile val7 = CreateACrate.MakeProjectile(Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/ModCompatibility/BazookaProjectileBurstBomb.prefab"), 1, 16f, 1f, default(Vector3), Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/ModCompatibility/BazookaImpactBurst.prefab"), 210f, (int[])null, (AudioClip[])(object)new AudioClip[1] { Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatShootSFX.ogg") }, Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/BurstExplodeSFX.ogg"), true, 7.5f, 0.5f, new Vector3(0.3f, 0.3f, 0.3f), new Vector3(0.1f, 0.1f, 0.1f), (string[])null, (string[])null);
			burstBombProjectile = ((Component)val7).gameObject;
		}

		private static void FizzyBombCrate()
		{
			//IL_004b: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0253: Unknown result type (might be due to invalid IL or missing references)
			CrashBandicootCratesAllAssets allAssets = CrashBandicootCratesManagerScript.allAssets;
			Material val = Plugin.SplatBombModAssets.LoadAsset<Material>("Assets/ModCompatibility/CrashCrateRimMatFizzy.mat");
			val.mainTexture = allAssets.allCrateMaterials[1].mainTexture;
			Vector4 val2 = default(Vector4);
			((Vector4)(ref val2))..ctor(1f, 0.1882f, 0.4823f, 1f);
			val.color = Color.op_Implicit(val2);
			Item val3 = CreateACrate.MakeItem("Fizzy Bomb Crate", true, true, false, true, 1.2f, false, false, true, false, 200, 25, false, 0f, false, Plugin.SplatBombModAssets.LoadAsset<Sprite>("Assets/ModCompatibility/IconFizzyCrate.png"), "HoldLung", (AudioClip)null, (AudioClip)null, (AudioClip)null, false, new string[2] { "Thank you for playing:", "LCSplatBombGrenadeMod" }, 0.01f, 0, true, default(Vector3), default(Vector3), default(Vector3), (Mesh[])null, (Material[])null, false, false);
			CrateData val4 = CreateACrate.MakeCrateData((AudioClip)null, (AudioClip)null, (AudioClip[])null, true, true, false, true, 0.5f, 10f, 2f, (Material[])null, (int[])null, 2f, 10f, 1f, (AnimationCurve)null, -1f, -1f, -1f, false, false, false, false, false, false, false, false, false, false, (GameObject[])null, false, false, 0.15f, -1, 2, -1, -1, false, false, false, true, 0, true, 45f);
			Vector3 val5 = default(Vector3);
			ModdedCrateRuntimeParameters val6 = CreateACrate.MakeModdedCrateRuntimeParameters(val4, val3, (string)null, (Material[])(object)new Material[3]
			{
				val,
				allAssets.allCrateMaterials[0],
				Plugin.SplatBombModAssets.LoadAsset<Material>("Assets/ModCompatibility/CrashCrateMatFizzy.mat")
			}, (Mesh)null, val5, (GameObject)null, Color.op_Implicit(val2), (GameObject)null, default(Color), true, (string)null, (string)null, 0.25f, 20f, 0, 4, true, 0, 1, 99, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (GameObject)null, 8, -1f, (GameObject)null);
			CreateACrate.RegisterCrateToAllLevelsWithRarity(val6, 16);
			Projectile val7 = CreateACrate.MakeProjectile(Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/ModCompatibility/BazookaProjectileFizzyBomb.prefab"), 2, 24f, 0.25f, new Vector3(0f, 0f, 2f), Plugin.SplatBombModAssets.LoadAsset<GameObject>("Assets/ModCompatibility/BazookaImpactFizzy.prefab"), 210f, new int[1] { -1 }, (AudioClip[])(object)new AudioClip[1] { Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/SplatShootSFX.ogg") }, Plugin.SplatBombModAssets.LoadAsset<AudioClip>("Assets/SplatSounds/FizzyExplodeSFX.ogg"), true, 15f, 0.75f, new Vector3(0.2f, 0.2f, 0.4f), new Vector3(0.1f, 0.1f, 0.2f), (string[])null, (string[])null);
			ExplosionSpawner val8 = val7.spawnOnDestroy.AddComponent<ExplosionSpawner>();
			val8.explosiveCrate = false;
			val8.explosionKillRange = 2.5f;
			val8.explosionDamageRange = 5f;
			val8.explosionNonLethalDamage = 50;
			val8.explosionPhysicsForce = 5f;
			val8.stunCrate = true;
			val8.stunAffectAudio = true;
			val8.stunSeverityMultiplier = 1f;
			val8.stunEnemyTime = 10f;
			val8.stunDistanceRolloff = 1f;
			fizzyBombProjectile = ((Component)val7).gameObject;
		}

		public static void CreateSplatBombGrenadeModLoadingScreen()
		{
			if (Configs.LoadingScreenConfig.Value && PlaylistsModCompatible && !addedLoadingScreen)
			{
				SharedAudioComponent genericPlaylistsContainer = GetGenericPlaylistsContainer();
				if (!((Object)(object)genericPlaylistsContainer == (Object)null))
				{
					AudioList val = SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod - Loading Screen", genericPlaylistsContainer, false, true);
					string text = "Assets/ModCompatibility/SplatBombLoadingMusic";
					SharedAudioMethods.AudioClipAddNew(Plugin.SplatBombModAssets.LoadAsset<AudioClip>(text + "1.ogg"), val, true, 25, false);
					SharedAudioMethods.AudioClipAddNew(Plugin.SplatBombModAssets.LoadAsset<AudioClip>(text + "2.ogg"), val, true, 75, false);
					SharedAudioMethods.AudioClipAddNew(Plugin.SplatBombModAssets.LoadAsset<AudioClip>(text + "3.ogg"), val, true, 125, false);
					SharedAudioMethods.AudioClipAddNew(Plugin.SplatBombModAssets.LoadAsset<AudioClip>(text + "4.ogg"), val, true, 75, false);
					addedLoadingScreen = true;
				}
			}
		}

		private static SharedAudioComponent GetGenericPlaylistsContainer()
		{
			ManualLogSource logger = Plugin.Logger;
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				return null;
			}
			Transform val = ((Component)StartOfRound.Instance).transform.parent.Find("SimonTendoManagers");
			if ((Object)(object)val == (Object)null)
			{
				logger.LogWarning((object)"failed to find: SimonTendoManagers");
				return null;
			}
			Transform val2 = val.Find("LCSimonTendoPlaylistsMod");
			if ((Object)(object)val2 == (Object)null)
			{
				logger.LogWarning((object)"failed to find: LCSimonTendoPlaylistsMod");
				return null;
			}
			SharedAudioComponent component = ((Component)val2).GetComponent<SharedAudioComponent>();
			if ((Object)(object)component == (Object)null)
			{
				logger.LogError((object)"failed to find: SharedAudioComponent");
			}
			return component;
		}

		public static bool FlashFromProjectile(Vector3 stunPos)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			ExplosionSpawner[] array = Object.FindObjectsByType<ExplosionSpawner>((FindObjectsSortMode)0);
			if (array == null || array.Length == 0)
			{
				return false;
			}
			foreach (ExplosionSpawner val in array)
			{
				if (!((Object)(object)val == (Object)null) && val.stunCrate && ((Component)val).transform.position == stunPos)
				{
					Plugin.Logger.LogDebug((object)$"E: {val}");
					return true;
				}
			}
			return false;
		}
	}
	[BepInPlugin("LCSplatBombGrenadeMod", "LCSplatBombGrenadeMod", "1.5.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static AssetBundle SplatBombModAssets;

		public static GameObject SplatBomb;

		public static GameObject FizzyBomb;

		public static GameObject BurstBomb;

		public static Material SplatBombEmptyMaterial;

		public static GameObject InkScreenSplatters;

		public static Configs MyConfig { get; internal set; }

		private void Awake()
		{
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin LCSplatBombGrenadeMod is loaded!");
			SplatBombModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "splatbombmodassets"));
			if ((Object)(object)SplatBombModAssets == (Object)null)
			{
				Logger.LogError((object)"Failed to load SplatBomb AssetBundle");
				return;
			}
			Logger.LogInfo((object)"Loaded SplatBomb AssetBundle");
			ModCompatibility.CrashBandicootCratesCompatible = CheckForPlugin("LCCrashBandicootCratesMod");
			ModCompatibility.PlaylistsModCompatible = CheckForPlugin("LCSimonTendoPlaylistsMod");
			DoHarmonyPatches(new Harmony("LCSplatBombGrenadeMod"));
			MyConfig = new Configs(((BaseUnityPlugin)this).Config);
			Configs.DisplayConfigs();
			SplatBomb = SplatBombModAssets.LoadAsset<GameObject>("Assets/SplatBombPrefab.prefab");
			SplatBombEmptyMaterial = SplatBombModAssets.LoadAsset<Material>("Assets/SplatBombAssets/EmptyMaterial.mat");
			FizzyBomb = SplatBombModAssets.LoadAsset<GameObject>("Assets/FizzyBombAssets/FizzyBombPrefab.prefab");
			BurstBomb = SplatBombModAssets.LoadAsset<GameObject>("Assets/BurstBombAssets/BurstBombPrefab.prefab");
			InkScreenSplatters = SplatBombModAssets.LoadAsset<GameObject>("Assets/SplatInk/ScreenSplatters/SplatBombInkSplattersScreen.prefab");
			ModCompatibility.CreateSplatBombGrenadeModCrates();
		}

		private static void DoHarmonyPatches(Harmony harmony)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Expected O, but got Unknown
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Expected O, but got Unknown
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Expected O, but got Unknown
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Expected O, but got Unknown
			harmony.Patch((MethodBase)typeof(StartOfRound).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic), (HarmonyMethod)null, new HarmonyMethod(typeof(HarmonyPatches.NewStartOfRound).GetMethod("AwakePostfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(StartOfRound).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic), new HarmonyMethod(typeof(HarmonyPatches.NewStartOfRound).GetMethod("StartPrefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(RoundManager).GetMethod("GenerateNewLevelClientRpc", BindingFlags.Instance | BindingFlags.Public), (HarmonyMethod)null, new HarmonyMethod(typeof(HarmonyPatches.NewRoundManager).GetMethod("GenerateNewLevelClientRpcPostfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(StunGrenadeItem).GetMethod("Start", BindingFlags.Instance | BindingFlags.Public), (HarmonyMethod)null, new HarmonyMethod(typeof(HarmonyPatches.NewStunGrenade).GetMethod("StartPostfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(StunGrenadeItem).GetMethod("SetControlTipForGrenade", BindingFlags.Instance | BindingFlags.NonPublic), (HarmonyMethod)null, new HarmonyMethod(typeof(HarmonyPatches.NewStunGrenade).GetMethod("SetControlTipForGrenadePostfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(StunGrenadeItem).GetMethod("ExplodeStunGrenade", BindingFlags.Instance | BindingFlags.NonPublic), new HarmonyMethod(typeof(HarmonyPatches.NewStunGrenade).GetMethod("ExplodeStunGrenadePrefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(StunGrenadeItem).GetMethod("StunExplosion", BindingFlags.Static | BindingFlags.Public), (HarmonyMethod)null, new HarmonyMethod(typeof(HarmonyPatches.NewStunGrenade).GetMethod("StunExplosionPostfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			if (ModCompatibility.CrashBandicootCratesCompatible)
			{
				PatchCrashBandicootCrates(harmony);
			}
		}

		private static void PatchCrashBandicootCrates(Harmony harmony)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			harmony.Patch((MethodBase)typeof(Projectile).GetMethod("CreateProjectile"), (HarmonyMethod)null, new HarmonyMethod(typeof(ModCompatibility.NewProjectile).GetMethod("CreateProjectilePostfix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(Projectile).GetMethod("SpawnOnDestroy"), new HarmonyMethod(typeof(ModCompatibility.NewProjectile).GetMethod("SpawnOnDestroyPrefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)typeof(StunGrenadeItem).GetMethod("ExplodeStunGrenade", BindingFlags.Instance | BindingFlags.NonPublic), new HarmonyMethod(typeof(ModCompatibility.NewStunGrenadeItem).GetMethod("ExplodeStunGrenadePrefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}

		public static void SetSplatBombKeyword()
		{
			Terminal val = Object.FindObjectOfType<Terminal>();
			TerminalKeyword val2 = null;
			bool flag = false;
			bool flag2 = false;
			TerminalKeyword[] allKeywords = val.terminalNodes.allKeywords;
			foreach (TerminalKeyword val3 in allKeywords)
			{
				if (((Object)val3).name == "StunGrenade")
				{
					val3.word = "splat";
					flag = true;
				}
				else if (((Object)val3).name == "Buy")
				{
					val2 = val3;
					flag2 = true;
				}
				if (flag && flag2)
				{
					break;
				}
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			TerminalNode val4 = null;
			CompatibleNoun[] compatibleNouns = val2.compatibleNouns;
			foreach (CompatibleNoun val5 in compatibleNouns)
			{
				if (((Object)val5.noun).name == "StunGrenade")
				{
					val4 = val5.result;
					break;
				}
			}
			if (!((Object)(object)val4 == (Object)null))
			{
				val4.displayText = "You have requested to order Splat Bombs. Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
				val4.terminalOptions[0].result.displayText = "Ordered [variableAmount] Splat Bombs. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\nBooyah!\n\n";
			}
		}

		public static GameObject SearchForObject(string name, Transform parentTransform = null)
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Expected O, but got Unknown
			Logger.LogDebug((object)("Starting search for " + name));
			GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsSortMode)0);
			GameObject[] array2 = array;
			GameObject[] array3 = array2;
			GameObject result;
			foreach (GameObject val in array3)
			{
				if (((Object)val).name == name)
				{
					result = val;
					Logger.LogDebug((object)("Found existing " + ((Object)val).name + ", using as parent."));
					return result;
				}
			}
			result = new GameObject(name);
			if ((Object)(object)parentTransform != (Object)null)
			{
				result.transform.SetParent(parentTransform, false);
			}
			Logger.LogDebug((object)("Did not find existing " + name + ", instantiating new " + ((Object)result).name));
			return result;
		}

		private static bool CheckForPlugin(string pluginName, bool printDebug = true)
		{
			foreach (PluginInfo value in Chainloader.PluginInfos.Values)
			{
				if (value.Metadata.Name == pluginName)
				{
					if (printDebug)
					{
						Logger.LogDebug((object)("Successfully found " + pluginName));
					}
					return true;
				}
			}
			if (printDebug)
			{
				Logger.LogDebug((object)("Failed to find " + pluginName));
			}
			return false;
		}
	}
	internal class SplatBehaviour : MonoBehaviour
	{
		public static SplatBehaviour Instance;

		private Image InkSplattersScreen;

		private bool FlashFromInkBomb;

		private void Awake()
		{
			//IL_0092: 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)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			StartOfRound instance = StartOfRound.Instance;
			object obj;
			if (instance == null)
			{
				obj = null;
			}
			else
			{
				Transform parent = ((Component)instance).transform.parent;
				if (parent == null)
				{
					obj = null;
				}
				else
				{
					Transform parent2 = parent.parent;
					if (parent2 == null)
					{
						obj = null;
					}
					else
					{
						Transform obj2 = parent2.Find("UI");
						obj = ((obj2 != null) ? ((Component)obj2).GetComponentInChildren<Canvas>() : null);
					}
				}
			}
			Canvas val = (Canvas)obj;
			Plugin.Logger.LogDebug((object)$"found canvas: {val}");
			if ((Object)(object)val != (Object)null)
			{
				GameObject val2 = Object.Instantiate<GameObject>(Plugin.InkScreenSplatters, ((Component)val).transform.GetChild(0));
				InkSplattersScreen = val2.GetComponent<Image>();
				Color color = ((Graphic)InkSplattersScreen).color;
				color.a = 0f;
				((Graphic)InkSplattersScreen).color = color;
			}
		}

		private void Update()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (FlashFromInkBomb && (Object)(object)HUDManager.Instance != (Object)null && HUDManager.Instance.flashFilter > 0.025f)
			{
				Color color = ((Graphic)InkSplattersScreen).color;
				color.a = HUDManager.Instance.flashFilter;
				((Graphic)InkSplattersScreen).color = color;
			}
			else
			{
				FlashFromInkBomb = false;
				Color color2 = ((Graphic)InkSplattersScreen).color;
				color2.a = 0f;
				((Graphic)InkSplattersScreen).color = color2;
			}
		}

		internal void PerformInkSplatterCheck(Vector3 stunPos)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)InkSplattersScreen == (Object)null || (Object)(object)HUDManager.Instance == (Object)null || HUDManager.Instance.flashFilter < ((Graphic)InkSplattersScreen).color.a)
			{
				return;
			}
			StunGrenadeItem[] array = Object.FindObjectsByType<StunGrenadeItem>((FindObjectsSortMode)0);
			if (array == null || array.Length == 0)
			{
				return;
			}
			bool flag = false;
			for (int i = 0; i < array.Length; i++)
			{
				if (((Configs.SplatBombConfig.Value && ((Object)((Component)array[i]).gameObject).name == "StunGrenade(Clone)") || (Configs.FizzyBombConfig.Value && ((Object)((Component)array[i]).gameObject).name == "DiyFlashbang(Clone)")) && stunPos == ((Component)array[i]).transform.position)
				{
					flag = true;
					break;
				}
			}
			if (!flag && ModCompatibility.CrashBandicootCratesCompatible)
			{
				flag = ModCompatibility.FlashFromProjectile(stunPos);
			}
			AddInkToScreen(flag, stunPos);
		}

		public void AddInkToScreen(bool setTo, Vector3 pos)
		{
			//IL_004b: 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)
			PlayerControllerB val = StartOfRound.Instance.localPlayerController;
			if (StartOfRound.Instance.localPlayerController.isPlayerDead && (Object)(object)StartOfRound.Instance.localPlayerController.spectatedPlayerScript != (Object)null)
			{
				val = StartOfRound.Instance.localPlayerController.spectatedPlayerScript;
			}
			float num = Vector3.Distance(pos, val.playerEye.position);
			if (num < 15f)
			{
				FlashFromInkBomb = setTo;
			}
			Plugin.Logger.LogDebug((object)$"distance: {num} | FlashFromInkBomb: {FlashFromInkBomb}");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCSplatBombGrenadeMod";

		public const string PLUGIN_NAME = "LCSplatBombGrenadeMod";

		public const string PLUGIN_VERSION = "1.5.2";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}