Decompiled source of NoxiousCompatFix v1.0.2

NoxiousCompatFix.dll

Decompiled 4 days 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.2")]
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.2";

	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_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: 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;
			}
			flag2 = CustomConfigFile.Bind<bool>("Noxious Thorn Compatibility", "Should Nox Transfer Debuff: " + ((Object)val).name, 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);
	}
}