Decompiled source of MULT Movement Primaries v1.2.0

MultMovementPrimaries.dll

Decompiled 2 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Toolbot;
using On.EntityStates.Toolbot;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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: AssemblyCompany("MultMovementPrimaries")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MultMovementPrimaries")]
[assembly: AssemblyTitle("MultMovementPrimaries")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MultMovementPrimaries;

[BepInPlugin("com.brynzananas.multmovementprimaries", "MUL-T Movement Primaries", "1.2.0")]
[BepInDependency("com.bepis.r2api", "5.0.10")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
	public class RocketComponent : MonoBehaviour
	{
		public bool isHoming = true;

		public Vector3 direction;

		private bool applyNewVelocity = true;

		private bool applyNewDamage = true;

		private bool applyNewCooldown = true;

		public float rocketJumpPower = 1f;

		private void Update()
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_0136: 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_014f: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody component = ((ProjectileExplosion)((Component)this).GetComponent<ProjectileImpactExplosion>()).projectileController.owner.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			bool value = RocketEnableFinalHoming.Value;
			bool value2 = RocketEnableFinalVelocityIncrease.Value;
			bool value3 = RocketEnableRestockOnRelease.Value;
			if (((!(value3 || value || value2) || !((ButtonState)(ref component.inputBank.skill1)).justReleased) && (component.skillLocator.secondary.skillDef.skillIndex != ((SkillDef)grenadeSkillDef).skillIndex || !((ButtonState)(ref component.inputBank.skill2)).justReleased)) || !isHoming)
			{
				return;
			}
			if (value)
			{
				((Component)this).GetComponent<Rigidbody>().velocity = Vector3.RotateTowards(((Component)this).GetComponent<Rigidbody>().velocity, direction, 180f, 0f);
				isHoming = false;
			}
			if (value2)
			{
				Rigidbody component2 = ((Component)this).GetComponent<Rigidbody>();
				component2.velocity *= ConfigFloat(RocketFinalVelocity, RocketEnableConfig);
				EffectData val = new EffectData();
				val.origin = ((Component)this).transform.position;
				bool flag = false;
				if (((Component)this).GetComponent<Rigidbody>().velocity != Vector3.zero)
				{
					val.rotation = Util.QuaternionSafeLookRotation(((Component)this).GetComponent<Rigidbody>().velocity);
					flag = true;
				}
				if (!flag)
				{
					val.rotation = ((Component)this).transform.rotation;
				}
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/SprintActivate"), val, true);
			}
			if (value3)
			{
				component.skillLocator.primary.stock = component.skillLocator.primary.maxStock;
				if (component.skillLocator.secondary.skillDef.skillIndex == ((SkillDef)grenadeSkillDef).skillIndex)
				{
					component.skillLocator.secondary.stock = component.skillLocator.secondary.maxStock;
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: 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_0206: 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_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_026d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			if (RocketEnableDamageChange.Value && applyNewDamage)
			{
				ProjectileDamage projectileDamage = ((ProjectileExplosion)((Component)this).GetComponent<ProjectileImpactExplosion>()).projectileDamage;
				projectileDamage.damage *= ConfigFloat(RocketDamageChange, RocketEnableConfig);
				applyNewDamage = false;
			}
			CharacterBody component = ((ProjectileExplosion)((Component)this).GetComponent<ProjectileImpactExplosion>()).projectileController.owner.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (applyNewCooldown)
			{
				applyNewCooldown = false;
			}
			float num = Vector3.Distance(((Component)this).transform.position, component.corePosition);
			if (RocketEnableVelocityChange.Value && applyNewVelocity && num > 5f)
			{
				Rigidbody component2 = ((Component)this).GetComponent<Rigidbody>();
				component2.velocity *= ConfigFloat(RocketVelocityChange, RocketEnableConfig);
				applyNewVelocity = false;
			}
			if (RocketEnablePowerScaling.Value)
			{
				ProjectileDamage projectileDamage2 = ((ProjectileExplosion)((Component)this).GetComponent<ProjectileImpactExplosion>()).projectileDamage;
				projectileDamage2.damage += component.damage * ConfigFloat(RocketDamageScaling, RocketEnableConfig) / 100f / 60f;
				ProjectileImpactExplosion component3 = ((Component)this).GetComponent<ProjectileImpactExplosion>();
				((ProjectileExplosion)component3).blastRadius = ((ProjectileExplosion)component3).blastRadius + ConfigFloat(RocketRadiusScaling, RocketEnableConfig) / 60f;
				float num2 = ConfigFloat(RocketVelocityScaling, RocketEnableConfig);
				if (num2 != 0f)
				{
					Rigidbody component4 = ((Component)this).GetComponent<Rigidbody>();
					component4.velocity *= 1f + num2 / 60f;
				}
				rocketJumpPower += ConfigFloat(RocketJumpScaling, RocketEnableConfig) / 60f;
			}
			Ray val = default(Ray);
			((Ray)(ref val)).direction = component.inputBank.aimDirection;
			((Ray)(ref val)).origin = component.inputBank.aimOrigin;
			Ray val2 = val;
			RaycastHit val3 = default(RaycastHit);
			if (isHoming && Util.CharacterRaycast(((Component)component).gameObject, val2, ref val3, 30000f, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)1))
			{
				Vector3 val4 = ((RaycastHit)(ref val3)).point - ((Component)this).transform.position;
				direction = ((Vector3)(ref val4)).normalized;
				if (RocketEnableHoming.Value && num > 5f)
				{
					((Component)this).GetComponent<Rigidbody>().velocity = Vector3.RotateTowards(((Component)this).GetComponent<Rigidbody>().velocity, direction, ConfigFloat(RocketHomingAngle, RocketEnableConfig), 0f);
				}
			}
			else
			{
				direction = ((Component)this).transform.forward;
			}
		}

		private void OnDisable()
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: 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_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: 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_021a: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody component = ((ProjectileExplosion)((Component)this).GetComponent<ProjectileImpactExplosion>()).projectileController.owner.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			if (RocketEnableRestockOnDestroy.Value)
			{
				if ((isHoming || !RocketEnableRestockOnRelease.Value) && component.skillLocator.primary.stock < component.skillLocator.primary.maxStock)
				{
					GenericSkill primary = component.skillLocator.primary;
					int stock = primary.stock;
					primary.stock = stock + 1;
				}
				if (component.skillLocator.secondary.skillDef.skillIndex == ((SkillDef)grenadeSkillDef).skillIndex && component.skillLocator.secondary.stock < component.skillLocator.secondary.maxStock)
				{
					GenericSkill secondary = component.skillLocator.secondary;
					int stock = secondary.stock;
					secondary.stock = stock + 1;
				}
			}
			if (RocketEnableJump.Value)
			{
				Vector3 position = ((Component)this).transform.position;
				Vector3 corePosition = component.corePosition;
				float num = Vector3.Distance(((Component)this).transform.position, component.footPosition);
				Vector3 zero = Vector3.zero;
				if (ConfigBool(RocketJumpMode, RocketEnableConfig))
				{
					Vector3 val = corePosition - position;
					zero = ((Vector3)(ref val)).normalized * ConfigFloat(RocketJumpFlatMultiplier, RocketEnableConfig);
				}
				else
				{
					zero = (corePosition - position) * ConfigFloat(RocketJumpMultiplier, RocketEnableConfig);
				}
				if (component.characterMotor.isGrounded)
				{
					zero /= ConfigFloat(RocketJumpReduction, RocketEnableConfig);
				}
				zero *= rocketJumpPower;
				if (num < ((ProjectileExplosion)((Component)this).GetComponent<ProjectileImpactExplosion>()).blastRadius)
				{
					CharacterMotor characterMotor = component.characterMotor;
					characterMotor.velocity += zero * component.moveSpeed;
				}
			}
		}
	}

	public const string ModGuid = "com.brynzananas.multmovementprimaries";

	public const string ModName = "MUL-T Movement Primaries";

	public const string ModVer = "1.2.0";

	public static ToolbotWeaponSkillDef grenadeSkillDef = Addressables.LoadAssetAsync<ToolbotWeaponSkillDef>((object)"RoR2/Base/Toolbot/ToolbotBodyFireGrenadeLauncher.asset").WaitForCompletion();

	public static ConfigEntry<bool> SawEnableConfig;

	public static ConfigEntry<bool> SawEnableFly;

	public static ConfigEntry<float> SawMoveVector;

	public static ConfigEntry<float> SawMoveVelocityVector;

	public static ConfigEntry<float> SawFlyVector;

	public static ConfigEntry<float> SawFlyJumpVector;

	public static ConfigEntry<float> SawFlyJumpDownVector;

	public static ConfigEntry<float> SawStuck;

	public static ConfigEntry<float> SawStuckJump;

	public static ConfigEntry<float> SawStuckFall;

	public static ConfigEntry<bool> SawEnableBarrier;

	public static ConfigEntry<float> SawBarrierChanceMode;

	public static ConfigEntry<float> SawBarrierChance;

	public static ConfigEntry<float> SawBarrierPercentage;

	public static ConfigEntry<bool> RocketEnableConfig;

	public static ConfigEntry<bool> RocketEnableVelocityChange;

	public static ConfigEntry<float> RocketVelocityChange;

	public static ConfigEntry<bool> RocketEnableDamageChange;

	public static ConfigEntry<float> RocketDamageChange;

	public static ConfigEntry<bool> RocketEnableJump;

	public static ConfigEntry<bool> RocketJumpMode;

	public static ConfigEntry<float> RocketJumpFlatMultiplier;

	public static ConfigEntry<float> RocketJumpMultiplier;

	public static ConfigEntry<float> RocketJumpReduction;

	public static ConfigEntry<bool> RocketEnableHoming;

	public static ConfigEntry<float> RocketHomingAngle;

	public static ConfigEntry<bool> RocketEnablePowerScaling;

	public static ConfigEntry<float> RocketDamageScaling;

	public static ConfigEntry<float> RocketRadiusScaling;

	public static ConfigEntry<float> RocketVelocityScaling;

	public static ConfigEntry<float> RocketJumpScaling;

	public static ConfigEntry<bool> RocketEnableFinalHoming;

	public static ConfigEntry<bool> RocketEnableFinalVelocityIncrease;

	public static ConfigEntry<float> RocketFinalVelocity;

	public static ConfigEntry<bool> RocketEnableCooldownOnAttackSpeed;

	public static ConfigEntry<bool> RocketEnableRestockOnRelease;

	public static ConfigEntry<bool> RocketEnableRestockOnDestroy;

	public static ConfigEntry<bool> SpearEnableConfig;

	public static ConfigEntry<bool> SpearEnableMove;

	public static ConfigEntry<float> SpearHorizontalMultiplier;

	public static ConfigEntry<float> SpearVerticalMultiplier;

	public static ConfigEntry<bool> NailgunEnableConfig;

	public static ConfigEntry<bool> NailgunEnableMove;

	public static ConfigEntry<float> NailgunHorizontalMultiplier;

	public static ConfigEntry<float> NailgunVerticalMultiplier;

	private void Awake()
	{
		//IL_060e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0618: Expected O, but got Unknown
		//IL_061e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0628: Expected O, but got Unknown
		//IL_062e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0638: Expected O, but got Unknown
		//IL_063e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0648: Expected O, but got Unknown
		//IL_064e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0658: Expected O, but got Unknown
		//IL_065e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0668: Expected O, but got Unknown
		//IL_066e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0678: Expected O, but got Unknown
		//IL_067e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0688: Expected O, but got Unknown
		//IL_068e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0698: Expected O, but got Unknown
		//IL_069e: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a8: Expected O, but got Unknown
		//IL_06ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06be: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d9: Expected O, but got Unknown
		//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06de: Expected O, but got Unknown
		//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ee: Expected O, but got Unknown
		//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fe: Expected O, but got Unknown
		//IL_0704: Unknown result type (might be due to invalid IL or missing references)
		//IL_070e: Expected O, but got Unknown
		//IL_0714: Unknown result type (might be due to invalid IL or missing references)
		//IL_071e: Expected O, but got Unknown
		//IL_0724: Unknown result type (might be due to invalid IL or missing references)
		//IL_072e: Expected O, but got Unknown
		//IL_0734: Unknown result type (might be due to invalid IL or missing references)
		//IL_073e: Expected O, but got Unknown
		//IL_0744: Unknown result type (might be due to invalid IL or missing references)
		//IL_074e: Expected O, but got Unknown
		//IL_0754: Unknown result type (might be due to invalid IL or missing references)
		//IL_075e: Expected O, but got Unknown
		//IL_0764: Unknown result type (might be due to invalid IL or missing references)
		//IL_076e: Expected O, but got Unknown
		//IL_0774: Unknown result type (might be due to invalid IL or missing references)
		//IL_077e: Expected O, but got Unknown
		//IL_0784: Unknown result type (might be due to invalid IL or missing references)
		//IL_078e: Expected O, but got Unknown
		//IL_0794: Unknown result type (might be due to invalid IL or missing references)
		//IL_079e: Expected O, but got Unknown
		//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ae: Expected O, but got Unknown
		//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07be: Expected O, but got Unknown
		//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ce: Expected O, but got Unknown
		//IL_07d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07de: Expected O, but got Unknown
		//IL_07e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ee: Expected O, but got Unknown
		//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_07fe: Expected O, but got Unknown
		//IL_0804: Unknown result type (might be due to invalid IL or missing references)
		//IL_080e: Expected O, but got Unknown
		//IL_0814: Unknown result type (might be due to invalid IL or missing references)
		//IL_081e: Expected O, but got Unknown
		//IL_0824: Unknown result type (might be due to invalid IL or missing references)
		//IL_082e: Expected O, but got Unknown
		//IL_0834: Unknown result type (might be due to invalid IL or missing references)
		//IL_083e: Expected O, but got Unknown
		//IL_0844: Unknown result type (might be due to invalid IL or missing references)
		//IL_084e: Expected O, but got Unknown
		//IL_0854: Unknown result type (might be due to invalid IL or missing references)
		//IL_085e: Expected O, but got Unknown
		//IL_0864: Unknown result type (might be due to invalid IL or missing references)
		//IL_086e: Expected O, but got Unknown
		//IL_0874: Unknown result type (might be due to invalid IL or missing references)
		//IL_087e: Expected O, but got Unknown
		//IL_0884: Unknown result type (might be due to invalid IL or missing references)
		//IL_088e: Expected O, but got Unknown
		//IL_0894: Unknown result type (might be due to invalid IL or missing references)
		//IL_089e: Expected O, but got Unknown
		//IL_08a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ae: Expected O, but got Unknown
		//IL_08b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_08be: Expected O, but got Unknown
		//IL_08c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_08ce: Expected O, but got Unknown
		//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_08e0: Expected O, but got Unknown
		//IL_08e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f2: Expected O, but got Unknown
		//IL_08fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0904: Expected O, but got Unknown
		//IL_090c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0916: Expected O, but got Unknown
		SawEnableConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Power-Saw", "Enable config", false, "Enable config?");
		SawEnableFly = ((BaseUnityPlugin)this).Config.Bind<bool>("Power-Saw", "Enable flying", true, "Enable flying function?");
		SawMoveVector = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Flying horizontal speed", 0.01f, "Control the horizontal fly speed from your aim direction");
		SawMoveVelocityVector = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Flying horizontal velocity addition", 0.2f, "Control the horizontal velocity increase from your aim direction");
		SawFlyVector = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Flying vertical velocity addition", 0.1f, "Control the vertical velocity increase when using saw");
		SawFlyJumpVector = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Flying vertical velocity addition on jump", 0.3f, "Control the vertical velocity increase when using saw and holding jump key");
		SawFlyJumpDownVector = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Flying vertical velocity addition on jump and fall", 0.4f, "Control the vertical velocity increase when using saw and holding jump key while falling");
		SawStuck = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Vertical velocity increase on enemy hit", 0.2f, "Control the vertical velocity increase when hitting an enemy midair");
		SawStuckJump = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Vertical velocity increase on enemy hit on jump", 1f, "Control the vertical velocity increase when hitting an enemy midair while holding jump button");
		SawStuckFall = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Vertical velocity increase on enemy hit on fall", 1f, "Control the vertical velocity increase when hitting an enemy midair while falling");
		SawEnableBarrier = ((BaseUnityPlugin)this).Config.Bind<bool>("Power-Saw", "Enable barrier on hit", true, "Enable barrier on hit function?");
		SawBarrierPercentage = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Barrior on hit percentage", 1f, "Control the barrier percentage");
		SawBarrierChance = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Barrior on hit chance", 12f, "Control the chance of getting barrier");
		SawBarrierChanceMode = ((BaseUnityPlugin)this).Config.Bind<float>("Power-Saw", "Barrior on hit chance mode", 2f, "1: Flat chance\n2: Chance based on maximum health\n3: Chance based on current health");
		RocketEnableConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable config", false, "Enable config?");
		RocketEnableVelocityChange = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable scrap velocity change", true, "Enable scrap velocity change?");
		RocketVelocityChange = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Scrap velocity change", 0.4f, "Control the scrap velocity change as a multiplier");
		RocketEnableDamageChange = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable scrap damage change", false, "Enable scrap damage multiplier change?");
		RocketDamageChange = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Scrap damage change", 1f, "Control the scrap damage change as a multiplier");
		RocketEnableJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable rocket jump", true, "Enable rocket jump?");
		RocketJumpMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Flat rocket jump", true, "Velocity addition will not be based on the distance between explosion and the player");
		RocketJumpFlatMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Flat rocket jump multiplier", 5f, "Control flat rocket jump velocity multiplier");
		RocketJumpMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Rocket jump multiplier", 1f, "Control non-flat rocket jump velocity multiplier");
		RocketJumpReduction = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Rocket jump reduction on ground", 3f, "Control the rocket jump reduction power on ground");
		RocketEnableHoming = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable scrap homing", true, "Enable scrap homing towards your cursor position?");
		RocketHomingAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Scrap homing angle", 0.5f, "Control the angle of scrap homing");
		RocketEnablePowerScaling = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable power scaling", true, "Enable scrap power increase the longer it is midair?");
		RocketDamageScaling = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Damage increase", 200f, "Control base damage percentage increase per second");
		RocketRadiusScaling = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Radius increase", 2f, "Control radius increase per second");
		RocketVelocityScaling = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Velocity increase", 0f, "Control velocity increase per second");
		RocketJumpScaling = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Rocket jump power increase", 0.1f, "Control rocket jump power increase per second");
		RocketEnableFinalHoming = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable unguiding on fire release", true, "Enable scrap unguiding on fire button release?");
		RocketEnableFinalVelocityIncrease = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable velocity increase on fire release", true, "Enable velocity increase on fire release?");
		RocketFinalVelocity = ((BaseUnityPlugin)this).Config.Bind<float>("Scrap Launcher", "Velocity increase on fire release", 3f, "Control velocity increase multiplier on fire release");
		RocketEnableCooldownOnAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable cooldown attack speed scaling", true, "Enable cooldown to scale from attack speed?");
		RocketEnableRestockOnRelease = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable restock on fire release", false, "Enable scrap restock on fire release?");
		RocketEnableRestockOnDestroy = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Launcher", "Enable restock on scrap explosion", false, "Enable scrap restock on its explosion?");
		SpearEnableConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Rebar Puncher", "Enable config", false, "Enable config?");
		SpearEnableMove = ((BaseUnityPlugin)this).Config.Bind<bool>("Rebar Puncher", "Enable function", true, "Enable velocity increase on fire?");
		SpearHorizontalMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Rebar Puncher", "Horizontal velocity multiplier", 3f, "Control the horizontal velocity multiplier");
		SpearVerticalMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Rebar Puncher", "Vertical velocity multiplier", 1f, "Control the vertical velocity multiplier");
		NailgunEnableConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Auto-Nailgun", "Enable config", false, "Enable config?");
		NailgunEnableMove = ((BaseUnityPlugin)this).Config.Bind<bool>("Auto-Nailgun", "Enable function", true, "Enable velocity increase on fire?");
		NailgunHorizontalMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Auto-Nailgun", "Horizontal velocity multiplier", -0.08f, "Control the horizontal velocity multiplier");
		NailgunVerticalMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Auto-Nailgun", "Vertical velocity multiplier", -0.04f, "Control the vertical velocity multiplier");
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SawEnableConfig));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SawEnableFly));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawMoveVector));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawMoveVelocityVector));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawFlyVector));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawFlyJumpVector));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawFlyJumpDownVector));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SawEnableBarrier));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawBarrierPercentage));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SawBarrierChance));
		ModSettingsManager.AddOption((BaseOption)new StepSliderOption(SawBarrierChanceMode, new StepSliderConfig
		{
			min = 1f,
			max = 3f,
			increment = 1f
		}));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableConfig));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableVelocityChange));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketVelocityChange));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableDamageChange));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketDamageChange));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableJump));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketJumpMode));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketJumpFlatMultiplier));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketJumpMultiplier));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketJumpReduction));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableHoming));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketHomingAngle));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnablePowerScaling));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketDamageScaling));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketRadiusScaling));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketVelocityScaling));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketJumpScaling));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableFinalHoming));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableFinalVelocityIncrease));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(RocketFinalVelocity));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableCooldownOnAttackSpeed));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableRestockOnRelease));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RocketEnableRestockOnDestroy));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpearEnableConfig));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(SpearEnableMove));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SpearHorizontalMultiplier));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(SpearVerticalMultiplier));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(NailgunEnableConfig));
		ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(NailgunEnableMove));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(NailgunHorizontalMultiplier));
		ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(NailgunVerticalMultiplier));
		FireBuzzsaw.FixedUpdate += new hook_FixedUpdate(Fly);
		FireGrenadeLauncher.OnEnter += new hook_OnEnter(ModifyProjectile);
		FireNailgun.FixedUpdate += new hook_FixedUpdate(Recoil);
		FireSpear.FireBullet += new hook_FireBullet(Pierce);
	}

	private void Recoil(orig_FixedUpdate orig, FireNailgun self)
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: 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_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self);
		if (NailgunEnableMove.Value && !((EntityState)self).characterMotor.isGrounded)
		{
			float num = ConfigFloat(NailgunHorizontalMultiplier, NailgunEnableConfig);
			float num2 = ConfigFloat(NailgunVerticalMultiplier, NailgunEnableConfig);
			Vector3 aimDirection = ((EntityState)self).inputBank.aimDirection;
			Vector3 normalized = ((Vector3)(ref aimDirection)).normalized;
			CharacterMotor characterMotor = ((EntityState)self).characterMotor;
			characterMotor.velocity += new Vector3(normalized.x * num, normalized.y * num2, normalized.z * num) * ((EntityState)self).characterBody.moveSpeed;
		}
	}

	private void ModifyProjectile(orig_OnEnter orig, FireGrenadeLauncher self)
	{
		orig.Invoke(self);
		if (RocketEnableCooldownOnAttackSpeed.Value)
		{
			if (((IToolbotPrimarySkillState)self).currentHand == 0 || ((IToolbotPrimarySkillState)self).currentHand == -1)
			{
				((EntityState)self).skillLocator.primary.RunRecharge(ConvertAmplificationPercentageIntoReductionPercentage(((BaseState)self).attackSpeedStat - 1f, ((EntityState)self).skillLocator.primary.cooldownRemaining));
			}
			if (((IToolbotPrimarySkillState)self).currentHand == 1)
			{
				((EntityState)self).skillLocator.secondary.RunRecharge(ConvertAmplificationPercentageIntoReductionPercentage(((BaseState)self).attackSpeedStat - 1f, ((EntityState)self).skillLocator.secondary.cooldownRemaining));
			}
		}
		if (!Object.op_Implicit((Object)(object)((GenericProjectileBaseState)self).projectilePrefab.GetComponent<RocketComponent>()))
		{
			RocketComponent rocketComponent = ((GenericProjectileBaseState)self).projectilePrefab.AddComponent<RocketComponent>();
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static float ConfigFloat(ConfigEntry<float> value, ConfigEntry<bool> enable)
	{
		if (enable.Value)
		{
			return value.Value;
		}
		return (float)((ConfigEntryBase)value).DefaultValue;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static int ConfigInt(ConfigEntry<int> value, ConfigEntry<bool> enable)
	{
		if (enable.Value)
		{
			return value.Value;
		}
		return (int)((ConfigEntryBase)value).DefaultValue;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static bool ConfigBool(ConfigEntry<bool> value, ConfigEntry<bool> enable)
	{
		if (enable.Value)
		{
			return value.Value;
		}
		return (bool)((ConfigEntryBase)value).DefaultValue;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static float ConvertAmplificationPercentageIntoReductionPercentage(float amplificationPercentage, float maxChance)
	{
		return (1f - maxChance / (maxChance + amplificationPercentage)) * maxChance;
	}

	private void Pierce(orig_FireBullet orig, FireSpear self, Ray aimRay)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_008c: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self, aimRay);
		if (SpearEnableMove.Value && !((EntityState)self).characterMotor.isGrounded && ((EntityState)self).inputBank.sprint.down)
		{
			float num = ConfigFloat(SpearHorizontalMultiplier, SpearEnableConfig);
			float num2 = ConfigFloat(SpearVerticalMultiplier, SpearEnableConfig);
			Vector3 aimDirection = ((EntityState)self).inputBank.aimDirection;
			Vector3 normalized = ((Vector3)(ref aimDirection)).normalized;
			CharacterMotor characterMotor = ((EntityState)self).characterMotor;
			characterMotor.velocity += new Vector3(normalized.x * num, normalized.y * num2, normalized.z * num) * ((EntityState)self).characterBody.moveSpeed;
		}
	}

	private void Fly(orig_FixedUpdate orig, FireBuzzsaw self)
	{
		//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_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_0166: Unknown result type (might be due to invalid IL or missing references)
		//IL_016b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke(self);
		if (SawEnableFly.Value && Object.op_Implicit((Object)(object)((EntityState)self).characterMotor))
		{
			Vector3 aimDirection = ((EntityState)self).inputBank.aimDirection;
			Vector3 normalized = ((Vector3)(ref aimDirection)).normalized;
			float num = ConfigFloat(SawFlyVector, SawEnableConfig);
			if (((EntityState)self).inputBank.jump.down)
			{
				num = ((!(((EntityState)self).characterMotor.velocity.y < 0f)) ? ConfigFloat(SawFlyJumpVector, SawEnableConfig) : ConfigFloat(SawFlyJumpDownVector, SawEnableConfig));
			}
			if (((BaseToolbotPrimarySkillState)self).isInDualWield)
			{
				num /= 2f;
			}
			aimDirection = ((EntityState)self).inputBank.aimDirection;
			float num2 = ((Vector3)(ref aimDirection)).normalized.x * ConfigFloat(SawMoveVelocityVector, SawEnableConfig);
			aimDirection = ((EntityState)self).inputBank.aimDirection;
			float num3 = ((Vector3)(ref aimDirection)).normalized.z * ConfigFloat(SawMoveVelocityVector, SawEnableConfig);
			CharacterMotor characterMotor = ((EntityState)self).characterMotor;
			characterMotor.velocity += new Vector3(num2, num, num3);
			CharacterMotor characterMotor2 = ((EntityState)self).characterMotor;
			characterMotor2.rootMotion += normalized * ConfigFloat(SawMoveVector, SawEnableConfig) * ((EntityState)self).characterBody.moveSpeed;
		}
		if (SawEnableBarrier.Value && self.hitOverlapLastTick)
		{
			if (!((BaseState)self).isGrounded)
			{
				float num4 = 0f;
				num4 = ((((EntityState)self).characterMotor.velocity.y < 0f) ? ConfigFloat(SawStuckFall, SawEnableConfig) : ((!((EntityState)self).inputBank.jump.down) ? ConfigFloat(SawStuck, SawEnableConfig) : ConfigFloat(SawStuckJump, SawEnableConfig)));
				CharacterMotor characterMotor3 = ((EntityState)self).characterMotor;
				characterMotor3.velocity += new Vector3(0f, num4, 0f);
			}
			float num5 = 0f;
			float num6 = ConfigFloat(SawBarrierChanceMode, SawEnableConfig);
			float num7 = num6;
			num5 = ((num7 == 1f) ? ConfigFloat(SawBarrierChance, SawEnableConfig) : ((num7 == 3f) ? ((((EntityState)self).characterBody.healthComponent.health + ((EntityState)self).characterBody.healthComponent.shield) * (ConfigFloat(SawBarrierChance, SawEnableConfig) / 10f) / ((EntityState)self).characterBody.healthComponent.barrier) : ((num7 != 2f) ? ((((EntityState)self).characterBody.healthComponent.fullHealth + ((EntityState)self).characterBody.healthComponent.fullShield) * (ConfigFloat(SawBarrierChance, SawEnableConfig) / 10f) / ((EntityState)self).characterBody.healthComponent.barrier) : ((((EntityState)self).characterBody.healthComponent.fullHealth + ((EntityState)self).characterBody.healthComponent.fullShield) * (ConfigFloat(SawBarrierChance, SawEnableConfig) / 10f) / ((EntityState)self).characterBody.healthComponent.barrier))));
			if (Util.CheckRoll(num5, 0f, (CharacterMaster)null))
			{
				((EntityState)self).characterBody.healthComponent.AddBarrierAuthority(((EntityState)self).characterBody.maxHealth * ConfigFloat(SawBarrierPercentage, SawEnableConfig) / 100f);
			}
		}
	}
}