Decompiled source of FasterBossWait2 v1.1.9

EvenFasterBossWait.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EvenFasterBossWait")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6a5c6aebb9dbedb597f46ed9edca8b69d77e2b77")]
[assembly: AssemblyProduct("EvenFasterBossWait")]
[assembly: AssemblyTitle("EvenFasterBossWait")]
[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 EvenFasterBossWait
{
	public static class Extensions
	{
		public static bool victimIsMiniboss(this DamageReport report)
		{
			return (report?.victimMaster?.isMiniboss()).GetValueOrDefault();
		}

		public static bool isMiniboss(this CharacterBody body)
		{
			return ((body == null) ? null : body.master?.isMiniboss()).GetValueOrDefault();
		}

		public static bool isMiniboss(this CharacterMaster master)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			return Hooks.Minibosses.Contains((master != null) ? master.masterIndex : MasterIndex.none);
		}

		public static EliteDef[] affixes(this CharacterBody body)
		{
			return body?.activeBuffsList?.ToList()?.FindAll(delegate(BuffIndex x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				BuffDef buffDef = BuffCatalog.GetBuffDef(x);
				return buffDef != null && buffDef.isElite;
			}).ConvertAll((BuffIndex x) => BuffCatalog.GetBuffDef(x).eliteDef).ToArray() ?? Array.Empty<EliteDef>();
		}

		public static bool isT2(this EliteDef elite)
		{
			return (CombatDirector.eliteTiers?.First((EliteTierDef x) => x.eliteTypes.Contains(Elites.Poison))?.eliteTypes?.Contains(elite)).GetValueOrDefault();
		}
	}
	public class Hooks
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Action<Run> <>9__4_0;

			public static Predicate<Category> <>9__4_11;

			public static hook_GenerateDirectorCardWeightedSelection <>9__4_1;

			public static hook_OnEnable <>9__4_2;

			public static hook_FixedUpdate <>9__4_3;

			public static hook_OnDisable <>9__4_4;

			public static hook_OnEnable <>9__4_5;

			public static Func<EliteDef, bool> <>9__4_16;

			public static Func<EliteDef, bool> <>9__4_15;

			public static Action<DamageReport> <>9__4_6;

			public static Action<BossGroup> <>9__4_7;

			public static hook_OnDisable <>9__4_8;

			public static hook_ApplyRate <>9__4_9;

			public static hook_ApplyRadius <>9__4_10;

			internal void <Patch>b__4_0(Run _)
			{
				ActiveZones.Clear();
				BossKilled.Clear();
				ChargeCredit.Clear();
			}

			internal WeightedSelection<DirectorCard> <Patch>b__4_1(orig_GenerateDirectorCardWeightedSelection orig, DirectorCardCategorySelection self)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				Category val = self.categories.ToList().Find((Category x) => x.name == Helpers.GetVanillaMonsterCategoryName((MonsterCategory)3));
				if (!((object)(Category)(ref val)).Equals((object)default(Category)))
				{
					Minibosses.Clear();
					DirectorCard[] cards = val.cards;
					foreach (DirectorCard val2 in cards)
					{
						if (!val2.IsAvailable())
						{
							continue;
						}
						object obj;
						if (val2 == null)
						{
							obj = null;
						}
						else
						{
							SpawnCard spawnCard = val2.spawnCard;
							if (spawnCard == null)
							{
								obj = null;
							}
							else
							{
								GameObject prefab = spawnCard.prefab;
								obj = ((prefab != null) ? prefab.GetComponent<CharacterMaster>() : null);
							}
						}
						if (obj == null)
						{
							obj = null;
						}
						CharacterMaster val3 = (CharacterMaster)obj;
						if (!((Object)(object)val3 == (Object)null))
						{
							Minibosses.Add(val3.masterIndex);
						}
					}
					Main.Log.LogDebug((object)("Repopulated miniboss list with " + Minibosses.Count + " element(s)."));
				}
				return orig.Invoke(self);
			}

			internal bool <Patch>b__4_11(Category x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return x.name == Helpers.GetVanillaMonsterCategoryName((MonsterCategory)3);
			}

			internal void <Patch>b__4_2(orig_OnEnable orig, OutsideInteractableLocker self)
			{
				if (!Main.UnlockInteractables.Value && (!Main.UnlockVoidSeeds.Value || !(((Object)self.lockPrefab).name == "PurchaseLockVoid")))
				{
					orig.Invoke(self);
				}
			}

			internal void <Patch>b__4_3(orig_FixedUpdate orig, OutsideInteractableLocker self)
			{
				if (!Main.UnlockInteractables.Value && (!Main.UnlockVoidSeeds.Value || !(((Object)self.lockPrefab).name == "PurchaseLockVoid")))
				{
					orig.Invoke(self);
				}
			}

			internal void <Patch>b__4_4(orig_OnDisable orig, OutsideInteractableLocker self)
			{
				if (!Main.UnlockInteractables.Value && (!Main.UnlockVoidSeeds.Value || !(((Object)self.lockPrefab).name == "PurchaseLockVoid")))
				{
					orig.Invoke(self);
				}
			}

			internal void <Patch>b__4_5(orig_OnEnable orig, HoldoutZoneController self)
			{
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0297: Expected O, but got Unknown
				//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f1: Expected O, but got Unknown
				//IL_0654: Unknown result type (might be due to invalid IL or missing references)
				//IL_065e: Expected O, but got Unknown
				<>c__DisplayClass4_0 CS$<>8__locals0 = new <>c__DisplayClass4_0
				{
					self = self
				};
				if (Run.instance is InfiniteTowerRun)
				{
					return;
				}
				foreach (Main.HoldoutMultiplierInfo holdoutMultiplier in Main.HoldoutMultipliers)
				{
					if (((Object)((Component)CS$<>8__locals0.self).gameObject).name.Contains(holdoutMultiplier.name))
					{
						ActiveZones.Add(CS$<>8__locals0.self, holdoutMultiplier);
					}
				}
				if (!ActiveZones.ContainsKey(CS$<>8__locals0.self))
				{
					ActiveZones.Add(CS$<>8__locals0.self, Main.DefaultHoldoutInfo);
				}
				BossKilled.Add(CS$<>8__locals0.self, value: false);
				ChargeCredit.Add(CS$<>8__locals0.self, 0f);
				if (ActiveZones[CS$<>8__locals0.self].time >= 0f)
				{
					CS$<>8__locals0.self.baseChargeDuration = ActiveZones[CS$<>8__locals0.self].time * Mathf.Lerp(1f, Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount - 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount), ActiveZones[CS$<>8__locals0.self].mult);
				}
				if (ActiveZones[CS$<>8__locals0.self].area >= 0f)
				{
					CS$<>8__locals0.self.baseRadius = ActiveZones[CS$<>8__locals0.self].area * Mathf.Lerp(1f, Main.Calc(Main.ModePerPersonArea.Value, Main.ValuePerPersonArea.Value, Run.instance.participatingPlayerCount), ActiveZones[CS$<>8__locals0.self].mult);
				}
				if ((Object)(object)((Component)CS$<>8__locals0.self).gameObject.GetComponent<BossGroup>() != (Object)null && ActiveZones[CS$<>8__locals0.self].multBoss >= 0f)
				{
					CS$<>8__locals0.self.calcChargeRate += (CalcChargeRateDelegate)delegate(ref float rate)
					{
						if (BossKilled[CS$<>8__locals0.self])
						{
							rate *= ActiveZones[CS$<>8__locals0.self].multBoss;
						}
					};
				}
				if ((Object)(object)((Component)CS$<>8__locals0.self).gameObject.GetComponent<BossGroup>() != (Object)null && ActiveZones[CS$<>8__locals0.self].areaBoss >= 0f)
				{
					CS$<>8__locals0.self.calcRadius += (CalcRadiusDelegate)delegate(ref float radius)
					{
						if (BossKilled[CS$<>8__locals0.self])
						{
							radius *= ActiveZones[CS$<>8__locals0.self].areaBoss / ActiveZones[CS$<>8__locals0.self].area;
						}
					};
				}
				if (Main.DebugMode.Value)
				{
					Main.Log.LogInfo((object)("Holdout Zone Begin, boss: " + (object)((Component)CS$<>8__locals0.self).gameObject.GetComponent<BossGroup>() != null));
					Main.Log.LogInfo((object)$"Zone Info ({ActiveZones[CS$<>8__locals0.self].name}): {ActiveZones[CS$<>8__locals0.self].time} time, {ActiveZones[CS$<>8__locals0.self].mult} mult, {ActiveZones[CS$<>8__locals0.self].area} area, {ActiveZones[CS$<>8__locals0.self].multBoss} multBoss, {ActiveZones[CS$<>8__locals0.self].areaBoss} areaBoss");
					Main.Log.LogInfo((object)$"Config: {Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount - 1)}({Main.ModePerPerson.Value} {Main.ValuePerPerson.Value}x{Run.instance.participatingPlayerCount - 1}) / {Main.Calc(Main.ModePerPersonArea.Value, Main.ValuePerPersonArea.Value, Run.instance.participatingPlayerCount)}({Main.ModePerPersonArea.Value} {Main.ValuePerPersonArea.Value}x{Run.instance.participatingPlayerCount - 1})(area) per person, {Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount)}({Main.ModePerStage.Value} {Main.ValuePerStage.Value}x{Run.instance.stageClearCount}) per stage, {Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)}({Main.ModePerLoop.Value} {Main.ValuePerLoop.Value}x{Run.instance.loopClearCount}) per loop");
					Main.Log.LogInfo((object)$"Result: {CS$<>8__locals0.self.baseChargeDuration}(x{ActiveZones[CS$<>8__locals0.self].multBoss}b) time, {CS$<>8__locals0.self.baseRadius}(x{ActiveZones[CS$<>8__locals0.self].areaBoss / ActiveZones[CS$<>8__locals0.self].area}b) area");
				}
				CS$<>8__locals0.self.calcAccumulatedCharge += (CalcAccumulatedChargeDelegate)delegate(ref float charge)
				{
					if (ChargeCredit[CS$<>8__locals0.self] > 0f)
					{
						charge += ChargeCredit[CS$<>8__locals0.self];
						ChargeCredit[CS$<>8__locals0.self] = 0f;
					}
				};
				orig.Invoke(CS$<>8__locals0.self);
			}

			internal void <Patch>b__4_6(DamageReport report)
			{
				//IL_0020: 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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Invalid comparison between Unknown and I4
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0471: Unknown result type (might be due to invalid IL or missing references)
				if (report == null)
				{
					return;
				}
				CharacterBody victimBody = report.victimBody;
				if (victimBody == null)
				{
					return;
				}
				TeamComponent teamComponent = victimBody.teamComponent;
				if (teamComponent == null)
				{
					return;
				}
				_ = teamComponent.teamIndex;
				if (false || report == null)
				{
					return;
				}
				CharacterBody attackerBody = report.attackerBody;
				if (attackerBody == null)
				{
					return;
				}
				TeamComponent teamComponent2 = attackerBody.teamComponent;
				if (teamComponent2 == null)
				{
					return;
				}
				_ = teamComponent2.teamIndex;
				if (false || !TeamManager.IsTeamEnemy((TeamIndex)1, report.victimBody.teamComponent.teamIndex) || (int)report.attackerBody.teamComponent.teamIndex != 1)
				{
					return;
				}
				foreach (HoldoutZoneController key in ActiveZones.Keys)
				{
					if (report.victimIsBoss || key.baseChargeDuration <= 0f)
					{
						continue;
					}
					if (Main.DebugMode.Value)
					{
						Main.Log.LogInfo((object)("Kill Credited, base: " + ActiveZones[key].kill));
					}
					if (ActiveZones[key].kill == 0f)
					{
						continue;
					}
					float num = Main.Value.Value + report.victimBody.baseMaxHealth * Main.ValuePerHP.Value;
					if (Main.DebugMode.Value)
					{
						Main.Log.LogInfo((object)$"base: {Main.Value.Value}({Main.Value.Value}+{report.victimBody.baseMaxHealth}x{Main.ValuePerHP.Value})");
					}
					if (report.victimIsElite)
					{
						num += Main.EliteBonus.Value;
					}
					if (report.victimBody.affixes().Any((EliteDef x) => x.isT2()))
					{
						num += Main.EliteT2Bonus.Value;
					}
					if (report.victimIsMiniboss())
					{
						num += Main.MinibossBonus.Value;
					}
					if (report.victimIsChampion)
					{
						num += Main.BossBonus.Value;
					}
					if (Main.DebugMode.Value)
					{
						Main.Log.LogInfo((object)("bonuses: " + (report.victimIsElite ? $"+{Main.EliteBonus.Value} (elite)" : "") + (report.victimBody.affixes().Any((EliteDef x) => x.isT2()) ? $"+{Main.EliteT2Bonus.Value} (T2)" : "") + (report.victimIsMiniboss() ? $"+{Main.MinibossBonus.Value} (miniboss)" : "") + (report.victimIsChampion ? $"+{Main.BossBonus.Value} (champion)" : "")));
					}
					num *= ActiveZones[key].kill;
					if ((Object)(object)((Component)key).gameObject.GetComponent<BossGroup>() != (Object)null && !BossKilled[key])
					{
						num *= Main.PreBossKillPenalty.Value;
					}
					if (!((BaseZoneBehavior)key).IsInBounds(report.attackerBody.footPosition))
					{
						num *= Main.OutsideRangePenalty.Value;
					}
					if (Main.DebugMode.Value)
					{
						Main.Log.LogInfo((object)("multipliers: " + ActiveZones[key].kill + (((Object)(object)((Component)key).gameObject.GetComponent<BossGroup>() != (Object)null && !BossKilled[key]) ? $"x{Main.PreBossKillPenalty.Value} (prebosskill)" : "") + ((!((BaseZoneBehavior)key).IsInBounds(report.attackerBody.footPosition)) ? $"x{Main.OutsideRangePenalty.Value} (outsiderange)" : "") + (Main.UseFixedTime.Value ? $"x1s(out of {key.baseChargeDuration})" : "x1%")));
					}
					if (num == 0f)
					{
						break;
					}
					ChargeCredit[key] += num * (Main.UseFixedTime.Value ? (1f / key.baseChargeDuration) : 0.01f);
					if (Main.DebugMode.Value)
					{
						Main.Log.LogInfo((object)("Return:" + num * (Main.UseFixedTime.Value ? (1f / key.baseChargeDuration) : 0.01f)));
					}
					if (Main.CompensateKills.Value == 0f)
					{
						continue;
					}
					if (!Main.UseFixedTime.Value)
					{
						float num2 = 1f / key.baseChargeDuration;
						CalcChargeRateDelegate val = AccessTools.FieldRefAccess<CalcChargeRateDelegate>(typeof(HoldoutZoneController), "calcChargeRate").Invoke((object)key);
						if (val != null)
						{
							val.Invoke(ref num2);
						}
						num *= 0.01f / num2;
						if (Main.DebugMode.Value)
						{
							Main.Log.LogInfo((object)"ChargeRate accessed");
						}
					}
					if (Main.GeneralScalingCompensation.Value != 0f)
					{
						num /= Mathf.Lerp(ActiveZones[key].mult * (Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount + 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)), 1f, Main.GeneralScalingCompensation.Value);
					}
					Run.instance.SetRunStopwatch(Run.instance.GetRunStopwatch() + num * Main.CompensateKills.Value);
					if (Main.DebugMode.Value)
					{
						Main.Log.LogInfo((object)"Time Compensated");
						Main.Log.LogInfo((object)$"Config: {Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount - 1)}({Main.ModePerPerson.Value} {Main.ValuePerPerson.Value}x{Run.instance.participatingPlayerCount - 1}) / {Main.Calc(Main.ModePerPersonArea.Value, Main.ValuePerPersonArea.Value, Run.instance.participatingPlayerCount)}({Main.ModePerPersonArea.Value} {Main.ValuePerPersonArea.Value}x{Run.instance.participatingPlayerCount - 1})(area) per person, {Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount)}({Main.ModePerStage.Value} {Main.ValuePerStage.Value}x{Run.instance.stageClearCount}) per stage, {Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)}({Main.ModePerLoop.Value} {Main.ValuePerLoop.Value}x{Run.instance.loopClearCount}) per loop");
						Main.Log.LogInfo((object)$"Result: a{ActiveZones[key].mult * (Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount + 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount))}, b{Mathf.Lerp(ActiveZones[key].mult * (Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount + 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)), 1f, Main.GeneralScalingCompensation.Value)}({ActiveZones[key].mult} mult), charge{num}, d{Main.CompensateKills.Value}");
					}
				}
			}

			internal bool <Patch>b__4_16(EliteDef x)
			{
				return x.isT2();
			}

			internal bool <Patch>b__4_15(EliteDef x)
			{
				return x.isT2();
			}

			internal void <Patch>b__4_7(BossGroup group)
			{
				if ((Object)(object)TeleporterInteraction.instance?.bossGroup != (Object)null && (Object)(object)TeleporterInteraction.instance.bossGroup == (Object)(object)group && BossKilled.ContainsKey(TeleporterInteraction.instance.holdoutZoneController))
				{
					BossKilled[TeleporterInteraction.instance.holdoutZoneController] = true;
					if (Main.UnlockInteractablesPostBoss.Value && Object.op_Implicit((Object)(object)TeleporterInteraction.instance.outsideInteractableLocker))
					{
						((Behaviour)TeleporterInteraction.instance.outsideInteractableLocker).enabled = false;
					}
				}
			}

			internal void <Patch>b__4_8(orig_OnDisable orig, HoldoutZoneController self)
			{
				if (ActiveZones.ContainsKey(self))
				{
					ActiveZones.Remove(self);
				}
				if (BossKilled.ContainsKey(self))
				{
					BossKilled.Remove(self);
				}
				if (ChargeCredit.ContainsKey(self))
				{
					ChargeCredit.Remove(self);
				}
				orig.Invoke(self);
			}

			internal void <Patch>b__4_9(orig_ApplyRate orig, MonoBehaviour self, ref float rate)
			{
				//IL_0002: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				int currentFocusConvergenceCount = ((FocusConvergenceController)self).currentFocusConvergenceCount;
				if (Main.FocusedConvergenceRateLimit.Value >= 0)
				{
					((FocusConvergenceController)self).currentFocusConvergenceCount = (int)MathF.Min(currentFocusConvergenceCount, Main.FocusedConvergenceRateLimit.Value);
				}
				orig.Invoke(self, ref rate);
				((FocusConvergenceController)self).currentFocusConvergenceCount = currentFocusConvergenceCount;
			}

			internal void <Patch>b__4_10(orig_ApplyRadius orig, MonoBehaviour self, ref float radius)
			{
				//IL_0002: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				int currentFocusConvergenceCount = ((FocusConvergenceController)self).currentFocusConvergenceCount;
				if (Main.FocusedConvergenceRangeLimit.Value >= 0)
				{
					((FocusConvergenceController)self).currentFocusConvergenceCount = (int)MathF.Min(currentFocusConvergenceCount, Main.FocusedConvergenceRangeLimit.Value);
				}
				orig.Invoke(self, ref radius);
				((FocusConvergenceController)self).currentFocusConvergenceCount = currentFocusConvergenceCount;
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass4_0
		{
			public HoldoutZoneController self;

			internal void <Patch>b__12(ref float rate)
			{
				if (BossKilled[self])
				{
					rate *= ActiveZones[self].multBoss;
				}
			}

			internal void <Patch>b__13(ref float radius)
			{
				if (BossKilled[self])
				{
					radius *= ActiveZones[self].areaBoss / ActiveZones[self].area;
				}
			}

			internal void <Patch>b__14(ref float charge)
			{
				if (ChargeCredit[self] > 0f)
				{
					charge += ChargeCredit[self];
					ChargeCredit[self] = 0f;
				}
			}
		}

		public static List<MasterIndex> Minibosses = new List<MasterIndex>();

		public static Dictionary<HoldoutZoneController, Main.HoldoutMultiplierInfo> ActiveZones = new Dictionary<HoldoutZoneController, Main.HoldoutMultiplierInfo>();

		public static Dictionary<HoldoutZoneController, bool> BossKilled = new Dictionary<HoldoutZoneController, bool>();

		public static Dictionary<HoldoutZoneController, float> ChargeCredit = new Dictionary<HoldoutZoneController, float>();

		public static void Patch()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			Run.onRunStartGlobal += delegate
			{
				ActiveZones.Clear();
				BossKilled.Clear();
				ChargeCredit.Clear();
			};
			object obj = <>c.<>9__4_1;
			if (obj == null)
			{
				hook_GenerateDirectorCardWeightedSelection val = delegate(orig_GenerateDirectorCardWeightedSelection orig, DirectorCardCategorySelection self)
				{
					//IL_002b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0030: Unknown result type (might be due to invalid IL or missing references)
					//IL_0035: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					//IL_0063: Unknown result type (might be due to invalid IL or missing references)
					//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
					Category val10 = self.categories.ToList().Find((Category x) => x.name == Helpers.GetVanillaMonsterCategoryName((MonsterCategory)3));
					if (!((object)(Category)(ref val10)).Equals((object)default(Category)))
					{
						Minibosses.Clear();
						DirectorCard[] cards = val10.cards;
						foreach (DirectorCard val11 in cards)
						{
							if (val11.IsAvailable())
							{
								object obj9;
								if (val11 == null)
								{
									obj9 = null;
								}
								else
								{
									SpawnCard spawnCard = val11.spawnCard;
									if (spawnCard == null)
									{
										obj9 = null;
									}
									else
									{
										GameObject prefab = spawnCard.prefab;
										obj9 = ((prefab != null) ? prefab.GetComponent<CharacterMaster>() : null);
									}
								}
								if (obj9 == null)
								{
									obj9 = null;
								}
								CharacterMaster val12 = (CharacterMaster)obj9;
								if (!((Object)(object)val12 == (Object)null))
								{
									Minibosses.Add(val12.masterIndex);
								}
							}
						}
						Main.Log.LogDebug((object)("Repopulated miniboss list with " + Minibosses.Count + " element(s)."));
					}
					return orig.Invoke(self);
				};
				<>c.<>9__4_1 = val;
				obj = (object)val;
			}
			DirectorCardCategorySelection.GenerateDirectorCardWeightedSelection += (hook_GenerateDirectorCardWeightedSelection)obj;
			object obj2 = <>c.<>9__4_2;
			if (obj2 == null)
			{
				hook_OnEnable val2 = delegate(orig_OnEnable orig, OutsideInteractableLocker self)
				{
					if (!Main.UnlockInteractables.Value && (!Main.UnlockVoidSeeds.Value || !(((Object)self.lockPrefab).name == "PurchaseLockVoid")))
					{
						orig.Invoke(self);
					}
				};
				<>c.<>9__4_2 = val2;
				obj2 = (object)val2;
			}
			OutsideInteractableLocker.OnEnable += (hook_OnEnable)obj2;
			object obj3 = <>c.<>9__4_3;
			if (obj3 == null)
			{
				hook_FixedUpdate val3 = delegate(orig_FixedUpdate orig, OutsideInteractableLocker self)
				{
					if (!Main.UnlockInteractables.Value && (!Main.UnlockVoidSeeds.Value || !(((Object)self.lockPrefab).name == "PurchaseLockVoid")))
					{
						orig.Invoke(self);
					}
				};
				<>c.<>9__4_3 = val3;
				obj3 = (object)val3;
			}
			OutsideInteractableLocker.FixedUpdate += (hook_FixedUpdate)obj3;
			object obj4 = <>c.<>9__4_4;
			if (obj4 == null)
			{
				hook_OnDisable val4 = delegate(orig_OnDisable orig, OutsideInteractableLocker self)
				{
					if (!Main.UnlockInteractables.Value && (!Main.UnlockVoidSeeds.Value || !(((Object)self.lockPrefab).name == "PurchaseLockVoid")))
					{
						orig.Invoke(self);
					}
				};
				<>c.<>9__4_4 = val4;
				obj4 = (object)val4;
			}
			OutsideInteractableLocker.OnDisable += (hook_OnDisable)obj4;
			object obj5 = <>c.<>9__4_5;
			if (obj5 == null)
			{
				hook_OnEnable val5 = delegate(orig_OnEnable orig, HoldoutZoneController self)
				{
					//IL_028d: Unknown result type (might be due to invalid IL or missing references)
					//IL_0297: Expected O, but got Unknown
					//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
					//IL_02f1: Expected O, but got Unknown
					//IL_0654: Unknown result type (might be due to invalid IL or missing references)
					//IL_065e: Expected O, but got Unknown
					if (!(Run.instance is InfiniteTowerRun))
					{
						foreach (Main.HoldoutMultiplierInfo holdoutMultiplier in Main.HoldoutMultipliers)
						{
							if (((Object)((Component)self).gameObject).name.Contains(holdoutMultiplier.name))
							{
								ActiveZones.Add(self, holdoutMultiplier);
							}
						}
						if (!ActiveZones.ContainsKey(self))
						{
							ActiveZones.Add(self, Main.DefaultHoldoutInfo);
						}
						BossKilled.Add(self, value: false);
						ChargeCredit.Add(self, 0f);
						if (ActiveZones[self].time >= 0f)
						{
							self.baseChargeDuration = ActiveZones[self].time * Mathf.Lerp(1f, Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount - 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount), ActiveZones[self].mult);
						}
						if (ActiveZones[self].area >= 0f)
						{
							self.baseRadius = ActiveZones[self].area * Mathf.Lerp(1f, Main.Calc(Main.ModePerPersonArea.Value, Main.ValuePerPersonArea.Value, Run.instance.participatingPlayerCount), ActiveZones[self].mult);
						}
						if ((Object)(object)((Component)self).gameObject.GetComponent<BossGroup>() != (Object)null && ActiveZones[self].multBoss >= 0f)
						{
							self.calcChargeRate += (CalcChargeRateDelegate)delegate(ref float rate)
							{
								if (BossKilled[self])
								{
									rate *= ActiveZones[self].multBoss;
								}
							};
						}
						if ((Object)(object)((Component)self).gameObject.GetComponent<BossGroup>() != (Object)null && ActiveZones[self].areaBoss >= 0f)
						{
							self.calcRadius += (CalcRadiusDelegate)delegate(ref float radius)
							{
								if (BossKilled[self])
								{
									radius *= ActiveZones[self].areaBoss / ActiveZones[self].area;
								}
							};
						}
						if (Main.DebugMode.Value)
						{
							Main.Log.LogInfo((object)("Holdout Zone Begin, boss: " + (object)((Component)self).gameObject.GetComponent<BossGroup>() != null));
							Main.Log.LogInfo((object)$"Zone Info ({ActiveZones[self].name}): {ActiveZones[self].time} time, {ActiveZones[self].mult} mult, {ActiveZones[self].area} area, {ActiveZones[self].multBoss} multBoss, {ActiveZones[self].areaBoss} areaBoss");
							Main.Log.LogInfo((object)$"Config: {Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount - 1)}({Main.ModePerPerson.Value} {Main.ValuePerPerson.Value}x{Run.instance.participatingPlayerCount - 1}) / {Main.Calc(Main.ModePerPersonArea.Value, Main.ValuePerPersonArea.Value, Run.instance.participatingPlayerCount)}({Main.ModePerPersonArea.Value} {Main.ValuePerPersonArea.Value}x{Run.instance.participatingPlayerCount - 1})(area) per person, {Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount)}({Main.ModePerStage.Value} {Main.ValuePerStage.Value}x{Run.instance.stageClearCount}) per stage, {Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)}({Main.ModePerLoop.Value} {Main.ValuePerLoop.Value}x{Run.instance.loopClearCount}) per loop");
							Main.Log.LogInfo((object)$"Result: {self.baseChargeDuration}(x{ActiveZones[self].multBoss}b) time, {self.baseRadius}(x{ActiveZones[self].areaBoss / ActiveZones[self].area}b) area");
						}
						self.calcAccumulatedCharge += (CalcAccumulatedChargeDelegate)delegate(ref float charge)
						{
							if (ChargeCredit[self] > 0f)
							{
								charge += ChargeCredit[self];
								ChargeCredit[self] = 0f;
							}
						};
						orig.Invoke(self);
					}
				};
				<>c.<>9__4_5 = val5;
				obj5 = (object)val5;
			}
			HoldoutZoneController.OnEnable += (hook_OnEnable)obj5;
			GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport report)
			{
				//IL_0020: 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_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Invalid comparison between Unknown and I4
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0471: Unknown result type (might be due to invalid IL or missing references)
				if (report != null)
				{
					CharacterBody victimBody = report.victimBody;
					if (victimBody != null)
					{
						TeamComponent teamComponent = victimBody.teamComponent;
						if (teamComponent != null)
						{
							_ = teamComponent.teamIndex;
							if (0 == 0 && report != null)
							{
								CharacterBody attackerBody = report.attackerBody;
								if (attackerBody != null)
								{
									TeamComponent teamComponent2 = attackerBody.teamComponent;
									if (teamComponent2 != null)
									{
										_ = teamComponent2.teamIndex;
										if (0 == 0 && TeamManager.IsTeamEnemy((TeamIndex)1, report.victimBody.teamComponent.teamIndex) && (int)report.attackerBody.teamComponent.teamIndex == 1)
										{
											foreach (HoldoutZoneController key in ActiveZones.Keys)
											{
												if (!report.victimIsBoss && !(key.baseChargeDuration <= 0f))
												{
													if (Main.DebugMode.Value)
													{
														Main.Log.LogInfo((object)("Kill Credited, base: " + ActiveZones[key].kill));
													}
													if (ActiveZones[key].kill != 0f)
													{
														float num = Main.Value.Value + report.victimBody.baseMaxHealth * Main.ValuePerHP.Value;
														if (Main.DebugMode.Value)
														{
															Main.Log.LogInfo((object)$"base: {Main.Value.Value}({Main.Value.Value}+{report.victimBody.baseMaxHealth}x{Main.ValuePerHP.Value})");
														}
														if (report.victimIsElite)
														{
															num += Main.EliteBonus.Value;
														}
														if (report.victimBody.affixes().Any((EliteDef x) => x.isT2()))
														{
															num += Main.EliteT2Bonus.Value;
														}
														if (report.victimIsMiniboss())
														{
															num += Main.MinibossBonus.Value;
														}
														if (report.victimIsChampion)
														{
															num += Main.BossBonus.Value;
														}
														if (Main.DebugMode.Value)
														{
															Main.Log.LogInfo((object)("bonuses: " + (report.victimIsElite ? $"+{Main.EliteBonus.Value} (elite)" : "") + (report.victimBody.affixes().Any((EliteDef x) => x.isT2()) ? $"+{Main.EliteT2Bonus.Value} (T2)" : "") + (report.victimIsMiniboss() ? $"+{Main.MinibossBonus.Value} (miniboss)" : "") + (report.victimIsChampion ? $"+{Main.BossBonus.Value} (champion)" : "")));
														}
														num *= ActiveZones[key].kill;
														if ((Object)(object)((Component)key).gameObject.GetComponent<BossGroup>() != (Object)null && !BossKilled[key])
														{
															num *= Main.PreBossKillPenalty.Value;
														}
														if (!((BaseZoneBehavior)key).IsInBounds(report.attackerBody.footPosition))
														{
															num *= Main.OutsideRangePenalty.Value;
														}
														if (Main.DebugMode.Value)
														{
															Main.Log.LogInfo((object)("multipliers: " + ActiveZones[key].kill + (((Object)(object)((Component)key).gameObject.GetComponent<BossGroup>() != (Object)null && !BossKilled[key]) ? $"x{Main.PreBossKillPenalty.Value} (prebosskill)" : "") + ((!((BaseZoneBehavior)key).IsInBounds(report.attackerBody.footPosition)) ? $"x{Main.OutsideRangePenalty.Value} (outsiderange)" : "") + (Main.UseFixedTime.Value ? $"x1s(out of {key.baseChargeDuration})" : "x1%")));
														}
														if (num == 0f)
														{
															break;
														}
														ChargeCredit[key] += num * (Main.UseFixedTime.Value ? (1f / key.baseChargeDuration) : 0.01f);
														if (Main.DebugMode.Value)
														{
															Main.Log.LogInfo((object)("Return:" + num * (Main.UseFixedTime.Value ? (1f / key.baseChargeDuration) : 0.01f)));
														}
														if (Main.CompensateKills.Value != 0f)
														{
															if (!Main.UseFixedTime.Value)
															{
																float num2 = 1f / key.baseChargeDuration;
																CalcChargeRateDelegate val9 = AccessTools.FieldRefAccess<CalcChargeRateDelegate>(typeof(HoldoutZoneController), "calcChargeRate").Invoke((object)key);
																if (val9 != null)
																{
																	val9.Invoke(ref num2);
																}
																num *= 0.01f / num2;
																if (Main.DebugMode.Value)
																{
																	Main.Log.LogInfo((object)"ChargeRate accessed");
																}
															}
															if (Main.GeneralScalingCompensation.Value != 0f)
															{
																num /= Mathf.Lerp(ActiveZones[key].mult * (Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount + 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)), 1f, Main.GeneralScalingCompensation.Value);
															}
															Run.instance.SetRunStopwatch(Run.instance.GetRunStopwatch() + num * Main.CompensateKills.Value);
															if (Main.DebugMode.Value)
															{
																Main.Log.LogInfo((object)"Time Compensated");
																Main.Log.LogInfo((object)$"Config: {Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount - 1)}({Main.ModePerPerson.Value} {Main.ValuePerPerson.Value}x{Run.instance.participatingPlayerCount - 1}) / {Main.Calc(Main.ModePerPersonArea.Value, Main.ValuePerPersonArea.Value, Run.instance.participatingPlayerCount)}({Main.ModePerPersonArea.Value} {Main.ValuePerPersonArea.Value}x{Run.instance.participatingPlayerCount - 1})(area) per person, {Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount)}({Main.ModePerStage.Value} {Main.ValuePerStage.Value}x{Run.instance.stageClearCount}) per stage, {Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)}({Main.ModePerLoop.Value} {Main.ValuePerLoop.Value}x{Run.instance.loopClearCount}) per loop");
																Main.Log.LogInfo((object)$"Result: a{ActiveZones[key].mult * (Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount + 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount))}, b{Mathf.Lerp(ActiveZones[key].mult * (Main.Calc(Main.ModePerPerson.Value, Main.ValuePerPerson.Value, Run.instance.participatingPlayerCount + 1) * Main.Calc(Main.ModePerStage.Value, Main.ValuePerStage.Value, Run.instance.stageClearCount) * Main.Calc(Main.ModePerLoop.Value, Main.ValuePerLoop.Value, Run.instance.loopClearCount)), 1f, Main.GeneralScalingCompensation.Value)}({ActiveZones[key].mult} mult), charge{num}, d{Main.CompensateKills.Value}");
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			};
			BossGroup.onBossGroupDefeatedServer += delegate(BossGroup group)
			{
				if ((Object)(object)TeleporterInteraction.instance?.bossGroup != (Object)null && (Object)(object)TeleporterInteraction.instance.bossGroup == (Object)(object)group && BossKilled.ContainsKey(TeleporterInteraction.instance.holdoutZoneController))
				{
					BossKilled[TeleporterInteraction.instance.holdoutZoneController] = true;
					if (Main.UnlockInteractablesPostBoss.Value && Object.op_Implicit((Object)(object)TeleporterInteraction.instance.outsideInteractableLocker))
					{
						((Behaviour)TeleporterInteraction.instance.outsideInteractableLocker).enabled = false;
					}
				}
			};
			object obj6 = <>c.<>9__4_8;
			if (obj6 == null)
			{
				hook_OnDisable val6 = delegate(orig_OnDisable orig, HoldoutZoneController self)
				{
					if (ActiveZones.ContainsKey(self))
					{
						ActiveZones.Remove(self);
					}
					if (BossKilled.ContainsKey(self))
					{
						BossKilled.Remove(self);
					}
					if (ChargeCredit.ContainsKey(self))
					{
						ChargeCredit.Remove(self);
					}
					orig.Invoke(self);
				};
				<>c.<>9__4_8 = val6;
				obj6 = (object)val6;
			}
			HoldoutZoneController.OnDisable += (hook_OnDisable)obj6;
			FocusConvergenceController.cap = int.MaxValue;
			object obj7 = <>c.<>9__4_9;
			if (obj7 == null)
			{
				hook_ApplyRate val7 = delegate(orig_ApplyRate orig, MonoBehaviour self, ref float rate)
				{
					//IL_0002: 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_0022: Unknown result type (might be due to invalid IL or missing references)
					int currentFocusConvergenceCount2 = ((FocusConvergenceController)self).currentFocusConvergenceCount;
					if (Main.FocusedConvergenceRateLimit.Value >= 0)
					{
						((FocusConvergenceController)self).currentFocusConvergenceCount = (int)MathF.Min(currentFocusConvergenceCount2, Main.FocusedConvergenceRateLimit.Value);
					}
					orig.Invoke(self, ref rate);
					((FocusConvergenceController)self).currentFocusConvergenceCount = currentFocusConvergenceCount2;
				};
				<>c.<>9__4_9 = val7;
				obj7 = (object)val7;
			}
			FocusConvergenceController.ApplyRate += (hook_ApplyRate)obj7;
			object obj8 = <>c.<>9__4_10;
			if (obj8 == null)
			{
				hook_ApplyRadius val8 = delegate(orig_ApplyRadius orig, MonoBehaviour self, ref float radius)
				{
					//IL_0002: 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_0022: Unknown result type (might be due to invalid IL or missing references)
					int currentFocusConvergenceCount = ((FocusConvergenceController)self).currentFocusConvergenceCount;
					if (Main.FocusedConvergenceRangeLimit.Value >= 0)
					{
						((FocusConvergenceController)self).currentFocusConvergenceCount = (int)MathF.Min(currentFocusConvergenceCount, Main.FocusedConvergenceRangeLimit.Value);
					}
					orig.Invoke(self, ref radius);
					((FocusConvergenceController)self).currentFocusConvergenceCount = currentFocusConvergenceCount;
				};
				<>c.<>9__4_10 = val8;
				obj8 = (object)val8;
			}
			FocusConvergenceController.ApplyRadius += (hook_ApplyRadius)obj8;
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("prodzpod.FasterBossWait2", "FasterBossWait2", "1.1.9")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Main : BaseUnityPlugin
	{
		public struct HoldoutMultiplierInfo
		{
			public string name;

			public float time;

			public float mult;

			public float multBoss;

			public float kill;

			public float area;

			public float areaBoss;
		}

		public enum StackingMode
		{
			Linear,
			Exponential,
			Hyperbolic,
			Asymptotic
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_ShouldUpdateRunStopwatch <>9__78_0;

			internal bool <Awake>b__78_0(orig_ShouldUpdateRunStopwatch orig, Run self)
			{
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: 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_006c: Unknown result type (might be due to invalid IL or missing references)
				bool result = orig.Invoke(self);
				TeleporterInteraction instance = TeleporterInteraction.instance;
				if (instance != null && instance.isCharged)
				{
					foreach (NetworkUser instances in NetworkUser.instancesList)
					{
						CharacterBody currentBody = instances.GetCurrentBody();
						if (!((Object)(object)currentBody == (Object)null))
						{
							Vector3 val = ((Component)TeleporterInteraction.instance).transform.position - currentBody.corePosition;
							if (((Vector3)(ref val)).magnitude > TeleporterTimestopArea.Value)
							{
								return result;
							}
						}
					}
					if (DebugMode.Value)
					{
						Log.LogInfo((object)"Time Stopped");
					}
					return false;
				}
				return result;
			}
		}

		public const string PluginGUID = "prodzpod.FasterBossWait2";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "FasterBossWait2";

		public const string PluginVersion = "1.1.9";

		public static ManualLogSource Log;

		internal static PluginInfo pluginInfo;

		public static ConfigFile Config;

		public static ConfigEntry<bool> UseFixedTime;

		public static ConfigEntry<float> CompensateKills;

		public static ConfigEntry<float> GeneralScalingCompensation;

		public static ConfigEntry<float> Value;

		public static ConfigEntry<float> ValuePerHP;

		public static ConfigEntry<float> EliteBonus;

		public static ConfigEntry<float> EliteT2Bonus;

		public static ConfigEntry<float> VariantBonus;

		public static ConfigEntry<float> MinibossBonus;

		public static ConfigEntry<float> BossBonus;

		public static ConfigEntry<float> PreBossKillPenalty;

		public static ConfigEntry<float> OutsideRangePenalty;

		public static ConfigEntry<bool> UnlockInteractables;

		public static ConfigEntry<bool> UnlockInteractablesPostBoss;

		public static ConfigEntry<bool> UnlockVoidSeeds;

		public static ConfigEntry<StackingMode> ModePerPerson;

		public static ConfigEntry<float> ValuePerPerson;

		public static ConfigEntry<StackingMode> ModePerPersonArea;

		public static ConfigEntry<float> ValuePerPersonArea;

		public static ConfigEntry<StackingMode> ModePerStage;

		public static ConfigEntry<float> ValuePerStage;

		public static ConfigEntry<StackingMode> ModePerLoop;

		public static ConfigEntry<float> ValuePerLoop;

		public static ConfigEntry<int> FocusedConvergenceRateLimit;

		public static ConfigEntry<int> FocusedConvergenceRangeLimit;

		public static ConfigEntry<float> TeleporterTime;

		public static ConfigEntry<float> TeleporterMult;

		public static ConfigEntry<float> TeleporterKill;

		public static ConfigEntry<float> TeleporterArea;

		public static ConfigEntry<float> TeleporterMultBoss;

		public static ConfigEntry<float> TeleporterAreaBoss;

		public static ConfigEntry<float> TeleporterTimestopArea;

		public static ConfigEntry<float> PrimordialTime;

		public static ConfigEntry<float> PrimordialMult;

		public static ConfigEntry<float> PrimordialKill;

		public static ConfigEntry<float> PrimordialArea;

		public static ConfigEntry<float> PrimordialMultBoss;

		public static ConfigEntry<float> PrimordialAreaBoss;

		public static ConfigEntry<float> PillarMassTime;

		public static ConfigEntry<float> PillarMassMult;

		public static ConfigEntry<float> PillarMassKill;

		public static ConfigEntry<float> PillarMassArea;

		public static ConfigEntry<float> PillarDesignTime;

		public static ConfigEntry<float> PillarDesignMult;

		public static ConfigEntry<float> PillarDesignKill;

		public static ConfigEntry<float> PillarDesignArea;

		public static ConfigEntry<float> PillarBloodTime;

		public static ConfigEntry<float> PillarBloodMult;

		public static ConfigEntry<float> PillarBloodKill;

		public static ConfigEntry<float> PillarBloodArea;

		public static ConfigEntry<float> PillarSoulTime;

		public static ConfigEntry<float> PillarSoulMult;

		public static ConfigEntry<float> PillarSoulKill;

		public static ConfigEntry<float> PillarSoulArea;

		public static ConfigEntry<float> EndingTime;

		public static ConfigEntry<float> EndingMult;

		public static ConfigEntry<float> EndingKill;

		public static ConfigEntry<float> EndingArea;

		public static ConfigEntry<float> FieldTime;

		public static ConfigEntry<float> FieldMult;

		public static ConfigEntry<float> FieldKill;

		public static ConfigEntry<float> FieldArea;

		public static ConfigEntry<float> LocusTime;

		public static ConfigEntry<float> LocusMult;

		public static ConfigEntry<float> LocusKill;

		public static ConfigEntry<float> LocusArea;

		public static ConfigEntry<bool> DebugMode;

		public static List<HoldoutMultiplierInfo> HoldoutMultipliers;

		public static HoldoutMultiplierInfo DefaultHoldoutInfo = new HoldoutMultiplierInfo
		{
			name = "",
			time = -1f,
			mult = 1f,
			multBoss = -1f,
			kill = 1f,
			area = -1f,
			areaBoss = -1f
		};

		public void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bc: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.FasterBossWait2.cfg"), true);
			UseFixedTime = Config.Bind<bool>("Kills to Time", "Use Fixed Time", true, "If true, value will be seconds instead of percent.");
			CompensateKills = Config.Bind<float>("Kills to Time", "Kill Compensation Ratio", 1f, "Time saved by kills multiplied by this amount will be added to run timer.");
			GeneralScalingCompensation = Config.Bind<float>("Kills to Time", "General Scaling Compensation Ratio", 1f, "0: Kill Compensation will account for total time. 1: Kill compensation will only account for time before general scaling is applied.");
			Value = Config.Bind<float>("Kills to Time", "Base Value", 1f, "Charge value per kill.");
			ValuePerHP = Config.Bind<float>("Kills to Time", "Additional Value Per HP", 0f, "Charge value per base HP of the enemy, takes elites into account but not ambient level.");
			EliteBonus = Config.Bind<float>("Kills to Time", "Elite Bonus Value", 1f, "Extra charge given for defeating an elite.");
			EliteT2Bonus = Config.Bind<float>("Kills to Time", "Elite T2 Bonus Value", 10f, "Extra charge given for defeating a tier 2 elite. stacks with general elite bonus.");
			VariantBonus = Config.Bind<float>("Kills to Time", "Variant Bonus Value", 1f, "Extra charge given for defeating a variant enemy, multiplied by experience multiplier.");
			MinibossBonus = Config.Bind<float>("Kills to Time", "Miniboss Bonus Value", 2f, "Extra charge given for defeating a miniboss.");
			BossBonus = Config.Bind<float>("Kills to Time", "Boss Bonus Value", 9f, "Extra charge given for defeating a champion.");
			PreBossKillPenalty = Config.Bind<float>("Kills to Time", "Pre Bosskill Penalty", 0f, "Every kill % before the boss is defeated will be multiplied by this amount.");
			OutsideRangePenalty = Config.Bind<float>("Kills to Time", "Outside Range Penalty", 1f, "Every kill % while you're outside the teleporter range will be multiplied by this amount.");
			UnlockInteractables = Config.Bind<bool>("Unlock Interactables", "Unlock Interactables", false, "Unlock interactables with a teleporter enabled.");
			UnlockInteractablesPostBoss = Config.Bind<bool>("Unlock Interactables", "Unlock Interactables Post Boss", false, "Unlock interactables with a teleporter enabled.");
			UnlockVoidSeeds = Config.Bind<bool>("Unlock Interactables", "Unlock Void Seeds", false, "Unlock interactables with void seed enabled.");
			ModePerPerson = Config.Bind<StackingMode>("General Scaling", "Per Person Multiplier Mode", StackingMode.Exponential, "Linear: Value*Count+1, Exponential: Value^Count, Hyperbolic: Value*(Count/(Count+1))+1, Asymptotic: Value - (Value-1)*(1-0.5^Count)");
			ValuePerPerson = Config.Bind<float>("General Scaling", "Multiplier Per Person", 1f, "For people who are well coordinated?? idk");
			ModePerPersonArea = Config.Bind<StackingMode>("General Scaling", "Per Person Area Multiplier Mode", StackingMode.Exponential, "Linear: Value*Count+1, Exponential: Value^Count, Hyperbolic: Value*(Count/(Count+1))+1, Asymptotic: Value - (Value-1)*(1-0.5^Count)");
			ValuePerPersonArea = Config.Bind<float>("General Scaling", "Area Multiplier Per Person", 1f, "For people who are well coordinated?? idk");
			ModePerStage = Config.Bind<StackingMode>("General Scaling", "Per Stage Multiplier Mode", StackingMode.Exponential, "Linear: Value*Count+1, Exponential: Value^Count, Hyperbolic: Value*(Count/(Count+1))+1, Asymptotic: Value - (Value-1)*(1-0.5^Count)");
			ValuePerStage = Config.Bind<float>("General Scaling", "Multiplier Per Stage", 1f, "multiplier per stage.");
			ModePerLoop = Config.Bind<StackingMode>("General Scaling", "Per Loop Multiplier Mode", StackingMode.Linear, "Linear: Value*Count+1, Exponential: Value^Count, Hyperbolic: Value*(Count/(Count+1))+1, Asymptotic: Value - (Value-1)*(1-0.5^Count)");
			ValuePerLoop = Config.Bind<float>("General Scaling", "Multiplier Per Loop", 1f, "This is also a ChargeInHalf continuation");
			FocusedConvergenceRateLimit = Config.Bind<int>("General Scaling", "Focused Convergence Rate Max Stack", -1, "Set to -1 for infinite.");
			FocusedConvergenceRangeLimit = Config.Bind<int>("General Scaling", "Focused Convergence Range Max Stack", 3, "Set to -1 for infinite.");
			TeleporterTime = Config.Bind<float>("Zones", "Teleporter Base Charge Time", 90f, "Good ol' Teleporter.");
			TeleporterMult = Config.Bind<float>("Zones", "Teleporter Charge Multiplier", 1f, "General Scaling's effect on Teleporters. (except focused convergence)");
			TeleporterKill = Config.Bind<float>("Zones", "Teleporter Kills Multiplier", 1f, "Kills to Time's effect on Teleporters.");
			TeleporterArea = Config.Bind<float>("Zones", "Teleporter Base Area", 60f, "");
			TeleporterMultBoss = Config.Bind<float>("Zones", "Teleporter Charge Rate post Bosskill", 1f, "");
			TeleporterAreaBoss = Config.Bind<float>("Zones", "Teleporter Base Area post Bosskill", 60f, "");
			TeleporterTimestopArea = Config.Bind<float>("Zones", "Telepoter Time Stop Area", 12f, "Radius in meters. Set to 0 to disable.");
			DebugMode = Config.Bind<bool>("If some configs dont work enable this", "Debug Mode", false, "Enable Detailed Log Messages.");
			if (TeleporterTimestopArea.Value > 0f)
			{
				object obj = <>c.<>9__78_0;
				if (obj == null)
				{
					hook_ShouldUpdateRunStopwatch val = delegate(orig_ShouldUpdateRunStopwatch orig, Run self)
					{
						//IL_005b: Unknown result type (might be due to invalid IL or missing references)
						//IL_0062: 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_006c: Unknown result type (might be due to invalid IL or missing references)
						bool result = orig.Invoke(self);
						TeleporterInteraction instance = TeleporterInteraction.instance;
						if (instance != null && instance.isCharged)
						{
							foreach (NetworkUser instances in NetworkUser.instancesList)
							{
								CharacterBody currentBody = instances.GetCurrentBody();
								if (!((Object)(object)currentBody == (Object)null))
								{
									Vector3 val2 = ((Component)TeleporterInteraction.instance).transform.position - currentBody.corePosition;
									if (((Vector3)(ref val2)).magnitude > TeleporterTimestopArea.Value)
									{
										return result;
									}
								}
							}
							if (DebugMode.Value)
							{
								Log.LogInfo((object)"Time Stopped");
							}
							return false;
						}
						return result;
					};
					<>c.<>9__78_0 = val;
					obj = (object)val;
				}
				Run.ShouldUpdateRunStopwatch += (hook_ShouldUpdateRunStopwatch)obj;
			}
			PrimordialTime = Config.Bind<float>("Zones", "Primordial Teleporter Base Charge Time", 90f, "Primordial Teleporter, in case you want Stage 5 to be special.");
			PrimordialMult = Config.Bind<float>("Zones", "Primordial Teleporter Charge Multiplier", 1f, "General Scaling's effect on Primordial Teleporters. (except focused convergence)");
			PrimordialKill = Config.Bind<float>("Zones", "Primordial Teleporter Kills Multiplier", 0f, "Kills to Time's effect on Primordial Teleporters.");
			PrimordialArea = Config.Bind<float>("Zones", "Primordial Teleporter Base Area", 60f, "");
			PrimordialMultBoss = Config.Bind<float>("Zones", "Primordial Teleporter Charge Rate post Bosskill", 1f, "");
			PrimordialAreaBoss = Config.Bind<float>("Zones", "Primordial Teleporter Base Area post Bosskill", 60f, "");
			PillarMassTime = Config.Bind<float>("Zones", "Pillar of Mass Base Charge Time", 60f, "Who doesn't like Moon Pillars?");
			PillarMassMult = Config.Bind<float>("Zones", "Pillar of Mass Charge Multiplier", 0f, "General Scaling's effect on Moon Pillars. (except focused convergence)");
			PillarMassKill = Config.Bind<float>("Zones", "Pillar of Mass Kills Multiplier", 0f, "Kills to Time's effect on Moon Pillars.");
			PillarMassArea = Config.Bind<float>("Zones", "Pillar of Mass Base Area", 20f, "");
			PillarDesignTime = Config.Bind<float>("Zones", "Pillar of Design Base Charge Time", 30f, "Who doesn't like Moon Pillars?");
			PillarDesignMult = Config.Bind<float>("Zones", "Pillar of Design Charge Multiplier", 0f, "General Scaling's effect on Moon Pillars. (except focused convergence)");
			PillarDesignKill = Config.Bind<float>("Zones", "Pillar of Design Kills Multiplier", 0f, "Kills to Time's effect on Moon Pillars.");
			PillarDesignArea = Config.Bind<float>("Zones", "Pillar of Design Base Area", 20f, "");
			PillarSoulTime = Config.Bind<float>("Zones", "Pillar of Soul Base Charge Time", 30f, "Who doesn't like Moon Pillars?");
			PillarSoulMult = Config.Bind<float>("Zones", "Pillar of Soul Charge Multiplier", 0f, "General Scaling's effect on Moon Pillars. (except focused convergence)");
			PillarSoulKill = Config.Bind<float>("Zones", "Pillar of Soul Kills Multiplier", 0f, "Kills to Time's effect on Moon Pillars.");
			PillarSoulArea = Config.Bind<float>("Zones", "Pillar of Soul Base Area", 20f, "");
			PillarBloodTime = Config.Bind<float>("Zones", "Pillar of Blood Base Charge Time", 10f, "Who doesn't like Moon Pillars?");
			PillarBloodMult = Config.Bind<float>("Zones", "Pillar of Blood Charge Multiplier", 0f, "General Scaling's effect on Moon Pillars. (except focused convergence)");
			PillarBloodKill = Config.Bind<float>("Zones", "Pillar of Blood Kills Multiplier", 0f, "Kills to Time's effect on Moon Pillars.");
			PillarBloodArea = Config.Bind<float>("Zones", "Pillar of Blood Base Area", 20f, "");
			EndingTime = Config.Bind<float>("Zones", "The Final Spacecraft Base Charge Time", 120f, "And so they left...");
			EndingMult = Config.Bind<float>("Zones", "The Final Spacecraft Charge Multiplier", 0f, "General Scaling's effect on The Final Spacecraft. (except focused convergence)");
			EndingKill = Config.Bind<float>("Zones", "The Final Spacecraft Kills Multiplier", 2f, "Kills to Time's effect on The Final Spacecraft.");
			EndingArea = Config.Bind<float>("Zones", "The Final Spacecraft Base Area", 40f, "");
			FieldTime = Config.Bind<float>("Zones", "Void Field Base Charge Time", 60f, "Void Fields");
			FieldMult = Config.Bind<float>("Zones", "Void Field Charge Multiplier", 1f, "General Scaling's effect on Void Fields. (except focused convergence)");
			FieldKill = Config.Bind<float>("Zones", "Void Field Kills Multiplier", 1f, "Kills to Time's effect on Void Fields.");
			FieldArea = Config.Bind<float>("Zones", "Void Field Base Area", 15f, "");
			LocusTime = Config.Bind<float>("Zones", "Deep Void Beacon Base Charge Time", 90f, "Deep Void Beacons");
			LocusMult = Config.Bind<float>("Zones", "Deep Void Beacon Charge Multiplier", 1f, "General Scaling's effect on Deep Void Beacons. (except focused convergence)");
			LocusKill = Config.Bind<float>("Zones", "Deep Void Beacon Kills Multiplier", 1f, "Kills to Time's effect on Deep Void Beacons.");
			LocusArea = Config.Bind<float>("Zones", "Deep Void Beacon Base Area", 20f, "");
			HoldoutMultipliers = new List<HoldoutMultiplierInfo>(9)
			{
				new HoldoutMultiplierInfo
				{
					name = "Teleporter1",
					time = TeleporterTime.Value,
					mult = TeleporterMult.Value,
					multBoss = TeleporterMultBoss.Value,
					kill = TeleporterKill.Value,
					area = TeleporterArea.Value,
					areaBoss = TeleporterAreaBoss.Value
				},
				new HoldoutMultiplierInfo
				{
					name = "LunarTeleporter",
					time = PrimordialTime.Value,
					mult = PrimordialMult.Value,
					multBoss = PrimordialMultBoss.Value,
					kill = PrimordialKill.Value,
					area = PrimordialArea.Value,
					areaBoss = PrimordialAreaBoss.Value
				},
				new HoldoutMultiplierInfo
				{
					name = "MoonBatteryMass",
					time = PillarMassTime.Value,
					mult = PillarMassMult.Value,
					multBoss = -1f,
					kill = PillarMassKill.Value,
					area = PillarMassArea.Value,
					areaBoss = -1f
				},
				new HoldoutMultiplierInfo
				{
					name = "MoonBatteryDesign",
					time = PillarDesignTime.Value,
					mult = PillarDesignMult.Value,
					multBoss = -1f,
					kill = PillarDesignKill.Value,
					area = PillarDesignArea.Value,
					areaBoss = -1f
				},
				new HoldoutMultiplierInfo
				{
					name = "MoonBatteryBlood",
					time = PillarBloodTime.Value,
					mult = PillarBloodMult.Value,
					multBoss = -1f,
					kill = PillarBloodKill.Value,
					area = PillarBloodArea.Value,
					areaBoss = -1f
				},
				new HoldoutMultiplierInfo
				{
					name = "MoonBatterySoul",
					time = PillarSoulTime.Value,
					mult = PillarSoulMult.Value,
					multBoss = -1f,
					kill = PillarSoulKill.Value,
					area = PillarSoulArea.Value,
					areaBoss = -1f
				},
				new HoldoutMultiplierInfo
				{
					name = "HoldoutZone",
					time = EndingTime.Value,
					mult = EndingMult.Value,
					multBoss = -1f,
					kill = EndingKill.Value,
					area = EndingArea.Value,
					areaBoss = -1f
				},
				new HoldoutMultiplierInfo
				{
					name = "NullSafeZone",
					time = FieldTime.Value,
					mult = FieldMult.Value,
					multBoss = -1f,
					kill = FieldKill.Value,
					area = FieldArea.Value,
					areaBoss = -1f
				},
				new HoldoutMultiplierInfo
				{
					name = "DeepVoidPortalBattery",
					time = LocusTime.Value,
					mult = LocusMult.Value,
					multBoss = -1f,
					kill = LocusKill.Value,
					area = LocusArea.Value,
					areaBoss = -1f
				}
			};
			Hooks.Patch();
		}

		public static float Calc(StackingMode mode, float value, float count)
		{
			switch (mode)
			{
			case StackingMode.Linear:
				return value * count + 1f;
			case StackingMode.Exponential:
				return Mathf.Pow(value, count);
			case StackingMode.Hyperbolic:
				return value * count / (count + 1f) + 1f;
			case StackingMode.Asymptotic:
				return (1f - value) * (1f - Mathf.Pow(2f, 0f - count)) + value;
			default:
				Log.LogError((object)"Invalid Mode??");
				return 0f;
			}
		}
	}
}