Decompiled source of FasterProcChains v1.0.1

FasterProcChains.dll

Decompiled 3 weeks ago
using System;
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 BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2.Orbs;
using RoR2;
using RoR2.Orbs;
using RoR2.Projectile;
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("FasterProcChains")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+23ea7e10894255552568fa9c678395df455738b0")]
[assembly: AssemblyProduct("FasterProcChains")]
[assembly: AssemblyTitle("FasterProcChains")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FasterProcChains
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("swuff.FasterProcChains", "FasterProcChains", "1.0.1")]
	public class FasterProcChainsPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "swuff.FasterProcChains";

		public const string PluginAuthor = "swuff";

		public const string PluginName = "FasterProcChains";

		public const string PluginVersion = "1.0.1";

		public static ConfigEntry<bool> MissileConfig { get; set; }

		public static ConfigEntry<bool> FireworkConfig { get; set; }

		public static ConfigEntry<bool> VoidMissileConfig { get; set; }

		public static ConfigEntry<bool> DaggerConfig { get; set; }

		public static ConfigEntry<bool> StunAndPierceBoomerangConfig { get; set; }

		public static ConfigEntry<bool> BossMissileConfig { get; set; }

		public static ConfigEntry<bool> UkuleleConfig { get; set; }

		public static ConfigEntry<bool> TeslaConfig { get; set; }

		public static ConfigEntry<bool> RazorConfig { get; set; }

		public void Awake()
		{
			MakeConfig();
			ModifyProjectiles();
		}

		public void MakeConfig()
		{
			MissileConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "ATG Missile Speed Changes", true, "Enable ATG speedup?");
			FireworkConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Firework Speed Changes", true, "Enable Firework speedup?");
			VoidMissileConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Plasma Shrimp Speed Changes", true, "Enable Plasma Shrimp speedup?");
			DaggerConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Ceremonial Dagger Speed Changes", true, "Enable Ceremonial Dagger speedup?");
			StunAndPierceBoomerangConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Electric Boomerang Speed Changes", true, "Enable Electric Boomerang speedup?");
			BossMissileConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Warbonds missile Speed Changes", true, "Enable Warbonds missile speedup?");
			UkuleleConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Ukulele Speed Changes", true, "Enable Ukulele speedup?");
			TeslaConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Tesla Coil Speed Changes", true, "Enable Tesla Coil speedup?");
			RazorConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Projectile Config", "Razorwire Speed Changes", true, "Enable Razorwire speedup?");
		}

		public void ModifyProjectiles()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Expected O, but got Unknown
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			if (MissileConfig.Value)
			{
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"2b983d683d9cd5a4595c990f5ff28c51").WaitForCompletion();
				MissileController val2 = default(MissileController);
				if ((Object)(object)val != (Object)null && val.TryGetComponent<MissileController>(ref val2))
				{
					val2.maxVelocity = 75f;
					val2.delayTimer = 0.1f;
					val2.giveupTimer = 4f;
					val2.deathTimer = 8f;
					val2.acceleration = 9f;
				}
			}
			if (FireworkConfig.Value)
			{
				GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)"041fe0a68f990b843acd9652941f8f87").WaitForCompletion();
				MissileController val4 = default(MissileController);
				if ((Object)(object)val3 != (Object)null && val3.TryGetComponent<MissileController>(ref val4))
				{
					val4.maxVelocity = 75f;
					val4.giveupTimer = 4f;
					val4.deathTimer = 8f;
					val4.acceleration = 9f;
				}
			}
			if (VoidMissileConfig.Value)
			{
				GameObject val5 = Addressables.LoadAssetAsync<GameObject>((object)"e006990e46d3b7b4eb92dcebf62d2307").WaitForCompletion();
				MissileController val6 = default(MissileController);
				if ((Object)(object)val5 != (Object)null && val5.TryGetComponent<MissileController>(ref val6))
				{
					val6.maxVelocity = 80f;
				}
			}
			if (DaggerConfig.Value)
			{
				GameObject val7 = Addressables.LoadAssetAsync<GameObject>((object)"35853d5e14376084a9b9fe465c7ea20d").WaitForCompletion();
				if ((Object)(object)val7 != (Object)null)
				{
					ProjectileSimple val8 = default(ProjectileSimple);
					if (val7.TryGetComponent<ProjectileSimple>(ref val8))
					{
						val8.desiredForwardSpeed = 200f;
						EnableOnTimer enableOnTimer = val7.AddComponent<EnableOnTimer>();
						enableOnTimer.componentToToggle = (MonoBehaviour)(object)val8;
						enableOnTimer.active = false;
						enableOnTimer. = true;
						enableOnTimer.duration = 3.05f;
					}
					ProjectileDirectionalTargetFinder componentToToggle = default(ProjectileDirectionalTargetFinder);
					if (val7.TryGetComponent<ProjectileDirectionalTargetFinder>(ref componentToToggle))
					{
						EnableOnTimer enableOnTimer2 = val7.AddComponent<EnableOnTimer>();
						enableOnTimer2.componentToToggle = (MonoBehaviour)(object)componentToToggle;
						enableOnTimer2.duration = 0.25f;
						EnableOnTimer enableOnTimer3 = val7.AddComponent<EnableOnTimer>();
						enableOnTimer3.componentToToggle = (MonoBehaviour)(object)componentToToggle;
						enableOnTimer3.active = false;
						enableOnTimer3.duration = 3.05f;
					}
					ProjectileSteerTowardTarget componentToToggle2 = default(ProjectileSteerTowardTarget);
					if (val7.TryGetComponent<ProjectileSteerTowardTarget>(ref componentToToggle2))
					{
						EnableOnTimer enableOnTimer4 = val7.AddComponent<EnableOnTimer>();
						enableOnTimer4.componentToToggle = (MonoBehaviour)(object)componentToToggle2;
						enableOnTimer4.duration = 0.25f;
						EnableOnTimer enableOnTimer5 = val7.AddComponent<EnableOnTimer>();
						enableOnTimer5.componentToToggle = (MonoBehaviour)(object)componentToToggle2;
						enableOnTimer5.active = false;
						enableOnTimer5.duration = 3.05f;
					}
					DestroyOnTimer val9 = default(DestroyOnTimer);
					if (val7.TryGetComponent<DestroyOnTimer>(ref val9))
					{
						val9.duration = 3.25f;
					}
				}
			}
			if (StunAndPierceBoomerangConfig.Value)
			{
				GameObject val10 = Addressables.LoadAssetAsync<GameObject>((object)"c3e60bb47577fdc4692263b66eec052e").WaitForCompletion();
				BoomerangProjectile val11 = default(BoomerangProjectile);
				if ((Object)(object)val10 != (Object)null && val10.TryGetComponent<BoomerangProjectile>(ref val11))
				{
					val11.travelSpeed = 90f;
				}
			}
			if (BossMissileConfig.Value)
			{
				GameObject val12 = Addressables.LoadAssetAsync<GameObject>((object)"5d325a2b9a87683448896f2fae27570c").WaitForCompletion();
				ProjectileSimple val13 = default(ProjectileSimple);
				if ((Object)(object)val12 != (Object)null && val12.TryGetComponent<ProjectileSimple>(ref val13))
				{
					val13.desiredForwardSpeed = 600f;
				}
			}
			LightningOrb.Begin += new hook_Begin(LightningOrb_Begin);
		}

		private void LightningOrb_Begin(orig_Begin orig, LightningOrb self)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			bool flag = false;
			float genericFloat = 0.1f;
			string text = null;
			LightningType lightningType = self.lightningType;
			LightningType val = lightningType;
			if ((int)val != 0)
			{
				if ((int)val != 1)
				{
					if ((int)val == 6)
					{
						text = "Prefabs/Effects/OrbEffects/RazorwireOrbEffect";
						genericFloat = 0.05f;
						flag = RazorConfig.Value;
					}
				}
				else
				{
					text = "Prefabs/Effects/OrbEffects/TeslaOrbEffect";
					genericFloat = 0.025f;
					flag = TeslaConfig.Value;
				}
			}
			else
			{
				text = "Prefabs/Effects/OrbEffects/LightningOrbEffect";
				genericFloat = 0.025f;
				flag = UkuleleConfig.Value;
			}
			if (flag)
			{
				EffectData val2 = new EffectData
				{
					origin = ((Orb)self).origin,
					genericFloat = genericFloat
				};
				val2.SetHurtBoxReference(((Orb)self).target);
				EffectManager.SpawnEffect(OrbStorageUtility.Get(text), val2, true);
			}
			else
			{
				orig.Invoke(self);
			}
		}
	}
	public class EnableOnTimer : MonoBehaviour
	{
		public float duration;

		private float timer;

		public MonoBehaviour componentToToggle;

		public bool active = true;

		private bool triggered = false;

		public bool  = false;

		public void FixedUpdate()
		{
			timer += Time.fixedDeltaTime;
			if (!triggered && timer >= duration)
			{
				triggered = true;
				((Behaviour)componentToToggle).enabled = active;
				if ()
				{
					((Component)this).GetComponent<Rigidbody>().useGravity = true;
				}
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}