Decompiled source of Bandit Dynamite Toss v1.1.3

BanditDynamite.dll

Decompiled 3 months 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 BanditDynamite.Components;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Moffein.BanditDynamite;
using On.RoR2;
using On.RoR2.Projectile;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.Networking;

[assembly: AssemblyProduct("BanditDynamite")]
[assembly: AssemblyInformationalVersion("1.0.0+b89925fa40e4fe60abe99d5585dae29d1b15393f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCompany("BanditDynamite")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyTitle("BanditDynamite")]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace EntityStates.Moffein.BanditDynamite
{
	public class ClusterBomb : BaseState
	{
		public static GameObject projectilePrefab;

		public static float damageCoefficient;

		public static float force = 2500f;

		public static float baseDuration;

		public static float bombletDamageCoefficient;

		private float duration;

		public static bool quickdrawEnabled = false;

		public override void OnEnter()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			Ray aimRay = ((BaseState)this).GetAimRay();
			((BaseState)this).StartAimMode(aimRay, 2f, false);
			((EntityState)this).PlayAnimation("Gesture, Additive", "SlashBlade", "SlashBlade.playbackRate", duration, 0f);
			Util.PlaySound("Play_MoffeinBanditDynamite_toss", ((EntityState)this).gameObject);
			if (((EntityState)this).isAuthority)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded)
				{
					((EntityState)this).characterMotor.velocity = new Vector3(((EntityState)this).characterMotor.velocity.x, Mathf.Max(((EntityState)this).characterMotor.velocity.y, 6f), ((EntityState)this).characterMotor.velocity.z);
				}
				ProjectileManager.instance.FireProjectile(projectilePrefab, ((Ray)(ref aimRay)).origin, Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction), ((EntityState)this).gameObject, base.damageStat * damageCoefficient, 0f, Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master), (DamageColorIndex)0, (GameObject)null, -1f);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && ((EntityState)this).inputBank.skill2.down)
			{
				return (InterruptPriority)2;
			}
			return (InterruptPriority)1;
		}
	}
}
namespace BanditDynamite
{
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.Moffein.BanditDynamite", "Bandit Dynamite", "1.1.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BanditDynamite : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TakeDamage <>9__13_0;

			internal void <Awake>b__13_0(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_002f: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				//IL_008e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_020b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0210: Unknown result type (might be due to invalid IL or missing references)
				//IL_0215: Unknown result type (might be due to invalid IL or missing references)
				//IL_021c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0226: Unknown result type (might be due to invalid IL or missing references)
				//IL_022b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0230: Unknown result type (might be due to invalid IL or missing references)
				//IL_018a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0190: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
				bool flag = false;
				bool flag2 = false;
				bool flag3 = DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)4)) != 0 || DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)268435456)) != 0;
				AssignDynamiteTeamFilter component = ((Component)self).gameObject.GetComponent<AssignDynamiteTeamFilter>();
				if (Object.op_Implicit((Object)(object)component))
				{
					flag = true;
					CharacterBody val = null;
					if (Object.op_Implicit((Object)(object)damageInfo.attacker))
					{
						val = damageInfo.attacker.GetComponent<CharacterBody>();
						if (Object.op_Implicit((Object)(object)val))
						{
							flag2 = val.bodyIndex == BodyCatalog.FindBodyIndex("Bandit2Body");
						}
					}
				}
				if (flag)
				{
					if (!component.fired && flag2 && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)131072)) == 0L && damageInfo.procCoefficient > 0f)
					{
						component.fired = true;
						damageInfo.crit = true;
						damageInfo.procCoefficient = 0f;
						ProjectileImpactExplosion component2 = ((Component)self).gameObject.GetComponent<ProjectileImpactExplosion>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							((ProjectileExplosion)component2).blastRadius = ((ProjectileExplosion)component2).blastRadius * 2f;
							((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
						}
						ProjectileDamage component3 = ((Component)self).gameObject.GetComponent<ProjectileDamage>();
						if (Object.op_Implicit((Object)(object)component3))
						{
							if (flag3)
							{
								component3.damage *= 2f;
								if (dynamiteSpecialCombo)
								{
									if (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)4)) != 0)
									{
										component3.damageType |= DamageTypeCombo.op_Implicit((DamageType)4);
									}
									if (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)268435456)) != 0)
									{
										component3.damageType |= DamageTypeCombo.op_Implicit((DamageType)268435456);
									}
								}
								damageInfo.damageType &= DamageTypeCombo.op_Implicit((DamageType)(-5));
								damageInfo.damageType &= DamageTypeCombo.op_Implicit((DamageType)(-268435457));
								BanditNetworkCommands component4 = damageInfo.attacker.GetComponent<BanditNetworkCommands>();
								if (Object.op_Implicit((Object)(object)component4))
								{
									component4.CallRpcResetSpecialCooldown();
								}
							}
							else
							{
								component3.damage *= 1.5f;
							}
						}
					}
					else
					{
						damageInfo.rejected = true;
					}
				}
				orig.Invoke(self, damageInfo);
			}
		}

		private AssetBundle assets;

		private readonly Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/hgstandard");

		public static GameObject ClusterBombObject;

		public static GameObject ClusterBombletObject;

		public static ModdedDamageType ClusterBombDamage;

		public static bool dynamiteSpecialCombo = true;

		public static float cbRadius;

		public static float cbBombletRadius;

		public static float cbBombletProcCoefficient;

		public static float cbCooldown;

		public static int cbBombletCount;

		public static int cbStock;

		private bool disableFalloff = false;

		public void Awake()
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			ReadConfig();
			LoadResources();
			SetupClusterBomb();
			SetupClusterBomblet();
			RegisterLanguageTokens();
			AddSkill();
			FireBomblets.AddHook();
			object obj = <>c.<>9__13_0;
			if (obj == null)
			{
				hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_000c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0011: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					//IL_002a: Unknown result type (might be due to invalid IL or missing references)
					//IL_002f: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
					//IL_008e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0098: Unknown result type (might be due to invalid IL or missing references)
					//IL_013b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0204: Unknown result type (might be due to invalid IL or missing references)
					//IL_020b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0210: Unknown result type (might be due to invalid IL or missing references)
					//IL_0215: Unknown result type (might be due to invalid IL or missing references)
					//IL_021c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0226: Unknown result type (might be due to invalid IL or missing references)
					//IL_022b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0230: Unknown result type (might be due to invalid IL or missing references)
					//IL_018a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0190: Unknown result type (might be due to invalid IL or missing references)
					//IL_0195: Unknown result type (might be due to invalid IL or missing references)
					//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
					//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
					//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
					//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
					//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
					//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
					//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
					//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
					//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
					bool flag = false;
					bool flag2 = false;
					bool flag3 = DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)4)) != 0 || DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)268435456)) != 0;
					AssignDynamiteTeamFilter component = ((Component)self).gameObject.GetComponent<AssignDynamiteTeamFilter>();
					if (Object.op_Implicit((Object)(object)component))
					{
						flag = true;
						CharacterBody val2 = null;
						if (Object.op_Implicit((Object)(object)damageInfo.attacker))
						{
							val2 = damageInfo.attacker.GetComponent<CharacterBody>();
							if (Object.op_Implicit((Object)(object)val2))
							{
								flag2 = val2.bodyIndex == BodyCatalog.FindBodyIndex("Bandit2Body");
							}
						}
					}
					if (flag)
					{
						if (!component.fired && flag2 && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)131072)) == 0L && damageInfo.procCoefficient > 0f)
						{
							component.fired = true;
							damageInfo.crit = true;
							damageInfo.procCoefficient = 0f;
							ProjectileImpactExplosion component2 = ((Component)self).gameObject.GetComponent<ProjectileImpactExplosion>();
							if (Object.op_Implicit((Object)(object)component2))
							{
								((ProjectileExplosion)component2).blastRadius = ((ProjectileExplosion)component2).blastRadius * 2f;
								((ProjectileExplosion)component2).falloffModel = (FalloffModel)0;
							}
							ProjectileDamage component3 = ((Component)self).gameObject.GetComponent<ProjectileDamage>();
							if (Object.op_Implicit((Object)(object)component3))
							{
								if (flag3)
								{
									component3.damage *= 2f;
									if (dynamiteSpecialCombo)
									{
										if (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)4)) != 0)
										{
											component3.damageType |= DamageTypeCombo.op_Implicit((DamageType)4);
										}
										if (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)268435456)) != 0)
										{
											component3.damageType |= DamageTypeCombo.op_Implicit((DamageType)268435456);
										}
									}
									damageInfo.damageType &= DamageTypeCombo.op_Implicit((DamageType)(-5));
									damageInfo.damageType &= DamageTypeCombo.op_Implicit((DamageType)(-268435457));
									BanditNetworkCommands component4 = damageInfo.attacker.GetComponent<BanditNetworkCommands>();
									if (Object.op_Implicit((Object)(object)component4))
									{
										component4.CallRpcResetSpecialCooldown();
									}
								}
								else
								{
									component3.damage *= 1.5f;
								}
							}
						}
						else
						{
							damageInfo.rejected = true;
						}
					}
					orig.Invoke(self, damageInfo);
				};
				<>c.<>9__13_0 = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj;
		}

		public void RegisterLanguageTokens()
		{
			LanguageAPI.Add("MOFFEINBANDITDYNAMITE_SECONDARY_NAME", "Dynamite Toss");
			LanguageAPI.Add("MOFFEINBANDITDYNAMITE_SECONDARY_DESC", "Toss a bomb that <style=cIsDamage>ignites</style> for <style=cIsDamage>" + ClusterBomb.damageCoefficient.ToString("P0").Replace(" ", "").Replace(",", "") + " damage</style>. Drops bomblets for <style=cIsDamage>" + cbBombletCount + "x" + ClusterBomb.bombletDamageCoefficient.ToString("P0").Replace(" ", "").Replace(",", "") + " damage</style>. Can be shot midair for <style=cIsDamage>bonus damage</style>." + Environment.NewLine);
		}

		private void AddSkill()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
			val.activationState = new SerializableEntityStateType(typeof(ClusterBomb));
			val.baseRechargeInterval = cbCooldown;
			val.skillNameToken = "MOFFEINBANDITDYNAMITE_SECONDARY_NAME";
			val.skillDescriptionToken = "MOFFEINBANDITDYNAMITE_SECONDARY_DESC";
			val.skillName = "Dynamite";
			val.icon = assets.LoadAsset<Sprite>("dynamite_red.png");
			val.baseMaxStock = cbStock;
			val.rechargeStock = 1;
			val.beginSkillCooldownOnSkillEnd = false;
			val.activationStateMachineName = "Weapon";
			val.interruptPriority = (InterruptPriority)1;
			val.isCombatSkill = true;
			val.cancelSprintingOnActivation = false;
			val.canceledFromSprinting = false;
			val.mustKeyPress = false;
			val.requiredStock = 1;
			val.stockToConsume = 1;
			val.keywordTokens = new string[0];
			ContentAddition.AddSkillDef(val);
			bool flag = default(bool);
			ContentAddition.AddEntityState<ClusterBomb>(ref flag);
			((Object)val).name = val.skillName;
			GameObject val2 = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/Bandit2Body");
			val2.AddComponent<BanditNetworkCommands>();
			SkillFamily skillFamily = val2.GetComponent<SkillLocator>().secondary.skillFamily;
			Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
			Variant[] variants = skillFamily.variants;
			int num = skillFamily.variants.Length - 1;
			Variant val3 = new Variant
			{
				skillDef = val,
				unlockableName = ""
			};
			((Variant)(ref val3)).viewableNode = new Node(val.skillNameToken, false, (Node)null);
			variants[num] = val3;
		}

		private void ReadConfig()
		{
			//IL_0011: 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_002c: Expected O, but got Unknown
			//IL_002c: Expected O, but got Unknown
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_0065: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Expected O, but got Unknown
			//IL_009e: Expected O, but got Unknown
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			//IL_00d3: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			//IL_010c: Expected O, but got Unknown
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Expected O, but got Unknown
			//IL_0145: Expected O, but got Unknown
			//IL_015f: 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_017e: Expected O, but got Unknown
			//IL_017e: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01b7: Expected O, but got Unknown
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Expected O, but got Unknown
			//IL_01f0: Expected O, but got Unknown
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Expected O, but got Unknown
			//IL_0225: Expected O, but got Unknown
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Expected O, but got Unknown
			//IL_025b: Expected O, but got Unknown
			dynamiteSpecialCombo = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Dynamite", "Special Combo"), true, new ConfigDescription("Dynamite inherits the damagetype of Bandit's Special skills when shot by them.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ClusterBomb.damageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Damage*"), 3.9f, new ConfigDescription("How much damage Dynamite Toss deals.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			cbRadius = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Radius*"), 8f, new ConfigDescription("How large the explosion is. Radius is doubled when shot out of the air.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			cbBombletCount = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Dynamite", "Bomblet Count*"), 6, new ConfigDescription("How many mini bombs Dynamite Toss releases.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ClusterBomb.bombletDamageCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Bomblet Damage*"), 1.2f, new ConfigDescription("How much damage Dynamite Toss Bomblets deals.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			cbBombletRadius = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Bomblet Radius*"), 8f, new ConfigDescription("How large the mini explosions are.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			cbBombletProcCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Bomblet Proc Coefficient*"), 0.6f, new ConfigDescription("Affects the chance and power of Dynamite Toss Bomblet procs.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			ClusterBomb.baseDuration = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Throw Duration"), 0.6f, new ConfigDescription("How long it takes to throw a Dynamite Bundle.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			cbCooldown = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Dynamite", "Cooldown"), 6f, new ConfigDescription("How long it takes for Dynamite Toss to recharge.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			cbStock = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Dynamite", "Stock"), 1, new ConfigDescription("How much Dynamite you start with.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			disableFalloff = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Dynamite", "Disable Falloff"), false, new ConfigDescription("Disable explosion damage falloff.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}

		public void LoadResources()
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("BanditDynamite.dynamite"))
			{
				assets = AssetBundle.LoadFromStream(stream);
			}
			using Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("BanditDynamite.BanditDynamite.bnk");
			byte[] array = new byte[stream2.Length];
			stream2.Read(array, 0, array.Length);
			SoundBanks.Add(array);
		}

		private void SetupClusterBomb()
		{
			//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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			ClusterBombDamage = DamageAPI.ReserveDamageType();
			ClusterBombObject = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/BanditClusterBombSeed"), "MoffeinBanditDynamiteClusterBomb", true);
			ContentAddition.AddProjectile(ClusterBombObject);
			GameObject val = PrefabAPI.InstantiateClone(assets.LoadAsset<GameObject>("DynamiteBundle.prefab"), "MoffeinBanditDynamiteClusterBombGhost", false);
			((Renderer)val.GetComponentInChildren<MeshRenderer>()).material.shader = hotpoo;
			val.AddComponent<ProjectileGhostController>();
			ClusterBombObject.AddComponent<DynamiteRotation>();
			ClusterBombObject.GetComponent<ProjectileController>().ghostPrefab = val;
			ModdedDamageTypeHolderComponent val2 = ClusterBombObject.AddComponent<ModdedDamageTypeHolderComponent>();
			val2.Add(ClusterBombDamage);
			float childrenDamageCoefficient = ClusterBomb.bombletDamageCoefficient / ClusterBomb.damageCoefficient;
			SphereCollider val3 = ClusterBombObject.AddComponent<SphereCollider>();
			val3.radius = 0.6f;
			((Collider)val3).contactOffset = 0.01f;
			TeamComponent val4 = ClusterBombObject.AddComponent<TeamComponent>();
			val4.hideAllyCardDisplay = true;
			ClusterBombObject.AddComponent<SkillLocator>();
			CharacterBody val5 = ClusterBombObject.AddComponent<CharacterBody>();
			val5.rootMotionInMainState = false;
			val5.bodyFlags = (BodyFlags)4;
			val5.baseMaxHealth = 1f;
			val5.baseCrit = 0f;
			val5.baseAcceleration = 0f;
			val5.baseArmor = 0f;
			val5.baseAttackSpeed = 0f;
			val5.baseDamage = 0f;
			val5.baseJumpCount = 0;
			val5.baseJumpPower = 0f;
			val5.baseMoveSpeed = 0f;
			val5.baseMaxShield = 0f;
			val5.baseRegen = 0f;
			val5.autoCalculateLevelStats = true;
			val5.levelArmor = 0f;
			val5.levelAttackSpeed = 0f;
			val5.levelCrit = 0f;
			val5.levelDamage = 0f;
			val5.levelJumpPower = 0f;
			val5.levelMaxHealth = 0f;
			val5.levelMaxShield = 0f;
			val5.levelMoveSpeed = 0f;
			val5.levelRegen = 0f;
			val5.hullClassification = (HullClassification)0;
			HealthComponent val6 = ClusterBombObject.AddComponent<HealthComponent>();
			val6.globalDeathEventChanceCoefficient = 0f;
			val6.body = val5;
			ClusterBombObject.AddComponent<AssignDynamiteTeamFilter>();
			ProjectileImpactExplosion component = ClusterBombObject.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastRadius = cbRadius;
			((ProjectileExplosion)component).falloffModel = (FalloffModel)((!disableFalloff) ? 2 : 0);
			component.lifetime = 25f;
			component.lifetimeAfterImpact = 1.5f;
			component.destroyOnEnemy = true;
			component.destroyOnWorld = false;
			((ProjectileExplosion)component).childrenCount = cbBombletCount;
			((ProjectileExplosion)component).childrenDamageCoefficient = childrenDamageCoefficient;
			((ProjectileExplosion)component).blastProcCoefficient = 1f;
			component.impactEffect = SetupDynamiteExplosion();
			((ProjectileExplosion)component).fireChildren = false;
			((ProjectileExplosion)component).explosionSoundString = "";
			component.lifetimeExpiredSound = null;
			((ProjectileExplosion)component).projectileHealthComponent = val6;
			component.transformSpace = (TransformSpace)0;
			Object.Destroy((Object)(object)ClusterBombObject.GetComponent<ProjectileStickOnImpact>());
			ProjectileSimple component2 = ClusterBombObject.GetComponent<ProjectileSimple>();
			component2.velocity = 60f;
			component2.lifetime = 25f;
			ClusterBombObject.GetComponent<Rigidbody>().useGravity = true;
			ProjectileDamage component3 = ClusterBombObject.GetComponent<ProjectileDamage>();
			component3.damageType = DamageTypeCombo.op_Implicit((DamageType)128);
			AddDynamiteHurtbox(ClusterBombObject);
			ClusterBomb.projectilePrefab = ClusterBombObject;
		}

		private void AddDynamiteHurtbox(GameObject go)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject();
			val.transform.parent = go.transform;
			val.layer = LayerIndex.entityPrecise.intVal;
			SphereCollider val2 = val.AddComponent<SphereCollider>();
			val2.radius = 0.9f;
			HurtBoxGroup val3 = val.AddComponent<HurtBoxGroup>();
			HurtBox val4 = val.AddComponent<HurtBox>();
			val4.isBullseye = false;
			val4.healthComponent = go.GetComponent<HealthComponent>();
			val4.damageModifier = (DamageModifier)0;
			val4.hurtBoxGroup = val3;
			val4.indexInGroup = 0;
			HurtBox[] hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 };
			val3.bullseyeCount = 0;
			val3.hurtBoxes = hurtBoxes;
			val3.mainHurtBox = val4;
			DisableCollisionsBetweenColliders val5 = go.AddComponent<DisableCollisionsBetweenColliders>();
			val5.collidersA = go.GetComponents<Collider>();
			val5.collidersB = val.GetComponents<Collider>();
		}

		private GameObject SetupDynamiteExplosion()
		{
			//IL_0045: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/omnieffect/omniexplosionvfx"), "MoffeinBanditDynamiteDynamiteExplosion", false);
			ShakeEmitter val2 = val.AddComponent<ShakeEmitter>();
			val2.shakeOnStart = true;
			val2.duration = 0.5f;
			val2.scaleShakeRadiusWithLocalScale = false;
			val2.radius = 75f;
			val2.wave = new Wave
			{
				amplitude = 1f,
				cycleOffset = 0f,
				frequency = 40f
			};
			EffectComponent component = val.GetComponent<EffectComponent>();
			component.soundName = "Play_MoffeinBanditDynamite_explode";
			ContentAddition.AddEffect(val);
			return val;
		}

		private void SetupClusterBomblet()
		{
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			ClusterBombletObject = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/BanditClusterGrenadeProjectile"), "MoffeinBanditDynamiteClusterBomblet", true);
			ContentAddition.AddProjectile(ClusterBombletObject);
			GameObject val = PrefabAPI.InstantiateClone(assets.LoadAsset<GameObject>("DynamiteStick.prefab"), "MoffeinBanditDynamiteClusterBombletGhost", false);
			((Renderer)val.GetComponentInChildren<MeshRenderer>()).material.shader = hotpoo;
			val.AddComponent<ProjectileGhostController>();
			((ProjectileExplosion)ClusterBombObject.GetComponent<ProjectileImpactExplosion>()).childrenProjectilePrefab = ClusterBombletObject;
			ClusterBombletObject.AddComponent<SphereCollider>();
			ClusterBombletObject.GetComponent<ProjectileController>().ghostPrefab = val;
			ProjectileImpactExplosion component = ClusterBombletObject.GetComponent<ProjectileImpactExplosion>();
			((ProjectileExplosion)component).blastRadius = cbBombletRadius;
			((ProjectileExplosion)component).falloffModel = (FalloffModel)((!disableFalloff) ? 2 : 0);
			component.destroyOnEnemy = false;
			component.destroyOnWorld = false;
			component.lifetime = 1.5f;
			component.timerAfterImpact = false;
			((ProjectileExplosion)component).blastProcCoefficient = cbBombletProcCoefficient;
			((ProjectileExplosion)component).explosionSoundString = "";
			component.impactEffect = SetupDynamiteBombletExplosion();
			((ProjectileExplosion)component).fireChildren = false;
			Object.Destroy((Object)(object)ClusterBombletObject.GetComponent<ProjectileStickOnImpact>());
			ProjectileSimple component2 = ClusterBombletObject.GetComponent<ProjectileSimple>();
			component2.velocity = 12f;
			ProjectileDamage component3 = ClusterBombletObject.GetComponent<ProjectileDamage>();
			component3.damageType = DamageTypeCombo.op_Implicit((DamageType)128);
		}

		private GameObject SetupDynamiteBombletExplosion()
		{
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/effects/impacteffects/explosionvfx"), "MoffeinBanditDynamiteBombletExplosion", false);
			EffectComponent component = val.GetComponent<EffectComponent>();
			component.soundName = "Play_engi_M2_explo";
			ContentAddition.AddEffect(val);
			return val;
		}
	}
	public class FireBomblets
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_DetonateServer <>9__3_0;

			internal void <AddHook>b__3_0(orig_DetonateServer orig, ProjectileExplosion self)
			{
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				if (!Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)((Component)self).gameObject))
				{
					return;
				}
				ModdedDamageTypeHolderComponent component = ((Component)self).gameObject.GetComponent<ModdedDamageTypeHolderComponent>();
				if (Object.op_Implicit((Object)(object)component) && component.Has(BanditDynamite.ClusterBombDamage) && NetworkServer.active)
				{
					int[] bomblets = FireBomblets.bomblets;
					foreach (int num in bomblets)
					{
						FireBomblet(self);
					}
				}
			}
		}

		private static int[] bomblets = new int[BanditDynamite.cbBombletCount];

		private static Quaternion GetRandomDirectionForChild(ProjectileExplosion self)
		{
			//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_002c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			Quaternion val = Quaternion.AngleAxis((float)RoR2Application.rng.nextInt + Random.Range(0f, (float)RoR2Application.rng.nextInt), Vector3.forward);
			Quaternion val2 = Quaternion.AngleAxis((float)RoR2Application.rng.nextInt + Random.Range(0f, (float)RoR2Application.rng.nextInt), Vector3.left);
			Quaternion val3 = val * val2;
			if (Object.op_Implicit((Object)(object)self))
			{
				return ((Component)self).transform.rotation * val3;
			}
			return val3;
		}

		private static void FireBomblet(ProjectileExplosion self)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			Quaternion randomDirectionForChild = GetRandomDirectionForChild(self);
			GameObject val = Object.Instantiate<GameObject>(BanditDynamite.ClusterBombletObject, ((Component)self).transform.position, randomDirectionForChild);
			ProjectileController component = val.GetComponent<ProjectileController>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.procChainMask = self.projectileController.procChainMask;
				component.procCoefficient = self.projectileController.procCoefficient;
				component.Networkowner = self.projectileController.owner;
			}
			val.GetComponent<TeamFilter>().teamIndex = ((Component)self).GetComponent<TeamFilter>().teamIndex;
			ProjectileDamage component2 = val.GetComponent<ProjectileDamage>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.damage = self.projectileDamage.damage * ClusterBomb.bombletDamageCoefficient / ClusterBomb.damageCoefficient;
				component2.crit = self.projectileDamage.crit;
				component2.force = self.projectileDamage.force;
				component2.damageColorIndex = self.projectileDamage.damageColorIndex;
			}
			NetworkServer.Spawn(val);
		}

		public static void AddHook()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			object obj = <>c.<>9__3_0;
			if (obj == null)
			{
				hook_DetonateServer val = delegate(orig_DetonateServer orig, ProjectileExplosion self)
				{
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(self);
					if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)self).gameObject))
					{
						ModdedDamageTypeHolderComponent component = ((Component)self).gameObject.GetComponent<ModdedDamageTypeHolderComponent>();
						if (Object.op_Implicit((Object)(object)component) && component.Has(BanditDynamite.ClusterBombDamage) && NetworkServer.active)
						{
							int[] array = bomblets;
							foreach (int num in array)
							{
								FireBomblet(self);
							}
						}
					}
				};
				<>c.<>9__3_0 = val;
				obj = (object)val;
			}
			ProjectileExplosion.DetonateServer += (hook_DetonateServer)obj;
		}
	}
}
namespace BanditDynamite.Components
{
	public class AssignDynamiteTeamFilter : MonoBehaviour
	{
		public bool fired = false;

		private void Start()
		{
			if (NetworkServer.active)
			{
				TeamComponent component = ((Component)this).GetComponent<TeamComponent>();
				component.teamIndex = (TeamIndex)(-1);
			}
		}
	}
	public class BanditNetworkCommands : NetworkBehaviour
	{
		private SkillLocator skillLocator;

		private CharacterBody characterBody;

		private static int kRpcRpcResetSpecialCooldown;

		[ClientRpc]
		public void RpcResetSpecialCooldown()
		{
			if (((NetworkBehaviour)this).hasAuthority)
			{
				skillLocator.special.stock = skillLocator.special.maxStock;
				skillLocator.special.rechargeStopwatch = 0f;
			}
		}

		private void Awake()
		{
			characterBody = ((Component)this).GetComponent<CharacterBody>();
			skillLocator = ((Component)this).GetComponent<SkillLocator>();
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeRpcRpcResetSpecialCooldown(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcResetSpecialCooldown called on server.");
			}
			else
			{
				((BanditNetworkCommands)(object)obj).RpcResetSpecialCooldown();
			}
		}

		public void CallRpcResetSpecialCooldown()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcResetSpecialCooldown called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcResetSpecialCooldown);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcResetSpecialCooldown");
		}

		static BanditNetworkCommands()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			kRpcRpcResetSpecialCooldown = 1641151393;
			NetworkBehaviour.RegisterRpcDelegate(typeof(BanditNetworkCommands), kRpcRpcResetSpecialCooldown, new CmdDelegate(InvokeRpcRpcResetSpecialCooldown));
			NetworkCRC.RegisterBehaviour("BanditNetworkCommands", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			bool result = default(bool);
			return result;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
		}
	}
	internal class DynamiteRotation : MonoBehaviour
	{
		private ProjectileImpactExplosion projectileImpactExplosion;

		public void Awake()
		{
			projectileImpactExplosion = ((Component)this).gameObject.GetComponent<ProjectileImpactExplosion>();
		}

		public void FixedUpdate()
		{
			//IL_0034: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				if (projectileImpactExplosion.hasImpact)
				{
					Object.Destroy((Object)(object)this);
				}
				((Component)this).transform.rotation = Quaternion.AngleAxis(-360f * Time.fixedDeltaTime, Vector3.right) * ((Component)this).transform.rotation;
			}
		}
	}
}