Decompiled source of LethalCompanyMod v1.16.9

BepInEx/plugins/LethalCompanyMod/LethalCompanyMod.dll

Decompiled 36 minutes ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalCompanyMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalCompanyMod")]
[assembly: AssemblyTitle("LethalCompanyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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;
		}
	}
	[CompilerGenerated]
	[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 LethalCompanyMod
{
	[BepInPlugin("anton.lethalcompanymod", "LethalCompanyMod", "1.16.9")]
	public sealed class Plugin : BaseUnityPlugin
	{
		private sealed class AnimatedSlashSprite
		{
			internal Transform Transform;

			internal Renderer Renderer;

			internal Vector3 Anchor;

			internal Vector3 Drift;

			internal Vector3 BaseScale;

			internal Color Tint;

			internal float Phase;

			internal float Speed;

			internal float Roll;

			internal bool CameraAttached;
		}

		private sealed class HiddenTerrainState
		{
			internal Behaviour Terrain;

			internal bool WasEnabled;
		}

		private sealed class ArenaEntityState
		{
			internal Vector3 Position;

			internal Quaternion Rotation;

			internal Vector3 Velocity;

			internal Vector3 AngularVelocity;
		}

		private enum DomainKind
		{
			InfiniteVoid,
			MalevolentShrineOpen,
			MalevolentShrineClosed,
			IdleDeathGamble
		}

		internal sealed class DomainDriver : MonoBehaviour
		{
			internal Plugin? Owner;

			private void Update()
			{
				Owner?.Tick();
			}

			private void LateUpdate()
			{
				Owner?.LateTick();
			}
		}

		private readonly struct DomainStyle
		{
			public readonly Color BoundaryColor;

			public readonly Color CoreColor;

			public readonly Color AccentColor;

			public readonly Color LightColor;

			public readonly Color FogColor;

			public readonly Color TextColor;

			public readonly float LightIntensity;

			public DomainStyle(Color boundaryColor, Color coreColor, Color accentColor, Color lightColor, Color fogColor, Color textColor, float lightIntensity)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0002: 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_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: 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_001e: 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_0026: 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)
				BoundaryColor = boundaryColor;
				CoreColor = coreColor;
				AccentColor = accentColor;
				LightColor = lightColor;
				FogColor = fogColor;
				TextColor = textColor;
				LightIntensity = lightIntensity;
			}
		}

		public const string PluginGuid = "anton.lethalcompanymod";

		public const string PluginName = "LethalCompanyMod";

		public const string PluginVersion = "1.16.9";

		private const float DomainDuration = 30f;

		private const float IdleDeathGambleMinDuration = 45f;

		private const float IdleDeathGambleMaxDuration = 70f;

		private const float OpeningDuration = 2.35f;

		private const float DomainRadius = 26f;

		private const float MalevolentShrineOpenRadius = 42f;

		private const float EffectInterval = 0.35f;

		private const float ClosedBarrierRadius = 23.4f;

		private const float BarrierReturnOffset = 1.5f;

		private const float InfiniteVoidMovementMultiplier = 0.015f;

		private const float JackpotDuration = 100f;

		private const float JackpotRegenInterval = 0.1f;

		private const int JackpotRegenHealAmount = 32;

		private const int JackpotMinimumHealth = 92;

		private const ulong NoJackpotRegenClientId = ulong.MaxValue;

		private const float GambleSpinInterval = 4.2f;

		private const float ArenaFloorSize = 62f;

		private const float ArenaCaptureRadius = 26f;

		private const string OpenDomainMessage = "LethalCompanyMod.OpenDomain";

		private const string RequestDomainMessage = "LethalCompanyMod.RequestDomain";

		private const string CloseDomainMessage = "LethalCompanyMod.CloseDomain";

		private const string GambleRollMessage = "LethalCompanyMod.GambleRoll";

		private const string ShrineDamageMessage = "LethalCompanyMod.ShrineDamage";

		private const string DomainDeniedMessage = "LethalCompanyMod.DomainDenied";

		private readonly Dictionary<EnemyAI, float> originalEnemySpeeds = new Dictionary<EnemyAI, float>();

		private readonly Dictionary<DomainKind, AudioClip> domainSounds = new Dictionary<DomainKind, AudioClip>();

		private readonly HashSet<DomainKind> missingSoundWarnings = new HashSet<DomainKind>();

		private readonly HashSet<ulong> playersWhoUsedDomainThisMoon = new HashSet<ulong>();

		private AudioClip? slotRollClip;

		private AudioClip? jackpotSoundClip;

		private Texture2D? infiniteVoidGalaxyTexture;

		private Texture2D? infiniteVoidBlackHoleTexture;

		private Texture2D? infiniteVoidInkTexture;

		private Texture2D? infiniteVoidStreakTexture;

		private Texture2D? malevolentShrineOpenBarrierTexture;

		private Texture2D? malevolentShrineClosedBarrierTexture;

		private Texture2D? idleDeathGambleBarrierTexture;

		private Texture2D? malevolentShrineGroundSealTexture;

		private Texture2D? malevolentShrineSlashTexture;

		private Texture2D? malevolentShrineSlashCoreTexture;

		private Texture2D? softParticleTexture;

		private readonly List<Transform> infiniteVoidRotators = new List<Transform>();

		private readonly List<LineRenderer> infiniteVoidPulseLines = new List<LineRenderer>();

		private readonly List<ParticleSystem> infiniteVoidParticleSystems = new List<ParticleSystem>();

		private readonly List<float> infiniteVoidParticleRates = new List<float>();

		private readonly List<RawImage> infiniteVoidOverlayImages = new List<RawImage>();

		private readonly List<RectTransform> infiniteVoidOverlayRects = new List<RectTransform>();

		private readonly List<LineRenderer> malevolentShrineSlashLines = new List<LineRenderer>();

		private readonly List<float> malevolentShrineSlashPhases = new List<float>();

		private readonly List<float> malevolentShrineSlashSpeeds = new List<float>();

		private readonly List<float> malevolentShrineSlashWidths = new List<float>();

		private readonly List<AnimatedSlashSprite> malevolentShrineSlashSprites = new List<AnimatedSlashSprite>();

		private readonly List<Transform> openingRotators = new List<Transform>();

		private readonly List<float> openingRotationSpeeds = new List<float>();

		private readonly List<ParticleSystem> openingTimedParticles = new List<ParticleSystem>();

		private readonly List<float> openingParticleStopProgress = new List<float>();

		private readonly List<Transform> idleDeathGambleRotators = new List<Transform>();

		private readonly List<float> idleDeathGambleRotationSpeeds = new List<float>();

		private readonly List<Vector3> idleDeathGambleRotationAxes = new List<Vector3>();

		private readonly List<Renderer> idleDeathGambleChaseLights = new List<Renderer>();

		private readonly List<Vector3> idleDeathGambleChaseScales = new List<Vector3>();

		private readonly Dictionary<Renderer, bool> hiddenDomainRenderers = new Dictionary<Renderer, bool>();

		private readonly Dictionary<Light, bool> hiddenDomainLights = new Dictionary<Light, bool>();

		private readonly List<HiddenTerrainState> hiddenDomainTerrains = new List<HiddenTerrainState>();

		private readonly Dictionary<DomainKind, GameObject> persistentDomainArenas = new Dictionary<DomainKind, GameObject>();

		private readonly List<NavMeshDataInstance> persistentArenaNavMeshes = new List<NavMeshDataInstance>();

		private readonly List<NavMeshData> persistentArenaNavMeshData = new List<NavMeshData>();

		private readonly Dictionary<EnemyAI, ArenaEntityState> arenaEnemyStates = new Dictionary<EnemyAI, ArenaEntityState>();

		private readonly Dictionary<GrabbableObject, ArenaEntityState> arenaItemStates = new Dictionary<GrabbableObject, ArenaEntityState>();

		private readonly Dictionary<NetworkObject, ArenaEntityState> arenaNetworkEntityStates = new Dictionary<NetworkObject, ArenaEntityState>();

		private readonly Dictionary<ulong, Vector3> domainParticipantSourcePositions = new Dictionary<ulong, Vector3>();

		private Renderer? infiniteVoidGalaxyRenderer;

		private Renderer? activeDomainInteriorRenderer;

		private Transform? shrineMouthRoot;

		private GameObject? shrineCameraVfxRoot;

		private GameObject? domainCameraBackdropRoot;

		private bool atmosphereCaptured;

		private bool originalFogEnabled;

		private FogMode originalFogMode;

		private Color originalFogColor;

		private float originalFogDensity;

		private Color originalAmbientLight;

		private Material? originalSkybox;

		private Material? domainSkyboxMaterial;

		private bool skyboxCaptured;

		private Camera? domainGameplayCamera;

		private CameraClearFlags originalCameraClearFlags;

		private Color originalCameraBackgroundColor;

		private bool domainCameraCaptured;

		private bool domainArenaActivated;

		private bool localPlayerInDomainArena;

		private bool localPlayerReturnCaptured;

		private int arenaRoundInstanceId;

		private float idleDeathGambleVisualTime;

		private float idleDeathGambleRollPulse;

		private DomainKind selectedDomain;

		private bool menuOpen;

		private bool domainOpen;

		private bool openingActive;

		private bool domainVisualBuilt;

		private bool domainAffectsGameplay;

		private bool readyTipShown;

		private bool inputDebugLogged;

		private bool networkHandlersRegistered;

		private bool moonUsageStateInitialized;

		private bool previousShipHasLanded;

		private bool domainUsesAvailableOnMoon;

		private int moonUsageLevelId = int.MinValue;

		private int lastTickFrame = -1;

		private int lastMenuToggleFrame = -1;

		private int lastDirectHotkeyFrame = -1;

		private float openingTime;

		private float domainTimeLeft;

		private float activeDomainDuration;

		private float effectTimer;

		private float gambleTimer;

		private float barrierTipCooldown;

		private float jackpotRegenTimeLeft;

		private float jackpotRegenTick;

		private float spinDisplayTimeLeft;

		private int jackpotRoll;

		private ulong casterClientId;

		private ulong jackpotRegenClientId = ulong.MaxValue;

		private Vector3 domainCenter;

		private Vector3 domainSourceCenter;

		private Vector3 localPlayerReturnPosition;

		private Quaternion localPlayerReturnRotation;

		private Vector3 lastLocalPlayerPosition;

		private bool hasLastLocalPlayerPosition;

		private GameObject? driverHost;

		private GameObject? menuCanvasRoot;

		private Text? menuText;

		private GameObject? spinCanvasRoot;

		private Text? spinText;

		private GameObject? domainRoot;

		private GameObject? openingRoot;

		private GameObject? infiniteVoidOverlayRoot;

		private GameObject? jackpotSoundObject;

		private AudioSource? jackpotSoundSource;

		private Light? domainLight;

		private string statusText = "Press 0, F1, or Insert to open the menu.";

		private string soundDirectory = string.Empty;

		private string textureDirectory = string.Empty;

		private float infiniteVoidVisualTime;

		private float malevolentShrineVisualTime;

		internal static ManualLogSource Log { get; private set; }

		internal static Plugin? Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			AttachDriver();
			CreateCanvasMenu();
			CreateSpinDisplay();
			soundDirectory = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? Paths.PluginPath, "sounds");
			textureDirectory = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? Paths.PluginPath, "textures");
			LoadVisualTextures();
			((MonoBehaviour)this).StartCoroutine(LoadDomainSounds());
			((MonoBehaviour)this).StartCoroutine(LoadJackpotSound());
			slotRollClip = CreateSlotRollClip();
			Log.LogInfo((object)"LethalCompanyMod 1.16.9 loaded. 0/F1/Insert menu, F2-F5 domains, multiplayer opening sync enabled.");
		}

		private void OnDestroy()
		{
			UnregisterNetworkHandlers();
			StopJackpotSound();
			CloseDomain(broadcast: false);
			ClearPersistentDomainArenas();
			if ((Object)(object)driverHost != (Object)null)
			{
				Object.Destroy((Object)(object)driverHost);
				driverHost = null;
			}
			Instance = null;
		}

		private void AttachDriver()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			driverHost = new GameObject("LethalCompanyModDriverHost");
			Object.DontDestroyOnLoad((Object)(object)driverHost);
			driverHost.AddComponent<DomainDriver>().Owner = this;
		}

		private void Update()
		{
			Tick();
		}

		private void LateUpdate()
		{
			LateTick();
		}

		internal void LateTick()
		{
			if (domainOpen && !openingActive && domainVisualBuilt)
			{
				MaintainRemoteDomainPlayerRepresentations();
				if (!HasClosedBarrier() || localPlayerInDomainArena)
				{
					EnforceDomainAtmosphere();
				}
			}
		}

		internal void Tick()
		{
			if (lastTickFrame == Time.frameCount)
			{
				return;
			}
			lastTickFrame = Time.frameCount;
			TryRegisterNetworkHandlers();
			EnsurePersistentDomainArenas();
			UpdateDomainUsageMoonState();
			ShowReadyTipOnce();
			LogInputDebugOnce();
			HandleMenuKeyboard();
			HandleDirectDomainHotkeys();
			HandleMenuToggle();
			UpdateCanvasMenu();
			UpdateSpinDisplay();
			ApplyJackpotRegeneration();
			if (domainOpen)
			{
				UpdateOpeningAndDomainVisuals();
				ApplyInfiniteVoidPlayerSlow();
				ApplyClosedBarrierContainment();
				domainTimeLeft -= Time.deltaTime;
				effectTimer -= Time.deltaTime;
				if (!openingActive && effectTimer <= 0f)
				{
					effectTimer = 0.35f;
					ApplyDomainEffect();
				}
				if (domainTimeLeft <= 0f)
				{
					CloseDomain();
				}
			}
		}

		private void HandleMenuToggle()
		{
			Keyboard current = Keyboard.current;
			if (!WasPressed((current != null) ? current.digit0Key : null, (KeyCode)48))
			{
				Keyboard current2 = Keyboard.current;
				if (!WasPressed((current2 != null) ? current2.numpad0Key : null, (KeyCode)256))
				{
					Keyboard current3 = Keyboard.current;
					if (!WasPressed((current3 != null) ? current3.f1Key : null, (KeyCode)282))
					{
						Keyboard current4 = Keyboard.current;
						if (!WasPressed((current4 != null) ? current4.insertKey : null, (KeyCode)277))
						{
							return;
						}
					}
				}
			}
			if (lastMenuToggleFrame != Time.frameCount)
			{
				lastMenuToggleFrame = Time.frameCount;
				menuOpen = !menuOpen;
				statusText = (menuOpen ? "Domain menu opened." : "Domain menu closed.");
				Log.LogInfo((object)statusText);
			}
		}

		private void CreateCanvasMenu()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			//IL_00bf: 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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)menuCanvasRoot != (Object)null))
			{
				menuCanvasRoot = new GameObject("DomainMenuCanvas");
				Object.DontDestroyOnLoad((Object)(object)menuCanvasRoot);
				Canvas obj = menuCanvasRoot.AddComponent<Canvas>();
				obj.renderMode = (RenderMode)0;
				obj.sortingOrder = 32767;
				CanvasScaler obj2 = menuCanvasRoot.AddComponent<CanvasScaler>();
				obj2.uiScaleMode = (ScaleMode)1;
				obj2.referenceResolution = new Vector2(1920f, 1080f);
				obj2.matchWidthOrHeight = 0.5f;
				menuCanvasRoot.AddComponent<GraphicRaycaster>();
				GameObject val = new GameObject("Panel");
				val.transform.SetParent(menuCanvasRoot.transform, false);
				((Graphic)val.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.74f);
				RectTransform component = val.GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0.03f, 0.12f);
				component.anchorMax = new Vector2(0.38f, 0.58f);
				component.offsetMin = Vector2.zero;
				component.offsetMax = Vector2.zero;
				GameObject val2 = new GameObject("MenuText");
				val2.transform.SetParent(val.transform, false);
				menuText = val2.AddComponent<Text>();
				menuText.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				menuText.fontSize = 18;
				((Graphic)menuText).color = new Color(0.78f, 1f, 1f, 1f);
				menuText.alignment = (TextAnchor)0;
				menuText.horizontalOverflow = (HorizontalWrapMode)0;
				menuText.verticalOverflow = (VerticalWrapMode)1;
				RectTransform component2 = val2.GetComponent<RectTransform>();
				component2.anchorMin = Vector2.zero;
				component2.anchorMax = Vector2.one;
				component2.offsetMin = new Vector2(16f, 12f);
				component2.offsetMax = new Vector2(-16f, -12f);
				menuCanvasRoot.SetActive(false);
			}
		}

		private void CreateSpinDisplay()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)spinCanvasRoot != (Object)null))
			{
				spinCanvasRoot = new GameObject("IdleDeathGambleSpinCanvas");
				Object.DontDestroyOnLoad((Object)(object)spinCanvasRoot);
				Canvas obj = spinCanvasRoot.AddComponent<Canvas>();
				obj.renderMode = (RenderMode)0;
				obj.sortingOrder = 32766;
				CanvasScaler obj2 = spinCanvasRoot.AddComponent<CanvasScaler>();
				obj2.uiScaleMode = (ScaleMode)1;
				obj2.referenceResolution = new Vector2(1920f, 1080f);
				obj2.matchWidthOrHeight = 0.5f;
				GameObject val = new GameObject("SpinText");
				val.transform.SetParent(spinCanvasRoot.transform, false);
				spinText = val.AddComponent<Text>();
				spinText.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
				spinText.fontSize = 52;
				spinText.fontStyle = (FontStyle)1;
				spinText.supportRichText = true;
				spinText.alignment = (TextAnchor)4;
				spinText.horizontalOverflow = (HorizontalWrapMode)1;
				spinText.verticalOverflow = (VerticalWrapMode)1;
				RectTransform component = val.GetComponent<RectTransform>();
				component.anchorMin = new Vector2(0.34f, 0.67f);
				component.anchorMax = new Vector2(0.66f, 0.84f);
				component.offsetMin = Vector2.zero;
				component.offsetMax = Vector2.zero;
				spinCanvasRoot.SetActive(false);
			}
		}

		private void UpdateSpinDisplay()
		{
			//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_0093: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)spinCanvasRoot == (Object)null)
			{
				CreateSpinDisplay();
			}
			if ((Object)(object)spinCanvasRoot == (Object)null)
			{
				return;
			}
			if (spinDisplayTimeLeft > 0f)
			{
				spinDisplayTimeLeft -= Time.deltaTime;
				if (!spinCanvasRoot.activeSelf)
				{
					spinCanvasRoot.SetActive(true);
				}
				if ((Object)(object)spinText != (Object)null)
				{
					Color color = ((Graphic)spinText).color;
					color.a = Mathf.Clamp01(spinDisplayTimeLeft / 0.55f);
					((Graphic)spinText).color = color;
				}
			}
			else if (spinCanvasRoot.activeSelf)
			{
				spinCanvasRoot.SetActive(false);
			}
		}

		private void ShowGambleRoll(int roll, bool jackpot)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)spinText == (Object)null)
			{
				CreateSpinDisplay();
			}
			if (!((Object)(object)spinText == (Object)null))
			{
				spinText.text = (jackpot ? ("<color=#FFD633>JACKPOT</color>\n<color=#000000>" + roll + "</color>") : ("<color=#000000>ROLL\n" + roll + "</color>"));
				((Graphic)spinText).color = Color.white;
				spinDisplayTimeLeft = (jackpot ? 3.2f : 2.1f);
				if ((Object)(object)spinCanvasRoot != (Object)null)
				{
					spinCanvasRoot.SetActive(true);
				}
			}
		}

		private void UpdateCanvasMenu()
		{
			if ((Object)(object)menuCanvasRoot == (Object)null)
			{
				CreateCanvasMenu();
			}
			if ((Object)(object)menuCanvasRoot != (Object)null && menuCanvasRoot.activeSelf != menuOpen)
			{
				menuCanvasRoot.SetActive(menuOpen);
			}
			if (!((Object)(object)menuText == (Object)null))
			{
				menuText.text = "DOMAIN EXPANSION MENU\n\n1 - Infinite Void" + SelectedMark(DomainKind.InfiniteVoid) + "\n2 - Malevolent Shrine Open" + SelectedMark(DomainKind.MalevolentShrineOpen) + "\n3 - Malevolent Shrine Closed" + SelectedMark(DomainKind.MalevolentShrineClosed) + "\n4 - Idle Death Gamble" + SelectedMark(DomainKind.IdleDeathGamble) + "\n\nDomain uses: " + GetLocalDomainUsesRemaining() + "\nEnter - Open selected domain\nF2/F3/F4/F5 - Direct domains\n0 / F1 / Insert - Toggle menu\n\n" + statusText;
			}
		}

		private string SelectedMark(DomainKind domain)
		{
			if (selectedDomain != domain)
			{
				return string.Empty;
			}
			return "  <";
		}

		private int GetLocalDomainUsesRemaining()
		{
			if (!domainUsesAvailableOnMoon)
			{
				return 0;
			}
			return (!playersWhoUsedDomainThisMoon.Contains(GetLocalClientId())) ? 1 : 0;
		}

		private void HandleMenuKeyboard()
		{
			Keyboard current = Keyboard.current;
			if (menuOpen)
			{
				if (WasPressed((current != null) ? current.digit1Key : null, (KeyCode)49) || WasPressed((current != null) ? current.numpad1Key : null, (KeyCode)257))
				{
					selectedDomain = DomainKind.InfiniteVoid;
				}
				if (WasPressed((current != null) ? current.digit2Key : null, (KeyCode)50) || WasPressed((current != null) ? current.numpad2Key : null, (KeyCode)258))
				{
					selectedDomain = DomainKind.MalevolentShrineOpen;
				}
				if (WasPressed((current != null) ? current.digit3Key : null, (KeyCode)51) || WasPressed((current != null) ? current.numpad3Key : null, (KeyCode)259))
				{
					selectedDomain = DomainKind.MalevolentShrineClosed;
				}
				if (WasPressed((current != null) ? current.digit4Key : null, (KeyCode)52) || WasPressed((current != null) ? current.numpad4Key : null, (KeyCode)260))
				{
					selectedDomain = DomainKind.IdleDeathGamble;
				}
				if (WasPressed((current != null) ? current.enterKey : null, (KeyCode)13) || WasPressed((current != null) ? current.numpadEnterKey : null, (KeyCode)271))
				{
					menuOpen = false;
					OpenSelectedDomain();
				}
			}
		}

		private void HandleDirectDomainHotkeys()
		{
			Keyboard current = Keyboard.current;
			if (lastDirectHotkeyFrame != Time.frameCount)
			{
				if (WasPressed((current != null) ? current.f2Key : null, (KeyCode)283))
				{
					OpenDomainDirect(DomainKind.InfiniteVoid);
				}
				else if (WasPressed((current != null) ? current.f3Key : null, (KeyCode)284))
				{
					OpenDomainDirect(DomainKind.MalevolentShrineOpen);
				}
				else if (WasPressed((current != null) ? current.f4Key : null, (KeyCode)285))
				{
					OpenDomainDirect(DomainKind.MalevolentShrineClosed);
				}
				else if (WasPressed((current != null) ? current.f5Key : null, (KeyCode)286))
				{
					OpenDomainDirect(DomainKind.IdleDeathGamble);
				}
			}
		}

		private void OpenDomainDirect(DomainKind domain)
		{
			lastDirectHotkeyFrame = Time.frameCount;
			selectedDomain = domain;
			menuOpen = false;
			OpenSelectedDomain();
		}

		private void OpenSelectedDomain()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
			if ((Object)(object)val == (Object)null)
			{
				statusText = "No local player found yet.";
				Log.LogWarning((object)statusText);
				return;
			}
			Vector3 position = ((Component)val).transform.position;
			ulong localClientId = GetLocalClientId();
			NetworkManager singleton = NetworkManager.Singleton;
			if ((Object)(object)singleton != (Object)null && singleton.IsListening && !singleton.IsServer)
			{
				SendDomainRequest(selectedDomain, position, localClientId);
				statusText = "Domain request sent to host: " + GetDomainName(selectedDomain) + ".";
				ShowTip("Domain requested", GetDomainName(selectedDomain));
			}
			else if (!domainUsesAvailableOnMoon)
			{
				ShowDomainUnavailableInShip();
			}
			else if (playersWhoUsedDomainThisMoon.Contains(localClientId))
			{
				ShowDomainUsageDenied();
			}
			else if (TryConsumeDomainUse(localClientId))
			{
				float duration = RollDomainDuration(selectedDomain);
				Dictionary<ulong, Vector3> participants = CaptureDomainParticipants(position, localClientId);
				OpenDomainLocal(selectedDomain, position, localClientId, affectsGameplay: true, duration, participants);
				BroadcastOpenDomain(selectedDomain, position, localClientId, duration, participants);
			}
		}

		private void UpdateDomainUsageMoonState()
		{
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null)
			{
				moonUsageStateInitialized = false;
				previousShipHasLanded = false;
				domainUsesAvailableOnMoon = false;
				moonUsageLevelId = int.MinValue;
				playersWhoUsedDomainThisMoon.Clear();
				return;
			}
			object memberValue = GetMemberValue(instance, "shipHasLanded");
			bool flag = default(bool);
			int num;
			if (memberValue is bool)
			{
				flag = (bool)memberValue;
				num = 1;
			}
			else
			{
				num = 0;
			}
			bool flag2 = (byte)((uint)num & (flag ? 1u : 0u)) != 0;
			memberValue = GetMemberValue(instance, "inShipPhase");
			bool flag3 = default(bool);
			int num2;
			if (memberValue is bool)
			{
				flag3 = (bool)memberValue;
				num2 = 1;
			}
			else
			{
				num2 = 0;
			}
			bool flag4 = (byte)((uint)num2 & (flag3 ? 1u : 0u)) != 0;
			bool flag5 = flag2 && !flag4;
			int currentMoonLevelId = GetCurrentMoonLevelId(instance);
			if (!moonUsageStateInitialized)
			{
				moonUsageStateInitialized = true;
				previousShipHasLanded = flag5;
				domainUsesAvailableOnMoon = flag5;
				moonUsageLevelId = currentMoonLevelId;
				playersWhoUsedDomainThisMoon.Clear();
				Log.LogInfo((object)("Domain usage initialized for moon level " + currentMoonLevelId + "."));
				return;
			}
			if (flag5 && (!previousShipHasLanded || currentMoonLevelId != moonUsageLevelId))
			{
				playersWhoUsedDomainThisMoon.Clear();
				domainUsesAvailableOnMoon = true;
				Log.LogInfo((object)("Every player received one domain use for moon level " + currentMoonLevelId + "."));
			}
			else if (!flag5 && previousShipHasLanded)
			{
				playersWhoUsedDomainThisMoon.Clear();
				domainUsesAvailableOnMoon = false;
				Log.LogInfo((object)"Ship returned to orbit; every player's domain uses were set to zero.");
				if (domainOpen)
				{
					NetworkManager singleton = NetworkManager.Singleton;
					bool broadcast = (Object)(object)singleton == (Object)null || !singleton.IsListening || singleton.IsServer;
					CloseDomain(broadcast);
				}
			}
			previousShipHasLanded = flag5;
			moonUsageLevelId = currentMoonLevelId;
		}

		private static int GetCurrentMoonLevelId(StartOfRound round)
		{
			object memberValue = GetMemberValue(round, "currentLevelID");
			if (memberValue is int)
			{
				return (int)memberValue;
			}
			object memberValue2 = GetMemberValue(round, "currentLevel");
			if (memberValue2 != null)
			{
				object memberValue3 = GetMemberValue(memberValue2, "levelID");
				if (memberValue3 is int)
				{
					return (int)memberValue3;
				}
			}
			return -1;
		}

		private bool TryConsumeDomainUse(ulong clientId)
		{
			if (!domainUsesAvailableOnMoon)
			{
				if (clientId == GetLocalClientId())
				{
					ShowDomainUnavailableInShip();
				}
				return false;
			}
			if (playersWhoUsedDomainThisMoon.Add(clientId))
			{
				Log.LogInfo((object)("Domain use consumed for client " + clientId + " on moon level " + moonUsageLevelId + "."));
				return true;
			}
			if (clientId == GetLocalClientId())
			{
				ShowDomainUsageDenied();
			}
			return false;
		}

		private void ShowDomainUsageDenied()
		{
			statusText = "You already used a Domain Expansion on this moon.";
			ShowTip("Domain unavailable", statusText);
			Log.LogInfo((object)statusText);
		}

		private void ShowDomainUnavailableInShip()
		{
			statusText = "You have 0 domain uses while the ship is in orbit.";
			ShowTip("Domain unavailable", statusText);
			Log.LogInfo((object)statusText);
		}

		private void OpenDomainLocal(DomainKind domain, Vector3 center, ulong casterId, bool affectsGameplay, float duration = -1f, Dictionary<ulong, Vector3>? participants = null)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			selectedDomain = domain;
			CloseDomain(broadcast: false);
			ClearInfiniteVoidRuntimeReferences();
			domainOpen = true;
			openingActive = true;
			domainVisualBuilt = false;
			domainAffectsGameplay = affectsGameplay;
			openingTime = 0f;
			activeDomainDuration = ((duration > 0f) ? duration : RollDomainDuration(domain));
			domainTimeLeft = activeDomainDuration + 2.35f;
			effectTimer = 0f;
			gambleTimer = 0f;
			jackpotRoll = 0;
			domainSourceCenter = center;
			domainCenter = center;
			domainParticipantSourcePositions.Clear();
			if (participants != null)
			{
				foreach (KeyValuePair<ulong, Vector3> participant in participants)
				{
					domainParticipantSourcePositions[participant.Key] = participant.Value;
				}
			}
			domainArenaActivated = false;
			localPlayerInDomainArena = false;
			localPlayerReturnCaptured = false;
			domainParticipantSourcePositions.Clear();
			casterClientId = casterId;
			CreateOpeningAnimation();
			PlayDomainSound(domain, center);
			statusText = GetDomainName(domain) + " opening...";
			ShowTip("Domain opening", statusText);
			Log.LogInfo((object)statusText);
		}

		private void CloseDomain(bool broadcast = true)
		{
			if (broadcast)
			{
				BroadcastCloseDomain();
			}
			RestoreEntitiesFromDomainArena();
			RestoreEnemySpeeds();
			RestoreDomainEnvironmentRendering();
			RestoreDomainAtmosphere();
			ClearInfiniteVoidRuntimeReferences();
			if ((Object)(object)domainRoot != (Object)null)
			{
				Object.Destroy((Object)(object)domainRoot);
				domainRoot = null;
			}
			openingRoot = null;
			domainLight = null;
			domainOpen = false;
			openingActive = false;
			domainVisualBuilt = false;
			domainAffectsGameplay = false;
			domainArenaActivated = false;
			localPlayerInDomainArena = false;
			localPlayerReturnCaptured = false;
			domainTimeLeft = 0f;
			activeDomainDuration = 0f;
		}

		private void ClearInfiniteVoidRuntimeReferences()
		{
			infiniteVoidRotators.Clear();
			infiniteVoidPulseLines.Clear();
			infiniteVoidParticleSystems.Clear();
			infiniteVoidParticleRates.Clear();
			infiniteVoidOverlayImages.Clear();
			infiniteVoidOverlayRects.Clear();
			malevolentShrineSlashLines.Clear();
			malevolentShrineSlashPhases.Clear();
			malevolentShrineSlashSpeeds.Clear();
			malevolentShrineSlashWidths.Clear();
			malevolentShrineSlashSprites.Clear();
			openingRotators.Clear();
			openingRotationSpeeds.Clear();
			openingTimedParticles.Clear();
			openingParticleStopProgress.Clear();
			idleDeathGambleRotators.Clear();
			idleDeathGambleRotationSpeeds.Clear();
			idleDeathGambleRotationAxes.Clear();
			idleDeathGambleChaseLights.Clear();
			idleDeathGambleChaseScales.Clear();
			infiniteVoidGalaxyRenderer = null;
			activeDomainInteriorRenderer = null;
			shrineMouthRoot = null;
			if ((Object)(object)shrineCameraVfxRoot != (Object)null)
			{
				Object.Destroy((Object)(object)shrineCameraVfxRoot);
				shrineCameraVfxRoot = null;
			}
			if ((Object)(object)domainCameraBackdropRoot != (Object)null)
			{
				Object.Destroy((Object)(object)domainCameraBackdropRoot);
				domainCameraBackdropRoot = null;
			}
			infiniteVoidVisualTime = 0f;
			malevolentShrineVisualTime = 0f;
			idleDeathGambleVisualTime = 0f;
			idleDeathGambleRollPulse = 0f;
			if ((Object)(object)infiniteVoidOverlayRoot != (Object)null)
			{
				Object.Destroy((Object)(object)infiniteVoidOverlayRoot);
				infiniteVoidOverlayRoot = null;
			}
		}

		private void EnsurePersistentDomainArenas()
		{
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)instance.localPlayerController == (Object)null)
			{
				return;
			}
			int instanceID = ((Object)instance).GetInstanceID();
			if (arenaRoundInstanceId != instanceID)
			{
				ClearPersistentDomainArenas();
				arenaRoundInstanceId = instanceID;
			}
			else
			{
				bool flag = false;
				foreach (GameObject value in persistentDomainArenas.Values)
				{
					if ((Object)(object)value == (Object)null)
					{
						flag = true;
						break;
					}
				}
				if (flag)
				{
					ClearPersistentDomainArenas();
					arenaRoundInstanceId = instanceID;
				}
			}
			EnsurePersistentDomainArena(DomainKind.InfiniteVoid);
			EnsurePersistentDomainArena(DomainKind.MalevolentShrineClosed);
			EnsurePersistentDomainArena(DomainKind.IdleDeathGamble);
		}

		private unsafe void EnsurePersistentDomainArena(DomainKind domain)
		{
			//IL_001b: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_003d: 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_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			if (persistentDomainArenas.TryGetValue(domain, out GameObject value) && (Object)(object)value != (Object)null)
			{
				return;
			}
			Vector3 persistentArenaCenter = GetPersistentArenaCenter(domain);
			GameObject val = new GameObject("Persistent Domain Arena - " + GetDomainName(domain));
			val.transform.position = persistentArenaCenter;
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)obj).name = "Persistent Arena Physics Floor";
			obj.transform.SetParent(val.transform, false);
			obj.transform.localPosition = new Vector3(0f, -0.5f, 0f);
			obj.transform.localScale = new Vector3(62f, 1f, 62f);
			Renderer component = obj.GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null)
			{
				component.enabled = false;
			}
			int num = 32;
			float num2 = 23.949999f;
			float num3 = MathF.PI * 2f * num2 / (float)num * 1.12f;
			for (int i = 0; i < num; i++)
			{
				float num4 = (float)i * MathF.PI * 2f / (float)num;
				GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)3);
				((Object)obj2).name = "Persistent Arena Invisible Wall";
				obj2.transform.SetParent(val.transform, false);
				obj2.transform.localPosition = new Vector3(Mathf.Cos(num4) * num2, 4.5f, Mathf.Sin(num4) * num2);
				obj2.transform.localRotation = Quaternion.Euler(0f, (0f - num4) * 57.29578f + 90f, 0f);
				obj2.transform.localScale = new Vector3(num3, 9f, 0.8f);
				Renderer component2 = obj2.GetComponent<Renderer>();
				if ((Object)(object)component2 != (Object)null)
				{
					component2.enabled = false;
				}
			}
			persistentDomainArenas[domain] = val;
			BuildArenaNavMeshes(val, persistentArenaCenter);
			ManualLogSource log = Log;
			string[] obj3 = new string[5]
			{
				"Persistent arena ready: ",
				GetDomainName(domain),
				" at ",
				null,
				null
			};
			Vector3 val2 = persistentArenaCenter;
			obj3[3] = ((object)(*(Vector3*)(&val2))/*cast due to .constrained prefix*/).ToString();
			obj3[4] = ".";
			log.LogInfo((object)string.Concat(obj3));
		}

		private void BuildArenaNavMeshes(GameObject arenaRoot, Vector3 center)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: 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_002c: 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_0055: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				List<NavMeshBuildSource> list = new List<NavMeshBuildSource>();
				NavMeshBuilder.CollectSources(arenaRoot.transform, -1, (NavMeshCollectGeometry)1, 0, new List<NavMeshBuildMarkup>(), list);
				Bounds val = default(Bounds);
				((Bounds)(ref val))..ctor(center + Vector3.up * 3.5f, new Vector3(66f, 10f, 66f));
				int settingsCount = NavMesh.GetSettingsCount();
				for (int i = 0; i < settingsCount; i++)
				{
					NavMeshData val2 = NavMeshBuilder.BuildNavMeshData(NavMesh.GetSettingsByIndex(i), list, val, Vector3.zero, Quaternion.identity);
					if (!((Object)(object)val2 == (Object)null))
					{
						persistentArenaNavMeshData.Add(val2);
						persistentArenaNavMeshes.Add(NavMesh.AddNavMeshData(val2));
					}
				}
				Log.LogInfo((object)("Persistent arena NavMesh built with " + settingsCount + " agent settings and " + list.Count + " sources."));
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Could not build persistent arena NavMesh: " + ex.Message));
			}
		}

		private void ClearPersistentDomainArenas()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			foreach (NavMeshDataInstance persistentArenaNavMesh in persistentArenaNavMeshes)
			{
				NavMeshDataInstance current = persistentArenaNavMesh;
				try
				{
					((NavMeshDataInstance)(ref current)).Remove();
				}
				catch
				{
				}
			}
			persistentArenaNavMeshes.Clear();
			foreach (NavMeshData persistentArenaNavMeshDatum in persistentArenaNavMeshData)
			{
				if ((Object)(object)persistentArenaNavMeshDatum != (Object)null)
				{
					Object.Destroy((Object)(object)persistentArenaNavMeshDatum);
				}
			}
			persistentArenaNavMeshData.Clear();
			foreach (GameObject value in persistentDomainArenas.Values)
			{
				if ((Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)value);
				}
			}
			persistentDomainArenas.Clear();
			arenaRoundInstanceId = 0;
		}

		private static Vector3 GetPersistentArenaCenter(DomainKind domain)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			return (Vector3)(domain switch
			{
				DomainKind.InfiniteVoid => new Vector3(8192f, 512f, 8192f), 
				DomainKind.MalevolentShrineClosed => new Vector3(8320f, 512f, 8192f), 
				DomainKind.IdleDeathGamble => new Vector3(8448f, 512f, 8192f), 
				_ => Vector3.zero, 
			});
		}

		private unsafe void ActivateClosedDomainArena()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_0032: 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_003f: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			if (!domainArenaActivated && selectedDomain != DomainKind.MalevolentShrineOpen)
			{
				domainArenaActivated = true;
				EnsurePersistentDomainArenas();
				Vector3 persistentArenaCenter = GetPersistentArenaCenter(selectedDomain);
				TeleportLocalPlayerIntoArena(domainSourceCenter, persistentArenaCenter);
				TeleportRemotePlayerRepresentationsIntoArena(domainSourceCenter, persistentArenaCenter);
				if (domainAffectsGameplay)
				{
					TeleportHostEntitiesIntoArena(domainSourceCenter, persistentArenaCenter);
				}
				domainCenter = persistentArenaCenter;
				ManualLogSource log = Log;
				string[] obj = new string[7]
				{
					"Closed domain arena activated: ",
					GetDomainName(selectedDomain),
					", source=",
					null,
					null,
					null,
					null
				};
				Vector3 val = domainSourceCenter;
				obj[3] = ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString();
				obj[4] = ", arena=";
				val = persistentArenaCenter;
				obj[5] = ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString();
				obj[6] = ".";
				log.LogInfo((object)string.Concat(obj));
			}
		}

		private unsafe void TeleportLocalPlayerIntoArena(Vector3 sourceCenter, Vector3 arenaCenter)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00ae: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
			if ((Object)(object)val == (Object)null || IsPlayerDead(val))
			{
				return;
			}
			ulong localClientId = GetLocalClientId();
			Vector3 value = ((Component)val).transform.position;
			if (domainParticipantSourcePositions.Count > 0)
			{
				if (!domainParticipantSourcePositions.TryGetValue(localClientId, out value))
				{
					return;
				}
			}
			else if (localClientId != casterClientId && !IsWithinArenaCaptureRadius(((Component)val).transform.position, sourceCenter))
			{
				return;
			}
			localPlayerReturnPosition = ((Component)val).transform.position;
			localPlayerReturnRotation = ((Component)val).transform.rotation;
			localPlayerReturnCaptured = true;
			localPlayerInDomainArena = true;
			hasLastLocalPlayerPosition = false;
			Vector3 val2 = MapPositionIntoArena(value, sourceCenter, arenaCenter);
			TeleportPlayerSafely(val, val2, ((Component)val).transform.rotation);
			ManualLogSource log = Log;
			string[] obj = new string[5] { "Local player entered domain arena; return=", null, null, null, null };
			Vector3 val3 = localPlayerReturnPosition;
			obj[1] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString();
			obj[2] = ", target=";
			val3 = val2;
			obj[3] = ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString();
			obj[4] = ".";
			log.LogInfo((object)string.Concat(obj));
		}

		private void TeleportRemotePlayerRepresentationsIntoArena(Vector3 sourceCenter, Vector3 arenaCenter)
		{
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null || domainParticipantSourcePositions.Count == 0)
			{
				return;
			}
			ulong localClientId = GetLocalClientId();
			PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)instance.localPlayerController) && !IsPlayerDead(val) && TryGetPlayerClientId(val, out var clientId) && clientId != localClientId && domainParticipantSourcePositions.TryGetValue(clientId, out var value))
				{
					Vector3 position = MapPositionIntoArena(value, sourceCenter, arenaCenter);
					((Component)val).transform.position = position;
					EnsureRemoteParticipantVisible(val);
				}
			}
		}

		private void MaintainRemoteDomainPlayerRepresentations()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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_00ee: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			if (!HasClosedBarrier() || !localPlayerInDomainArena || domainParticipantSourcePositions.Count == 0)
			{
				return;
			}
			StartOfRound instance = StartOfRound.Instance;
			if ((Object)(object)instance == (Object)null || instance.allPlayerScripts == null)
			{
				return;
			}
			Vector3 persistentArenaCenter = GetPersistentArenaCenter(selectedDomain);
			ulong localClientId = GetLocalClientId();
			PlayerControllerB[] allPlayerScripts = instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)instance.localPlayerController) && !IsPlayerDead(val) && TryGetPlayerClientId(val, out var clientId) && clientId != localClientId && domainParticipantSourcePositions.TryGetValue(clientId, out var value))
				{
					Vector3 position = ((Component)val).transform.position;
					Vector3 val2 = position - persistentArenaCenter;
					val2.y = 0f;
					if (((Vector3)(ref val2)).sqrMagnitude > 985.95996f)
					{
						Vector3 position2 = (IsWithinArenaCaptureRadius(position, domainSourceCenter) ? position : value);
						((Component)val).transform.position = MapPositionIntoArena(position2, domainSourceCenter, persistentArenaCenter);
					}
					EnsureRemoteParticipantVisible(val);
				}
			}
		}

		private static void EnsureRemoteParticipantVisible(PlayerControllerB player)
		{
			SkinnedMeshRenderer[] componentsInChildren = ((Component)player).GetComponentsInChildren<SkinnedMeshRenderer>(true);
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				if ((Object)(object)val != (Object)null)
				{
					((Renderer)val).enabled = true;
				}
			}
			object? memberValue = GetMemberValue(player, "thisPlayerModel");
			Renderer val2 = (Renderer)((memberValue is Renderer) ? memberValue : null);
			if (val2 != null)
			{
				val2.enabled = true;
			}
			object? memberValue2 = GetMemberValue(player, "thisPlayerModelLOD1");
			Renderer val3 = (Renderer)((memberValue2 is Renderer) ? memberValue2 : null);
			if (val3 != null)
			{
				val3.enabled = true;
			}
			object? memberValue3 = GetMemberValue(player, "thisPlayerModelLOD2");
			Renderer val4 = (Renderer)((memberValue3 is Renderer) ? memberValue3 : null);
			if (val4 != null)
			{
				val4.enabled = true;
			}
		}

		private void TeleportHostEntitiesIntoArena(Vector3 sourceCenter, Vector3 arenaCenter)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			arenaEnemyStates.Clear();
			arenaItemStates.Clear();
			arenaNetworkEntityStates.Clear();
			EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>();
			foreach (EnemyAI val in array)
			{
				if (!((Object)(object)val == (Object)null) && !IsEnemyDead(val) && IsWithinArenaCaptureRadius(((Component)val).transform.position, sourceCenter))
				{
					Rigidbody component = ((Component)val).GetComponent<Rigidbody>();
					arenaEnemyStates[val] = CaptureArenaEntityState(((Component)val).transform, component);
					TeleportEnemySafely(val, MapPositionIntoArena(((Component)val).transform.position, sourceCenter, arenaCenter));
				}
			}
			GrabbableObject[] array2 = Object.FindObjectsOfType<GrabbableObject>();
			foreach (GrabbableObject val2 in array2)
			{
				if (!((Object)(object)val2 == (Object)null) && !IsHeldGrabbable(val2) && IsWithinArenaCaptureRadius(((Component)val2).transform.position, sourceCenter))
				{
					Rigidbody component2 = ((Component)val2).GetComponent<Rigidbody>();
					arenaItemStates[val2] = CaptureArenaEntityState(((Component)val2).transform, component2);
					TeleportGrabbableSafely(val2, MapPositionIntoArena(((Component)val2).transform.position, sourceCenter, arenaCenter));
				}
			}
			NetworkObject[] array3 = Object.FindObjectsOfType<NetworkObject>();
			foreach (NetworkObject val3 in array3)
			{
				if (!((Object)(object)val3 == (Object)null) && val3.IsSpawned && !((Object)(object)((Component)val3).GetComponentInParent<PlayerControllerB>() != (Object)null) && !((Object)(object)((Component)val3).GetComponentInParent<EnemyAI>() != (Object)null) && !((Object)(object)((Component)val3).GetComponentInParent<GrabbableObject>() != (Object)null))
				{
					Rigidbody component3 = ((Component)val3).GetComponent<Rigidbody>();
					if (!((Object)(object)component3 == (Object)null) && !component3.isKinematic && IsWithinArenaCaptureRadius(((Component)val3).transform.position, sourceCenter) && (val3.IsOwnedByServer || val3.IsOwner))
					{
						arenaNetworkEntityStates[val3] = CaptureArenaEntityState(((Component)val3).transform, component3);
						TeleportDynamicNetworkObject(val3, MapPositionIntoArena(((Component)val3).transform.position, sourceCenter, arenaCenter));
					}
				}
			}
			Log.LogInfo((object)("Arena capture moved " + arenaEnemyStates.Count + " enemies, " + arenaItemStates.Count + " loose items, and " + arenaNetworkEntityStates.Count + " dynamic network entities."));
		}

		private void RestoreEntitiesFromDomainArena()
		{
			//IL_002d: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			if (localPlayerReturnCaptured)
			{
				PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
				hasLastLocalPlayerPosition = false;
				if ((Object)(object)val != (Object)null)
				{
					TeleportPlayerSafely(val, localPlayerReturnPosition, localPlayerReturnRotation);
				}
			}
			if (arenaEnemyStates.Count > 0 || arenaItemStates.Count > 0 || arenaNetworkEntityStates.Count > 0)
			{
				foreach (KeyValuePair<EnemyAI, ArenaEntityState> arenaEnemyState in arenaEnemyStates)
				{
					if (!((Object)(object)arenaEnemyState.Key == (Object)null))
					{
						TeleportEnemySafely(arenaEnemyState.Key, arenaEnemyState.Value.Position);
						((Component)arenaEnemyState.Key).transform.rotation = arenaEnemyState.Value.Rotation;
						RestoreRigidbodyState(((Component)arenaEnemyState.Key).GetComponent<Rigidbody>(), arenaEnemyState.Value);
					}
				}
				foreach (KeyValuePair<GrabbableObject, ArenaEntityState> arenaItemState in arenaItemStates)
				{
					if (!((Object)(object)arenaItemState.Key == (Object)null) && !IsHeldGrabbable(arenaItemState.Key))
					{
						TeleportGrabbableSafely(arenaItemState.Key, arenaItemState.Value.Position);
						((Component)arenaItemState.Key).transform.rotation = arenaItemState.Value.Rotation;
						RestoreRigidbodyState(((Component)arenaItemState.Key).GetComponent<Rigidbody>(), arenaItemState.Value);
					}
				}
				foreach (KeyValuePair<NetworkObject, ArenaEntityState> arenaNetworkEntityState in arenaNetworkEntityStates)
				{
					if (!((Object)(object)arenaNetworkEntityState.Key == (Object)null))
					{
						TeleportDynamicNetworkObject(arenaNetworkEntityState.Key, arenaNetworkEntityState.Value.Position);
						((Component)arenaNetworkEntityState.Key).transform.rotation = arenaNetworkEntityState.Value.Rotation;
						RestoreRigidbodyState(((Component)arenaNetworkEntityState.Key).GetComponent<Rigidbody>(), arenaNetworkEntityState.Value);
					}
				}
			}
			arenaEnemyStates.Clear();
			arenaItemStates.Clear();
			arenaNetworkEntityStates.Clear();
			localPlayerReturnCaptured = false;
			localPlayerInDomainArena = false;
		}

		private static ArenaEntityState CaptureArenaEntityState(Transform transformToCapture, Rigidbody? body)
		{
			//IL_0007: 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_0013: 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_002f: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			return new ArenaEntityState
			{
				Position = transformToCapture.position,
				Rotation = transformToCapture.rotation,
				Velocity = (((Object)(object)body != (Object)null) ? body.velocity : Vector3.zero),
				AngularVelocity = (((Object)(object)body != (Object)null) ? body.angularVelocity : Vector3.zero)
			};
		}

		private static void RestoreRigidbodyState(Rigidbody? body, ArenaEntityState state)
		{
			//IL_000c: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)body == (Object)null))
			{
				body.position = state.Position;
				body.rotation = state.Rotation;
				body.velocity = state.Velocity;
				body.angularVelocity = state.AngularVelocity;
			}
		}

		private static bool IsWithinArenaCaptureRadius(Vector3 position, Vector3 center)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position - center;
			val.y = 0f;
			return ((Vector3)(ref val)).sqrMagnitude <= 676f;
		}

		private static Vector3 MapPositionIntoArena(Vector3 position, Vector3 sourceCenter, Vector3 arenaCenter)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: 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_001a: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position - sourceCenter;
			val.y = 0f;
			val *= 0.72f;
			float num = 19.4f;
			if (((Vector3)(ref val)).magnitude > num)
			{
				val = ((Vector3)(ref val)).normalized * num;
			}
			return arenaCenter + val + Vector3.up * 0.25f;
		}

		private void TeleportPlayerSafely(PlayerControllerB player, Vector3 position, Quaternion rotation)
		{
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			CharacterController component = ((Component)player).GetComponent<CharacterController>();
			bool flag = (Object)(object)component == (Object)null || ((Collider)component).enabled;
			bool flag2 = false;
			MethodInfo[] methods = ((object)player).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (MethodInfo methodInfo in methods)
			{
				if (methodInfo.Name != "TeleportPlayer")
				{
					continue;
				}
				ParameterInfo[] parameters = methodInfo.GetParameters();
				if (parameters.Length == 0 || parameters[0].ParameterType != typeof(Vector3))
				{
					continue;
				}
				object[] array = new object[parameters.Length];
				for (int j = 0; j < parameters.Length; j++)
				{
					Type parameterType = parameters[j].ParameterType;
					if (parameterType == typeof(Vector3))
					{
						array[j] = position;
					}
					else if (parameterType == typeof(Quaternion))
					{
						array[j] = rotation;
					}
					else if (parameterType == typeof(float))
					{
						array[j] = ((Quaternion)(ref rotation)).eulerAngles.y;
					}
					else if (parameterType == typeof(bool))
					{
						array[j] = j == 1;
					}
					else if (parameters[j].HasDefaultValue)
					{
						array[j] = parameters[j].DefaultValue;
					}
					else
					{
						array[j] = (parameterType.IsValueType ? Activator.CreateInstance(parameterType) : null);
					}
				}
				try
				{
					methodInfo.Invoke(player, array);
					flag2 = true;
				}
				catch
				{
					continue;
				}
				break;
			}
			if ((Object)(object)component != (Object)null && ((Collider)component).enabled)
			{
				((Collider)component).enabled = false;
			}
			((Component)player).transform.position = position;
			((Component)player).transform.rotation = rotation;
			if ((Object)(object)component != (Object)null && flag)
			{
				((Collider)component).enabled = true;
			}
			RestorePlayerMovementState(player, flag);
			((MonoBehaviour)this).StartCoroutine(EnsurePlayerMovementAfterTeleport(player, flag));
			if (!flag2)
			{
				Log.LogWarning((object)"TeleportPlayer method was unavailable; used transform fallback.");
			}
		}

		private IEnumerator EnsurePlayerMovementAfterTeleport(PlayerControllerB player, bool controllerShouldBeEnabled)
		{
			yield return null;
			RestorePlayerMovementState(player, controllerShouldBeEnabled);
			yield return (object)new WaitForSeconds(0.2f);
			RestorePlayerMovementState(player, controllerShouldBeEnabled);
		}

		private static void RestorePlayerMovementState(PlayerControllerB player, bool controllerShouldBeEnabled)
		{
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)player == (Object)null) && !IsPlayerDead(player))
			{
				CharacterController component = ((Component)player).GetComponent<CharacterController>();
				if ((Object)(object)component != (Object)null && controllerShouldBeEnabled)
				{
					((Collider)component).enabled = true;
				}
				TrySetMemberValue(player, "disableMoveInput", false);
				TrySetMemberValue(player, "disableLookInput", false);
				TrySetMemberValue(player, "inSpecialInteractAnimation", false);
				TrySetMemberValue(player, "isClimbingLadder", false);
				TrySetMemberValue(player, "isGrabbingObjectAnimation", false);
				TrySetMemberValue(player, "externalForces", Vector3.zero);
				TrySetMemberValue(player, "averageVelocity", 0f);
				TrySetMemberValue(player, "velocityLastFrame", Vector3.zero);
			}
		}

		private static void TeleportEnemySafely(EnemyAI enemy, Vector3 position)
		{
			//IL_0006: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			((Component)enemy).transform.position = position;
			SetMemberValue(enemy, "serverPosition", position);
			Rigidbody component = ((Component)enemy).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.position = position;
				component.velocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
			}
			object? memberValue = GetMemberValue(enemy, "agent");
			NavMeshAgent val = (NavMeshAgent)((memberValue is NavMeshAgent) ? memberValue : null);
			if (val == null || !((Behaviour)val).enabled)
			{
				return;
			}
			try
			{
				if (!val.Warp(position))
				{
					((Component)enemy).transform.position = position;
				}
				val.velocity = Vector3.zero;
			}
			catch
			{
				((Component)enemy).transform.position = position;
			}
		}

		private static void TeleportGrabbableSafely(GrabbableObject item, Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			((Component)item).transform.position = position;
			Rigidbody component = ((Component)item).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.position = position;
				component.velocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
			}
			SetMemberValue(item, "targetFloorPosition", position);
			SetMemberValue(item, "startFallingPosition", position);
			SetMemberValue(item, "fallTime", 0f);
		}

		private static void TeleportDynamicNetworkObject(NetworkObject networkObject, Vector3 position)
		{
			//IL_0006: 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)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			((Component)networkObject).transform.position = position;
			Rigidbody component = ((Component)networkObject).GetComponent<Rigidbody>();
			if (!((Object)(object)component == (Object)null))
			{
				component.position = position;
				component.velocity = Vector3.zero;
				component.angularVelocity = Vector3.zero;
			}
		}

		private static bool IsHeldGrabbable(GrabbableObject item)
		{
			object memberValue = GetMemberValue(item, "isHeld");
			object memberValue2 = GetMemberValue(item, "isHeldByEnemy");
			object memberValue3 = GetMemberValue(item, "isPocketed");
			bool flag = default(bool);
			int num;
			if (memberValue is bool)
			{
				flag = (bool)memberValue;
				num = 1;
			}
			else
			{
				num = 0;
			}
			if (((uint)num & (flag ? 1u : 0u)) == 0)
			{
				bool flag2 = default(bool);
				int num2;
				if (memberValue2 is bool)
				{
					flag2 = (bool)memberValue2;
					num2 = 1;
				}
				else
				{
					num2 = 0;
				}
				if (((uint)num2 & (flag2 ? 1u : 0u)) == 0)
				{
					bool flag3 = default(bool);
					int num3;
					if (memberValue3 is bool)
					{
						flag3 = (bool)memberValue3;
						num3 = 1;
					}
					else
					{
						num3 = 0;
					}
					return (byte)((uint)num3 & (flag3 ? 1u : 0u)) != 0;
				}
			}
			return true;
		}

		private static bool IsEnemyDead(EnemyAI enemy)
		{
			object memberValue = GetMemberValue(enemy, "isEnemyDead");
			bool flag = default(bool);
			int num;
			if (memberValue is bool)
			{
				flag = (bool)memberValue;
				num = 1;
			}
			else
			{
				num = 0;
			}
			return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
		}

		private AudioClip CreateSlotRollClip()
		{
			int num = Mathf.CeilToInt(31752.002f);
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / 44100f;
				float num3 = Mathf.Clamp01(1f - num2 / 0.72f);
				float num4 = Mathf.Sin(MathF.PI * 2f * (920f + Mathf.Floor(num2 * 18f) * 95f) * num2);
				float num5 = Mathf.Sign(Mathf.Sin(MathF.PI * 36f * num2));
				array[i] = (num4 * 0.16f + num5 * 0.045f) * num3;
			}
			AudioClip obj = AudioClip.Create("Idle Death Gamble Slot Roll", num, 1, 44100, false);
			obj.SetData(array, 0);
			return obj;
		}

		private void PlaySlotRollSound(Vector3 center)
		{
			//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_001f: 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_0085: Expected O, but got Unknown
			if (!((Object)(object)slotRollClip == (Object)null))
			{
				GameObject val = new GameObject("Idle Death Gamble Slot Sound");
				val.transform.position = center;
				AudioSource obj = val.AddComponent<AudioSource>();
				obj.clip = slotRollClip;
				obj.volume = 0.8f;
				obj.spatialBlend = 0.65f;
				obj.minDistance = 6f;
				obj.maxDistance = 45f;
				obj.rolloffMode = (AudioRolloffMode)1;
				obj.Play();
				Object.Destroy((Object)val, slotRollClip.length + 0.2f);
			}
		}

		private void StartJackpotSound()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			StopJackpotSound();
			AudioClip val = jackpotSoundClip;
			if ((Object)(object)val == (Object)null && domainSounds.TryGetValue(DomainKind.IdleDeathGamble, out AudioClip value))
			{
				val = value;
			}
			if ((Object)(object)val == (Object)null)
			{
				Log.LogWarning((object)("Jackpot sound is not loaded yet: " + GetJackpotSoundFileName()));
				return;
			}
			jackpotSoundObject = new GameObject("Idle Death Gamble Jackpot Sound");
			jackpotSoundObject.transform.position = domainCenter;
			jackpotSoundSource = jackpotSoundObject.AddComponent<AudioSource>();
			jackpotSoundSource.clip = val;
			jackpotSoundSource.volume = 1f;
			jackpotSoundSource.spatialBlend = 0.18f;
			jackpotSoundSource.minDistance = 14f;
			jackpotSoundSource.maxDistance = 110f;
			jackpotSoundSource.rolloffMode = (AudioRolloffMode)1;
			jackpotSoundSource.loop = true;
			jackpotSoundSource.Play();
			Object.Destroy((Object)(object)jackpotSoundObject, 100.5f);
		}

		private void StopJackpotSound()
		{
			if ((Object)(object)jackpotSoundSource != (Object)null)
			{
				jackpotSoundSource.Stop();
				jackpotSoundSource = null;
			}
			if ((Object)(object)jackpotSoundObject != (Object)null)
			{
				Object.Destroy((Object)(object)jackpotSoundObject);
				jackpotSoundObject = null;
			}
		}

		private void LoadVisualTextures()
		{
			infiniteVoidGalaxyTexture = LoadTextureFromFile("infinite_void_panorama_v2.png") ?? LoadTextureFromFile("infinite_void_galaxy.png") ?? LoadTextureFromFile("infinite_void_galaxy.jpg") ?? CreateInfiniteVoidGalaxyTexture();
			infiniteVoidBlackHoleTexture = CreateInfiniteVoidBlackHoleTexture();
			infiniteVoidInkTexture = CreateInfiniteVoidInkTexture();
			infiniteVoidStreakTexture = CreateInfiniteVoidStreakTexture();
			malevolentShrineOpenBarrierTexture = CreateMalevolentShrineBarrierTexture(open: true);
			malevolentShrineClosedBarrierTexture = LoadTextureFromFile("malevolent_shrine_interior_v2.png") ?? CreateMalevolentShrineBarrierTexture(open: false);
			idleDeathGambleBarrierTexture = LoadTextureFromFile("idle_death_gamble_interior_v2.png") ?? CreateIdleDeathGambleBarrierTexture();
			malevolentShrineGroundSealTexture = LoadTextureFromFile("malevolent_shrine_ground_seal_v2.png");
			malevolentShrineSlashTexture = LoadTextureFromFile("malevolent_shrine_slash_v2.png");
			malevolentShrineSlashCoreTexture = CreateHighContrastSlashTexture();
			softParticleTexture = CreateSoftParticleTexture();
		}

		private Texture2D? LoadTextureFromFile(string fileName)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			string text = Path.Combine(textureDirectory, fileName);
			if (!File.Exists(text))
			{
				Log.LogWarning((object)("Visual texture not found: " + text));
				return null;
			}
			try
			{
				Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
				if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text)))
				{
					Log.LogWarning((object)("Could not decode visual texture: " + text));
					return null;
				}
				((Texture)val).wrapMode = (TextureWrapMode)0;
				((Texture)val).filterMode = (FilterMode)1;
				((Object)val).name = Path.GetFileNameWithoutExtension(fileName);
				Log.LogInfo((object)("Loaded visual texture: " + fileName));
				return val;
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Could not load visual texture " + text + ": " + ex.Message));
				return null;
			}
		}

		private static Texture2D CreateSoftParticleTexture()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					float num = ((float)j + 0.5f) / 64f * 2f - 1f;
					float num2 = ((float)i + 0.5f) / 64f * 2f - 1f;
					float num3 = Mathf.Sqrt(num * num + num2 * num2);
					float num4 = Mathf.Pow(Mathf.Clamp01(1f - num3), 2.2f);
					array[i * 64 + j] = new Color(1f, 1f, 1f, num4);
				}
			}
			val.SetPixels(array);
			val.Apply(false, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			((Object)val).name = "Domain Soft Particle Texture";
			return val;
		}

		private static Texture2D CreateHighContrastSlashTexture()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_00ea: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(512, 128, (TextureFormat)4, false);
			Color[] array = (Color[])(object)new Color[65536];
			Color val2 = default(Color);
			for (int i = 0; i < 128; i++)
			{
				float num = (float)i / 127f;
				for (int j = 0; j < 512; j++)
				{
					float num2 = (float)j / 511f;
					float num3 = Mathf.Abs(num2 * 2f - 1f);
					float num4 = Mathf.Pow(Mathf.Clamp01(1f - num3), 0.34f);
					float num5 = 0.5f + Mathf.Sin(num2 * 41f) * 0.012f + Mathf.Sin(num2 * 113f) * 0.006f;
					float num6 = (0.052f + Mathf.Sin(num2 * 29f) * 0.008f) * num4;
					float num7 = Mathf.Abs(num - num5);
					float num8 = num6 * 2.25f;
					if (num8 <= 0.001f || num7 > num8)
					{
						array[i * 512 + j] = Color.clear;
						continue;
					}
					float num9 = Mathf.Clamp01(1f - num7 / num8) * num4;
					if (num7 < num6 * 0.3f)
					{
						((Color)(ref val2))..ctor(0.002f, 0f, 0f, 1f);
					}
					else if (num7 < num6 * 0.58f)
					{
						((Color)(ref val2))..ctor(1f, 0.92f, 0.78f, 1f);
					}
					else if (num7 < num6)
					{
						((Color)(ref val2))..ctor(0.95f, 0.025f, 0.008f, 1f);
					}
					else
					{
						((Color)(ref val2))..ctor(0.62f, 0f, 0f, num9 * 0.72f);
					}
					val2.a *= Mathf.Clamp01(num9 * 1.5f);
					array[i * 512 + j] = val2;
				}
			}
			val.SetPixels(array);
			val.Apply(false, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			((Object)val).name = "Malevolent Shrine High Contrast Slash";
			return val;
		}

		private static Texture2D CreateMalevolentShrineBarrierTexture(bool open)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0048: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			int num = 512;
			int num2 = 256;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false);
			Color val2 = (open ? new Color(0.05f, 0f, 0f, 1f) : new Color(0.015f, 0f, 0f, 1f));
			Color val3 = (open ? new Color(0.95f, 0.04f, 0.015f, 1f) : new Color(0.52f, 0f, 0f, 1f));
			Color val4 = (open ? new Color(1f, 0.28f, 0.04f, 1f) : new Color(0.9f, 0.02f, 0.01f, 1f));
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)(num2 - 1);
				for (int j = 0; j < num; j++)
				{
					float num4 = (float)j / (float)(num - 1);
					float num5 = Mathf.Sin((num4 * 11f + num3 * 2.5f) * MathF.PI * 2f) * 0.5f + 0.5f;
					float num6 = Mathf.Abs(Mathf.Sin((num4 * 5.7f + num3 * 8.4f) * MathF.PI));
					float num7 = Mathf.Abs(Mathf.Sin((num4 * -7.5f + num3 * 9.2f) * MathF.PI));
					float num8 = ((num6 > 0.94f || num7 > 0.955f) ? 1f : 0f);
					float num9 = ((Mathf.Abs(Mathf.Sin(num4 * MathF.PI * 34f)) < 0.035f && num3 > 0.08f && num3 < 0.92f) ? 1f : 0f);
					Color val5 = Color.Lerp(val2, val3, Mathf.Clamp01(num5 * 0.28f + num8 * 0.78f + num9 * 0.26f));
					if (num8 > 0f)
					{
						val5 = Color.Lerp(val5, val4, 0.72f);
					}
					val.SetPixel(j, i, val5);
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)0;
			((Texture)val).filterMode = (FilterMode)1;
			val.Apply(false, false);
			((Object)val).name = (open ? "Malevolent Shrine Open Barrier Texture" : "Malevolent Shrine Closed Barrier Texture");
			return val;
		}

		private static Texture2D CreateInfiniteVoidGalaxyTexture()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ff: 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_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0330: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			int num = 1024;
			int num2 = 512;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.48f);
			Vector2 val3 = default(Vector2);
			Color val5 = default(Color);
			Color val6 = default(Color);
			Color val7 = default(Color);
			Color val8 = default(Color);
			Color val9 = default(Color);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)(num2 - 1);
				for (int j = 0; j < num; j++)
				{
					float num4 = (float)j / (float)(num - 1);
					((Vector2)(ref val3))..ctor((num4 - val2.x) * 1.55f, (num3 - val2.y) * 1.08f);
					float magnitude = ((Vector2)(ref val3)).magnitude;
					float num5 = Mathf.Atan2(val3.y, val3.x);
					float num6 = Mathf.Exp(0f - Mathf.Pow((magnitude - 0.245f) * 28f, 2f));
					float num7 = Mathf.Exp(0f - Mathf.Pow((magnitude - 0.34f) * 19f, 2f));
					float num8 = Mathf.Exp(0f - Mathf.Pow((val3.y + Mathf.Sin(num5 * 2.6f) * 0.035f) * 14f, 2f)) * Mathf.SmoothStep(0.11f, 0.33f, magnitude) * Mathf.SmoothStep(0.63f, 0.36f, magnitude);
					float num9 = Mathf.Sin((num4 * 3.7f + num3 * 2.1f) * MathF.PI * 2f) * 0.5f + 0.5f;
					float num10 = Mathf.Sin((num4 * -5.1f + num3 * 4.4f + Mathf.Sin(num4 * 8f) * 0.12f) * MathF.PI) * 0.5f + 0.5f;
					float num11 = Mathf.Pow(Mathf.Clamp01(num9 * 0.62f + num10 * 0.55f - magnitude * 0.28f), 2.2f);
					float num12 = Mathf.Repeat(Mathf.Sin(((float)j * 12.9898f + (float)i * 78.233f) * 0.013f) * 43758.547f, 1f);
					float num13 = ((num12 > 0.993f) ? 1f : ((num12 > 0.987f) ? 0.45f : 0f));
					Color val4 = new Color(0.005f, 0.006f, 0.025f, 1f);
					((Color)(ref val5))..ctor(0.02f, 0.12f, 0.38f, 1f);
					((Color)(ref val6))..ctor(0.18f, 0.75f, 1f, 1f);
					((Color)(ref val7))..ctor(0.5f, 0.08f, 0.92f, 1f);
					((Color)(ref val8))..ctor(1f, 0.18f, 0.95f, 1f);
					((Color)(ref val9))..ctor(0.92f, 0.98f, 1f, 1f);
					Color val10 = Color.Lerp(val4, val5, Mathf.Clamp01(num11 * 0.9f));
					val10 = Color.Lerp(val10, val7, Mathf.Clamp01(num11 * num10 * 0.8f));
					val10 = Color.Lerp(val10, val8, Mathf.Clamp01(num11 * num9 * 0.38f));
					val10 = Color.Lerp(val10, val6, Mathf.Clamp01(num7 * 0.78f + num8 * 0.4f));
					val10 = Color.Lerp(val10, val9, Mathf.Clamp01(num6 + num13));
					if (magnitude < 0.165f)
					{
						((Color)(ref val10))..ctor(0f, 0f, 0.002f, 1f);
					}
					val.SetPixel(j, i, val10);
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)0;
			((Texture)val).filterMode = (FilterMode)1;
			val.Apply(false, false);
			((Object)val).name = "Procedural Infinite Void Galaxy";
			return val;
		}

		private static Texture2D CreateInfiniteVoidBlackHoleTexture()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0043: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			int num = 512;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			Color val4 = default(Color);
			Color val6 = default(Color);
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / (float)(num - 1);
				for (int j = 0; j < num; j++)
				{
					Vector2 val3 = new Vector2((float)j / (float)(num - 1), num2) - val2;
					float magnitude = ((Vector2)(ref val3)).magnitude;
					float num3 = Mathf.Atan2(val3.y, val3.x);
					float num4 = Mathf.Exp(0f - Mathf.Pow((magnitude - 0.315f) * 18f, 2f));
					float num5 = Mathf.Exp(0f - Mathf.Pow((magnitude - 0.39f) * 13f, 2f));
					float num6 = Mathf.Sin(num3 * 3.2f + magnitude * 34f) * 0.5f + 0.5f;
					float num7 = Mathf.Exp(0f - Mathf.Pow((val3.y + Mathf.Sin(num3 * 2f) * 0.018f) * 12f, 2f)) * Mathf.SmoothStep(0.1f, 0.46f, magnitude) * Mathf.SmoothStep(0.55f, 0.32f, magnitude);
					float num8 = Mathf.Clamp01(num4 * 1.1f + num5 * 0.38f + num7 * 0.72f);
					((Color)(ref val4))..ctor(0.95f, 1f, 1f, num8);
					Color val5 = new Color(0.18f, 0.44f, 1f, num8);
					((Color)(ref val6))..ctor(0.65f, 0.24f, 1f, num8);
					Color val7 = Color.Lerp(Color.Lerp(val5, val6, num6), val4, num4);
					if (magnitude < 0.245f)
					{
						((Color)(ref val7))..ctor(0f, 0f, 0f, 1f);
					}
					val.SetPixel(j, i, val7);
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			val.Apply(false, false);
			((Object)val).name = "Infinite Void Event Horizon Texture";
			return val;
		}

		private static Texture2D CreateInfiniteVoidInkTexture()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			int num = 512;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / (float)(num - 1);
				for (int j = 0; j < num; j++)
				{
					float num3 = (float)j / (float)(num - 1);
					float num4 = Mathf.Max(Mathf.Abs(num3 - 0.5f), Mathf.Abs(num2 - 0.5f)) * 2f;
					float num5 = 0f;
					for (int k = 0; k < 13; k++)
					{
						float num6 = Mathf.Repeat(Mathf.Sin((float)k * 12.9898f) * 43758.547f, 1f);
						float num7 = Mathf.Repeat(Mathf.Sin((float)k * 78.233f) * 24634.635f, 1f);
						float num8 = 0.035f + (float)(k % 5) * 0.018f;
						float num9 = Vector2.Distance(new Vector2(num3, num2), new Vector2(num6, num7));
						num5 += Mathf.SmoothStep(num8, 0f, num9);
					}
					float num10 = ((Mathf.Abs(Mathf.Sin((num3 * 8f + num2 * 5.2f) * MathF.PI)) < 0.09f) ? 0.22f : 0f);
					float num11 = Mathf.Clamp01(Mathf.SmoothStep(0.52f, 0.92f, num4) * 0.86f + num5 * 0.55f + num10);
					val.SetPixel(j, i, new Color(1f, 1f, 1f, num11));
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)0;
			((Texture)val).filterMode = (FilterMode)1;
			val.Apply(false, false);
			((Object)val).name = "Infinite Void Ink Splatter Texture";
			return val;
		}

		private static Texture2D CreateInfiniteVoidStreakTexture()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			int num = 1024;
			int num2 = 256;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false);
			Color val2 = default(Color);
			Color val4 = default(Color);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)(num2 - 1);
				for (int j = 0; j < num; j++)
				{
					float num4 = (float)j / (float)(num - 1);
					float num5 = 0f;
					for (int k = 0; k < 18; k++)
					{
						float num6 = Mathf.Repeat(Mathf.Sin((float)k * 41.17f) * 9283.13f, 1f);
						float num7 = 0.0035f + (float)(k % 4) * 0.0025f;
						float num8 = ((Mathf.Sin((num4 * (10f + (float)k) + (float)k * 0.37f) * MathF.PI * 2f) > -0.2f) ? 1f : 0.15f);
						num5 += Mathf.SmoothStep(num7 * 6f, 0f, Mathf.Abs(num3 - num6)) * num8;
					}
					float num9 = Mathf.Clamp01(num5);
					((Color)(ref val2))..ctor(1f, 0.06f, 0.9f, num9);
					Color val3 = new Color(0.1f, 0.15f, 1f, num9);
					((Color)(ref val4))..ctor(1f, 0.92f, 1f, num9);
					Color val5 = Color.Lerp(Color.Lerp(val3, val2, Mathf.Sin(num4 * MathF.PI * 2f) * 0.5f + 0.5f), val4, Mathf.Clamp01(num5 - 0.6f));
					val.SetPixel(j, i, val5);
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)0;
			((Texture)val).filterMode = (FilterMode)1;
			val.Apply(false, false);
			((Object)val).name = "Infinite Void Warp Streak Texture";
			return val;
		}

		private static Texture2D CreateIdleDeathGambleBarrierTexture()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_00c9: 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_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			int num = 512;
			int num2 = 256;
			Texture2D val = new Texture2D(num, num2, (TextureFormat)4, false);
			Color val3 = default(Color);
			Color val4 = default(Color);
			for (int i = 0; i < num2; i++)
			{
				float num3 = (float)i / (float)(num2 - 1);
				for (int j = 0; j < num; j++)
				{
					float num4 = (float)j / (float)(num - 1);
					float num5 = ((Mathf.Abs(Mathf.Sin(num4 * MathF.PI * 42f)) < 0.018f) ? 1f : 0f);
					float num6 = Mathf.Pow(Mathf.Sin(num3 * MathF.PI), 0.42f);
					float num7 = ((Mathf.Abs(Mathf.Sin((num4 * 7f + num3 * 3f) * MathF.PI * 2f)) < 0.055f) ? 0.08f : 0f);
					Color val2 = new Color(1f, 1f, 1f, 1f);
					((Color)(ref val3))..ctor(1f, 0.94f, 0.66f, 1f);
					((Color)(ref val4))..ctor(0.72f, 1f, 1f, 1f);
					Color val5 = Color.Lerp(val2, val3, num6 * 0.22f);
					val5 = Color.Lerp(val5, val4, num5 * 0.16f + num7);
					val.SetPixel(j, i, val5);
				}
			}
			((Texture)val).wrapMode = (TextureWrapMode)0;
			((Texture)val).filterMode = (FilterMode)1;
			val.Apply(false, false);
			((Object)val).name = "Idle Death Gamble White Barrier Texture";
			return val;
		}

		private IEnumerator LoadDomainSounds()
		{
			foreach (DomainKind value in Enum.GetValues(typeof(DomainKind)))
			{
				yield return LoadDomainSound(value);
			}
		}

		private IEnumerator LoadJackpotSound()
		{
			string path = Path.Combine(soundDirectory, GetJackpotSoundFileName());
			if (!File.Exists(path))
			{
				Log.LogWarning((object)("Jackpot sound not found: " + path));
				yield break;
			}
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, (AudioType)13);
			try
			{
				yield return request.SendWebRequest();
				if ((int)request.result != 1)
				{
					Log.LogWarning((object)("Could not load jackpot sound " + path + ": " + request.error));
					yield break;
				}
				jackpotSoundClip = DownloadHandlerAudioClip.GetContent(request);
				if ((Object)(object)jackpotSoundClip != (Object)null)
				{
					((Object)jackpotSoundClip).name = "Idle Death Gamble Jackpot Sound";
					Log.LogInfo((object)("Loaded jackpot sound: " + GetJackpotSoundFileName()));
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		private IEnumerator LoadDomainSound(DomainKind domain)
		{
			string path = Path.Combine(soundDirectory, GetSoundFileName(domain));
			if (!File.Exists(path))
			{
				Log.LogWarning((object)("Domain sound not found: " + path));
				yield break;
			}
			UnityWebRequest request = UnityWebReque