Decompiled source of ConfigurableVoidBand v1.0.0

ConfigurableVoidBand.dll

Decompiled 6 months 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 BepInEx.Logging;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.Networking;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("ConfigurableVoidBand")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ConfigurableVoidBand")]
[assembly: AssemblyTitle("ConfigurableVoidBand")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ExamplePlugin
{
	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);
		}
	}
}
namespace ConfigurableVoidBand
{
	[BepInPlugin("TaranDev.ConfigurableVoidBand", "ConfigurableVoidBand", "1.0.0")]
	public class ConfigurableVoidBand : BaseUnityPlugin
	{
		public const string PluginGUID = "TaranDev.ConfigurableVoidBand";

		public const string PluginAuthor = "TaranDev";

		public const string PluginName = "ConfigurableVoidBand";

		public const string PluginVersion = "1.0.0";

		public static ConfigEntry<float> cooldown;

		public static ConfigEntry<float> baseTotalDamage;

		public static ConfigEntry<float> totalDamagePerStack;

		public static ConfigEntry<float> baseRadius;

		public static ConfigEntry<float> radiusPerStack;

		public static ConfigEntry<float> basePullForce;

		public static ConfigEntry<float> pullForcePerStack;

		public void Awake()
		{
			configs();
		}

		private void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(OnHitEnemy);
		}

		private void OnDisable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			GlobalEventManager.OnHitEnemy -= new hook_OnHitEnemy(OnHitEnemy);
		}

		private static void OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
		{
			//IL_0121: 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_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0273: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			if (damageInfo.procCoefficient == 0f || damageInfo.rejected || !NetworkServer.active || !Object.op_Implicit((Object)(object)damageInfo.attacker) || !(damageInfo.procCoefficient > 0f))
			{
				return;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			CharacterMaster master = component.master;
			if (!Object.op_Implicit((Object)(object)master))
			{
				return;
			}
			Inventory inventory = master.inventory;
			if (!((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)12) && damageInfo.damage / component.damage >= 4f && component.HasBuff(Buffs.ElementalRingVoidReady))
			{
				int itemCount = inventory.GetItemCount(Items.ElementalRingVoid);
				component.RemoveBuff(Buffs.ElementalRingVoidReady);
				for (int i = 1; (float)i <= cooldown.Value; i++)
				{
					component.AddTimedBuff(Buffs.ElementalRingVoidCooldown, (float)i);
				}
				ProcChainMask procChainMask = damageInfo.procChainMask;
				((ProcChainMask)(ref procChainMask)).AddProc((ProcType)12);
				if (itemCount > 0)
				{
					GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/ElementalRingVoidBlackHole");
					RadialForce component2 = val.GetComponent<RadialForce>();
					ProjectileExplosion component3 = val.GetComponent<ProjectileExplosion>();
					float num = (baseRadius.Value + radiusPerStack.Value * (float)(itemCount - 1)) / 15f;
					val.transform.localScale = new Vector3(num, num, num);
					component2.radius = baseRadius.Value + radiusPerStack.Value * (float)(itemCount - 1);
					component2.forceMagnitude = 0f - (basePullForce.Value * 100f + pullForcePerStack.Value * 10f * (float)(itemCount - 1));
					component3.blastRadius = baseRadius.Value + radiusPerStack.Value * (float)(itemCount - 1);
					float num2 = baseTotalDamage.Value + totalDamagePerStack.Value * (float)(itemCount - 1);
					float damage = Util.OnHitProcDamage(damageInfo.damage, component.damage, num2);
					ProjectileManager.instance.FireProjectile(new FireProjectileInfo
					{
						damage = damage,
						crit = damageInfo.crit,
						damageColorIndex = (DamageColorIndex)9,
						position = damageInfo.position,
						procChainMask = procChainMask,
						force = 6000f,
						owner = damageInfo.attacker,
						projectilePrefab = val,
						rotation = Quaternion.identity,
						target = null
					});
				}
			}
			orig.Invoke(self, damageInfo, victim);
		}

		private void configs()
		{
			//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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//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)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Expected O, but got Unknown
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: 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_01bd: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected O, but got Unknown
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: 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)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Expected O, but got Unknown
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Expected O, but got Unknown
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_0271: Expected O, but got Unknown
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Expected O, but got Unknown
			cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Cooldown", 20f, "Default is 20.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(cooldown, new StepSliderConfig
			{
				min = 0f,
				max = 50f,
				increment = 1f
			}));
			baseTotalDamage = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Base Total Damage", 1f, "Each increment of 1 is 100% damage, so 1 is 100% base damage and 5 is 500% base damage. Default is 1.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(baseTotalDamage, new StepSliderConfig
			{
				min = 0f,
				max = 250f,
				increment = 0.25f
			}));
			totalDamagePerStack = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Additional Total Damage Per Stack", 1f, "Each increment of 1 is +100% damage, so 1 is +100% base damage and 5 is +500% base damage. Default is 1.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(totalDamagePerStack, new StepSliderConfig
			{
				min = 0f,
				max = 250f,
				increment = 0.25f
			}));
			baseRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Base Radius", 10f, "Default is 10.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(baseRadius, new StepSliderConfig
			{
				min = 0f,
				max = 250f,
				increment = 0.25f
			}));
			radiusPerStack = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Additional Radius Per Stack", 3f, "Default is 3.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(radiusPerStack, new StepSliderConfig
			{
				min = 0f,
				max = 250f,
				increment = 0.25f
			}));
			basePullForce = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Base Pull Force", 10f, "Default is 10.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(basePullForce, new StepSliderConfig
			{
				min = 0f,
				max = 250f,
				increment = 0.25f
			}));
			pullForcePerStack = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Additional Pull Force Per Stack", 5f, "Default is 5.");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(pullForcePerStack, new StepSliderConfig
			{
				min = 0f,
				max = 250f,
				increment = 0.25f
			}));
		}
	}
}