Decompiled source of VoidQoL v1.1.6

plugins/VoidQoL/VoidQoL.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Missions.Arena.NullWard;
using HG.Reflection;
using Microsoft.CodeAnalysis;
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: AssemblyTitle("VoidQoL")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VoidQoL")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("9999.1.1.6")]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("9999.1.1.6")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace VoidQoL
{
	internal static class Config
	{
		internal static ConfigEntry<bool> voidFieldsIncreaseChargeOnKill;

		internal static ConfigEntry<bool> voidFieldsIncreaseChargeBasedOnSize;

		internal static ConfigEntry<float> voidFieldsIncreaseChargePercentagePerKill;

		internal static ConfigEntry<bool> voidFieldsEnemyHasteOnSpawn;

		internal static ConfigEntry<float> voidFieldsEnemyHasteDuration;

		internal static ConfigEntry<bool> voidFieldsHealOnRoundStart;

		internal static ConfigEntry<bool> voidFieldsReviveOnRoundStart;

		internal static ConfigEntry<bool> voidFieldsReviveOnArenaEnd;

		internal static ConfigEntry<float> voidFieldsHoldoutZoneRadiusMult;

		internal static ConfigEntry<bool> voidLocusIncreaseChargeOnKill;

		internal static ConfigEntry<bool> voidLocusPlayerFogHaste;

		internal static ConfigEntry<bool> voidLocusSupressNPCEntry;

		internal static ConfigEntry<bool> voidLocusDecreaseRadiusIfEnemyInvades;

		internal static ConfigEntry<bool> voidLocusVoidMonsterNoVoidItem;

		internal static ConfigEntry<bool> voidLocusHoldoutZoneVerticalTube;

		internal static ConfigEntry<float> voidLocusHoldoutZoneRadiusExtra;

		internal static ConfigEntry<float> voidLocusHoldoutZoneAutoCharge;

		internal static ConfigEntry<float> voidLocusHoldoutZonePlayerScaling;

		internal static ConfigEntry<float> voidLocusHoldoutZoneDischargeRate;

		public static void Initialize()
		{
			voidFieldsIncreaseChargeOnKill = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Fields", "Charge On Kill : Active", true, "Should the holdout zones gain charge from monster kills.");
			voidFieldsIncreaseChargeBasedOnSize = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Fields", "Charge On Kill : Gain based on enemy Size", true, "Should the holdout zones gain charge from monster kills based on their size divided by 1.5. Champions always give flat 5%. Needs: Charge On Kill : Active");
			voidFieldsIncreaseChargePercentagePerKill = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Fields", "Charge On Kill : Flat gain per skill", 0f, "Flat amount of charge the holdout zones will gain with each kill. Needs: Charge On Kill : Active");
			voidFieldsEnemyHasteOnSpawn = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Fields", "Hasten Enemies : Active", true, "Should monsters spawning get a speedboost when spawning.");
			voidFieldsEnemyHasteDuration = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Fields", "Hasten Enemies : Buff Duration", 16f, "Base amount in seconds which the cloak speed boost buff will last in enemies spawning. Substracted by their current speed, so fast enemies / enemies with items don't go overdrive. Needs: Hasten Enemies : Active");
			voidFieldsHealOnRoundStart = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Fields", "Round Heal", true, "Should the players inside the Void Vent get healed when starting a new wave.");
			voidFieldsReviveOnRoundStart = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Fields", "Round Revival", false, "Should dead players revive when starting a new wave.");
			voidFieldsReviveOnArenaEnd = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Fields", "Clear Revival", false, "Should dead players revive when the arena has been cleared.");
			voidFieldsHoldoutZoneRadiusMult = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Fields", "Radius Multiplication", 1f, "By what number should the Holdout Zone multiply its radius for.");
			voidLocusIncreaseChargeOnKill = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Locus", "Charge On Kill", false, "Should the holdout zones gain charge from monster kills.");
			voidLocusPlayerFogHaste = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Locus", "Apply haste if inside fog on new round start.", true, "If true, it will grant a speed boost to all players in the fog whenever a zone gets activated.");
			voidLocusSupressNPCEntry = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Locus", "Supress NPC entry.", false, "If true, NPCs like drones won't be allowed in the stage. Bazaar between Time functions in the same way.");
			voidLocusDecreaseRadiusIfEnemyInvades = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Locus", "Decrease If Enemy Invades", true, "If true, the radius of the charging zone will decrease if there's enemies inside.");
			voidLocusVoidMonsterNoVoidItem = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Locus", "Remove void items from void enemies", true, "If true, any void enemies that spawn will get their void items taken away.");
			voidLocusHoldoutZoneVerticalTube = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<bool>("VoidQoL :: Void Locus", "Vertical Tube", true, "If true, it will change the zones to be a vertical tube instead of a sphere.");
			voidLocusHoldoutZoneRadiusExtra = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Locus", "Radius Increase", 5f, "By what number should the Holdout Zone increase its radius. Vanilla has a base radius of 20m, and it cannot be smaller than 5m.");
			voidLocusHoldoutZoneAutoCharge = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Locus", "Auto charging percentage", 0f, "What percentage should the Holdout Zone gain charge each second.");
			voidLocusHoldoutZonePlayerScaling = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Locus", "Player scale value", 0.75f, "How much players affect the charging rate while inside the zone. Default is 1. Math operation is (PlayersInRadius / AlivePlayers) ^ this.");
			voidLocusHoldoutZoneDischargeRate = ((BaseUnityPlugin)UnityPlugin.instance).Config.Bind<float>("VoidQoL :: Void Locus", "Discharge Rate", -0.005f, "By how much should the zone discharge when there's no players inside. Negative values add to the charge percentage.");
			Debug.Log((object)("The config values are:\nvoidFieldsIncreaseChargeOnKill " + voidFieldsIncreaseChargeOnKill.Value + "\nvoidFieldsHealOnRoundStart " + voidFieldsHealOnRoundStart.Value + "\nvoidFieldsReviveOnRoundStart " + voidFieldsReviveOnRoundStart.Value + "\nvoidFieldsReviveOnArenaEnd" + voidFieldsReviveOnArenaEnd.Value + "\nvoidFieldsHoldoutZoneRadiusMult" + voidFieldsHoldoutZoneRadiusMult.Value + "\n\nvoidLocusIncreaseChargeOnKill " + voidLocusIncreaseChargeOnKill.Value + "\nvoidLocusPlayerFogHaste " + voidLocusPlayerFogHaste.Value + "\voidLocusDecreaseRadiusIfEnemyInvades " + voidLocusDecreaseRadiusIfEnemyInvades.Value + "\nvoidLocusHoldoutZoneVerticalTube " + voidLocusHoldoutZoneVerticalTube.Value + "\voidLocusHoldoutZoneRadiusExtra " + voidLocusHoldoutZoneRadiusExtra.Value + "\nvoidLocusHoldoutZoneAutoCharge" + voidLocusHoldoutZoneAutoCharge.Value + "\nvoidLocusHoldoutZonePlayerScaling " + voidLocusHoldoutZonePlayerScaling.Value));
		}
	}
	[BepInPlugin("com.Anreol.VoidQoL", "VoidQoL", "9999.1.1.6")]
	public class UnityPlugin : BaseUnityPlugin
	{
		internal const string ModVer = "9999.1.1.6";

		internal const string ModIdentifier = "VoidQoL";

		internal const string ModGuid = "com.Anreol.VoidQoL";

		public static UnityPlugin instance;

		public void Awake()
		{
			instance = this;
			Config.Initialize();
		}
	}
}
namespace VoidQoL.Modules
{
	internal class VoidFieldsQoL
	{
		private static VoidFieldsQoLServerListener instance;

		[SystemInitializer(new Type[] { typeof(SceneCatalog) })]
		public static void Init()
		{
			ArenaMissionController.onInstanceChangedGlobal += onInstanceChangedGlobal;
			ArenaMissionController.onBeatArena += RemoveComponent;
		}

		private static void RemoveComponent()
		{
			if ((Object)(object)instance != (Object)null)
			{
				Object.Destroy((Object)(object)instance);
			}
		}

		private static void onInstanceChangedGlobal()
		{
			if ((Object)(object)instance == (Object)null && NetworkServer.active)
			{
				instance = ((Component)ArenaMissionController.instance).gameObject.AddComponent<VoidFieldsQoLServerListener>();
			}
		}
	}
	internal class VoidFieldsQoLServerListener : MonoBehaviour
	{
		private float accumulatedCharge;

		private float totalAccumulatedChargeInCurrentRound;

		private int nOfClearedRounds;

		private bool awaitActivation = false;

		private EntityStateMachine cachedMachineOfCurrentRound;

		private void OnEnable()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			cachedMachineOfCurrentRound = ArenaMissionController.instance.nullWards[0].GetComponent<EntityStateMachine>();
			if (Config.voidFieldsIncreaseChargeOnKill.Value)
			{
				GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal;
			}
			if (Config.voidFieldsEnemyHasteOnSpawn.Value)
			{
				CharacterBody.onBodyStartGlobal += onBodyStartGlobal;
			}
			GameObject[] nullWards = ArenaMissionController.instance.nullWards;
			foreach (GameObject val in nullWards)
			{
				HoldoutZoneController component = val.GetComponent<HoldoutZoneController>();
				component.calcAccumulatedCharge += new CalcAccumulatedChargeDelegate(calcAccumulatedCharge);
				component.calcRadius += new CalcRadiusDelegate(calcRadius);
			}
		}

		private void onBodyStartGlobal(CharacterBody obj)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			if (TeamManager.IsTeamEnemy(obj.teamComponent.teamIndex, (TeamIndex)1))
			{
				obj.AddTimedBuff(Buffs.CloakSpeed, Config.voidFieldsEnemyHasteDuration.Value - obj.moveSpeed);
				obj.AddTimedBuff(Buffs.HiddenInvincibility, 0.75f);
			}
		}

		private void calcRadius(ref float radius)
		{
			if (Config.voidFieldsHoldoutZoneRadiusMult.Value != 1f)
			{
				radius *= Config.voidFieldsHoldoutZoneRadiusMult.Value;
			}
		}

		private void OnDisable()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			GlobalEventManager.onCharacterDeathGlobal -= onCharacterDeathGlobal;
			GameObject[] nullWards = ArenaMissionController.instance.nullWards;
			foreach (GameObject val in nullWards)
			{
				HoldoutZoneController component = val.GetComponent<HoldoutZoneController>();
				component.calcAccumulatedCharge -= new CalcAccumulatedChargeDelegate(calcAccumulatedCharge);
			}
		}

		private void OnDestroy()
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			Debug.LogWarning((object)"Destroyed!");
			SphereZone component = ((Component)cachedMachineOfCurrentRound).gameObject.GetComponent<SphereZone>();
			if (Run.instance.isGameOverServer || !Config.voidFieldsReviveOnArenaEnd.Value)
			{
				return;
			}
			Debug.LogWarning((object)"Reviving players at round end!");
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				Debug.LogWarning((object)("Checking for revival " + instance.GetDisplayName()));
				CharacterMaster master = instance.master;
				if (!instance.isConnected || !master.IsDeadAndOutOfLivesServer() || !Config.voidFieldsReviveOnRoundStart.Value)
				{
					continue;
				}
				Vector3 val = master.deathFootPosition;
				if (Object.op_Implicit((Object)(object)component))
				{
					val = TeleportHelper.FindSafeTeleportDestination(((Component)component).transform.position, master.bodyPrefab.GetComponent<CharacterBody>(), RoR2Application.rng).GetValueOrDefault(val);
				}
				master.Respawn(val, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), false);
				CharacterBody body = master.GetBody();
				if (Object.op_Implicit((Object)(object)body))
				{
					body.AddTimedBuff(Buffs.Immune, 3f);
					EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>();
					foreach (EntityStateMachine val2 in components)
					{
						val2.initialStateType = val2.mainStateType;
					}
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Expected O, but got Unknown
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			if (nOfClearedRounds != ArenaMissionController.instance.clearedRounds)
			{
				Debug.LogWarning((object)"Awaiting new Round!");
				Debug.LogWarning((object)("Amount of charge accumulated in the previous round by kills: " + totalAccumulatedChargeInCurrentRound));
				totalAccumulatedChargeInCurrentRound = 0f;
				cachedMachineOfCurrentRound = ArenaMissionController.instance.nullWards[ArenaMissionController.instance.currentRound].GetComponent<EntityStateMachine>();
				nOfClearedRounds = ArenaMissionController.instance.clearedRounds;
				awaitActivation = true;
			}
			if (!awaitActivation)
			{
				return;
			}
			EntityState state = cachedMachineOfCurrentRound.state;
			Active val = (Active)(object)((state is Active) ? state : null);
			if (val == null)
			{
				return;
			}
			Debug.LogWarning((object)"New Round!");
			awaitActivation = false;
			if (Run.instance.isGameOverServer)
			{
				return;
			}
			for (int i = 0; i < PlayerCharacterMasterController.instances.Count; i++)
			{
				Debug.LogWarning((object)("Checking for healing & Revival: " + PlayerCharacterMasterController.instances[i].GetDisplayName()));
				CharacterMaster master = PlayerCharacterMasterController.instances[i].master;
				if (PlayerCharacterMasterController.instances[i].isConnected && master.IsDeadAndOutOfLivesServer() && Config.voidFieldsReviveOnRoundStart.Value)
				{
					Vector3 val2 = master.deathFootPosition;
					if (Object.op_Implicit((Object)(object)((NullWardBaseState)val).sphereZone))
					{
						val2 = TeleportHelper.FindSafeTeleportDestination(((Component)((NullWardBaseState)val).sphereZone).transform.position, master.bodyPrefab.GetComponent<CharacterBody>(), RoR2Application.rng).GetValueOrDefault(val2);
					}
					Debug.LogWarning((object)("Respawning " + PlayerCharacterMasterController.instances[i].GetDisplayName()));
					master.Respawn(val2, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), false);
					CharacterBody body = master.GetBody();
					if (Object.op_Implicit((Object)(object)body))
					{
						body.AddTimedBuff(Buffs.Immune, 3f);
						EntityStateMachine[] components = ((Component)body).GetComponents<EntityStateMachine>();
						foreach (EntityStateMachine val3 in components)
						{
							val3.initialStateType = val3.mainStateType;
						}
					}
				}
				CharacterBody body2 = master.GetBody();
				if (Config.voidFieldsHealOnRoundStart.Value)
				{
					Debug.LogWarning((object)("Healing " + master.GetBody().GetDisplayName()));
					body2.healthComponent.HealFraction(0.05f, default(ProcChainMask));
					EffectData val4 = new EffectData
					{
						origin = body2.transform.position
					};
					val4.SetNetworkedObjectReference(((Component)body2).gameObject);
					EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MedkitHealEffect"), val4, true);
					bool flag = Vector3.Distance(body2.transform.position, ((EntityState)val).transform.position) <= 5f;
					if (((BaseZoneBehavior)((NullWardBaseState)val).sphereZone).IsInBounds(body2.transform.position) || flag)
					{
						Debug.LogWarning((object)("Healing more since was inside void cell " + master.GetBody().GetDisplayName()));
						body2.healthComponent.HealFraction(0.45f, default(ProcChainMask));
					}
				}
			}
		}

		private void calcAccumulatedCharge(ref float charge)
		{
			if (charge >= 0.05f)
			{
				charge += accumulatedCharge / 100f;
				accumulatedCharge = 0f;
			}
		}

		private void onCharacterDeathGlobal(DamageReport obj)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			if (TeamManager.IsTeamEnemy(obj.victimTeamIndex, (TeamIndex)1) && (cachedMachineOfCurrentRound.state is Active || !awaitActivation))
			{
				if (Config.voidFieldsIncreaseChargeBasedOnSize.Value)
				{
					accumulatedCharge += (obj.victimIsChampion ? 5f : (obj.victimBody.bestFitRadius / 1.5f));
					totalAccumulatedChargeInCurrentRound += (obj.victimIsChampion ? 5f : (obj.victimBody.bestFitRadius / 1.5f));
				}
				if (Config.voidFieldsIncreaseChargePercentagePerKill.Value > 0f)
				{
					accumulatedCharge += Config.voidFieldsIncreaseChargePercentagePerKill.Value;
					totalAccumulatedChargeInCurrentRound += Config.voidFieldsIncreaseChargePercentagePerKill.Value;
				}
			}
		}
	}
	public class VoidLocusQoL
	{
		public static VoidLocusQoLMissionControllerListener instance;

		[SystemInitializer(new Type[] { typeof(SceneCatalog) })]
		public static void Init()
		{
			Stage.onStageStartGlobal += onStageStartGlobal;
			CharacterBody.onBodyStartGlobal += onBodyStartGlobal;
			SceneCatalog.GetSceneDefFromSceneName("voidstage").suppressNpcEntry = Config.voidLocusSupressNPCEntry.Value;
		}

		private static void onBodyStartGlobal(CharacterBody obj)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Invalid comparison between Unknown and I4
			//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_0067: 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_0078: Invalid comparison between Unknown and I4
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Invalid comparison between Unknown and I4
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Invalid comparison between Unknown and I4
			//IL_00a4: 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_0097: Invalid comparison between Unknown and I4
			//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_00e3: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active || !((Object)(object)instance != (Object)null) || !Config.voidLocusVoidMonsterNoVoidItem.Value || (int)obj.teamComponent.teamIndex != 4)
			{
				return;
			}
			List<ItemIndex> list = new List<ItemIndex>();
			foreach (ItemIndex item in obj.inventory.itemAcquisitionOrder)
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(item);
				if ((int)itemDef.tier == 6 || (int)itemDef.tier == 7 || (int)itemDef.tier == 8 || (int)itemDef.tier == 9)
				{
					list.Add(item);
				}
			}
			foreach (ItemIndex item2 in list)
			{
				obj.inventory.ResetItem(item2);
			}
		}

		public static void onStageStartGlobal(Stage obj)
		{
			if (Object.op_Implicit((Object)(object)VoidStageMissionController.instance) && (Object)(object)instance == (Object)null)
			{
				instance = ((Component)VoidStageMissionController.instance).gameObject.AddComponent<VoidLocusQoLMissionControllerListener>();
			}
		}
	}
	public class VoidLocusQoLMissionControllerListener : MonoBehaviour
	{
		private int cachedFogCount;

		private void FixedUpdate()
		{
			ScanForHoldoutZones();
		}

		private void ScanForHoldoutZones()
		{
			List<HoldoutZoneController> instancesList = InstanceTracker.GetInstancesList<HoldoutZoneController>();
			foreach (HoldoutZoneController item in instancesList)
			{
				if (Object.op_Implicit((Object)(object)((Component)item).gameObject.GetComponent<VoidLocusQoLHoldoutZoneController>()))
				{
					continue;
				}
				Debug.LogWarning((object)("Gave " + ((object)item)?.ToString() + " its own VoidLocusQoL controller"));
				((Component)item).gameObject.AddComponent<VoidLocusQoLHoldoutZoneController>();
				if (!Config.voidLocusPlayerFogHaste.Value || !NetworkServer.active)
				{
					continue;
				}
				Debug.Log((object)"Applying haste!");
				IEnumerable<CharacterBody> affectedBodiesOnTeam = VoidStageMissionController.instance.fogDamageController.GetAffectedBodiesOnTeam((TeamIndex)1);
				foreach (CharacterBody item2 in affectedBodiesOnTeam)
				{
					item2.AddTimedBuff(Buffs.KillMoveSpeed, 6f);
					item2.AddTimedBuff(Buffs.KillMoveSpeed, 6f);
					item2.AddTimedBuff(Buffs.KillMoveSpeed, 6f);
					item2.AddTimedBuff(Buffs.KillMoveSpeed, 6f);
					item2.AddTimedBuff(Buffs.KillMoveSpeed, 6f);
					Debug.Log((object)("Applied haste to " + (object)item2));
				}
			}
		}
	}
	internal class VoidLocusQoLHoldoutZoneController : MonoBehaviour
	{
		private HoldoutZoneController disThing;

		private SphereSearch sphereSearch;

		private List<HurtBox> enemyHurtboxList;

		private TeamMask voidTeam;

		private float chargeFromKilling;

		private float stopwatch;

		private void OnEnable()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Expected O, but got Unknown
			InstanceTracker.Add<VoidLocusQoLHoldoutZoneController>(this);
			disThing = ((Component)this).gameObject.GetComponent<HoldoutZoneController>();
			if ((Object)(object)disThing == (Object)null)
			{
				Debug.LogError((object)"Destroying self, theres no HoldoutZoneController to attach ourselves to!");
				Object.Destroy((Object)(object)this);
				return;
			}
			if (Config.voidLocusHoldoutZoneVerticalTube.Value)
			{
				Debug.Log((object)"Tubifying the zone...");
				((Component)((Component)disThing.radiusIndicator).gameObject.transform.parent).transform.localScale = new Vector3(1f, 50f, 1f);
				disThing.holdoutZoneShape = (HoldoutZoneShape)1;
			}
			if (NetworkServer.active)
			{
				voidTeam = default(TeamMask);
				((TeamMask)(ref voidTeam)).AddTeam((TeamIndex)4);
				if (Config.voidLocusDecreaseRadiusIfEnemyInvades.Value)
				{
					Debug.Log((object)"Initializing sphere search...");
					enemyHurtboxList = new List<HurtBox>();
					sphereSearch = new SphereSearch
					{
						queryTriggerInteraction = (QueryTriggerInteraction)2,
						mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
						origin = ((Component)this).transform.position
					};
				}
				GlobalEventManager.onCharacterDeathGlobal += onCharacterDeathGlobal;
				disThing.calcAccumulatedCharge += new CalcAccumulatedChargeDelegate(calcAccumulatedCharge);
				disThing.calcRadius += new CalcRadiusDelegate(calcRadius);
				disThing.playerCountScaling = Config.voidLocusHoldoutZonePlayerScaling.Value;
				disThing.dischargeRate = Config.voidLocusHoldoutZoneDischargeRate.Value;
			}
		}

		private void FixedUpdate()
		{
			if (disThing.wasCharged)
			{
				Object.Destroy((Object)(object)this);
			}
		}

		private void OnDisable()
		{
			InstanceTracker.Remove<VoidLocusQoLHoldoutZoneController>(this);
		}

		private void onCharacterDeathGlobal(DamageReport obj)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			if (TeamManager.IsTeamEnemy(obj.victimTeamIndex, (TeamIndex)1))
			{
				chargeFromKilling += (obj.victimIsChampion ? 5f : (obj.victimBody.bestFitRadius / 5f));
			}
		}

		private void calcRadius(ref float radius)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			if (Config.voidLocusDecreaseRadiusIfEnemyInvades.Value && sphereSearch != null)
			{
				sphereSearch.radius = disThing.currentRadius;
				enemyHurtboxList.Clear();
				sphereSearch.RefreshCandidates().FilterCandidatesByDistinctHurtBoxEntities().FilterCandidatesByHurtBoxTeam(voidTeam)
					.GetHurtBoxes(enemyHurtboxList);
				foreach (HurtBox enemyHurtbox in enemyHurtboxList)
				{
					if (Object.op_Implicit((Object)(object)enemyHurtbox) && Object.op_Implicit((Object)(object)enemyHurtbox.healthComponent) && Object.op_Implicit((Object)(object)enemyHurtbox.healthComponent.body))
					{
						num -= ((enemyHurtbox.healthComponent.body.bestFitRadius > 1f) ? 1f : enemyHurtbox.healthComponent.body.bestFitRadius);
					}
				}
			}
			num += Config.voidLocusHoldoutZoneRadiusExtra.Value;
			radius += num;
		}

		private void calcAccumulatedCharge(ref float charge)
		{
			if (charge >= 0.01f)
			{
				stopwatch += Time.fixedDeltaTime;
				if (stopwatch >= 1f)
				{
					stopwatch = 0f;
					charge += Config.voidLocusHoldoutZoneAutoCharge.Value;
				}
				if (Config.voidLocusIncreaseChargeOnKill.Value)
				{
					charge += chargeFromKilling / 100f;
					chargeFromKilling = 0f;
				}
			}
		}
	}
}