Decompiled source of NoxiousCompatFix v1.0.4

NoxiousCompatFix.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using On.RoR2;
using RoR2;
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("NoxiousCompatFix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoxiousCompatFix")]
[assembly: AssemblyTitle("NoxiousCompatFix")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoxiousCompatFix;

[BepInPlugin("com.RiskOfBrainrot.NoxiousCompatFix", "NoxiousCompatFix", "1.0.4")]
public class NoxiousCompatPlugin : BaseUnityPlugin
{
	public const string guid = "com.RiskOfBrainrot.NoxiousCompatFix";

	public const string teamName = "RiskOfBrainrot";

	public const string modName = "NoxiousCompatFix";

	public const string version = "1.0.4";

	internal static ConfigFile CustomConfigFile { get; set; }

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\com.RiskOfBrainrot.NoxiousCompatFix.cfg", true);
		BuffCatalog.SetBuffDefs += new hook_SetBuffDefs(NoxiousThornDebuffCompat);
	}

	private void NoxiousThornDebuffCompat(orig_SetBuffDefs orig, BuffDef[] newBuffDefs)
	{
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		foreach (BuffDef val in newBuffDefs)
		{
			if (!val.isDebuff && !val.isDOT)
			{
				continue;
			}
			bool flag = !((Enum)val.flags).HasFlag((Enum)(object)(Flags)1);
			bool flag2 = flag;
			string name = ((Object)val).name;
			string text = name;
			if (text == "bdLunarDetonationCharge")
			{
				flag2 = true;
			}
			string text2 = ((Object)val).name.Replace(" ", "");
			text2 = text2.Replace("=", "");
			text2 = text2.Replace("\n", "");
			text2 = text2.Replace("\t", "");
			text2 = text2.Replace("\\", "");
			text2 = text2.Replace("\"", "");
			text2 = text2.Replace("'", "");
			text2 = text2.Replace("[", "");
			text2 = text2.Replace("]", "");
			flag2 = CustomConfigFile.Bind<bool>("Noxious Thorn Compatibility", "Should Nox Transfer Debuff: " + text2 + "?", flag2, $"Vanilla value is {flag}. Set to TRUE for Noxious Thorn to transfer this debuff on kill.").Value;
			if (flag2 != flag)
			{
				if (flag)
				{
					val.flags = (Flags)(val.flags | 1);
				}
				else
				{
					val.flags = (Flags)(val.flags & -2);
				}
			}
		}
		orig.Invoke(newBuffDefs);
	}
}