Decompiled source of NoBossNoWaitHostOnly v1.0.3

NoBossNoWaitHostOnly.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
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.Logging;
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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("KillBossChargeTeleporter")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KillBossChargeTeleporter")]
[assembly: AssemblyTitle("KillBossChargeTeleporter")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace KillBossChargeTeleporter;

[BepInPlugin("OakPrime.KillBossChargeTeleporter", "KillBossChargeTeleporter", "1.0.3")]
public class KillBossChargeTeleporter : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_UpdateMonstersClear <>9__5_0;

		internal void <Awake>b__5_0(orig_UpdateMonstersClear orig, TeleporterInteraction self)
		{
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			orig.Invoke(self);
			if ((Object)(object)self != (Object)null && self.monstersCleared && Object.op_Implicit((Object)(object)self.holdoutZoneController) && (int)self.activationState == 2 && self.chargeFraction > 0.02f)
			{
				int displayChargePercent = TeleporterInteraction.instance.holdoutZoneController.displayChargePercent;
				float runStopwatch = Run.instance.GetRunStopwatch();
				int num = Math.Min(Util.GetItemCountForTeam(self.holdoutZoneController.chargingTeam, Items.FocusConvergence.itemIndex, true, true), 3);
				float num2 = (100f - (float)displayChargePercent) / 100f * (TeleporterInteraction.instance.holdoutZoneController.baseChargeDuration / (1f + 0.3f * (float)num));
				num2 = (float)Math.Round(num2, 2);
				float runStopwatch2 = runStopwatch + (float)Math.Round(num2, 2);
				Run.instance.SetRunStopwatch(runStopwatch2);
				TeleporterInteraction.instance.holdoutZoneController.FullyChargeHoldoutZone();
			}
		}
	}

	public const string PluginGUID = "OakPrime.KillBossChargeTeleporter";

	public const string PluginAuthor = "OakPrime";

	public const string PluginName = "KillBossChargeTeleporter";

	public const string PluginVersion = "1.0.3";

	private readonly Dictionary<string, string> DefaultLanguage = new Dictionary<string, string>();

	public void Awake()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		Log.Init(((BaseUnityPlugin)this).Logger);
		try
		{
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				hook_UpdateMonstersClear val = delegate(orig_UpdateMonstersClear orig, TeleporterInteraction self)
				{
					//IL_0069: Unknown result type (might be due to invalid IL or missing references)
					//IL_0073: Unknown result type (might be due to invalid IL or missing references)
					//IL_0028: Unknown result type (might be due to invalid IL or missing references)
					//IL_002e: Invalid comparison between Unknown and I4
					orig.Invoke(self);
					if ((Object)(object)self != (Object)null && self.monstersCleared && Object.op_Implicit((Object)(object)self.holdoutZoneController) && (int)self.activationState == 2 && self.chargeFraction > 0.02f)
					{
						int displayChargePercent = TeleporterInteraction.instance.holdoutZoneController.displayChargePercent;
						float runStopwatch = Run.instance.GetRunStopwatch();
						int num = Math.Min(Util.GetItemCountForTeam(self.holdoutZoneController.chargingTeam, Items.FocusConvergence.itemIndex, true, true), 3);
						float num2 = (100f - (float)displayChargePercent) / 100f * (TeleporterInteraction.instance.holdoutZoneController.baseChargeDuration / (1f + 0.3f * (float)num));
						num2 = (float)Math.Round(num2, 2);
						float runStopwatch2 = runStopwatch + (float)Math.Round(num2, 2);
						Run.instance.SetRunStopwatch(runStopwatch2);
						TeleporterInteraction.instance.holdoutZoneController.FullyChargeHoldoutZone();
					}
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			TeleporterInteraction.UpdateMonstersClear += (hook_UpdateMonstersClear)obj;
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
		}
	}
}
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);
	}
}