Decompiled source of BossDropRewardDelay v1.0.0

BossDropRewardDelay.dll

Decompiled 18 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace BossDropRewardDelay;

internal static class BuildInfo
{
	public const string Version = "1.0.0";
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInIncompatibility("com.DestroyedClone.BossDropRewardDelay")]
[BepInIncompatibility("com.YourName.BossDropDelay")]
[BepInPlugin("com.Videowiz92.BossDropRewardDelay", "Boss Drop Reward Delay", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3 <>9__13_0;

		public static hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool <>9__13_1;

		public static hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool <>9__13_2;

		public static hook_CreatePickupDroplet_PickupIndex_Vector3_Vector3 <>9__13_3;

		public static hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 <>9__13_4;

		internal void <Awake>b__13_0(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3 orig, UniquePickup pickup, Vector3 position, Vector3 velocity)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			<>c__DisplayClass13_0 CS$<>8__locals8 = new <>c__DisplayClass13_0
			{
				orig = orig,
				pickup = pickup,
				position = position,
				velocity = velocity
			};
			if (!Capture(delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				CS$<>8__locals8.orig.Invoke(CS$<>8__locals8.pickup, CS$<>8__locals8.position, CS$<>8__locals8.velocity);
			}))
			{
				CS$<>8__locals8.orig.Invoke(CS$<>8__locals8.pickup, CS$<>8__locals8.position, CS$<>8__locals8.velocity);
			}
		}

		internal void <Awake>b__13_1(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool orig, UniquePickup pickup, Vector3 position, Vector3 velocity, bool a)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass13_1 CS$<>8__locals10 = new <>c__DisplayClass13_1
			{
				orig = orig,
				pickup = pickup,
				position = position,
				velocity = velocity,
				a = a
			};
			if (!Capture(delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				CS$<>8__locals10.orig.Invoke(CS$<>8__locals10.pickup, CS$<>8__locals10.position, CS$<>8__locals10.velocity, CS$<>8__locals10.a);
			}))
			{
				CS$<>8__locals10.orig.Invoke(CS$<>8__locals10.pickup, CS$<>8__locals10.position, CS$<>8__locals10.velocity, CS$<>8__locals10.a);
			}
		}

		internal void <Awake>b__13_2(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool orig, UniquePickup pickup, Vector3 position, Vector3 velocity, bool a, bool b)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass13_2 CS$<>8__locals12 = new <>c__DisplayClass13_2
			{
				orig = orig,
				pickup = pickup,
				position = position,
				velocity = velocity,
				a = a,
				b = b
			};
			if (!Capture(delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				CS$<>8__locals12.orig.Invoke(CS$<>8__locals12.pickup, CS$<>8__locals12.position, CS$<>8__locals12.velocity, CS$<>8__locals12.a, CS$<>8__locals12.b);
			}))
			{
				CS$<>8__locals12.orig.Invoke(CS$<>8__locals12.pickup, CS$<>8__locals12.position, CS$<>8__locals12.velocity, CS$<>8__locals12.a, CS$<>8__locals12.b);
			}
		}

		internal void <Awake>b__13_3(orig_CreatePickupDroplet_PickupIndex_Vector3_Vector3 orig, PickupIndex pickupIndex, Vector3 position, Vector3 velocity)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			<>c__DisplayClass13_3 CS$<>8__locals8 = new <>c__DisplayClass13_3
			{
				orig = orig,
				pickupIndex = pickupIndex,
				position = position,
				velocity = velocity
			};
			if (!Capture(delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				CS$<>8__locals8.orig.Invoke(CS$<>8__locals8.pickupIndex, CS$<>8__locals8.position, CS$<>8__locals8.velocity);
			}))
			{
				CS$<>8__locals8.orig.Invoke(CS$<>8__locals8.pickupIndex, CS$<>8__locals8.position, CS$<>8__locals8.velocity);
			}
		}

		internal void <Awake>b__13_4(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo info, Vector3 position, Vector3 velocity)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			<>c__DisplayClass13_4 CS$<>8__locals8 = new <>c__DisplayClass13_4
			{
				orig = orig,
				info = info,
				position = position,
				velocity = velocity
			};
			if (!Capture(delegate
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				CS$<>8__locals8.orig.Invoke(CS$<>8__locals8.info, CS$<>8__locals8.position, CS$<>8__locals8.velocity);
			}))
			{
				CS$<>8__locals8.orig.Invoke(CS$<>8__locals8.info, CS$<>8__locals8.position, CS$<>8__locals8.velocity);
			}
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass13_0
	{
		public orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3 orig;

		public UniquePickup pickup;

		public Vector3 position;

		public Vector3 velocity;

		internal void <Awake>b__5()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(pickup, position, velocity);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass13_1
	{
		public orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool orig;

		public UniquePickup pickup;

		public Vector3 position;

		public Vector3 velocity;

		public bool a;

		internal void <Awake>b__6()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(pickup, position, velocity, a);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass13_2
	{
		public orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool orig;

		public UniquePickup pickup;

		public Vector3 position;

		public Vector3 velocity;

		public bool a;

		public bool b;

		internal void <Awake>b__7()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(pickup, position, velocity, a, b);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass13_3
	{
		public orig_CreatePickupDroplet_PickupIndex_Vector3_Vector3 orig;

		public PickupIndex pickupIndex;

		public Vector3 position;

		public Vector3 velocity;

		internal void <Awake>b__8()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(pickupIndex, position, velocity);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass13_4
	{
		public orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig;

		public CreatePickupInfo info;

		public Vector3 position;

		public Vector3 velocity;

		internal void <Awake>b__9()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(info, position, velocity);
		}
	}

	public const string ModName = "BossDropRewardDelay";

	public const string FormattedModName = "Boss Drop Reward Delay";

	public const string Author = "Videowiz92";

	public const string OriginalAuthor = "DestroyedClone";

	public const string Guid = "com.Videowiz92.BossDropRewardDelay";

	public const string Version = "1.0.0";

	public static ConfigEntry<float> cfgSpawnDelay;

	public static ConfigEntry<int> cfgBatchSize;

	private static List<Action> captureQueue;

	public static float SpawnDelay => Mathf.Max(0f, cfgSpawnDelay.Value);

	public static int BatchSize => Math.Max(1, cfgBatchSize.Value);

	private void Awake()
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Expected O, but got Unknown
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e0: Expected O, but got Unknown
		//IL_00f9: 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_0104: Expected O, but got Unknown
		cfgSpawnDelay = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Delay Between Drops", 0.3f, "The amount of time, in seconds, between each drop.");
		cfgBatchSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Item Batch Size", 1, "The amount of items dropped in each tick");
		BossGroup.DropRewards += new hook_DropRewards(BossGroup_DropRewards);
		object obj = <>c.<>9__13_0;
		if (obj == null)
		{
			hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3 val = delegate(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3 orig, UniquePickup pickup, Vector3 position, Vector3 velocity)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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 (!Capture(delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(pickup, position, velocity);
				}))
				{
					orig.Invoke(pickup, position, velocity);
				}
			};
			<>c.<>9__13_0 = val;
			obj = (object)val;
		}
		PickupDropletController.CreatePickupDroplet_UniquePickup_Vector3_Vector3 += (hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3)obj;
		object obj2 = <>c.<>9__13_1;
		if (obj2 == null)
		{
			hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool val2 = delegate(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool orig, UniquePickup pickup, Vector3 position, Vector3 velocity, bool a)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				if (!Capture(delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(pickup, position, velocity, a);
				}))
				{
					orig.Invoke(pickup, position, velocity, a);
				}
			};
			<>c.<>9__13_1 = val2;
			obj2 = (object)val2;
		}
		PickupDropletController.CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool += (hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool)obj2;
		object obj3 = <>c.<>9__13_2;
		if (obj3 == null)
		{
			hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool val3 = delegate(orig_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool orig, UniquePickup pickup, Vector3 position, Vector3 velocity, bool a, bool b)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				if (!Capture(delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(pickup, position, velocity, a, b);
				}))
				{
					orig.Invoke(pickup, position, velocity, a, b);
				}
			};
			<>c.<>9__13_2 = val3;
			obj3 = (object)val3;
		}
		PickupDropletController.CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool += (hook_CreatePickupDroplet_UniquePickup_Vector3_Vector3_bool_bool)obj3;
		object obj4 = <>c.<>9__13_3;
		if (obj4 == null)
		{
			hook_CreatePickupDroplet_PickupIndex_Vector3_Vector3 val4 = delegate(orig_CreatePickupDroplet_PickupIndex_Vector3_Vector3 orig, PickupIndex pickupIndex, Vector3 position, Vector3 velocity)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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 (!Capture(delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(pickupIndex, position, velocity);
				}))
				{
					orig.Invoke(pickupIndex, position, velocity);
				}
			};
			<>c.<>9__13_3 = val4;
			obj4 = (object)val4;
		}
		PickupDropletController.CreatePickupDroplet_PickupIndex_Vector3_Vector3 += (hook_CreatePickupDroplet_PickupIndex_Vector3_Vector3)obj4;
		object obj5 = <>c.<>9__13_4;
		if (obj5 == null)
		{
			hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 val5 = delegate(orig_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 orig, CreatePickupInfo info, Vector3 position, Vector3 velocity)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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 (!Capture(delegate
				{
					//IL_0007: Unknown result type (might be due to invalid IL or missing references)
					//IL_000d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0013: Unknown result type (might be due to invalid IL or missing references)
					orig.Invoke(info, position, velocity);
				}))
				{
					orig.Invoke(info, position, velocity);
				}
			};
			<>c.<>9__13_4 = val5;
			obj5 = (object)val5;
		}
		PickupDropletController.CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3 += (hook_CreatePickupDroplet_CreatePickupInfo_Vector3_Vector3)obj5;
		if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
		{
			ModCompat_RiskOfOptions();
		}
	}

	private static bool Capture(Action spawn)
	{
		if (captureQueue == null)
		{
			return false;
		}
		captureQueue.Add(spawn);
		return true;
	}

	private void BossGroup_DropRewards(orig_DropRewards orig, BossGroup self)
	{
		if (!NetworkServer.active)
		{
			orig.Invoke(self);
			return;
		}
		List<Action> queue = new List<Action>();
		List<Action> list = captureQueue;
		captureQueue = queue;
		try
		{
			orig.Invoke(self);
		}
		finally
		{
			captureQueue = list;
			Release(queue);
		}
	}

	private void Release(List<Action> queue)
	{
		if (queue.Count == 0)
		{
			return;
		}
		int batchSize = BatchSize;
		float spawnDelay = SpawnDelay;
		if (spawnDelay <= 0f || queue.Count <= batchSize)
		{
			foreach (Action item in queue)
			{
				Invoke(item);
			}
			return;
		}
		((MonoBehaviour)this).StartCoroutine(DropQueued(queue, batchSize, spawnDelay));
	}

	private IEnumerator DropQueued(List<Action> queue, int batchSize, float delay)
	{
		Stage startStage = Stage.instance;
		int index = 0;
		while (index < queue.Count && NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance) && !((Object)(object)Stage.instance != (Object)(object)startStage))
		{
			for (int num = Math.Min(index + batchSize, queue.Count); index < num; index++)
			{
				Invoke(queue[index]);
			}
			if (index < queue.Count)
			{
				yield return (object)new WaitForSeconds(delay);
			}
		}
	}

	private void Invoke(Action spawn)
	{
		try
		{
			spawn();
		}
		catch (Exception arg)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to spawn a boss reward droplet: {arg}");
		}
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	private void ModCompat_RiskOfOptions()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: 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_0030: Expected O, but got Unknown
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		ModSettingsManager.AddOption((BaseOption)new SliderOption(cfgSpawnDelay, new SliderConfig
		{
			min = 0.01f,
			max = 4f,
			FormatString = "{0:0.00}s"
		}), "com.Videowiz92.BossDropRewardDelay", "Boss Drop Reward Delay");
		ModSettingsManager.AddOption((BaseOption)new IntSliderOption(cfgBatchSize, new IntSliderConfig
		{
			min = 1,
			max = 50
		}), "com.Videowiz92.BossDropRewardDelay", "Boss Drop Reward Delay");
		ModSettingsManager.SetModDescription("Adds a short delay between boss drops to prevent lagspikes/crashing at large drop counts. Original mod by DestroyedClone.", "com.Videowiz92.BossDropRewardDelay", "Boss Drop Reward Delay");
		Sprite val = LoadIconSprite();
		if ((Object)(object)val != (Object)null)
		{
			ModSettingsManager.SetModIcon(val, "com.Videowiz92.BossDropRewardDelay", "Boss Drop Reward Delay");
		}
	}

	private Sprite LoadIconSprite()
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			using Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("icon.png");
			if (stream == null)
			{
				return null;
			}
			byte[] array = new byte[stream.Length];
			int num;
			for (int i = 0; i < array.Length; i += num)
			{
				num = stream.Read(array, i, array.Length - i);
				if (num <= 0)
				{
					break;
				}
			}
			Texture2D val = new Texture2D(2, 2);
			if (!ImageConversion.LoadImage(val, array))
			{
				return null;
			}
			return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not load the Risk of Options icon: " + ex.Message));
			return null;
		}
	}
}