Decompiled source of Phase Round Lightning v1.1.6

PhaseRoundLightning.dll

Decompiled a month 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 Microsoft.CodeAnalysis;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Orbs;
using RoR2.Projectile;
using UnityEngine;

[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 = "")]
[assembly: AssemblyCompany("PhaseRoundLightning")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PhaseRoundLightning")]
[assembly: AssemblyTitle("PhaseRoundLightning")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace PhaseRoundLightning
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[R2APISubmoduleDependency(new string[] { "LanguageAPI", "ContentAddition", "PrefabAPI" })]
	[BepInPlugin("com.Phreel.PhaseRoundLightningRevived", "Phase Round Lightning Revived", "1.1.6")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class PhaseRoundLightning : BaseUnityPlugin
	{
		private float projDamage;

		private float lightningDamage;

		private float procCoefficient;

		private float radius;

		private float resetInterval;

		private float attackInterval;

		public void Awake()
		{
			//IL_0012: 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_0031: Expected O, but got Unknown
			//IL_0031: Expected O, but got Unknown
			//IL_004c: 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_006b: Expected O, but got Unknown
			//IL_006b: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Expected O, but got Unknown
			//IL_00a5: Expected O, but got Unknown
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00df: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0119: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_0153: Expected O, but got Unknown
			projDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General Settings", "Projectile Damage"), 4.5f, new ConfigDescription("How much damage direct hits with Phase Round deals.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			lightningDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General Settings", "Damage"), 1.5f, new ConfigDescription("How much damage the lightning deals.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			procCoefficient = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("General Settings", "Lightning Proc Coefficient"), 0.5f, new ConfigDescription("Affects the effectiveness of procs triggered by the lightning.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			radius = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lightning Settings", "Radius"), 10f, new ConfigDescription("How far the lightning can reach.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			resetInterval = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lightning Settings", "Reset Interval"), 10f, new ConfigDescription("How often the list of targets hit should be reset. Lower this value to allow the lightning to hit the same target multiple times.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			attackInterval = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Lightning Settings", "Attack Interval"), 0.06f, new ConfigDescription("How often a lightning attack should be sent out.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			string text = "Fire a piercing round for <style=cIsDamage>" + projDamage.ToString("P0").Replace(" ", "").Replace(",", "") + " damage</style>.";
			text = text + " Zaps nearby enemies for <style=cIsDamage>" + lightningDamage.ToString("P0").Replace(" ", "").Replace(",", "") + " damage</style>.";
			LanguageAPI.Add("COMMANDO_SECONDARY_DESCRIPTION", text);
			EntityStateConfiguration val = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/EntityStates.Commando.CommandoWeapon.FireFMJ");
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == "projectilePrefab")
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = (Object)(object)BuildProjectilePrefab();
				}
			}
		}

		private GameObject BuildProjectilePrefab()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/fmjramping"), "MoffeinPhaseRoundLightning", true);
			ProjectileProximityBeamController val2 = val.GetComponent<ProjectileProximityBeamController>();
			if (!Object.op_Implicit((Object)(object)val2))
			{
				val2 = val.AddComponent<ProjectileProximityBeamController>();
			}
			val2.attackFireCount = 1;
			val2.attackInterval = attackInterval;
			val2.attackRange = radius;
			val2.listClearInterval = resetInterval;
			val2.minAngleFilter = 0f;
			val2.maxAngleFilter = 180f;
			val2.procCoefficient = procCoefficient;
			val2.damageCoefficient = projDamage / 3f * (lightningDamage / projDamage);
			val2.bounces = 0;
			val2.lightningType = (LightningType)0;
			ProjectileSimple component = val.GetComponent<ProjectileSimple>();
			component.lifetime = 10f;
			ProjectileOverlapAttack component2 = val.GetComponent<ProjectileOverlapAttack>();
			component2.onServerHit = null;
			component2.damageCoefficient = projDamage / 3f;
			ContentAddition.AddProjectile(val);
			return val;
		}
	}
}