Decompiled source of ArtifactOfTheUnchained v2.0.1

plugins/ArtifactOfTheUnchained.dll

Decompiled 32 minutes ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using SS2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ArtifactOfTheUnchained")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c54cac7ce31de349e2a46628641455b55789e726")]
[assembly: AssemblyProduct("ArtifactOfTheUnchained")]
[assembly: AssemblyTitle("ArtifactOfTheUnchained")]
[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 ArtifactOfTheUnchained
{
	public abstract class ArtifactBase
	{
		public ArtifactDef ArtifactDef;

		public abstract string ArtifactName { get; }

		public abstract string ArtifactLangTokenName { get; }

		public abstract string ArtifactDescription { get; }

		public abstract Sprite ArtifactEnabledIcon { get; }

		public abstract Sprite ArtifactDisabledIcon { get; }

		public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(ArtifactDef);

		public abstract void Init(ConfigFile config);

		protected void CreateLang()
		{
			LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName);
			LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription);
		}

		protected void CreateArtifact()
		{
			ArtifactDef = ScriptableObject.CreateInstance<ArtifactDef>();
			ArtifactDef.cachedName = "ARTIFACT_" + ArtifactLangTokenName;
			ArtifactDef.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME";
			ArtifactDef.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION";
			ArtifactDef.smallIconSelectedSprite = ArtifactEnabledIcon;
			ArtifactDef.smallIconDeselectedSprite = ArtifactDisabledIcon;
			ContentAddition.AddArtifactDef(ArtifactDef);
		}

		public abstract void Hooks();
	}
	public static class Assets
	{
		public static AssetBundle AssetBundle;

		public const string BundleName = "unchainedartifacticons";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Main.PluginInfo.Location), "unchainedartifacticons");

		public static void Init()
		{
			AssetBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	public static class ConfigOptions
	{
		public static ConfigEntry<bool> ServersideMode;

		public static ConfigEntry<int> ProcChainAmountLimit;

		public static ConfigEntry<float> ProcChainDamageNerfToPercent;

		public static ConfigEntry<float> ProcChainCoefficientNerfToPercent;

		public static ConfigEntry<bool> AllowEquipmentProcs;

		public static ConfigEntry<bool> AllowSawmerangProcs;

		public static ConfigEntry<bool> AllowElectricBoomerangProcs;

		public static ConfigEntry<bool> AllowGenericMissileProcs;

		public static ConfigEntry<bool> AllowFireworkProcs;

		public static ConfigEntry<bool> AllowShurikenProcs;

		public static ConfigEntry<bool> AllowEgoProcs;

		public static ConfigEntry<bool> AllowGloopProcs;

		public static ConfigEntry<bool> AllowAspectProcs;

		public static ConfigEntry<bool> AllowProcCrits;

		public static void BindConfigEntries(ConfigFile Config, ArtifactBase artifactInstance)
		{
			ServersideMode = Config.Bind<bool>(artifactInstance.ArtifactName, "Run serverside without artifact", false, "Should the mod run server-side only? This means the effects of the artifact will always on without needing to activate it.");
			ProcChainAmountLimit = Config.Bind<int>(artifactInstance.ArtifactName, "Proc chaining limit", 1, "The limit for how many times items can proc each other. 0 means item procs cannot chain into any other items, i.e. an atg hit will never chain into anytihng else. Set to -1 for vanilla behavior.");
			ProcChainDamageNerfToPercent = Config.Bind<float>(artifactInstance.ArtifactName, "Nerf chained procs damage", 0.2f, "Should damage from chained procs (i.e. polylute from an atg) be reduced to a percent of what they would normally do? I.E. 0.2 is 20% of the normal damage, and 1 is vanilla behavior as there is no change.");
			ProcChainCoefficientNerfToPercent = Config.Bind<float>(artifactInstance.ArtifactName, "Nerf chained procs coefficient", 1f, "Should the proc coefficients for chained procs (i.e. polylute from an atg) be reduced to a percent of what they would normally are? I.E. 0.1 is 10% of the normal proc coefficient, and 1 is vanilla behavior as there is no change.");
			AllowEquipmentProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow equipments to proc items", true, "Should damage from equipments be allowed to proc your on-hit items? This works for all vanilla equipment except for Forgive Me Please and a few that have their own config option.");
			AllowSawmerangProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Sawmerang to proc", true, "Should damage from Sawmerang be allowed to proc your on-hit items? WARNING: This will also disable the equipment's built-in bleed on hit!\nThis setting is completely separate from the general equipment procs setting, meaning you can let sawmerang proc while preventing all other equipments from proccing.");
			AllowElectricBoomerangProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Electric Boomerang to proc", true, "Should damage from Electric Boomerang be allowed to proc your on-hit items? WARNING: This will also disable the item's built-in stun on hit!");
			AllowGenericMissileProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Missiles to proc", true, "Should damage from any missiles that aren't ATG missiles be allowed to proc your on-hit items? WARNING: This counts for Starstorm 2's Armed Backpack alongside Disposable Missile Launcher!");
			AllowFireworkProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Fireworks to proc items", true, "Should damage from Fireworks be allowed to proc your on-hit items?");
			AllowShurikenProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Shurikens to proc items", true, "Should damage from Shurikens be allowed to proc your on-hit items?");
			AllowEgoProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Egocentrism to proc items", true, "Should damage from Egocentrism be allowed to proc your on-hit items?");
			AllowGloopProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow Genesis Loop to proc items", true, "Should damage from Genesis Loop be allowed to proc your on-hit items?");
			AllowAspectProcs = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow attacks from elite aspects to proc items", true, "Should damage from malachite, perfected, gilded, and twisted elites' aspect attacks be allowed to proc your on-hit items? WARNING: Disabling this will also disable those attacks applying an aspect's guranteed debuff such as malachite's healing disable!");
			AllowProcCrits = Config.Bind<bool>(artifactInstance.ArtifactName, "Allow item procs to crit", true, "Should damage from item procs be allowed to crit?");
		}
	}
	internal static class DamageRelated
	{
		public static ModdedProcType ProccedByItem;

		internal static void CharacterMaster_OnBodyDamaged(DamageReport damageReport)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			if (IsDamageReportSafeToModify(damageReport))
			{
				PreventProcChainingIfPastLimit(damageReport);
				if (ProcTypeAPI.HasModdedProc(damageReport.damageInfo.procChainMask, ProccedByItem))
				{
					NerfDamageReportBasedOnConfig(damageReport);
				}
				else if (Object.op_Implicit((Object)(object)damageReport.attackerMaster.playerCharacterMasterController))
				{
					ProcTypeAPI.AddModdedProc(ref damageReport.damageInfo.procChainMask, ProccedByItem);
				}
				else
				{
					HandleMonsterDamage(damageReport);
				}
			}
		}

		private static void HandleMonsterDamage(DamageReport damageReport)
		{
			//IL_0053: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)damageReport.damageInfo.inflictor) && damageReport.damageInfo.procChainMask.mask == 0)
			{
				ProcTypeAPI.AddModdedProc(ref damageReport.damageInfo.procChainMask, ProccedByItem);
			}
			else if (damageReport.damageInfo.procChainMask.mask != 0)
			{
				if (GetVanillaProcCountInChain(damageReport.damageInfo.procChainMask) > 1)
				{
					NerfDamageReportBasedOnConfig(damageReport);
				}
			}
			else if (IsInflictorSpecificItem(damageReport.damageInfo.inflictor))
			{
				ProcTypeAPI.AddModdedProc(ref damageReport.damageInfo.procChainMask, ProccedByItem);
			}
		}

		internal static bool IsDamageReportSafeToModify(DamageReport damageReport)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)damageReport.attacker))
			{
				return false;
			}
			if (!Object.op_Implicit((Object)(object)damageReport.attackerMaster))
			{
				return false;
			}
			if (((Enum)damageReport.damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)67108864))
			{
				return false;
			}
			if (IsDamageBrokenWithoutInflictor(damageReport.damageInfo))
			{
				return false;
			}
			if (!ShouldAllowNormalConfigurableItemProcs(damageReport.damageInfo))
			{
				if (!ConfigOptions.AllowProcCrits.Value)
				{
					damageReport.damageInfo.crit = false;
				}
				DamageInfo damageInfo = damageReport.damageInfo;
				damageInfo.procCoefficient *= ConfigOptions.ProcChainCoefficientNerfToPercent.Value;
				return false;
			}
			if (((DamageTypeCombo)(ref damageReport.damageInfo.damageType)).IsDamageSourceSkillBased)
			{
				return false;
			}
			if (Object.op_Implicit((Object)(object)damageReport.damageInfo.inflictor) && ((Object)damageReport.damageInfo.inflictor).name == "BossMissileProjectile(Clone)")
			{
				damageReport.damageInfo.procCoefficient = 0f;
				return false;
			}
			return true;
		}

		internal static bool IsDamageBrokenWithoutInflictor(DamageInfo damageInfo)
		{
			if (damageInfo.damageType.damageTypeCombined == 131328)
			{
				return true;
			}
			string name = ((Object)damageInfo.attacker).name;
			if (name == "SulfurPodBody(Clone)" || name == "ShrineBlood(Clone)")
			{
				return true;
			}
			return false;
		}

		internal static bool ShouldAllowNormalConfigurableItemProcs(DamageInfo damageInfo)
		{
			if (!Object.op_Implicit((Object)(object)damageInfo.inflictor))
			{
				return true;
			}
			bool result = true;
			switch (((Object)damageInfo.inflictor).name)
			{
			case "StunAndPierceBoomerang(Clone)":
				if (!ConfigOptions.AllowElectricBoomerangProcs.Value)
				{
					result = false;
				}
				break;
			case "FireworkProjectile(Clone)":
				if (!ConfigOptions.AllowFireworkProcs.Value)
				{
					result = false;
				}
				break;
			case "ShurikenProjectile(Clone)":
				if (!ConfigOptions.AllowShurikenProcs.Value)
				{
					result = false;
				}
				break;
			case "LunarSunProjectile(Clone)":
				if (!ConfigOptions.AllowEgoProcs.Value)
				{
					result = false;
				}
				break;
			case "VagrantNovaItemBodyAttachment(Clone)":
				if (!ConfigOptions.AllowGloopProcs.Value)
				{
					result = false;
				}
				break;
			case "GoldGatController(Clone)":
			case "BeamSphere(Clone)":
			case "MeteorStorm(Clone)":
			case "VendingMachineProjectile(Clone)":
			case "FireballVehicle(Clone)":
				if (!ConfigOptions.AllowEquipmentProcs.Value)
				{
					result = false;
				}
				break;
			case "Sawmerang(Clone)":
				if (!ConfigOptions.AllowSawmerangProcs.Value)
				{
					result = false;
				}
				break;
			case "MissileProjectile(Clone)":
				if (damageInfo.procChainMask.mask == 0 && !ConfigOptions.AllowGenericMissileProcs.Value)
				{
					result = false;
				}
				break;
			case "LunarMissileProjectile(Clone)":
			case "PoisonOrbProjectile(Clone)":
			case "PoisonStakeProjectile(Clone)":
			case "AffixAurelionitePreStrikeProjectile(Clone)":
			case "AffixAurelioniteCenterProjectile(Clone)":
			case "BeadProjectileTrackingBomb(Clone)":
				if (!ConfigOptions.AllowAspectProcs.Value)
				{
					result = false;
				}
				break;
			}
			return result;
		}

		internal static void NerfDamageReportBasedOnConfig(DamageReport damageReport)
		{
			if (!ConfigOptions.AllowProcCrits.Value)
			{
				damageReport.damageInfo.crit = false;
			}
			damageReport.damageDealt *= ConfigOptions.ProcChainDamageNerfToPercent.Value;
			DamageInfo damageInfo = damageReport.damageInfo;
			damageInfo.procCoefficient *= ConfigOptions.ProcChainCoefficientNerfToPercent.Value;
		}

		internal static int GetVanillaProcCountInChain(ProcChainMask procChainMask)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (ProcType val = (ProcType)0; (int)val < 24; val = (ProcType)(val + 1))
			{
				if (((ProcChainMask)(ref procChainMask)).HasProc(val))
				{
					num++;
				}
			}
			return num;
		}

		internal static bool IsProcChainPastLimit(ProcChainMask procChainMask)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (ConfigOptions.ProcChainAmountLimit.Value != -1)
			{
				return GetVanillaProcCountInChain(procChainMask) > ConfigOptions.ProcChainAmountLimit.Value;
			}
			return false;
		}

		internal static void PreventProcChainingIfPastLimit(DamageReport damageReport)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			if (damageReport.damageInfo.procChainMask.mask != 0 && IsProcChainPastLimit(damageReport.damageInfo.procChainMask))
			{
				damageReport.damageInfo.procCoefficient = 0f;
			}
		}

		internal static bool IsInflictorSpecificItem(GameObject inflictor)
		{
			switch (((Object)inflictor).name)
			{
			case "DaggerProjectile(Clone)":
			case "LampBulletPlayer(Clone)":
			case "IcicleAura(Clone)":
			case "RunicMeteorStrikeImpact(Clone)":
			case "IfritPylonPlayerBody(Clone)":
			case "MushroomWard(Clone)":
			case "ThunderAuraStrike(Clone)":
			case "LunarShockwave(Clone)":
				return true;
			default:
				return false;
			}
		}

		internal static void LogDamageInfo(DamageInfo damageInfo)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: 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_013c: 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_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			Log.Debug("");
			Log.Debug("");
			Log.Debug("");
			Log.Debug($"damageInfo.damageType.damageSource is {damageInfo.damageType.damageSource}");
			Log.Debug($"damageInfo.damageType.IsDamageSourceSkillBased is {((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased}");
			Log.Debug($"attacker is {damageInfo.attacker}");
			Log.Debug($"canRejectForce is {damageInfo.canRejectForce}");
			Log.Debug($"crit is {damageInfo.crit}");
			Log.Debug($"damage is {damageInfo.damage}");
			Log.Debug($"damageColorIndex is {damageInfo.damageColorIndex}");
			Log.Debug($"damageType is {damageInfo.damageType}");
			Log.Debug($"damageType.damageType is {damageInfo.damageType.damageType}");
			Log.Debug($"damageType.damageTypeCombined is {damageInfo.damageType.damageTypeCombined}");
			Log.Debug($"damageType.damageTypeExtended is {damageInfo.damageType.damageTypeExtended}");
			Log.Debug($"dotIndex is {damageInfo.dotIndex}");
			Log.Debug($"force is {damageInfo.force}");
			Log.Debug($"inflictor is {damageInfo.inflictor}");
			Log.Debug($"position is {damageInfo.position}");
			Log.Debug($"procChainMask is {damageInfo.procChainMask}");
			Log.Debug($"procChainMask.mask is {damageInfo.procChainMask.mask}");
			Log.Debug($"procCoefficient is {damageInfo.procCoefficient}");
			Log.Debug($"rejected is {damageInfo.rejected}");
		}
	}
	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);
		}
	}
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("LordVGames.ArtifactOfTheUnchained", "ArtifactOfTheUnchained", "2.0.1")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "LordVGames.ArtifactOfTheUnchained";

		public const string PluginAuthor = "LordVGames";

		public const string PluginName = "ArtifactOfTheUnchained";

		public const string PluginVersion = "2.0.1";

		public List<ArtifactBase> Artifacts = new List<ArtifactBase>();

		public static string ArtifactDescription;

		public static PluginInfo PluginInfo { get; private set; }

		public void Awake()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			PluginInfo = ((BaseUnityPlugin)this).Info;
			Log.Init(((BaseUnityPlugin)this).Logger);
			Assets.Init();
			DamageRelated.ProccedByItem = ProcTypeAPI.ReserveProcType();
			foreach (Type item in from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ArtifactBase))
				select type)
			{
				ArtifactBase artifactBase = (ArtifactBase)Activator.CreateInstance(item);
				ConfigOptions.BindConfigEntries(((BaseUnityPlugin)this).Config, artifactBase);
				if (ConfigOptions.ServersideMode.Value)
				{
					CharacterMaster.OnBodyDamaged += new hook_OnBodyDamaged(CharacterMaster_OnBodyDamaged_Serverside);
				}
				else
				{
					artifactBase.Init(((BaseUnityPlugin)this).Config);
				}
			}
		}

		private void CharacterMaster_OnBodyDamaged_Serverside(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport damageReport)
		{
			DamageRelated.CharacterMaster_OnBodyDamaged(damageReport);
			orig.Invoke(self, damageReport);
		}
	}
	public class ArtifactOfTheUnchained : ArtifactBase
	{
		public override string ArtifactLangTokenName => "NO_PROC_CHAINS";

		public override string ArtifactName => "Artifact of the Unchained";

		public override string ArtifactDescription => "Nerfs proc chains and procs caused by items such as fireworks, all depending on how you've configured the mod.";

		public override Sprite ArtifactEnabledIcon => Assets.AssetBundle.LoadAsset<Sprite>("NoProcChainsArtifactIcon_Enabled.png");

		public override Sprite ArtifactDisabledIcon => Assets.AssetBundle.LoadAsset<Sprite>("NoProcChainsArtifactIcon_Disabled.png");

		public override void Init(ConfigFile config)
		{
			CreateLang();
			CreateArtifact();
			Hooks();
			if (ModSupport.RiskOfOptions.ModIsRunning)
			{
				ModSupport.RiskOfOptions.AddOptions();
			}
		}

		public override void Hooks()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			CharacterMaster.OnBodyDamaged += new hook_OnBodyDamaged(CharacterMaster_OnBodyDamaged_Artifact);
		}

		private void CharacterMaster_OnBodyDamaged_Artifact(orig_OnBodyDamaged orig, CharacterMaster self, DamageReport damageReport)
		{
			if (!base.ArtifactEnabled)
			{
				orig.Invoke(self, damageReport);
				return;
			}
			DamageRelated.CharacterMaster_OnBodyDamaged(damageReport);
			orig.Invoke(self, damageReport);
		}
	}
	internal static class ModSupport
	{
		public static class RiskOfOptions
		{
			private static bool? _modexists;

			public static bool ModIsRunning
			{
				get
				{
					if (!_modexists.HasValue)
					{
						_modexists = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
					}
					return _modexists.Value;
				}
			}

			[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
			public static void AddOptions()
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				//IL_0041: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: 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_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Expected O, but got Unknown
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Expected O, but got Unknown
				//IL_008c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0096: Expected O, but got Unknown
				//IL_009b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c3: Expected O, but got Unknown
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Expected O, but got Unknown
				//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Expected O, but got Unknown
				ModSettingsManager.SetModIcon(Assets.AssetBundle.LoadAsset<Sprite>("RoOIcon.png"));
				ModSettingsManager.SetModDescription("Adds an artifact that prevents your items from proccing your on-hit items for you.");
				ModSettingsManager.AddOption((BaseOption)new IntFieldOption(ConfigOptions.ProcChainAmountLimit));
				ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(ConfigOptions.ProcChainDamageNerfToPercent));
				ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(ConfigOptions.ProcChainCoefficientNerfToPercent));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowEquipmentProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowSawmerangProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowElectricBoomerangProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowGenericMissileProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowFireworkProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowShurikenProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowEgoProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowGloopProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowAspectProcs));
				ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigOptions.AllowProcCrits));
			}
		}

		internal static class Starstorm2
		{
			private static bool? _modexists;

			public static bool ModIsRunning
			{
				get
				{
					if (!_modexists.HasValue)
					{
						_modexists = Chainloader.PluginInfos.ContainsKey("com.TeamMoonstorm");
					}
					return _modexists.Value;
				}
			}

			internal static ItemDef ChirrFlowerItemDef
			{
				get
				{
					if (ModIsRunning)
					{
						return Items.FlowerTurret;
					}
					return null;
				}
			}
		}
	}
}