Decompiled source of DefsServerSideTweaks v2.1.1

ServerSideTweaks.dll

Decompiled 3 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.InfiniteTowerSafeWard;
using HG.Reflection;
using IL.EntityStates.ChildMonster;
using IL.RoR2;
using InLobbyConfig;
using InLobbyConfig.Fields;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.InfiniteTowerSafeWard;
using On.RoR2;
using On.RoR2.Items;
using R2API.Utils;
using RoR2;
using RoR2.Navigation;
using ShareSuite;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ServerSideTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a0273983a9477457c5c3f57277a2845a90de1775")]
[assembly: AssemblyProduct("ServerSideTweaks")]
[assembly: AssemblyTitle("ServerSideTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[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 ServerSideTweaks
{
	public class BepConfig
	{
		public static ConfigEntry<float> PearlReplacesLunarItemChance;

		public static ConfigEntry<float> IrradiantPearlReplacesLunarItemChance;

		public static ConfigEntry<bool> NoPearlsInBazaar;

		public static ConfigEntry<bool> ChildReducedTeleportRange;

		public static ConfigEntry<bool> ChildRemoveInvincibility;

		public static ConfigEntry<bool> SimulacrumNonSharedLoot;

		public static ConfigEntry<int> SimulacrumLootMaxItemDebt;

		public static ConfigEntry<bool> SimulacrumLootSkullTokens;

		public static ConfigEntry<float> SimulacrumCommencementArtifactDissonanceChance;

		public static ConfigEntry<float> SimulacrumDirectorEnemyPowerBias;

		public static ConfigEntry<int> SimulacrumMaxSquadSize;

		public static ConfigEntry<float> SimulacrumWavePeriodSecondsFactor;

		public static ConfigEntry<bool> SimulacrumFastVoidCrab;

		public static ConfigEntry<float> ClassicDirectorEnemyPowerBias;

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

		public static void Init()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Expected O, but got Unknown
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Expected O, but got Unknown
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Expected O, but got Unknown
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected O, but got Unknown
			ConfigFile config = ((BaseUnityPlugin)ServerSideTweaks.instance).Config;
			Enabled = config.Bind<bool>("Main", "Enabled", true, "Enable Mod");
			PearlReplacesLunarItemChance = config.Bind<float>("Main", "Pearl replaces Lunar Item chance", 0.1f, new ConfigDescription("Adds a chance for lunar items to be replaced by a pearl.", (AcceptableValueBase)null, Array.Empty<object>()));
			IrradiantPearlReplacesLunarItemChance = config.Bind<float>("Main", "Irradiant Pearl replaces Lunar Item chance", 0.02f, new ConfigDescription("Adds a chance for lunar items to be replaced by an irradiant pearl.", (AcceptableValueBase)null, Array.Empty<object>()));
			NoPearlsInBazaar = config.Bind<bool>("Main", "No Pearl replacements in the Bazaar between Times", true, new ConfigDescription("Prevents pearls from appearing in the Bazaar to prevent hoarding.", (AcceptableValueBase)null, Array.Empty<object>()));
			ChildReducedTeleportRange = config.Bind<bool>("Main", "Child: Reduced teleport range", true, new ConfigDescription("Reduces the range children can teleport away.", (AcceptableValueBase)null, Array.Empty<object>()));
			ChildRemoveInvincibility = config.Bind<bool>("Main", "Child: Remove invincibility", true, new ConfigDescription("Removes the invincibility buff that children get before teleporting.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumNonSharedLoot = config.Bind<bool>("Simulacrum", "Non-shared loot", false, new ConfigDescription("(ShareSuite only) Forces the loot dropped at the end of each wave to be non-shared.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumLootMaxItemDebt = config.Bind<int>("Simulacrum", "Max loot debt", 2, new ConfigDescription("Prevents greedy players from taking too much of the loot dropped at the end of each wave.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumLootSkullTokens = config.Bind<bool>("Simulacrum", "Max loot debt - Skull Tokens", true, new ConfigDescription("Indicate to players how many void potentials they can take by assigning Skull Tokens.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumCommencementArtifactDissonanceChance = config.Bind<float>("Simulacrum", "Commencement Artifact of Dissonance Chance", 0.5f, new ConfigDescription("The chance for Artifact of Dissonance to be activated each wave when in the commencement stage to increase enemy variety.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumDirectorEnemyPowerBias = config.Bind<float>("Simulacrum", "Director: Enemy Power Bias", 0.5f, new ConfigDescription("Bias towards many,weak enemies (=0) or few,strong enemies (=1). Value between 0 and 1, 0.5 = vanilla.", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumMaxSquadSize = config.Bind<int>("Simulacrum", "Max squad size", 30, new ConfigDescription("No more than this many enemies shall be spawned at the same time (30 = vanilla).", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumWavePeriodSecondsFactor = config.Bind<float>("Simulacrum", "Wave Period Seconds Factor", 1f, new ConfigDescription("A factor on how long each wave takes. A value smaller than 1.0 makes the wave go faster, but also with stronger enemies. A value higher than 1.0 makes the wave take longer but the enemies are weaker. (1.0 = vanilla).", (AcceptableValueBase)null, Array.Empty<object>()));
			SimulacrumFastVoidCrab = config.Bind<bool>("Simulacrum", "Void Crab picks up speed", false, new ConfigDescription("Makes the Void Crab faster the more waves you complete.", (AcceptableValueBase)null, Array.Empty<object>()));
			ClassicDirectorEnemyPowerBias = config.Bind<float>("Classic", "Director: Enemy Power Bias", 0.5f, new ConfigDescription("Bias towards many,weak enemies (=0) or few,strong enemies (=1). Value between 0 and 1, 0.5 = vanilla.", (AcceptableValueBase)null, Array.Empty<object>()));
			if (ModCompatibilityInLobbyConfig.enabled)
			{
				ModCompatibilityInLobbyConfig.CreateFromBepInExConfigFile(config, "Server-Side Tweaks");
			}
		}
	}
	public static class ChatHelper
	{
		private const string RedColor = "ff0000";

		private const string GreenColor = "32cd32";

		private const string SilverColor = "c0c0c0";

		public static void PlayerHasTooManyItems(string userName)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			string baseToken = "<color=#ff0000>" + userName + " is being greedy!</color>";
			Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
			{
				baseToken = baseToken
			});
		}
	}
	public class EnumCollection
	{
		public enum ArtifactEnum
		{
			None,
			Chaos,
			Command,
			Death,
			Dissonance,
			Enigma,
			Evolution,
			Frailty,
			Glass,
			Honor,
			Kin,
			Metamorphosis,
			Sacrifice,
			Soul,
			Spite,
			Swarms,
			Vengeance
		}

		public enum StageEnum
		{
			None,
			TitanicPlains,
			DistantRoost,
			WetlandAspect,
			AbandonedAqueduct,
			RallypointDelta,
			ScorchedAcres,
			AbyssalDepths,
			SirensCall,
			GildedCoast,
			MomentFractured,
			Bazaar,
			VoidFields,
			MomentWhole,
			SkyMeadow,
			BullwarksAmbry,
			Commencement,
			SunderedGrove,
			VoidLocus,
			Planetarium,
			AphelianSanctuary,
			SimulacrumAbandonedAquaduct,
			SimulacrumAbyssalDepths,
			SimulacrumAphelianSanctuary,
			SimulacrumCommencement,
			SimulacrumRallypointDelta,
			SimulacrumSkyMeadow,
			SimulacrumTitanicPlains,
			SiphonedForest,
			SulfurPools
		}

		public static Dictionary<StageEnum, List<string>> SceneNames = new Dictionary<StageEnum, List<string>>
		{
			{
				StageEnum.TitanicPlains,
				new List<string> { "golemplains", "golemplains2" }
			},
			{
				StageEnum.DistantRoost,
				new List<string> { "blackbeach", "blackbeach2" }
			},
			{
				StageEnum.WetlandAspect,
				new List<string> { "foggyswamp" }
			},
			{
				StageEnum.AbandonedAqueduct,
				new List<string> { "goolake" }
			},
			{
				StageEnum.RallypointDelta,
				new List<string> { "frozenwall" }
			},
			{
				StageEnum.ScorchedAcres,
				new List<string> { "wispgraveyard" }
			},
			{
				StageEnum.AbyssalDepths,
				new List<string> { "dampcavesimple" }
			},
			{
				StageEnum.SirensCall,
				new List<string> { "shipgraveyard" }
			},
			{
				StageEnum.GildedCoast,
				new List<string> { "goldshores" }
			},
			{
				StageEnum.MomentFractured,
				new List<string> { "mysteryspace" }
			},
			{
				StageEnum.Bazaar,
				new List<string> { "bazaar" }
			},
			{
				StageEnum.VoidFields,
				new List<string> { "arena" }
			},
			{
				StageEnum.MomentWhole,
				new List<string> { "limbo" }
			},
			{
				StageEnum.SkyMeadow,
				new List<string> { "skymeadow" }
			},
			{
				StageEnum.BullwarksAmbry,
				new List<string> { "artifactworld" }
			},
			{
				StageEnum.Commencement,
				new List<string> { "moon", "moon2" }
			},
			{
				StageEnum.SunderedGrove,
				new List<string> { "rootjungle" }
			},
			{
				StageEnum.VoidLocus,
				new List<string> { "voidstage" }
			},
			{
				StageEnum.Planetarium,
				new List<string> { "voidraid" }
			},
			{
				StageEnum.AphelianSanctuary,
				new List<string> { "ancientloft" }
			},
			{
				StageEnum.SimulacrumAbandonedAquaduct,
				new List<string> { "itgoolake" }
			},
			{
				StageEnum.SimulacrumAbyssalDepths,
				new List<string> { "itdampcave" }
			},
			{
				StageEnum.SimulacrumAphelianSanctuary,
				new List<string> { "itancientloft" }
			},
			{
				StageEnum.SimulacrumCommencement,
				new List<string> { "itmoon" }
			},
			{
				StageEnum.SimulacrumRallypointDelta,
				new List<string> { "itfrozenwall" }
			},
			{
				StageEnum.SimulacrumSkyMeadow,
				new List<string> { "itskymeadow" }
			},
			{
				StageEnum.SimulacrumTitanicPlains,
				new List<string> { "itgolemplains" }
			},
			{
				StageEnum.SiphonedForest,
				new List<string> { "snowyforest" }
			},
			{
				StageEnum.SulfurPools,
				new List<string> { "sulfurpools" }
			}
		};

		public static T DecrementEnumValue<T>(T value) where T : struct, IConvertible
		{
			if (!typeof(T).IsEnum)
			{
				throw new ArgumentException("T must be an enumerated type");
			}
			int length = Enum.GetValues(typeof(T)).Length;
			return (T)(object)(((int)(object)value - 1 + length) % length);
		}

		public static T IncrementEnumValue<T>(T value) where T : struct, IConvertible
		{
			if (!typeof(T).IsEnum)
			{
				throw new ArgumentException("T must be an enumerated type");
			}
			int length = Enum.GetValues(typeof(T)).Length;
			return (T)(object)(((int)(object)value + 1) % length);
		}

		public static bool IsSimulacrumStage(string name)
		{
			if (GetFirstStageName(StageEnum.SimulacrumAbandonedAquaduct) == name)
			{
				return true;
			}
			if (GetFirstStageName(StageEnum.SimulacrumAbyssalDepths) == name)
			{
				return true;
			}
			if (GetFirstStageName(StageEnum.SimulacrumAphelianSanctuary) == name)
			{
				return true;
			}
			if (GetFirstStageName(StageEnum.SimulacrumCommencement) == name)
			{
				return true;
			}
			if (GetFirstStageName(StageEnum.SimulacrumRallypointDelta) == name)
			{
				return true;
			}
			if (GetFirstStageName(StageEnum.SimulacrumSkyMeadow) == name)
			{
				return true;
			}
			if (GetFirstStageName(StageEnum.SimulacrumTitanicPlains) == name)
			{
				return true;
			}
			return false;
		}

		public static bool SceneNameIsStage(string sceneName, StageEnum stageEnum)
		{
			return SceneNames[stageEnum].Contains(sceneName);
		}

		public static string GetFirstStageName(StageEnum stageEnum)
		{
			return SceneNames[stageEnum].First();
		}

		public static ArtifactDef GetArtifactDef(ArtifactEnum artifacts)
		{
			return (ArtifactDef)(artifacts switch
			{
				ArtifactEnum.Chaos => Artifacts.FriendlyFire, 
				ArtifactEnum.Command => Artifacts.Command, 
				ArtifactEnum.Death => Artifacts.TeamDeath, 
				ArtifactEnum.Dissonance => Artifacts.MixEnemy, 
				ArtifactEnum.Enigma => Artifacts.Enigma, 
				ArtifactEnum.Evolution => Artifacts.MonsterTeamGainsItems, 
				ArtifactEnum.Frailty => Artifacts.WeakAssKnees, 
				ArtifactEnum.Glass => Artifacts.Glass, 
				ArtifactEnum.Honor => Artifacts.EliteOnly, 
				ArtifactEnum.Kin => Artifacts.SingleMonsterType, 
				ArtifactEnum.Metamorphosis => Artifacts.RandomSurvivorOnRespawn, 
				ArtifactEnum.Sacrifice => Artifacts.Sacrifice, 
				ArtifactEnum.Soul => Artifacts.WispOnDeath, 
				ArtifactEnum.Spite => Artifacts.Bomb, 
				ArtifactEnum.Swarms => Artifacts.Swarms, 
				ArtifactEnum.Vengeance => Artifacts.ShadowClone, 
				_ => null, 
			});
		}
	}
	public class FastSimulacrumVrab
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnEnter <0>__Travelling_OnEnter;
		}

		private static bool enabled;

		private static AsyncOperationHandle<GameObject> iscInfiniteTowerSafeWard;

		private static AsyncOperationHandle<Material> matNullifierSafeWardPillarGlow;

		private static AsyncOperationHandle<Material> matNullifierSafeWardPillarStars;

		public static void Setup()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			iscInfiniteTowerSafeWard = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/InfiniteTowerSafeWard.prefab");
			matNullifierSafeWardPillarGlow = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/Common/Void/matNullifierSafeWardPillarGlow.mat");
			matNullifierSafeWardPillarStars = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/Common/Void/matNullifierSafeWardPillarStars.mat");
		}

		public static void Enable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			enabled = true;
			object obj = <>O.<0>__Travelling_OnEnter;
			if (obj == null)
			{
				hook_OnEnter val = Travelling_OnEnter;
				<>O.<0>__Travelling_OnEnter = val;
				obj = (object)val;
			}
			Travelling.OnEnter += (hook_OnEnter)obj;
		}

		public static void Disable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			enabled = false;
			object obj = <>O.<0>__Travelling_OnEnter;
			if (obj == null)
			{
				hook_OnEnter val = Travelling_OnEnter;
				<>O.<0>__Travelling_OnEnter = val;
				obj = (object)val;
			}
			Travelling.OnEnter -= (hook_OnEnter)obj;
		}

		private static void Travelling_OnEnter(orig_OnEnter orig, Travelling self)
		{
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			orig.Invoke(self);
			if (BepConfig.SimulacrumFastVoidCrab.Value && (Object)(object)Run.instance != (Object)null && ((object)Run.instance).GetType() == typeof(InfiniteTowerRun))
			{
				InfiniteTowerRun val = (InfiniteTowerRun)Run.instance;
				self.travelSpeed = 5f + (float)val.waveIndex * 0.1f;
			}
			if (NetworkServer.active)
			{
				List<NodeIndex> list = self.groundNodeGraph.FindNodesInRangeWithFlagConditions(((EntityState)self).transform.position, self.minDistanceToNewLocation, 500f, (HullMask)1, (NodeFlags)2, (NodeFlags)0, false);
				Util.ShuffleList<NodeIndex>(list, self.rng);
				self.potentialEndNodes.AddRange(list);
			}
		}

		private static void Travelling_EvaluateNextEndpoint(orig_EvaluateNextEndpoint orig, Travelling self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun))
			{
				InfiniteTowerRun val = (InfiniteTowerRun)Run.instance;
				GameObject val2 = new GameObject("Corridor");
				MeshFilter val3 = val2.AddComponent<MeshFilter>();
				MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
				CombineInstance[] array = (CombineInstance[])(object)new CombineInstance[self.catmullRomPoints.Count];
				int num = 50;
				for (int i = 0; i < self.catmullRomPoints.Count; i++)
				{
					GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
					obj.transform.localScale = new Vector3((float)num, 120f, (float)num);
					obj.transform.position = self.catmullRomPoints[i];
					obj.transform.rotation = Quaternion.identity;
					MeshFilter component = obj.GetComponent<MeshFilter>();
					((CombineInstance)(ref array[i])).mesh = component.sharedMesh;
					((CombineInstance)(ref array[i])).transform = ((Component)component).transform.localToWorldMatrix;
					Object.Destroy((Object)(object)obj);
					IZone val5 = CreateSafeZone2(self.catmullRomPoints[i], null);
					val.fogDamageController.AddSafeZone(val5);
				}
				Mesh val6 = new Mesh();
				val6.CombineMeshes(array, true, true);
				val3.mesh = val6;
				((Renderer)val4).castShadows = true;
				((Renderer)val4).motionVectors = true;
				((Renderer)val4).useLightProbes = true;
				((Renderer)val4).bounds = new Bounds(Vector3.zero, new Vector3(2f, 120f, 2f));
				((Renderer)val4).localBounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f));
				((Renderer)val4).enabled = true;
				((Renderer)val4).shadowCastingMode = (ShadowCastingMode)1;
				((Renderer)val4).receiveShadows = true;
				((Renderer)val4).forceRenderingOff = false;
				((Renderer)val4).staticShadowCaster = false;
				((Renderer)val4).motionVectorGenerationMode = (MotionVectorGenerationMode)1;
				((Renderer)val4).lightProbeUsage = (LightProbeUsage)1;
				((Renderer)val4).reflectionProbeUsage = (ReflectionProbeUsage)1;
				((Renderer)val4).renderingLayerMask = uint.MaxValue;
				((Renderer)val4).rendererPriority = 0;
				((Renderer)val4).rayTracingMode = (RayTracingMode)2;
				((Renderer)val4).sortingLayerName = "Default";
				((Renderer)val4).sortingLayerID = 0;
				((Renderer)val4).sortingOrder = 0;
				((Renderer)val4).allowOcclusionWhenDynamic = true;
				((Renderer)val4).lightmapIndex = -1;
				((Renderer)val4).realtimeLightmapIndex = -1;
				((Renderer)val4).lightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
				((Renderer)val4).realtimeLightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
				Material sharedMaterial = (((Renderer)val4).material = matNullifierSafeWardPillarStars.WaitForCompletion());
				((Renderer)val4).sharedMaterial = sharedMaterial;
				NetworkServer.Spawn(val2);
			}
		}

		private static Mesh CreateCylinderMesh()
		{
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
			Mesh mesh = obj.GetComponent<MeshFilter>().mesh;
			Object.Destroy((Object)(object)obj);
			return mesh;
		}

		private static GameObject CreateCylinder()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			GameObject val = new GameObject("IndicatorCylinder");
			val.transform.position = new Vector3(0f, 0f, 0f);
			val.transform.rotation = Quaternion.Euler(0f, 0f, 180f);
			val.transform.localScale = new Vector3(2f, 120f, 2f);
			MeshFilter obj = val.AddComponent<MeshFilter>();
			obj.sharedMesh = CreateCylinderMesh();
			obj.mesh = obj.sharedMesh;
			MeshRenderer obj2 = val.AddComponent<MeshRenderer>();
			((Renderer)obj2).castShadows = true;
			((Renderer)obj2).motionVectors = true;
			((Renderer)obj2).useLightProbes = true;
			((Renderer)obj2).bounds = new Bounds(Vector3.zero, new Vector3(2f, 120f, 2f));
			((Renderer)obj2).localBounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f));
			((Renderer)obj2).enabled = true;
			((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)1;
			((Renderer)obj2).receiveShadows = true;
			((Renderer)obj2).forceRenderingOff = false;
			((Renderer)obj2).staticShadowCaster = false;
			((Renderer)obj2).motionVectorGenerationMode = (MotionVectorGenerationMode)1;
			((Renderer)obj2).lightProbeUsage = (LightProbeUsage)1;
			((Renderer)obj2).reflectionProbeUsage = (ReflectionProbeUsage)1;
			((Renderer)obj2).renderingLayerMask = uint.MaxValue;
			((Renderer)obj2).rendererPriority = 0;
			((Renderer)obj2).rayTracingMode = (RayTracingMode)2;
			((Renderer)obj2).sortingLayerName = "Default";
			((Renderer)obj2).sortingLayerID = 0;
			((Renderer)obj2).sortingOrder = 0;
			((Renderer)obj2).allowOcclusionWhenDynamic = true;
			((Renderer)obj2).lightmapIndex = -1;
			((Renderer)obj2).realtimeLightmapIndex = -1;
			((Renderer)obj2).lightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			((Renderer)obj2).realtimeLightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			Material sharedMaterial = (((Renderer)obj2).material = matNullifierSafeWardPillarStars.WaitForCompletion());
			((Renderer)obj2).sharedMaterial = sharedMaterial;
			val.transform.position = Vector3.zero;
			return val;
		}

		private static GameObject CreateSphere()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			GameObject val = new GameObject("IndicatorSphere");
			Transform transform = val.transform;
			transform.position = new Vector3(0f, 0f, 0f);
			transform.rotation = Quaternion.Euler(0f, 0f, 0f);
			transform.localScale = new Vector3(2f, 2f, 2f);
			val.AddComponent<MeshFilter>().sharedMesh = CreateSphereMesh();
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).castShadows = true;
			((Renderer)obj).motionVectors = true;
			((Renderer)obj).useLightProbes = true;
			((Renderer)obj).bounds = new Bounds(Vector3.zero, new Vector3(2f, 2f, 2f));
			((Renderer)obj).localBounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f));
			((Renderer)obj).enabled = true;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1;
			((Renderer)obj).receiveShadows = true;
			((Renderer)obj).forceRenderingOff = false;
			((Renderer)obj).staticShadowCaster = false;
			((Renderer)obj).motionVectorGenerationMode = (MotionVectorGenerationMode)1;
			((Renderer)obj).lightProbeUsage = (LightProbeUsage)1;
			((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)1;
			((Renderer)obj).renderingLayerMask = uint.MaxValue;
			((Renderer)obj).rendererPriority = 0;
			((Renderer)obj).rayTracingMode = (RayTracingMode)2;
			((Renderer)obj).sortingLayerName = "Default";
			((Renderer)obj).sortingLayerID = 0;
			((Renderer)obj).sortingOrder = 0;
			((Renderer)obj).allowOcclusionWhenDynamic = true;
			((Renderer)obj).lightmapIndex = -1;
			((Renderer)obj).realtimeLightmapIndex = -1;
			((Renderer)obj).lightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			((Renderer)obj).realtimeLightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			Material sharedMaterial = (((Renderer)obj).material = matNullifierSafeWardPillarGlow.WaitForCompletion());
			((Renderer)obj).sharedMaterial = sharedMaterial;
			((Renderer)obj).allowOcclusionWhenDynamic = true;
			return val;
		}

		private static Mesh CreateSphereMesh()
		{
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
			Mesh mesh = obj.GetComponent<MeshFilter>().mesh;
			Object.Destroy((Object)(object)obj);
			return mesh;
		}

		private static IZone CreateSafeZone2(Vector3 position, Transform rangeIndicator)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject();
			SphereZone obj = val.AddComponent<SphereZone>();
			obj.radius = 15f;
			obj.rangeIndicator = rangeIndicator;
			obj.indicatorSmoothTime = 0.2f;
			obj.isInverted = false;
			obj.rangeIndicatorScaleVelocity = 0f;
			((Behaviour)obj).enabled = true;
			((MonoBehaviour)obj).useGUILayout = true;
			obj.Networkradius = 15f;
			val.transform.position = position;
			NetworkServer.Spawn(val);
			return (IZone)(object)obj;
		}

		private static IZone CreateSafeZone(Vector3 position)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = iscInfiniteTowerSafeWard.WaitForCompletion();
			GameObject val = Object.Instantiate<GameObject>(obj, position, Quaternion.identity);
			HoldoutZoneController component = obj.GetComponent<HoldoutZoneController>();
			component.holdoutZoneShape = (HoldoutZoneShape)1;
			NetworkServer.Spawn(val);
			return (IZone)(object)component;
		}
	}
	public class FastSimulacrumVrabObsolete
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_EvaluateNextEndpoint <0>__Travelling_EvaluateNextEndpoint;
		}

		private static bool enabled;

		private static AsyncOperationHandle<GameObject> iscInfiniteTowerSafeWard;

		private static AsyncOperationHandle<Material> matNullifierSafeWardPillarGlow;

		private static AsyncOperationHandle<Material> matNullifierSafeWardPillarStars;

		public static void Setup()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			iscInfiniteTowerSafeWard = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/GameModes/InfiniteTowerRun/InfiniteTowerAssets/InfiniteTowerSafeWard.prefab");
			matNullifierSafeWardPillarGlow = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/Common/Void/matNullifierSafeWardPillarGlow.mat");
			matNullifierSafeWardPillarStars = Addressables.LoadAssetAsync<Material>((object)"RoR2/DLC1/Common/Void/matNullifierSafeWardPillarStars.mat");
		}

		public static void Enable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			enabled = true;
			object obj = <>O.<0>__Travelling_EvaluateNextEndpoint;
			if (obj == null)
			{
				hook_EvaluateNextEndpoint val = Travelling_EvaluateNextEndpoint;
				<>O.<0>__Travelling_EvaluateNextEndpoint = val;
				obj = (object)val;
			}
			Travelling.EvaluateNextEndpoint += (hook_EvaluateNextEndpoint)obj;
		}

		public static void Disable()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			enabled = false;
			object obj = <>O.<0>__Travelling_EvaluateNextEndpoint;
			if (obj == null)
			{
				hook_EvaluateNextEndpoint val = Travelling_EvaluateNextEndpoint;
				<>O.<0>__Travelling_EvaluateNextEndpoint = val;
				obj = (object)val;
			}
			Travelling.EvaluateNextEndpoint -= (hook_EvaluateNextEndpoint)obj;
		}

		private static void Travelling_EvaluateNextEndpoint(orig_EvaluateNextEndpoint orig, Travelling self)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun))
			{
				InfiniteTowerRun val = (InfiniteTowerRun)Run.instance;
				GameObject val2 = new GameObject("Corridor");
				MeshFilter val3 = val2.AddComponent<MeshFilter>();
				MeshRenderer val4 = val2.AddComponent<MeshRenderer>();
				CombineInstance[] array = (CombineInstance[])(object)new CombineInstance[self.catmullRomPoints.Count];
				int num = 50;
				for (int i = 0; i < self.catmullRomPoints.Count; i++)
				{
					GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
					obj.transform.localScale = new Vector3((float)num, 120f, (float)num);
					obj.transform.position = self.catmullRomPoints[i];
					obj.transform.rotation = Quaternion.identity;
					MeshFilter component = obj.GetComponent<MeshFilter>();
					((CombineInstance)(ref array[i])).mesh = component.sharedMesh;
					((CombineInstance)(ref array[i])).transform = ((Component)component).transform.localToWorldMatrix;
					Object.Destroy((Object)(object)obj);
					IZone val5 = CreateSafeZone2(self.catmullRomPoints[i], null);
					val.fogDamageController.AddSafeZone(val5);
				}
				Mesh val6 = new Mesh();
				val6.CombineMeshes(array, true, true);
				val3.mesh = val6;
				((Renderer)val4).castShadows = true;
				((Renderer)val4).motionVectors = true;
				((Renderer)val4).useLightProbes = true;
				((Renderer)val4).bounds = new Bounds(Vector3.zero, new Vector3(2f, 120f, 2f));
				((Renderer)val4).localBounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f));
				((Renderer)val4).enabled = true;
				((Renderer)val4).shadowCastingMode = (ShadowCastingMode)1;
				((Renderer)val4).receiveShadows = true;
				((Renderer)val4).forceRenderingOff = false;
				((Renderer)val4).staticShadowCaster = false;
				((Renderer)val4).motionVectorGenerationMode = (MotionVectorGenerationMode)1;
				((Renderer)val4).lightProbeUsage = (LightProbeUsage)1;
				((Renderer)val4).reflectionProbeUsage = (ReflectionProbeUsage)1;
				((Renderer)val4).renderingLayerMask = uint.MaxValue;
				((Renderer)val4).rendererPriority = 0;
				((Renderer)val4).rayTracingMode = (RayTracingMode)2;
				((Renderer)val4).sortingLayerName = "Default";
				((Renderer)val4).sortingLayerID = 0;
				((Renderer)val4).sortingOrder = 0;
				((Renderer)val4).allowOcclusionWhenDynamic = true;
				((Renderer)val4).lightmapIndex = -1;
				((Renderer)val4).realtimeLightmapIndex = -1;
				((Renderer)val4).lightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
				((Renderer)val4).realtimeLightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
				Material sharedMaterial = (((Renderer)val4).material = matNullifierSafeWardPillarStars.WaitForCompletion());
				((Renderer)val4).sharedMaterial = sharedMaterial;
				NetworkServer.Spawn(val2);
			}
		}

		private static Mesh CreateCylinderMesh()
		{
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
			Mesh mesh = obj.GetComponent<MeshFilter>().mesh;
			Object.Destroy((Object)(object)obj);
			return mesh;
		}

		private static GameObject CreateCylinder()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Expected O, but got Unknown
			GameObject val = new GameObject("IndicatorCylinder");
			val.transform.position = new Vector3(0f, 0f, 0f);
			val.transform.rotation = Quaternion.Euler(0f, 0f, 180f);
			val.transform.localScale = new Vector3(2f, 120f, 2f);
			MeshFilter obj = val.AddComponent<MeshFilter>();
			obj.sharedMesh = CreateCylinderMesh();
			obj.mesh = obj.sharedMesh;
			MeshRenderer obj2 = val.AddComponent<MeshRenderer>();
			((Renderer)obj2).castShadows = true;
			((Renderer)obj2).motionVectors = true;
			((Renderer)obj2).useLightProbes = true;
			((Renderer)obj2).bounds = new Bounds(Vector3.zero, new Vector3(2f, 120f, 2f));
			((Renderer)obj2).localBounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f));
			((Renderer)obj2).enabled = true;
			((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)1;
			((Renderer)obj2).receiveShadows = true;
			((Renderer)obj2).forceRenderingOff = false;
			((Renderer)obj2).staticShadowCaster = false;
			((Renderer)obj2).motionVectorGenerationMode = (MotionVectorGenerationMode)1;
			((Renderer)obj2).lightProbeUsage = (LightProbeUsage)1;
			((Renderer)obj2).reflectionProbeUsage = (ReflectionProbeUsage)1;
			((Renderer)obj2).renderingLayerMask = uint.MaxValue;
			((Renderer)obj2).rendererPriority = 0;
			((Renderer)obj2).rayTracingMode = (RayTracingMode)2;
			((Renderer)obj2).sortingLayerName = "Default";
			((Renderer)obj2).sortingLayerID = 0;
			((Renderer)obj2).sortingOrder = 0;
			((Renderer)obj2).allowOcclusionWhenDynamic = true;
			((Renderer)obj2).lightmapIndex = -1;
			((Renderer)obj2).realtimeLightmapIndex = -1;
			((Renderer)obj2).lightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			((Renderer)obj2).realtimeLightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			Material sharedMaterial = (((Renderer)obj2).material = matNullifierSafeWardPillarStars.WaitForCompletion());
			((Renderer)obj2).sharedMaterial = sharedMaterial;
			val.transform.position = Vector3.zero;
			return val;
		}

		private static GameObject CreateSphere()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Expected O, but got Unknown
			GameObject val = new GameObject("IndicatorSphere");
			Transform transform = val.transform;
			transform.position = new Vector3(0f, 0f, 0f);
			transform.rotation = Quaternion.Euler(0f, 0f, 0f);
			transform.localScale = new Vector3(2f, 2f, 2f);
			val.AddComponent<MeshFilter>().sharedMesh = CreateSphereMesh();
			MeshRenderer obj = val.AddComponent<MeshRenderer>();
			((Renderer)obj).castShadows = true;
			((Renderer)obj).motionVectors = true;
			((Renderer)obj).useLightProbes = true;
			((Renderer)obj).bounds = new Bounds(Vector3.zero, new Vector3(2f, 2f, 2f));
			((Renderer)obj).localBounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f));
			((Renderer)obj).enabled = true;
			((Renderer)obj).shadowCastingMode = (ShadowCastingMode)1;
			((Renderer)obj).receiveShadows = true;
			((Renderer)obj).forceRenderingOff = false;
			((Renderer)obj).staticShadowCaster = false;
			((Renderer)obj).motionVectorGenerationMode = (MotionVectorGenerationMode)1;
			((Renderer)obj).lightProbeUsage = (LightProbeUsage)1;
			((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)1;
			((Renderer)obj).renderingLayerMask = uint.MaxValue;
			((Renderer)obj).rendererPriority = 0;
			((Renderer)obj).rayTracingMode = (RayTracingMode)2;
			((Renderer)obj).sortingLayerName = "Default";
			((Renderer)obj).sortingLayerID = 0;
			((Renderer)obj).sortingOrder = 0;
			((Renderer)obj).allowOcclusionWhenDynamic = true;
			((Renderer)obj).lightmapIndex = -1;
			((Renderer)obj).realtimeLightmapIndex = -1;
			((Renderer)obj).lightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			((Renderer)obj).realtimeLightmapScaleOffset = new Vector4(1f, 1f, 0f, 0f);
			Material sharedMaterial = (((Renderer)obj).material = matNullifierSafeWardPillarGlow.WaitForCompletion());
			((Renderer)obj).sharedMaterial = sharedMaterial;
			((Renderer)obj).allowOcclusionWhenDynamic = true;
			return val;
		}

		private static Mesh CreateSphereMesh()
		{
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
			Mesh mesh = obj.GetComponent<MeshFilter>().mesh;
			Object.Destroy((Object)(object)obj);
			return mesh;
		}

		private static IZone CreateSafeZone2(Vector3 position, Transform rangeIndicator)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject();
			SphereZone obj = val.AddComponent<SphereZone>();
			obj.radius = 15f;
			obj.rangeIndicator = rangeIndicator;
			obj.indicatorSmoothTime = 0.2f;
			obj.isInverted = false;
			obj.rangeIndicatorScaleVelocity = 0f;
			((Behaviour)obj).enabled = true;
			((MonoBehaviour)obj).useGUILayout = true;
			obj.Networkradius = 15f;
			val.transform.position = position;
			NetworkServer.Spawn(val);
			return (IZone)(object)obj;
		}

		private static IZone CreateSafeZone(Vector3 position)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = iscInfiniteTowerSafeWard.WaitForCompletion();
			GameObject val = Object.Instantiate<GameObject>(obj, position, Quaternion.identity);
			HoldoutZoneController component = obj.GetComponent<HoldoutZoneController>();
			component.holdoutZoneShape = (HoldoutZoneShape)1;
			NetworkServer.Spawn(val);
			return (IZone)(object)component;
		}
	}
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	public static class ModCompatibilityInLobbyConfig
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.KingEnderBrine.InLobbyConfig");
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void CreateFromBepInExConfigFile(ConfigFile config, string displayName)
		{
			ModConfigCatalog.Add(ConfigFieldUtilities.CreateFromBepInExConfigFile(config, displayName));
		}
	}
	public static class ModCompatibilityShareSuite
	{
		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.funkfrog_sipondo.sharesuite");
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddPickupEventHandler(Func<GenericPickupController, CharacterBody, bool> f)
		{
			ItemSharingHooks.AdditionalPickupValidityChecks += f;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void RemovePickupEventHandler(Func<GenericPickupController, CharacterBody, bool> f)
		{
			ItemSharingHooks.AdditionalPickupValidityChecks -= f;
		}
	}
	public class NonShareableItem : MonoBehaviour
	{
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Def.ServerSideTweaks", "ServerSideTweaks", "2.1.1")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class ServerSideTweaks : BaseUnityPlugin
	{
		public static ServerSideTweaks instance;

		public static int totalItemRewardCount = 0;

		public static float directorEnemyPowerBiasOverride = -1f;

		public static GameObject mostRecentlyCreatedPickup = null;

		public static Dictionary<PlayerCharacterMasterController, float> usersItemCredit = new Dictionary<PlayerCharacterMasterController, float>();

		public static List<EquipmentIndex> disableEquipments = new List<EquipmentIndex>();

		public static List<PickupIndex> availableEquipmentDropList_Saved = new List<PickupIndex>();

		public static List<PickupIndex> availableLunarItemDropList_Saved = new List<PickupIndex>();

		public static List<PickupIndex> availableLunarEquipmentDropList_Saved = new List<PickupIndex>();

		public static EnumCollection.StageEnum debug_nextStage = EnumCollection.StageEnum.None;

		public const string PluginGUID = "Def.ServerSideTweaks";

		public const string PluginAuthor = "Def";

		public const string PluginName = "ServerSideTweaks";

		public const string PluginVersion = "2.1.1";

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			PInfo = ((BaseUnityPlugin)this).Info;
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			BepConfig.Init();
			BepConfig.ChildReducedTeleportRange.SettingChanged += ChildReducedTeleportRange_SettingChanged;
			ChildReducedTeleportRange_SettingChanged(null, null);
			FastSimulacrumVrab.Setup();
		}

		private void ChildReducedTeleportRange_SettingChanged(object sender, EventArgs e)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (BepConfig.ChildReducedTeleportRange.Value)
			{
				FrolicAway.TeleportAway += new Manipulator(FrolicAway_TeleportAway);
			}
			else
			{
				FrolicAway.TeleportAway -= new Manipulator(FrolicAway_TeleportAway);
			}
		}

		private void OnEnable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			Run.Start += new hook_Start(Run_Start);
			InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer += new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer);
			InfiniteTowerRun.AdvanceWave += new hook_AdvanceWave(InfiniteTowerRun_AdvanceWave);
			CombatDirector.AttemptSpawnOnTarget += new Manipulator(CombatDirector_AttemptSpawnOnTarget);
			Run.FixedUpdate += new hook_FixedUpdate(Run_FixedUpdate);
			InfiniteTowerWaveController.DropRewards += new Manipulator(InfiniteTowerWaveController_DropRewards);
			InfiniteTowerWaveController.DropRewards += new hook_DropRewards(InfiniteTowerWaveController_DropRewards1);
			GenericPickupController.AttemptGrant += new hook_AttemptGrant(GenericPickupController_AttemptGrant);
			GenericPickupController.OnInteractionBegin += new hook_OnInteractionBegin(GenericPickupController_OnInteractionBegin);
			GenericPickupController.CreatePickup += new Manipulator(GenericPickupController_CreatePickup);
			PickupDropletController.OnCollisionEnter += new hook_OnCollisionEnter(PickupDropletController_OnCollisionEnter);
			PickupPickerController.OnInteractionBegin += new hook_OnInteractionBegin(PickupPickerController_OnInteractionBegin);
			PickupPickerController.CreatePickup_PickupIndex += new hook_CreatePickup_PickupIndex(PickupPickerController_CreatePickup_PickupIndex);
			RandomlyLunarUtils.CheckForLunarReplacement += new hook_CheckForLunarReplacement(RandomlyLunarUtils_CheckForLunarReplacement);
			RandomlyLunarUtils.CheckForLunarReplacementUniqueArray += new hook_CheckForLunarReplacementUniqueArray(RandomlyLunarUtils_CheckForLunarReplacementUniqueArray);
			InfiniteTowerWaveController.Initialize += new hook_Initialize(InfiniteTowerWaveController_Initialize);
			ChildMonsterController.RegisterTeleport += new hook_RegisterTeleport(ChildMonsterController_RegisterTeleport);
			FastSimulacrumVrab.Enable();
			if (ModCompatibilityShareSuite.enabled)
			{
				ModCompatibilityShareSuite.AddPickupEventHandler(NonShareableItemCheck);
			}
		}

		private void OnDisable()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Expected O, but got Unknown
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			Run.Start -= new hook_Start(Run_Start);
			InfiniteTowerRun.OnWaveAllEnemiesDefeatedServer -= new hook_OnWaveAllEnemiesDefeatedServer(InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer);
			InfiniteTowerRun.AdvanceWave -= new hook_AdvanceWave(InfiniteTowerRun_AdvanceWave);
			CombatDirector.AttemptSpawnOnTarget -= new Manipulator(CombatDirector_AttemptSpawnOnTarget);
			Run.FixedUpdate -= new hook_FixedUpdate(Run_FixedUpdate);
			InfiniteTowerWaveController.DropRewards -= new Manipulator(InfiniteTowerWaveController_DropRewards);
			InfiniteTowerWaveController.DropRewards -= new hook_DropRewards(InfiniteTowerWaveController_DropRewards1);
			GenericPickupController.AttemptGrant -= new hook_AttemptGrant(GenericPickupController_AttemptGrant);
			GenericPickupController.OnInteractionBegin -= new hook_OnInteractionBegin(GenericPickupController_OnInteractionBegin);
			GenericPickupController.CreatePickup -= new Manipulator(GenericPickupController_CreatePickup);
			PickupDropletController.OnCollisionEnter -= new hook_OnCollisionEnter(PickupDropletController_OnCollisionEnter);
			PickupPickerController.OnInteractionBegin -= new hook_OnInteractionBegin(PickupPickerController_OnInteractionBegin);
			PickupPickerController.CreatePickup_PickupIndex -= new hook_CreatePickup_PickupIndex(PickupPickerController_CreatePickup_PickupIndex);
			RandomlyLunarUtils.CheckForLunarReplacement -= new hook_CheckForLunarReplacement(RandomlyLunarUtils_CheckForLunarReplacement);
			RandomlyLunarUtils.CheckForLunarReplacementUniqueArray -= new hook_CheckForLunarReplacementUniqueArray(RandomlyLunarUtils_CheckForLunarReplacementUniqueArray);
			InfiniteTowerWaveController.Initialize -= new hook_Initialize(InfiniteTowerWaveController_Initialize);
			ChildMonsterController.RegisterTeleport -= new hook_RegisterTeleport(ChildMonsterController_RegisterTeleport);
			FastSimulacrumVrab.Disable();
			if (ModCompatibilityShareSuite.enabled)
			{
				ModCompatibilityShareSuite.RemovePickupEventHandler(NonShareableItemCheck);
			}
		}

		private void ChildMonsterController_RegisterTeleport(orig_RegisterTeleport orig, ChildMonsterController self, bool addInvincibility)
		{
			if (BepConfig.Enabled.Value && BepConfig.ChildRemoveInvincibility.Value)
			{
				orig.Invoke(self, false);
			}
			else
			{
				orig.Invoke(self, addInvincibility);
			}
		}

		private void FrolicAway_TeleportAway(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 100f),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 200f)
			});
			val.Remove();
			val.Remove();
			val.Emit(OpCodes.Ldc_R4, 50f);
			val.Emit(OpCodes.Ldc_R4, 100f);
		}

		private void InfiniteTowerWaveController_Initialize(orig_Initialize orig, InfiniteTowerWaveController self, int waveIndex, Inventory enemyInventory, GameObject spawnTarget)
		{
			if (BepConfig.Enabled.Value)
			{
				self.maxSquadSize = BepConfig.SimulacrumMaxSquadSize.Value;
			}
			if (NetworkServer.active && BepConfig.Enabled.Value)
			{
				self.wavePeriodSeconds *= BepConfig.SimulacrumWavePeriodSecondsFactor.Value;
			}
			orig.Invoke(self, waveIndex, enemyInventory, spawnTarget);
		}

		private bool NonShareableItemCheck(GenericPickupController pickup, CharacterBody picker)
		{
			NonShareableItem nonShareableItem = default(NonShareableItem);
			if (BepConfig.SimulacrumNonSharedLoot.Value)
			{
				return !((Component)pickup).TryGetComponent<NonShareableItem>(ref nonShareableItem);
			}
			return true;
		}

		private void Run_Start(orig_Start orig, Run self)
		{
			totalItemRewardCount = 0;
			mostRecentlyCreatedPickup = null;
			usersItemCredit.Clear();
			ResetOverridePowerBias();
			orig.Invoke(self);
		}

		public static void SetOverridePowerBias(float powerBias)
		{
			directorEnemyPowerBiasOverride = powerBias;
		}

		public static float GetCurrentPowerBias()
		{
			if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value)
			{
				return BepConfig.SimulacrumDirectorEnemyPowerBias.Value;
			}
			if (BepConfig.Enabled.Value)
			{
				return BepConfig.ClassicDirectorEnemyPowerBias.Value;
			}
			return 0.5f;
		}

		public static void ResetOverridePowerBias()
		{
			directorEnemyPowerBiasOverride = -1f;
		}

		private void Run_FixedUpdate(orig_FixedUpdate orig, Run self)
		{
			orig.Invoke(self);
			_ = NetworkServer.active;
		}

		private void PickupPickerController_OnInteractionBegin(orig_OnInteractionBegin orig, PickupPickerController self, Interactor activator)
		{
			if (CanInteract(((Component)self).gameObject, activator))
			{
				orig.Invoke(self, activator);
			}
		}

		private void GenericPickupController_OnInteractionBegin(orig_OnInteractionBegin orig, GenericPickupController self, Interactor activator)
		{
			if (CanInteract(((Component)self).gameObject, activator))
			{
				orig.Invoke(self, activator);
			}
		}

		private bool CanInteract(GameObject self, CharacterBody body)
		{
			if (!BepConfig.Enabled.Value)
			{
				return true;
			}
			NonShareableItem nonShareableItem = default(NonShareableItem);
			if (self.TryGetComponent<NonShareableItem>(ref nonShareableItem))
			{
				CharacterMaster master = body.master;
				if ((Object)(object)master != (Object)null && (Object)(object)master.playerCharacterMasterController != (Object)null)
				{
					PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
					if (usersItemCredit.TryGetValue(playerCharacterMasterController, out var value))
					{
						if (value + (float)BepConfig.SimulacrumLootMaxItemDebt.Value >= 1f)
						{
							return true;
						}
						ChatHelper.PlayerHasTooManyItems(playerCharacterMasterController.GetDisplayName());
						return false;
					}
				}
			}
			return true;
		}

		private bool CanInteract(GameObject self, Interactor activator)
		{
			return CanInteract(self, (activator != null) ? ((Component)activator).GetComponent<CharacterBody>() : null);
		}

		private void GenericPickupController_AttemptGrant(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body)
		{
			if ((BepConfig.Enabled.Value && CanInteract(((Component)self).gameObject, body)) || !BepConfig.Enabled.Value)
			{
				orig.Invoke(self, body);
			}
			NonShareableItem nonShareableItem = default(NonShareableItem);
			if (!NetworkServer.active || !BepConfig.Enabled.Value || !((Component)self).TryGetComponent<NonShareableItem>(ref nonShareableItem) || !self.consumed)
			{
				return;
			}
			CharacterMaster master = body.master;
			if ((Object)(object)master != (Object)null && (Object)(object)master.playerCharacterMasterController != (Object)null)
			{
				PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
				if (usersItemCredit.ContainsKey(playerCharacterMasterController))
				{
					usersItemCredit[playerCharacterMasterController] -= 1f;
				}
				else
				{
					usersItemCredit.Add(playerCharacterMasterController, -1f);
				}
				if (PlayerCharacterMasterController.instances.Where((PlayerCharacterMasterController pc) => pc.isConnected).Count() == 1)
				{
					SetSkullCounterCount(body.inventory, 0, null);
				}
				else
				{
					SetSkullCounterCount(body.inventory, (int)Math.Floor(usersItemCredit[playerCharacterMasterController] + (float)BepConfig.SimulacrumLootMaxItemDebt.Value), ((Component)body).gameObject);
				}
			}
		}

		private void SetSkullCounterCount(Inventory inventory, int count, GameObject playerObject)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (!BepConfig.SimulacrumLootSkullTokens.Value)
			{
				return;
			}
			ItemIndex val = ItemCatalog.FindItemIndex("SkullCounter");
			int itemCount = inventory.GetItemCount(val);
			int num = count - itemCount;
			if (num == 0)
			{
				return;
			}
			inventory.GiveItem(val, num);
			InfiniteTowerSafeWardController safeWardController = ((InfiniteTowerRun)Run.instance).safeWardController;
			if ((Object)(object)playerObject != (Object)null && (Object)(object)safeWardController != (Object)null)
			{
				if (num > 0)
				{
					PurchaseInteraction.CreateItemTakenOrb(((Component)safeWardController).transform.position, playerObject, val);
				}
				else
				{
					PurchaseInteraction.CreateItemTakenOrb(playerObject.transform.position, ((Component)safeWardController).gameObject, val);
				}
			}
		}

		private void InfiniteTowerWaveController_DropRewards(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2),
				(Instruction x) => ILPatternMatchingExt.MatchCall<PickupDropletController>(x, "CreatePickupDroplet")
			});
			val.Index += 1;
			val.Remove();
			val.EmitDelegate<Action<CreatePickupInfo, Vector3, Vector3>>((Action<CreatePickupInfo, Vector3, Vector3>)delegate(CreatePickupInfo pickupInfo, Vector3 position, Vector3 velocity)
			{
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0084: Unknown result type (might be due to invalid IL or missing references)
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: 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)
				if (BepConfig.Enabled.Value)
				{
					GameObject obj = Object.Instantiate<GameObject>(PickupDropletController.pickupDropletPrefab, position, Quaternion.identity);
					PickupDropletController component = obj.GetComponent<PickupDropletController>();
					if (Object.op_Implicit((Object)(object)component))
					{
						component.createPickupInfo = pickupInfo;
						component.NetworkpickupIndex = ((CreatePickupInfo)(ref pickupInfo)).pickupIndex;
					}
					Rigidbody component2 = obj.GetComponent<Rigidbody>();
					component2.velocity = velocity;
					component2.AddTorque(Random.Range(150f, 120f) * Random.onUnitSphere);
					obj.AddComponent<NonShareableItem>();
					NetworkServer.Spawn(obj);
					totalItemRewardCount++;
				}
				else
				{
					PickupDropletController.CreatePickupDroplet(pickupInfo, position, velocity);
				}
			});
		}

		private void InfiniteTowerWaveController_DropRewards1(orig_DropRewards orig, InfiniteTowerWaveController self)
		{
			orig.Invoke(self);
			if (!NetworkServer.active || !BepConfig.Enabled.Value)
			{
				return;
			}
			float num = 0f;
			int num2 = 0;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (instance.isConnected)
				{
					num2++;
				}
				else if (usersItemCredit.ContainsKey(instance))
				{
					num += Math.Max(0f, usersItemCredit[instance]);
					usersItemCredit[instance] = 0f;
					Inventory inventory = instance.master.inventory;
					int value = BepConfig.SimulacrumLootMaxItemDebt.Value;
					CharacterBody body = instance.body;
					SetSkullCounterCount(inventory, value, (body != null) ? ((Component)body).gameObject : null);
				}
			}
			foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances)
			{
				if (instance2.isConnected)
				{
					if (usersItemCredit.ContainsKey(instance2))
					{
						usersItemCredit[instance2] += (float)totalItemRewardCount / (float)num2;
					}
					else
					{
						usersItemCredit.Add(instance2, (float)totalItemRewardCount / (float)num2);
					}
					usersItemCredit[instance2] += num / Math.Max(1f, num2);
					if (num2 == 1)
					{
						SetSkullCounterCount(instance2.master.inventory, 0, null);
					}
					else
					{
						Inventory inventory2 = instance2.master.inventory;
						int count = (int)Math.Floor(usersItemCredit[instance2] + (float)BepConfig.SimulacrumLootMaxItemDebt.Value);
						CharacterBody body2 = instance2.body;
						SetSkullCounterCount(inventory2, count, (body2 != null) ? ((Component)body2).gameObject : null);
					}
					Log.LogDebug(instance2.networkUser.userName + " itemCredit: " + usersItemCredit[instance2]);
				}
			}
			totalItemRewardCount = 0;
		}

		private void PickupDropletController_OnCollisionEnter(orig_OnCollisionEnter orig, PickupDropletController self, Collision collision)
		{
			mostRecentlyCreatedPickup = null;
			orig.Invoke(self, collision);
			if (BepConfig.Enabled.Value && (Object)(object)mostRecentlyCreatedPickup != (Object)null && Object.op_Implicit((Object)(object)((Component)self).GetComponent<NonShareableItem>()))
			{
				mostRecentlyCreatedPickup.AddComponent<NonShareableItem>();
			}
		}

		private void PickupPickerController_CreatePickup_PickupIndex(orig_CreatePickup_PickupIndex orig, PickupPickerController self, PickupIndex pickupIndex)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			mostRecentlyCreatedPickup = null;
			orig.Invoke(self, pickupIndex);
			if (BepConfig.Enabled.Value && (Object)(object)mostRecentlyCreatedPickup != (Object)null && Object.op_Implicit((Object)(object)((Component)self).GetComponent<NonShareableItem>()))
			{
				mostRecentlyCreatedPickup.AddComponent<NonShareableItem>();
			}
		}

		private void CommandArtifactManager_OnDropletHitGroundServer(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[6]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "position"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "rotation"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "Instantiate"),
				(Instruction x) => ILPatternMatchingExt.MatchDup(x)
			});
			val.Index += 5;
			val.EmitDelegate<Func<GameObject, GameObject>>((Func<GameObject, GameObject>)delegate(GameObject obj)
			{
				mostRecentlyCreatedPickup = obj;
				return obj;
			});
		}

		private void GenericPickupController_CreatePickup(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			ILCursor val = new ILCursor(il);
			val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[5]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "position"),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CreatePickupInfo>(x, "rotation"),
				(Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "Instantiate")
			});
			val.Index += 5;
			val.EmitDelegate<Func<GameObject, GameObject>>((Func<GameObject, GameObject>)delegate(GameObject obj)
			{
				mostRecentlyCreatedPickup = obj;
				return obj;
			});
		}

		private bool SkipWithPowerBias(float costMultipliedByMaximumNumberToSpawnBeforeSkipping, CombatDirector combatDirector, float powerBias)
		{
			if (costMultipliedByMaximumNumberToSpawnBeforeSkipping / (float)combatDirector.maximumNumberToSpawnBeforeSkipping > (float)combatDirector.mostExpensiveMonsterCostInDeck * (0.5f + powerBias) * (0.5f + powerBias) * (0.5f + powerBias))
			{
				float num = Math.Max(0f, 0.1f - powerBias);
				if (2f * (0.5f - powerBias) - num > RoR2Application.rng.nextNormalizedFloat)
				{
					return true;
				}
			}
			return costMultipliedByMaximumNumberToSpawnBeforeSkipping * (1.5f - powerBias) * (1.5f - powerBias) < combatDirector.monsterCredit;
		}

		private void CombatDirector_AttemptSpawnOnTarget(ILContext il)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			ILLabel val2 = val.DefineLabel();
			val.GotoNext(new Func<Instruction, bool>[7]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "maximumNumberToSpawnBeforeSkipping"),
				(Instruction x) => ILPatternMatchingExt.MatchMul(x),
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "monsterCredit")
			});
			val.Index += 6;
			val.Remove();
			val.Remove();
			val.EmitDelegate<Func<float, CombatDirector, bool>>((Func<float, CombatDirector, bool>)delegate(float costMultipliedByMaximumNumberToSpawnBeforeSkipping, CombatDirector combatDirector)
			{
				if (directorEnemyPowerBiasOverride >= 0f)
				{
					return SkipWithPowerBias(costMultipliedByMaximumNumberToSpawnBeforeSkipping, combatDirector, directorEnemyPowerBiasOverride);
				}
				if (((object)Run.instance).GetType() == typeof(InfiniteTowerRun) && BepConfig.Enabled.Value)
				{
					return SkipWithPowerBias(costMultipliedByMaximumNumberToSpawnBeforeSkipping, combatDirector, BepConfig.SimulacrumDirectorEnemyPowerBias.Value);
				}
				return BepConfig.Enabled.Value ? SkipWithPowerBias(costMultipliedByMaximumNumberToSpawnBeforeSkipping, combatDirector, BepConfig.ClassicDirectorEnemyPowerBias.Value) : (costMultipliedByMaximumNumberToSpawnBeforeSkipping < combatDirector.monsterCredit);
			});
			val.Emit(OpCodes.Brfalse, (object)val2);
			val.Index += 2;
			val.GotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
				(Instruction x) => ILPatternMatchingExt.MatchLdfld<CombatDirector>(x, "currentMonsterCard"),
				(Instruction x) => ILPatternMatchingExt.MatchCallvirt<DirectorCard>(x, "GetSpawnCard"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 4)
			});
			val.MarkLabel(val2);
		}

		private void InfiniteTowerRun_OnWaveAllEnemiesDefeatedServer(orig_OnWaveAllEnemiesDefeatedServer orig, InfiniteTowerRun self, InfiniteTowerWaveController wc)
		{
			orig.Invoke(self, wc);
			if (BepConfig.Enabled.Value && NetworkServer.active && !(BepConfig.SimulacrumCommencementArtifactDissonanceChance.Value <= 0f) && (EnumCollection.SceneNameIsStage(SceneCatalog.currentSceneDef.cachedName, EnumCollection.StageEnum.SimulacrumCommencement) || EnumCollection.SceneNameIsStage(SceneCatalog.currentSceneDef.cachedName, EnumCollection.StageEnum.Commencement)))
			{
				RunArtifactManager.instance.SetArtifactEnabledServer(EnumCollection.GetArtifactDef(EnumCollection.ArtifactEnum.Dissonance), false);
			}
		}

		private void InfiniteTowerRun_AdvanceWave(orig_AdvanceWave orig, InfiniteTowerRun self)
		{
			orig.Invoke(self);
			if (BepConfig.Enabled.Value && NetworkServer.active && !(BepConfig.SimulacrumCommencementArtifactDissonanceChance.Value <= 0f) && (EnumCollection.SceneNameIsStage(SceneCatalog.currentSceneDef.cachedName, EnumCollection.StageEnum.SimulacrumCommencement) || EnumCollection.SceneNameIsStage(SceneCatalog.currentSceneDef.cachedName, EnumCollection.StageEnum.Commencement)) && BepConfig.SimulacrumCommencementArtifactDissonanceChance.Value > RoR2Application.rng.nextNormalizedFloat)
			{
				RunArtifactManager.instance.SetArtifactEnabledServer(EnumCollection.GetArtifactDef(EnumCollection.ArtifactEnum.Dissonance), true);
			}
		}

		private PickupIndex RandomlyLunarUtils_CheckForLunarReplacement(orig_CheckForLunarReplacement orig, PickupIndex pickupIndex, Xoroshiro128Plus rng)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			pickupIndex = orig.Invoke(pickupIndex, rng);
			if (!BepConfig.Enabled.Value || pickupIndex == PickupIndex.none)
			{
				return pickupIndex;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
			if (pickupDef != null && pickupDef.isLunar && (!BepConfig.NoPearlsInBazaar.Value || !EnumCollection.SceneNameIsStage(SceneCatalog.currentSceneDef.cachedName, EnumCollection.StageEnum.Bazaar)))
			{
				float nextNormalizedFloat = rng.nextNormalizedFloat;
				if (nextNormalizedFloat < BepConfig.IrradiantPearlReplacesLunarItemChance.Value)
				{
					pickupIndex = PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex("ShinyPearl"));
				}
				else if (nextNormalizedFloat < BepConfig.IrradiantPearlReplacesLunarItemChance.Value + BepConfig.PearlReplacesLunarItemChance.Value)
				{
					pickupIndex = PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex("Pearl"));
				}
				return pickupIndex;
			}
			return pickupIndex;
		}

		private void RandomlyLunarUtils_CheckForLunarReplacementUniqueArray(orig_CheckForLunarReplacementUniqueArray orig, PickupIndex[] pickupIndices, Xoroshiro128Plus rng)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(pickupIndices, rng);
			if (!BepConfig.Enabled.Value)
			{
				return;
			}
			for (int i = 0; i < pickupIndices.Length; i++)
			{
				PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndices[i]);
				if (pickupDef != null && pickupDef.isLunar && (!BepConfig.NoPearlsInBazaar.Value || !EnumCollection.SceneNameIsStage(SceneCatalog.currentSceneDef.cachedName, EnumCollection.StageEnum.Bazaar)))
				{
					float nextNormalizedFloat = rng.nextNormalizedFloat;
					if (nextNormalizedFloat < BepConfig.IrradiantPearlReplacesLunarItemChance.Value)
					{
						pickupIndices[i] = PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex("ShinyPearl"));
					}
					else if (nextNormalizedFloat < BepConfig.IrradiantPearlReplacesLunarItemChance.Value + BepConfig.PearlReplacesLunarItemChance.Value)
					{
						pickupIndices[i] = PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex("Pearl"));
					}
				}
			}
		}
	}
}