Decompiled source of ArtiQOL v1.1.2

ArtiQOL.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 BepInEx.Logging;
using EntityStates;
using EntityStates.Mage;
using EntityStates.Mage.Weapon;
using Microsoft.CodeAnalysis;
using On.EntityStates.Mage.Weapon;
using On.RoR2;
using On.RoR2.Skills;
using R2API;
using RoR2;
using RoR2.Projectile;
using RoR2.Skills;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[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 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 myArtiTweaks
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("IrrationalIntegral.ArtiQOL", "ArtiQOL", "1.1.1")]
	public class myArtiTweaks : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__Flamethrower_OnEnter;

			public static hook_OnEnter <1>__ChargeIceBomb_OnEnter;

			public static hook_OnEnter <2>__PrepWall_OnEnter;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_FixedUpdate <>9__30_0;

			public static hook_FixedUpdate <>9__30_1;

			public static hook_Init <>9__30_2;

			internal void <Awake>b__30_0(orig_FixedUpdate orig, AntiGravityForce self)
			{
				self.antiGravityCoefficient = AntiGravModifier;
				orig.Invoke(self);
			}

			internal void <Awake>b__30_1(orig_FixedUpdate orig, BaseChargeBombState self)
			{
				if (((EntityState)self).isAuthority && self.CalcCharge() > 0.98f)
				{
					((EntityState)self).fixedAge = self.duration * 0.98f;
				}
				orig.Invoke(self);
			}

			internal void <Awake>b__30_2(orig_Init orig)
			{
				orig.Invoke();
				if (IonSurgeHeightEnabled)
				{
					FlyUpState.duration *= IonSurgeHeightModifier;
				}
				if (JetpackThrustEnabled)
				{
					JetpackOn.hoverAcceleration *= JetpackThrustModifier;
				}
				if (FlamethrowerSprintingEnabled)
				{
					SkillDef val = Resources.Load<SkillDef>("skilldefs/magebody/MageBodyFlamethrower");
					if (Object.op_Implicit((Object)(object)val))
					{
						val.canceledFromSprinting = false;
						val.cancelSprintingOnActivation = false;
					}
				}
				if (M2SprintingEnabled)
				{
					SkillDef val2 = Resources.Load<SkillDef>("skilldefs/magebody/MageBodyNovaBomb");
					if (Object.op_Implicit((Object)(object)val2))
					{
						val2.cancelSprintingOnActivation = false;
					}
					SkillDef val3 = Resources.Load<SkillDef>("skilldefs/magebody/MageBodyIceBomb");
					if (Object.op_Implicit((Object)(object)val3))
					{
						val3.cancelSprintingOnActivation = false;
					}
				}
			}
		}

		public const string PluginGUID = "IrrationalIntegral.ArtiQOL";

		public const string PluginAuthor = "IrrationalIntegral";

		public const string PluginName = "ArtiQOL";

		public const string PluginVersion = "1.1.1";

		public static bool AntiGravEnabled;

		public static float AntiGravModifier;

		public static bool FlamethrowerTweaks;

		public static float FlamethrowerRangeModifier;

		public static bool FlamethrowerSprintingEnabled;

		public static float FlamethrowerDamageCoeff;

		public static float Flamethrowerignitechance;

		public static bool IonSurgeHeightEnabled;

		public static float IonSurgeHeightModifier;

		public static bool JetpackThrustEnabled;

		public static float JetpackThrustModifier;

		public static bool M2InfiniteChargeEnabled;

		public static bool M2SprintingEnabled;

		public static bool IceSpearTweaks;

		public static float IceSpearCastTime;

		public static float IceSpearProcCoeffModifier;

		public static float IceSpearMaxDmgModifier;

		public static float IceWallSpeed;

		public static string IceSpearSkillToken => "secondary_ice";

		public static string IceSpearDescText => "<style=cIsUtility>Freezing</style>. Charge up a <style=cIsDamage>piercing</style> nano-spear that deals <style=cIsDamage>" + d(4f) + "-" + d(IceSpearMaxDmgModifier) + "</style> damage.";

		public static string FlamethrowerSkillToken => "special_fire";

		public static string FlamethrowerDescText => "<style=cIsDamage>Ignite</style>. Burn all enemies in front of you for <style=cIsDamage>" + d(FlamethrowerDamageCoeff + FlamethrowerDamageCoeff / (1f / (Flamethrowerignitechance / 100f))) + " damage</style>.";

		public void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_0132: 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: Expected O, but got Unknown
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			LoadConfig();
			if (AntiGravEnabled)
			{
				object obj = <>c.<>9__30_0;
				if (obj == null)
				{
					hook_FixedUpdate val = delegate(orig_FixedUpdate orig, AntiGravityForce self)
					{
						self.antiGravityCoefficient = AntiGravModifier;
						orig.Invoke(self);
					};
					<>c.<>9__30_0 = val;
					obj = (object)val;
				}
				AntiGravityForce.FixedUpdate += (hook_FixedUpdate)obj;
			}
			if (FlamethrowerTweaks)
			{
				object obj2 = <>O.<0>__Flamethrower_OnEnter;
				if (obj2 == null)
				{
					hook_OnEnter val2 = Flamethrower_OnEnter;
					<>O.<0>__Flamethrower_OnEnter = val2;
					obj2 = (object)val2;
				}
				Flamethrower.OnEnter += (hook_OnEnter)obj2;
				string text = "MAGE_" + FlamethrowerSkillToken.ToUpper() + "_DESCRIPTION";
				LanguageAPI.Add(text, FlamethrowerDescText);
			}
			if (M2InfiniteChargeEnabled)
			{
				object obj3 = <>c.<>9__30_1;
				if (obj3 == null)
				{
					hook_FixedUpdate val3 = delegate(orig_FixedUpdate orig, BaseChargeBombState self)
					{
						if (((EntityState)self).isAuthority && self.CalcCharge() > 0.98f)
						{
							((EntityState)self).fixedAge = self.duration * 0.98f;
						}
						orig.Invoke(self);
					};
					<>c.<>9__30_1 = val3;
					obj3 = (object)val3;
				}
				BaseChargeBombState.FixedUpdate += (hook_FixedUpdate)obj3;
			}
			if (IceSpearTweaks)
			{
				object obj4 = <>O.<1>__ChargeIceBomb_OnEnter;
				if (obj4 == null)
				{
					hook_OnEnter val4 = ChargeIceBomb_OnEnter;
					<>O.<1>__ChargeIceBomb_OnEnter = val4;
					obj4 = (object)val4;
				}
				BaseChargeBombState.OnEnter += (hook_OnEnter)obj4;
				BaseThrowBombState.OnEnter += new hook_OnEnter(ThrownIceBomb_OnEnter);
				string text2 = "MAGE_" + IceSpearSkillToken.ToUpper() + "_DESCRIPTION";
				LanguageAPI.Add(text2, IceSpearDescText);
			}
			object obj5 = <>O.<2>__PrepWall_OnEnter;
			if (obj5 == null)
			{
				hook_OnEnter val5 = PrepWall_OnEnter;
				<>O.<2>__PrepWall_OnEnter = val5;
				obj5 = (object)val5;
			}
			PrepWall.OnEnter += (hook_OnEnter)obj5;
			object obj6 = <>c.<>9__30_2;
			if (obj6 == null)
			{
				hook_Init val6 = delegate(orig_Init orig)
				{
					orig.Invoke();
					if (IonSurgeHeightEnabled)
					{
						FlyUpState.duration *= IonSurgeHeightModifier;
					}
					if (JetpackThrustEnabled)
					{
						JetpackOn.hoverAcceleration *= JetpackThrustModifier;
					}
					if (FlamethrowerSprintingEnabled)
					{
						SkillDef val7 = Resources.Load<SkillDef>("skilldefs/magebody/MageBodyFlamethrower");
						if (Object.op_Implicit((Object)(object)val7))
						{
							val7.canceledFromSprinting = false;
							val7.cancelSprintingOnActivation = false;
						}
					}
					if (M2SprintingEnabled)
					{
						SkillDef val8 = Resources.Load<SkillDef>("skilldefs/magebody/MageBodyNovaBomb");
						if (Object.op_Implicit((Object)(object)val8))
						{
							val8.cancelSprintingOnActivation = false;
						}
						SkillDef val9 = Resources.Load<SkillDef>("skilldefs/magebody/MageBodyIceBomb");
						if (Object.op_Implicit((Object)(object)val9))
						{
							val9.cancelSprintingOnActivation = false;
						}
					}
				};
				<>c.<>9__30_2 = val6;
				obj6 = (object)val6;
			}
			SkillCatalog.Init += (hook_Init)obj6;
		}

		private static void Flamethrower_OnEnter(orig_OnEnter orig, Flamethrower self)
		{
			if (((EntityState)self).isAuthority)
			{
				self.maxDistance *= FlamethrowerRangeModifier;
			}
			Flamethrower.totalDamageCoefficient = FlamethrowerDamageCoeff;
			Flamethrower.ignitePercentChance = Flamethrowerignitechance;
			orig.Invoke(self);
		}

		private static void ChargeIceBomb_OnEnter(orig_OnEnter orig, BaseChargeBombState self)
		{
			if (self is ChargeIcebomb)
			{
				self.baseDuration = IceSpearCastTime;
			}
			orig.Invoke(self);
		}

		private static void PrepWall_OnEnter(orig_OnEnter orig, PrepWall self)
		{
			self.duration = PrepWall.baseDuration / IceWallSpeed;
			orig.Invoke(self);
		}

		private void ThrownIceBomb_OnEnter(orig_OnEnter orig, BaseThrowBombState self)
		{
			if (self is ThrowIcebomb)
			{
				self.projectilePrefab.GetComponent<ProjectileController>().procCoefficient = IceSpearProcCoeffModifier;
				self.maxDamageCoefficient = IceSpearMaxDmgModifier;
			}
			orig.Invoke(self);
		}

		public static string d(float dmgMod)
		{
			return dmgMod * 100f + "%";
		}

		private void LoadConfig()
		{
			//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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_009a: Expected O, but got Unknown
			//IL_00b4: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_0108: Expected O, but got Unknown
			//IL_0122: 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_0141: Expected O, but got Unknown
			//IL_0141: Expected O, but got Unknown
			//IL_015b: 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_017a: Expected O, but got Unknown
			//IL_017a: Expected O, but got Unknown
			//IL_0194: 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_01af: Expected O, but got Unknown
			//IL_01af: Expected O, but got Unknown
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Expected O, but got Unknown
			//IL_01e8: Expected O, but got Unknown
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Expected O, but got Unknown
			//IL_021d: Expected O, but got Unknown
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Expected O, but got Unknown
			//IL_0256: Expected O, but got Unknown
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Expected O, but got Unknown
			//IL_028b: Expected O, but got Unknown
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02c0: Expected O, but got Unknown
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Expected O, but got Unknown
			//IL_02f5: Expected O, but got Unknown
			//IL_030f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Expected O, but got Unknown
			//IL_032e: Expected O, but got Unknown
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Expected O, but got Unknown
			//IL_0367: Expected O, but got Unknown
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Expected O, but got Unknown
			//IL_03a0: Expected O, but got Unknown
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Expected O, but got Unknown
			//IL_03d9: Expected O, but got Unknown
			AntiGravEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Gravity", "Anti Gravity Enabled"), false, new ConfigDescription("Enable modifying Anti Gravity", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			AntiGravModifier = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Gravity", "Anti Gravity Value"), 1f, new ConfigDescription("Affects Gravity on Artificer's NanoBomb and Void Fiend's Corrupted Flood. No Gravity: 1, Vanilla Value: 0.7", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			FlamethrowerTweaks = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Flamethrower", "Tweaks"), true, new ConfigDescription("Enable modifying Flamethrower range", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			FlamethrowerRangeModifier = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Flamethrower", "Range Modifier"), 1.5f, new ConfigDescription("Multiply Flamethrower range by this value.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			FlamethrowerSprintingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Flamethrower", "Sprinting Enabled"), true, new ConfigDescription("Enable sprinting during Flamethrower usage", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			FlamethrowerDamageCoeff = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Flamethrower", "Tatal Damage"), 20f, new ConfigDescription("Change Flamethrower damage to this value. Vanilla Value: 20", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			Flamethrowerignitechance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Flamethrower", "Ignite Chance"), 100f, new ConfigDescription("Change Flamethrower ignite chance to this value. Vanilla Value: 50", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IonSurgeHeightEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Ion Surge", "Height Enabled"), true, new ConfigDescription("Enable modifying IonSurge Height", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IonSurgeHeightModifier = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Ion Surge", "Height Modifier"), 0.95f, new ConfigDescription("Modify Ion Surge height by this value.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			JetpackThrustEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Jetpack", "Thrust Enabled"), true, new ConfigDescription("Enable modifying Jetpack thrust", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			JetpackThrustModifier = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Jetpack", "Thrust Modifier"), 1.5f, new ConfigDescription("Modify how fast Jetpack slows your fall", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			M2InfiniteChargeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("M2", "Infinite Charge Enabled"), false, new ConfigDescription("Enable holding M2 Max Charge Infinitely", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			M2SprintingEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("M2", "Sprinting Enabled"), true, new ConfigDescription("Do not cancel sprint during M2 usage", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IceSpearTweaks = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Ice Spear", "Tweaks"), true, new ConfigDescription("Enable modifying Ice Spear cast time", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IceSpearCastTime = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Ice Spear", "Cast Time"), 1.375f, new ConfigDescription("Modify Ice Spear cast time to this value in seconds. Vanilla value: 2.0", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IceSpearProcCoeffModifier = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Ice Spear", "Proc Coefficient"), 1f, new ConfigDescription("Modify Ice Spear proc coefficient to this value. Vanilla value: 1.0", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IceSpearMaxDmgModifier = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Ice Spear", "Max Damage Modifier"), 15f, new ConfigDescription("Modify Ice Spear maximum charge damage. Vanilla value: 12", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			IceWallSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Ice Wall", "Speed"), 4f, new ConfigDescription("Modify Cast time of snapfreeze, higher is faster. Vanilla value: 1", (AcceptableValueBase)null, Array.Empty<object>())).Value;
		}
	}
}