Decompiled source of SingleItemSimulacrum v1.1.0

SingleItemSimulacrum.dll

Decompiled 3 weeks 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 BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[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("SingleItemSimulacrum")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SingleItemSimulacrum")]
[assembly: AssemblyTitle("SingleItemSimulacrum")]
[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 SingleItemSimulacrum
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void LogDebug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void LogError(object data)
		{
			_logSource.LogError(data);
		}

		internal static void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void LogInfo(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("Tero.SingleItemSimulacrum", "SingleItemSimulacrum", "1.1.0")]
	public class SingleItemSimulacrum : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_DropRewards <>9__9_0;

			internal void <Awake>b__9_0(orig_DropRewards orig, InfiniteTowerWaveController self)
			{
				//IL_0068: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0081: 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_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: 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_00ca: 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_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0123: Unknown result type (might be due to invalid IL or missing references)
				//IL_0125: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				if (!NetworkServer.active)
				{
					Debug.LogWarning((object)"[Server] function 'System.Void RoR2.InfiniteTowerWaveController::DropRewards()' called on client");
					return;
				}
				int participatingPlayerCount = Run.instance.participatingPlayerCount;
				if (participatingPlayerCount <= 0 || !Object.op_Implicit((Object)(object)self.spawnTarget) || !Object.op_Implicit((Object)(object)self.rewardDropTable))
				{
					return;
				}
				int num = participatingPlayerCount;
				float num2 = 360f / (float)num;
				Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
				Quaternion val2 = Quaternion.AngleAxis(num2, Vector3.up);
				Vector3 val3 = self.spawnTarget.transform.position + self.rewardOffset;
				int num3 = 0;
				UniquePickup val4 = UniquePickup.none;
				while (num3 < num)
				{
					if (Object.op_Implicit((Object)(object)self.rewardDropTable) && (num3 == 0 || !GetSameDrop))
					{
						val4 = self.rewardDropTable.GeneratePickup(self.rng);
					}
					PickupDropletController.CreatePickupDroplet(val4, val3, val, false, false);
					num3++;
					val = val2 * val;
				}
			}
		}

		public const string PluginGUID = "Tero.SingleItemSimulacrum";

		public const string PluginAuthor = "Tero";

		public const string PluginName = "SingleItemSimulacrum";

		public const string PluginVersion = "1.1.0";

		public static bool GetSameDrop;

		public static ConfigEntry<bool> AllGetSameDrop { get; set; }

		public void Awake()
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			try
			{
				AllGetSameDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("SingleItemSimulacrum", "AllGetSameDrop", false, "Whether or not all players in multiplayer get the same item");
				GetSameDrop = AllGetSameDrop.Value;
			}
			catch (Exception)
			{
			}
			object obj = <>c.<>9__9_0;
			if (obj == null)
			{
				hook_DropRewards val = delegate(orig_DropRewards orig, InfiniteTowerWaveController self)
				{
					//IL_0068: Unknown result type (might be due to invalid IL or missing references)
					//IL_006d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_007c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0081: 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_0090: Unknown result type (might be due to invalid IL or missing references)
					//IL_0095: Unknown result type (might be due to invalid IL or missing references)
					//IL_009a: Unknown result type (might be due to invalid IL or missing references)
					//IL_009e: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
					//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
					//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
					//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
					//IL_00c0: 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_00ca: 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_010f: Unknown result type (might be due to invalid IL or missing references)
					//IL_0111: Unknown result type (might be due to invalid IL or missing references)
					//IL_0113: Unknown result type (might be due to invalid IL or missing references)
					//IL_0123: Unknown result type (might be due to invalid IL or missing references)
					//IL_0125: Unknown result type (might be due to invalid IL or missing references)
					//IL_0127: Unknown result type (might be due to invalid IL or missing references)
					//IL_012c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0107: Unknown result type (might be due to invalid IL or missing references)
					//IL_010c: Unknown result type (might be due to invalid IL or missing references)
					if (!NetworkServer.active)
					{
						Debug.LogWarning((object)"[Server] function 'System.Void RoR2.InfiniteTowerWaveController::DropRewards()' called on client");
					}
					else
					{
						int participatingPlayerCount = Run.instance.participatingPlayerCount;
						if (participatingPlayerCount > 0 && Object.op_Implicit((Object)(object)self.spawnTarget) && Object.op_Implicit((Object)(object)self.rewardDropTable))
						{
							int num = participatingPlayerCount;
							float num2 = 360f / (float)num;
							Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
							Quaternion val3 = Quaternion.AngleAxis(num2, Vector3.up);
							Vector3 val4 = self.spawnTarget.transform.position + self.rewardOffset;
							int num3 = 0;
							UniquePickup val5 = UniquePickup.none;
							while (num3 < num)
							{
								if (Object.op_Implicit((Object)(object)self.rewardDropTable) && (num3 == 0 || !GetSameDrop))
								{
									val5 = self.rewardDropTable.GeneratePickup(self.rng);
								}
								PickupDropletController.CreatePickupDroplet(val5, val4, val2, false, false);
								num3++;
								val2 = val3 * val2;
							}
						}
					}
				};
				<>c.<>9__9_0 = val;
				obj = (object)val;
			}
			InfiniteTowerWaveController.DropRewards += (hook_DropRewards)obj;
		}
	}
}