Decompiled source of Sacrifice Tweaks v1.1.5

SacrificeTweaks.dll

Decompiled 4 months 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 IL.RoR2.Artifacts;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RoR2;

[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("SacrificeTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8a180e3f0181a2a54e5079a0a19a39762c54a863")]
[assembly: AssemblyProduct("SacrificeTweaks")]
[assembly: AssemblyTitle("SacrificeTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SacrificeTweaks
{
	[BepInPlugin("com.Moffein.SacrificeTweaks", "Sacrifice Tweaks", "1.1.5")]
	public class SacrificeTweaks : BaseUnityPlugin
	{
		public void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0037: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_0071: Expected O, but got Unknown
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			//IL_00ab: Expected O, but got Unknown
			//IL_00c6: 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_00e5: Expected O, but got Unknown
			//IL_00e5: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Expected O, but got Unknown
			float baseDropChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sacrifice Tweaks", "Base Drop Chance"), 10f, new ConfigDescription("Base item drop chance.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float maxBaseDropChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sacrifice Tweaks", "Max Drop Chance"), 10f, new ConfigDescription("Maximum item drop chance when scaling.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float swarmDropChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sacrifice Tweaks", "Swarms Base Drop Chance"), 5f, new ConfigDescription("Base item drop chance when Swarms is enabled.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			float maxSwarmDropChance = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Sacrifice Tweaks", "Swarms Max Drop Chance"), 5f, new ConfigDescription("Maximum item drop chance when scaling while Swarms is enabled.", (AcceptableValueBase)null, Array.Empty<object>())).Value;
			SacrificeArtifactManager.OnServerCharacterDeath += (Manipulator)delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 5f)
				});
				val.EmitDelegate<Func<float, float>>((Func<float, float>)((float orig) => RunArtifactManager.instance.IsArtifactEnabled(Artifacts.swarmsArtifactDef) ? swarmDropChance : baseDropChance));
				val.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
				});
				val.EmitDelegate<Func<float, float>>((Func<float, float>)delegate(float orig)
				{
					float num = orig;
					if (orig > 0f)
					{
						bool flag = RunArtifactManager.instance.IsArtifactEnabled(Artifacts.swarmsArtifactDef);
						float num2 = baseDropChance;
						float num3 = maxBaseDropChance;
						if (flag)
						{
							num2 = swarmDropChance;
							num3 = maxSwarmDropChance;
						}
						if (num < num2)
						{
							num = num2;
						}
						if (num > num3)
						{
							num = num3;
						}
					}
					return num;
				});
			};
		}
	}
}
namespace R2API.Utils
{
	[AttributeUsage(AttributeTargets.Assembly)]
	public class ManualNetworkRegistrationAttribute : Attribute
	{
	}
}