Decompiled source of Aerolt v4.1.1

Aerolt.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using Aerolt.Buttons;
using Aerolt.Classes;
using Aerolt.Enums;
using Aerolt.Helpers;
using Aerolt.Managers;
using Aerolt.Messages;
using Aerolt.Overrides;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using HarmonyLib;
using JetBrains.Annotations;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using RiskOfOptions;
using RiskOfOptions.Components.Panel;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Networking;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Serialization;
using UnityEngine.UI;
using Zio;
using ZioConfigFile;
using ZioRiskOfOptions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Aerolt")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+930c61a72c9d7d8ffb4be5d20d97e9914368f246")]
[assembly: AssemblyProduct("Aerolt")]
[assembly: AssemblyTitle("Aerolt")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Aerolt
{
	[BepInPlugin("com.Lodington.Aerolt", "Aerolt", "4.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Load : BaseUnityPlugin
	{
		public class AeroltHudLoader : MonoBehaviour
		{
			public HUD hud;

			public void SpawnHud()
			{
				if (!Object.op_Implicit((Object)(object)hud.cameraRigController))
				{
					return;
				}
				NetworkUser viewer = hud.cameraRigController.viewer;
				if (!AeroltUIs.ContainsKey(viewer))
				{
					if (Object.op_Implicit((Object)(object)_settingsUI) && _settingsUI.activeSelf)
					{
						_settingsUI.SetActive(false);
					}
					TempViewer = viewer;
					TempHud = hud;
					GameObject val = Object.Instantiate<GameObject>(Co);
					val.GetComponent<MPEventSystemProvider>().eventSystem = hud.eventSystemProvider.eventSystem;
					TempViewer = null;
					TempHud = null;
					AeroltUIs.Add(viewer, val);
					Tools.Log(LogLevel.Information, "Created UI");
				}
			}
		}

		public const string Name = "Aerolt";

		public const string Guid = "com.Lodington.Aerolt";

		public const string Version = "4.1.0";

		public static ManualLogSource Log;

		public static GameObject Co;

		public static AssetBundle Assets;

		public static Load Instance = null;

		public static Dictionary<ButtonNames, ZioConfigEntry<KeyboardShortcut>> KeyBinds = new Dictionary<ButtonNames, ZioConfigEntry<KeyboardShortcut>>();

		public static Dictionary<NetworkUser, GameObject> AeroltUIs = new Dictionary<NetworkUser, GameObject>();

		private static GameObject _settingsUI;

		public static ZioConfigFile ConfigFile;

		public static NetworkUser TempViewer;

		public static HUD TempHud;

		public static string Path;

		public void Awake()
		{
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Path = System.IO.Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			Assets = AssetBundle.LoadFromFile(System.IO.Path.Combine(Path, "aeroltbundle"));
			Tools.Log(LogLevel.Information, "Loaded AssetBundle");
			Co = Assets.LoadAsset<GameObject>("PlayerCanvas");
			Assets.LoadAsset<GameObject>("AeroltUI");
			Tools.Log(LogLevel.Information, Tools.SendCount());
			NetworkManager.Initialize();
		}

		public void Start()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(GameLoad));
			HUD.shouldHudDisplay += new ShouldHudDisplayDelegate(CreateHud);
		}

		public void OnGUI()
		{
			if (Object.op_Implicit((Object)(object)Esp.Instance))
			{
				Esp.Draw();
			}
		}

		public static bool GetKeyPressed(ZioConfigEntry<KeyboardShortcut> entry)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: 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)
			KeyboardShortcut value = entry.Value;
			foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers)
			{
				if (!Input.GetKey(modifier))
				{
					return false;
				}
			}
			value = entry.Value;
			return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey);
		}

		private void GameLoad()
		{
			//IL_000b: 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_001c: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			ConfigFile = new ZioConfigFile(RoR2Application.cloudStorage, UPath.op_Implicit("/Aerolt/Settings.cfg"), true, (BepInPlugin)null);
			CreateKeyBindSettings();
			Colors.InitColors();
			Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			new PatchClassProcessor(val, typeof(Hooks)).Patch();
		}

		private void CreateKeyBindSettings()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			KeyBinds.Add(ButtonNames.OpenMenu, ConfigFile.Bind<KeyboardShortcut>("Keybinds", "OpenMenu", new KeyboardShortcut((KeyCode)282, Array.Empty<KeyCode>()), (ConfigDescription)null));
			if (Chainloader.PluginInfos.ContainsKey("bubbet.zioriskofoptions"))
			{
				MakeRiskOfOptions();
			}
		}

		private void MakeRiskOfOptions()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			foreach (ZioConfigEntry<KeyboardShortcut> value in KeyBinds.Values)
			{
				ModSettingsManager.AddOption((BaseOption)new ZioKeyBindOption(value));
			}
			ModSettingsManager.SetModIcon(Assets.LoadAsset<Sprite>("NewLogo"));
		}

		public static void CreateHud(HUD hud, ref bool shoulddisplay)
		{
			if (Object.op_Implicit((Object)(object)hud.cameraRigController) && !Object.op_Implicit((Object)(object)((Component)hud).gameObject.GetComponent<AeroltHudLoader>()))
			{
				NetworkUser viewer = hud.cameraRigController.viewer;
				if (!AeroltUIs.ContainsKey(viewer))
				{
					AeroltHudLoader aeroltHudLoader = ((Component)hud).gameObject.AddComponent<AeroltHudLoader>();
					aeroltHudLoader.hud = hud;
					((MonoBehaviour)aeroltHudLoader).Invoke("SpawnHud", 3f);
				}
			}
		}
	}
}
namespace Aerolt.Overrides
{
	[HarmonyPatch]
	public class Hooks
	{
	}
	public class IconSwap : MonoBehaviour
	{
		public Image discord;

		public Sprite imageToSwapTo;

		public void Awake()
		{
			SwapThisImage();
		}

		public void SwapThisImage()
		{
			discord.sprite = imageToSwapTo;
		}
	}
}
namespace Aerolt.Messages
{
	public class BodyStatMessage : AeroltMessageBase
	{
		private string fieldName;

		private CharacterBody TargetBody;

		private float value;

		public BodyStatMessage()
		{
		}

		public BodyStatMessage(CharacterBody targetBody, string fieldName, float result)
		{
			this.fieldName = fieldName;
			TargetBody = targetBody;
			value = result;
		}

		public override void Handle()
		{
			base.Handle();
			FieldInfo field = typeof(CharacterBody).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public);
			field.SetValue(TargetBody, value);
			TargetBody.statsDirty = true;
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				TargetBody = val.GetComponent<CharacterBody>();
			}
			fieldName = reader.ReadString();
			value = reader.ReadSingle();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)TargetBody).netId);
			writer.Write(fieldName);
			writer.Write(value);
		}
	}
	public class CurrencyMessage : AeroltMessageBase
	{
		private CurrencyType _type;

		private uint amount;

		private CharacterMaster master;

		public CurrencyMessage()
		{
		}

		public CurrencyMessage(CharacterMaster master, CurrencyType type, uint amount)
		{
			_type = type;
			this.amount = amount;
			this.master = master;
		}

		public override void Handle()
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			switch (_type)
			{
			case CurrencyType.Money:
				master.GiveMoney(amount - master.money);
				break;
			case CurrencyType.Lunar:
			{
				NetworkUser networkUser = master.playerCharacterMasterController.networkUser;
				long num = (int)amount - networkUser.NetworknetLunarCoins;
				if (num < 0)
				{
					networkUser.DeductLunarCoins((uint)Math.Abs(num));
				}
				else
				{
					networkUser.AwardLunarCoins((uint)num);
				}
				break;
			}
			case CurrencyType.Void:
				master.GiveVoidCoins(amount - master.voidCoins);
				break;
			case CurrencyType.Experience:
				TeamManager.instance.SetTeamExperience(master.teamIndex, (ulong)amount);
				break;
			case CurrencyType.Level:
				TeamManager.instance.SetTeamLevel(master.teamIndex, amount);
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				master = val.GetComponent<CharacterMaster>();
			}
			_type = (CurrencyType)reader.ReadPackedUInt32();
			amount = reader.ReadPackedUInt32();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)master).netId);
			writer.WritePackedUInt32((uint)_type);
			writer.WritePackedUInt32(amount);
		}
	}
	public enum CurrencyType
	{
		Money,
		Lunar,
		Void,
		Experience,
		Level
	}
	public class GodModeMessage : AeroltMessageBase
	{
		private bool enabled;

		private CharacterMaster master;

		public GodModeMessage()
		{
		}

		public GodModeMessage(CharacterMaster master, bool enable)
		{
			this.master = master;
			enabled = enable;
		}

		public override void Handle()
		{
			base.Handle();
			master.godMode = enabled;
			master.UpdateBodyGodMode();
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				master = val.GetComponent<CharacterMaster>();
			}
			enabled = reader.ReadBoolean();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)master).netId);
			writer.Write(enabled);
		}
	}
	public class InteractableSpawnMessage : AeroltMessageBase
	{
		private uint index;

		private Vector3 position;

		public InteractableSpawnMessage()
		{
		}

		public InteractableSpawnMessage(uint index, Vector3 position)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			this.index = index;
			this.position = position;
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.WritePackedUInt32(index);
			writer.Write(position);
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			index = reader.ReadPackedUInt32();
			position = reader.ReadVector3();
		}

		public override void Handle()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			InteractableManager.Spawn(index, position);
		}
	}
	public class KillAllTeamMessage : AeroltMessageBase
	{
		private TeamIndex team;

		public KillAllTeamMessage()
		{
		}

		public KillAllTeamMessage(TeamIndex allExcept)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			team = allExcept;
		}

		public override void Handle()
		{
			//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)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			TeamMask mask = TeamMask.AllExcept(team);
			CharacterMaster[] array = CharacterMaster.instancesList.Where((CharacterMaster x) => ((TeamMask)(ref mask)).HasTeam(x.teamIndex)).ToArray();
			CharacterMaster[] array2 = array;
			foreach (CharacterMaster val in array2)
			{
				CharacterBody body = val.GetBody();
				if (Object.op_Implicit((Object)(object)body))
				{
					Chat.AddMessage("<color=yellow>Killed " + body.GetDisplayName() + " </color>");
				}
				val.TrueKill();
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000b: 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)
			((MessageBase)this).Deserialize(reader);
			team = NetworkExtensions.ReadTeamIndex(reader);
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			NetworkExtensions.Write(writer, team);
		}
	}
	public class KillMessage : AeroltMessageBase
	{
		private CharacterMaster master;

		public KillMessage()
		{
		}

		public KillMessage(CharacterMaster master)
		{
			this.master = master;
		}

		public override void Handle()
		{
			base.Handle();
			master.TrueKill();
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				master = val.GetComponent<CharacterMaster>();
			}
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)master).netId);
		}
	}
	public class MonsterSpawnMessage : AeroltMessageBase
	{
		private string bodyName;

		private bool brainDead;

		private EquipmentIndex eliteIndex;

		private Dictionary<ItemDef, uint> itemCounts;

		private Vector3 location;

		private string masterName;

		private TeamIndex teamIndex;

		public MonsterSpawnMessage()
		{
		}

		public MonsterSpawnMessage(string masterName, string bodyName, Vector3 vector3, TeamIndex teamIndex1, EquipmentIndex equipmentIndex, bool brainDead, Dictionary<ItemDef, uint> toDictionary)
		{
			//IL_0017: 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)
			this.masterName = masterName;
			this.bodyName = bodyName;
			location = vector3;
			teamIndex = teamIndex1;
			eliteIndex = equipmentIndex;
			this.brainDead = brainDead;
			itemCounts = toDictionary;
		}

		public override void Handle()
		{
			//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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Invalid comparison between Unknown and I4
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			GameObject val = MasterCatalog.FindMasterPrefab(masterName);
			GameObject val2 = Object.Instantiate<GameObject>(val.gameObject, location, Quaternion.identity);
			CharacterMaster component = val2.GetComponent<CharacterMaster>();
			component.teamIndex = teamIndex;
			foreach (var (val4, num2) in itemCounts)
			{
				component.inventory.GiveItem(val4, (int)num2);
			}
			if ((int)eliteIndex != -1)
			{
				component.inventory.SetEquipmentIndex(eliteIndex);
			}
			if (brainDead)
			{
				BaseAI[] aiComponents = component.aiComponents;
				foreach (BaseAI val5 in aiComponents)
				{
					Object.Destroy((Object)(object)val5);
				}
			}
			NetworkServer.Spawn(val2);
			component.bodyPrefab = BodyCatalog.FindBodyPrefab(bodyName);
			component.SpawnBody(location, Quaternion.identity);
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_003b: 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)
			((MessageBase)this).Deserialize(reader);
			masterName = reader.ReadString();
			bodyName = reader.ReadString();
			location = reader.ReadVector3();
			teamIndex = NetworkExtensions.ReadTeamIndex(reader);
			eliteIndex = NetworkExtensions.ReadEquipmentIndex(reader);
			brainDead = reader.ReadBoolean();
			itemCounts = reader.ReadItemAmounts();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0025: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(masterName);
			writer.Write(bodyName);
			writer.Write(location);
			NetworkExtensions.Write(writer, teamIndex);
			NetworkExtensions.Write(writer, eliteIndex);
			writer.Write(brainDead);
			writer.Write(itemCounts);
		}
	}
	public class PortalSpawnMessage : AeroltMessageBase
	{
		private string portal;

		public PortalSpawnMessage(string portal)
		{
			this.portal = portal;
		}

		public override void Handle()
		{
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_01c3: 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_01da: Expected O, but got Unknown
			base.Handle();
			switch (portal)
			{
			case "gold":
				TeleporterInteraction.instance.shouldAttemptToSpawnGoldshoresPortal = true;
				break;
			case "newt":
				TeleporterInteraction.instance.shouldAttemptToSpawnShopPortal = true;
				break;
			case "blue":
				TeleporterInteraction.instance.shouldAttemptToSpawnMSPortal = true;
				break;
			case "void":
			{
				PortalSpawner val2 = ((IEnumerable<PortalSpawner>)TeleporterInteraction.instance.portalSpawners).FirstOrDefault((Func<PortalSpawner, bool>)((PortalSpawner x) => x.spawnMessageToken == "PORTAL_VOID_OPEN"));
				if ((Object)(object)val2 != (Object)null && Run.instance.IsExpansionEnabled(val2.requiredExpansion))
				{
					val2.NetworkwillSpawn = true;
					if (!string.IsNullOrEmpty(val2.spawnPreviewMessageToken))
					{
						Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
						{
							baseToken = val2.spawnPreviewMessageToken
						});
					}
					if (Object.op_Implicit((Object)(object)val2.previewChild))
					{
						val2.previewChild.SetActive(true);
					}
				}
				break;
			}
			case "all":
			{
				Chat.AddMessage("<color=red>Spawned All Portal</color>");
				TeleporterInteraction.instance.shouldAttemptToSpawnGoldshoresPortal = true;
				TeleporterInteraction.instance.shouldAttemptToSpawnShopPortal = true;
				TeleporterInteraction.instance.shouldAttemptToSpawnMSPortal = true;
				PortalSpawner[] portalSpawners = TeleporterInteraction.instance.portalSpawners;
				foreach (PortalSpawner val in portalSpawners)
				{
					if (Run.instance.IsExpansionEnabled(val.requiredExpansion))
					{
						val.NetworkwillSpawn = true;
						if (!string.IsNullOrEmpty(val.spawnPreviewMessageToken))
						{
							Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
							{
								baseToken = val.spawnPreviewMessageToken
							});
						}
						if (Object.op_Implicit((Object)(object)val.previewChild))
						{
							val.previewChild.SetActive(true);
						}
					}
				}
				break;
			}
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			((MessageBase)this).Deserialize(reader);
			portal = reader.ReadString();
		}

		public override void Serialize(NetworkWriter writer)
		{
			((MessageBase)this).Serialize(writer);
			writer.Write(portal);
		}
	}
	public class SceneChangeMessage : AeroltMessageBase
	{
		private bool isSet;

		private SceneIndex target;

		public SceneChangeMessage()
		{
		}

		public SceneChangeMessage(SceneIndex sceneIndex)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			isSet = true;
			target = sceneIndex;
		}

		public override void Handle()
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			SceneDef sceneDef = SceneCatalog.GetSceneDef(target);
			if (isSet && Object.op_Implicit((Object)(object)sceneDef))
			{
				Run.instance.AdvanceStage(sceneDef);
				Run instance = Run.instance;
				instance.stageClearCount--;
			}
			else
			{
				Run.instance.AdvanceStage(Run.instance.nextStageScene);
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			isSet = reader.ReadBoolean();
			target = (SceneIndex)reader.ReadInt32();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			((MessageBase)this).Serialize(writer);
			writer.Write(isSet);
			writer.Write((int)target);
		}
	}
	public class SetBodyMessage : AeroltMessageBase
	{
		private string newBody;

		private NetworkUser user;

		public SetBodyMessage()
		{
		}

		public SetBodyMessage(NetworkUser user, CharacterBody newBody)
			: this(user)
		{
			this.newBody = ((Object)newBody).name;
		}

		public SetBodyMessage(NetworkUser networkUser)
		{
			user = networkUser;
			newBody = "";
		}

		public override void Handle()
		{
			base.Handle();
			GameOverController val = Object.FindObjectOfType<GameOverController>();
			if (Object.op_Implicit((Object)(object)val))
			{
				foreach (KeyValuePair<HUD, GameEndReportPanelController> reportPanel in val.reportPanels)
				{
					Object.Destroy((Object)(object)((Component)reportPanel.Value).gameObject);
				}
				Object.Destroy((Object)(object)((Component)val).gameObject);
			}
			if (NetworkServer.active)
			{
				bool usePod = false;
				if (Object.op_Implicit((Object)(object)Stage.instance))
				{
					usePod = Stage.instance.usePod;
					Stage.instance.usePod = false;
				}
				user.master.preventRespawnUntilNextStageServer = false;
				user.master.CmdRespawn(newBody);
				if (Object.op_Implicit((Object)(object)Stage.instance))
				{
					Stage.instance.usePod = usePod;
				}
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				user = val.GetComponent<NetworkUser>();
			}
			newBody = reader.ReadString();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)user).netId);
			writer.Write(newBody);
		}
	}
	public class SetBuffCountMessage : AeroltMessageBase
	{
		public CharacterBody body;

		public Dictionary<BuffIndex, uint> buffCounts;

		public SetBuffCountMessage()
		{
		}

		public SetBuffCountMessage(CharacterBody bodyIn, Dictionary<BuffIndex, uint> buffCountsIn)
		{
			body = bodyIn;
			buffCounts = buffCountsIn;
		}

		public override void Handle()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			foreach (KeyValuePair<BuffIndex, uint> buffCount in buffCounts)
			{
				body.SetBuffCount(buffCount.Key, (int)buffCount.Value);
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				body = val.GetComponent<CharacterBody>();
			}
			uint num = reader.ReadPackedUInt32();
			buffCounts = new Dictionary<BuffIndex, uint>();
			for (int i = 0; i < num; i++)
			{
				buffCounts.Add((BuffIndex)reader.ReadPackedUInt32(), reader.ReadPackedUInt32());
			}
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected I4, but got Unknown
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)body).netId);
			writer.WritePackedUInt32((uint)buffCounts.Count);
			foreach (var (val2, num2) in buffCounts)
			{
				writer.WritePackedUInt32((uint)(int)val2);
				writer.WritePackedUInt32(num2);
			}
		}
	}
	public class SetEquipmentMessage : AeroltMessageBase
	{
		private Dictionary<EquipmentDef, int> equipmentCounts;

		private Inventory inventory;

		public SetEquipmentMessage()
		{
		}

		public SetEquipmentMessage(Inventory inventory, Dictionary<EquipmentDef, int> equipmentCounts)
		{
			this.inventory = inventory;
			this.equipmentCounts = equipmentCounts;
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: 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_0063: Expected I4, but got Unknown
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)inventory).netId);
			writer.WritePackedUInt32((uint)equipmentCounts.Count);
			foreach (var (val2, num2) in equipmentCounts)
			{
				writer.WritePackedUInt32((uint)(int)val2.equipmentIndex);
				writer.WritePackedUInt32((uint)num2);
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject obj = Util.FindNetworkObject(reader.ReadNetworkId());
			inventory = ((obj != null) ? obj.GetComponent<Inventory>() : null);
			equipmentCounts = new Dictionary<EquipmentDef, int>();
			uint num = reader.ReadPackedUInt32();
			for (int i = 0; i < num; i++)
			{
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)reader.ReadPackedUInt32());
				equipmentCounts.Add(equipmentDef, (int)reader.ReadPackedUInt32());
			}
		}

		public override void Handle()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042->IL0042: Incompatible stack types: O vs I4
			//IL_0036->IL0042: Incompatible stack types: I4 vs O
			//IL_0036->IL0042: Incompatible stack types: O vs I4
			base.Handle();
			foreach (KeyValuePair<EquipmentDef, int> equipmentCount in equipmentCounts)
			{
				object obj = inventory;
				int num;
				if (!Object.op_Implicit((Object)(object)equipmentCount.Key))
				{
					num = -1;
					obj = num;
					num = (int)obj;
				}
				else
				{
					obj = equipmentCount.Key.equipmentIndex;
					num = (int)obj;
				}
				((Inventory)num).SetEquipmentIndex((EquipmentIndex)obj);
			}
		}
	}
	public class SetItemCountMessage : AeroltMessageBase
	{
		private Inventory inventory;

		private Dictionary<ItemDef, uint> itemCounts;

		public SetItemCountMessage()
		{
		}

		public SetItemCountMessage(Inventory inventory, Dictionary<ItemDef, int> itemCounts)
		{
			this.inventory = inventory;
			this.itemCounts = itemCounts.ToDictionary<KeyValuePair<ItemDef, int>, ItemDef, uint>((KeyValuePair<ItemDef, int> x) => x.Key, (KeyValuePair<ItemDef, int> x) => (uint)x.Value);
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)inventory).netId);
			writer.Write(itemCounts);
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject obj = Util.FindNetworkObject(reader.ReadNetworkId());
			inventory = ((obj != null) ? obj.GetComponent<Inventory>() : null);
			itemCounts = reader.ReadItemAmounts();
		}

		public override void Handle()
		{
			base.Handle();
			foreach (KeyValuePair<ItemDef, uint> itemCount in itemCounts)
			{
				inventory.GiveItem(itemCount.Key, (int)itemCount.Value - inventory.GetItemCount(itemCount.Key));
			}
		}
	}
	public class TeamSwitchMessage : AeroltMessageBase
	{
		private TeamIndex newTeam;

		private CharacterMaster target;

		public TeamSwitchMessage()
		{
		}

		public TeamSwitchMessage(CharacterMaster who, TeamIndex team)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			target = who;
			newTeam = team;
		}

		public override void Handle()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			target.teamIndex = newTeam;
			CharacterBody body = target.GetBody();
			if (Object.op_Implicit((Object)(object)body))
			{
				body.teamComponent.teamIndex = newTeam;
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: 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)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				target = val.GetComponent<CharacterMaster>();
			}
			newTeam = (TeamIndex)(sbyte)reader.ReadInt32();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: 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: Expected I4, but got Unknown
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)target).netId);
			writer.Write((int)newTeam);
		}
	}
	public class TeleporterChargeMessage : AeroltMessageBase
	{
		public override void Handle()
		{
			base.Handle();
			if (Object.op_Implicit((Object)(object)TeleporterInteraction.instance) && Object.op_Implicit((Object)(object)TeleporterInteraction.instance.holdoutZoneController))
			{
				TeleporterInteraction.instance.holdoutZoneController.charge = 1f;
			}
		}
	}
	public class TeleportMessage : AeroltMessageBase
	{
		private Vector3 targetPosition;

		private CharacterBody teleportedBody;

		public TeleportMessage()
		{
		}

		public TeleportMessage(CharacterBody teleportedBody, Vector3 targetPosition)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			this.teleportedBody = teleportedBody;
			this.targetPosition = targetPosition;
		}

		public override void Handle()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			base.Handle();
			if (Object.op_Implicit((Object)(object)teleportedBody) && Object.op_Implicit((Object)(object)teleportedBody.characterMotor))
			{
				((BaseCharacterController)teleportedBody.characterMotor).Motor.MoveCharacter(targetPosition);
			}
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: 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)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				teleportedBody = val.GetComponent<CharacterBody>();
			}
			targetPosition = reader.ReadVector3();
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: 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)
			((MessageBase)this).Serialize(writer);
			writer.Write(((NetworkBehaviour)teleportedBody).netId);
			writer.Write(targetPosition);
		}
	}
}
namespace Aerolt.Managers
{
	public static class EspHelper
	{
		public static void DrawEspLabel(Vector3 worldpos, Color textcolor, Color outlinecolor, string? text, string? outlinetext = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			//IL_002c: 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: 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)
			//IL_0047: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: 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_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_00d1: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			GUIContent val = new GUIContent(text);
			if (outlinetext == null)
			{
				outlinetext = text;
			}
			GUIContent val2 = new GUIContent(outlinetext);
			GUIStyle label = GUI.skin.label;
			label.alignment = (TextAnchor)4;
			Vector2 val3 = label.CalcSize(val);
			Vector3 val4 = Camera.main.WorldToScreenPoint(worldpos);
			val4.y = (float)Screen.height - val4.y;
			if (val4.z >= 0f)
			{
				GUI.color = Color.black;
				GUI.Label(new Rect(val4.x - val3.x / 2f + 1f, val4.y + 1f, val3.x, val3.y), val2);
				GUI.Label(new Rect(val4.x - val3.x / 2f - 1f, val4.y - 1f, val3.x, val3.y), val2);
				GUI.Label(new Rect(val4.x - val3.x / 2f + 1f, val4.y - 1f, val3.x, val3.y), val2);
				GUI.Label(new Rect(val4.x - val3.x / 2f - 1f, val4.y + 1f, val3.x, val3.y), val2);
				GUI.color = textcolor;
				GUI.Label(new Rect(val4.x - val3.x / 2f, val4.y, val3.x, val3.y), val);
				GUI.color = Color.black;
			}
		}

		public static void DrawRarityEspLabel(Vector3 worldpos, Color textcolor, Color outlinecolor, string? text, Color itemColor, string itemName = "", string? outlinetext = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0033: 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_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_0044: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Expected O, but got Unknown
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Expected O, but got Unknown
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: 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)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: 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_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032d: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			GUIContent val = new GUIContent(text);
			if (outlinetext == null)
			{
				outlinetext = text;
			}
			GUIContent val2 = new GUIContent(outlinetext);
			GUIStyle label = GUI.skin.label;
			label.alignment = (TextAnchor)4;
			Vector2 val3 = label.CalcSize(val);
			Vector3 val4 = Camera.main.WorldToScreenPoint(worldpos);
			val4.y = (float)Screen.height - val4.y;
			if (val4.z >= 0f)
			{
				GUI.color = Color.black;
				GUI.Label(new Rect(val4.x - val3.x / 2f + 1f, val4.y + 1f, val3.x, val3.y), val2);
				GUI.Label(new Rect(val4.x - val3.x / 2f - 1f, val4.y - 1f, val3.x, val3.y), val2);
				GUI.Label(new Rect(val4.x - val3.x / 2f + 1f, val4.y - 1f, val3.x, val3.y), val2);
				GUI.Label(new Rect(val4.x - val3.x / 2f - 1f, val4.y + 1f, val3.x, val3.y), val2);
				GUI.color = textcolor;
				GUI.Label(new Rect(val4.x - val3.x / 2f, val4.y, val3.x, val3.y), val);
				if (!string.IsNullOrEmpty(itemName))
				{
					GUIContent val5 = new GUIContent(itemName);
					GUIContent val6 = new GUIContent(itemName);
					Vector2 val7 = label.CalcSize(val5);
					GUI.color = Color.black;
					GUI.Label(new Rect(val4.x - val7.x / 2f + 1f, val4.y + 1f + val3.y, val7.x, val7.y), val6);
					GUI.Label(new Rect(val4.x - val7.x / 2f - 1f, val4.y - 1f + val3.y, val7.x, val7.y), val6);
					GUI.Label(new Rect(val4.x - val7.x / 2f + 1f, val4.y - 1f + val3.y, val7.x, val7.y), val6);
					GUI.Label(new Rect(val4.x - val7.x / 2f - 1f, val4.y + 1f + val3.y, val7.x, val7.y), val6);
					GUI.color = itemColor;
					GUI.Label(new Rect(val4.x - val7.x / 2f, val4.y + val3.y, val7.x, val7.y), val5);
				}
				GUI.color = Color.black;
			}
		}

		public static void DrawMultiShopRarityESPLabel(Vector3 worldpos, Color textcolor, Color outlinecolor, string text, List<Color> itemColors, List<string> itemNames, string outlinetext = null)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0033: 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_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_0044: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: 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)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_0293: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: 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_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_033f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0352: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: 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)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0375: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			GUIContent val = new GUIContent(text);
			if (outlinetext == null)
			{
				outlinetext = text;
			}
			GUIContent val2 = new GUIContent(outlinetext);
			GUIStyle label = GUI.skin.label;
			label.alignment = (TextAnchor)4;
			Vector2 val3 = label.CalcSize(val);
			Vector3 val4 = Camera.main.WorldToScreenPoint(worldpos);
			val4.y = (float)Screen.height - val4.y;
			if (!(val4.z >= 0f))
			{
				return;
			}
			GUI.color = Color.black;
			GUI.Label(new Rect(val4.x - val3.x / 2f + 1f, val4.y + 1f, val3.x, val3.y), val2);
			GUI.Label(new Rect(val4.x - val3.x / 2f - 1f, val4.y - 1f, val3.x, val3.y), val2);
			GUI.Label(new Rect(val4.x - val3.x / 2f + 1f, val4.y - 1f, val3.x, val3.y), val2);
			GUI.Label(new Rect(val4.x - val3.x / 2f - 1f, val4.y + 1f, val3.x, val3.y), val2);
			GUI.color = textcolor;
			GUI.Label(new Rect(val4.x - val3.x / 2f, val4.y, val3.x, val3.y), val);
			for (int i = 0; i < itemNames.Count; i++)
			{
				string text2 = itemNames[i];
				if (!string.IsNullOrEmpty(text2))
				{
					Color color = itemColors[i];
					GUIContent val5 = new GUIContent(text2);
					string text3 = text2;
					GUIContent val6 = new GUIContent(text3);
					Vector2 val7 = label.CalcSize(val5);
					GUI.color = Color.black;
					GUI.Label(new Rect(val4.x - val7.x / 2f + 1f, val4.y + 1f + val3.y + (float)i * val7.y, val7.x, val7.y), val6);
					GUI.Label(new Rect(val4.x - val7.x / 2f - 1f, val4.y - 1f + val3.y + (float)i * val7.y, val7.x, val7.y), val6);
					GUI.Label(new Rect(val4.x - val7.x / 2f + 1f, val4.y - 1f + val3.y + (float)i * val7.y, val7.x, val7.y), val6);
					GUI.Label(new Rect(val4.x - val7.x / 2f - 1f, val4.y + 1f + val3.y + (float)i * val7.y, val7.x, val7.y), val6);
					GUI.color = color;
					GUI.Label(new Rect(val4.x - val7.x / 2f, val4.y + val3.y + (float)i * val7.y, val7.x, val7.y), val5);
				}
			}
			GUI.color = Color.black;
		}

		public static Vector3 WorldToScreen(Vector3 worldpos)
		{
			//IL_0006: 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_000c: 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)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_0035: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Camera.main.WorldToScreenPoint(worldpos);
			val.y = (float)Screen.height - val.y;
			return new Vector3(val.x, val.y);
		}
	}
	public class BodyManager : MonoBehaviour
	{
		public GameObject buttonPrefab;

		public GameObject buttonParent;

		public TMP_InputField searchFilter;

		private GameObject _newBody;

		private readonly Dictionary<CharacterBody, CustomButton> bodyDefRef = new Dictionary<CharacterBody, CustomButton>();

		private NetworkUser target;

		private void Awake()
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Expected O, but got Unknown
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Expected O, but got Unknown
			foreach (CharacterBody body in BodyCatalog.allBodyPrefabBodyBodyComponents.OrderBy((CharacterBody x) => Language.GetString(x.baseNameToken)))
			{
				GameObject val = Object.Instantiate<GameObject>(buttonPrefab, buttonParent.transform);
				CustomButton component = val.GetComponent<CustomButton>();
				component.buttonText.text = Language.GetString(body.baseNameToken);
				component.image.sprite = Sprite.Create((Texture2D)body.portraitIcon, new Rect(0f, 0f, (float)body.portraitIcon.width, (float)body.portraitIcon.height), new Vector2(0.5f, 0.5f));
				((UnityEvent)component.button.onClick).AddListener((UnityAction)delegate
				{
					SetBodyDef(body);
				});
				bodyDefRef[body] = component;
			}
			if (Object.op_Implicit((Object)(object)searchFilter))
			{
				((UnityEvent<string>)(object)searchFilter.onValueChanged).AddListener((UnityAction<string>)FilterUpdated);
			}
		}

		public void SpawnAsBody()
		{
			new SetBodyMessage(target, _newBody.GetComponent<CharacterBody>()).SendToServer();
		}

		public void SetBodyDef(CharacterBody body)
		{
			_newBody = BodyCatalog.FindBodyPrefab(body);
			SpawnAsBody();
			((Component)this).GetComponentInParent<LobbyPlayerPageManager>().SwapViewState();
		}

		public void Initialize(NetworkUser currentUser)
		{
			target = currentUser;
		}

		private void FilterUpdated(string text)
		{
			if (Utility.IsNullOrWhiteSpace(text))
			{
				foreach (KeyValuePair<CharacterBody, CustomButton> item in bodyDefRef)
				{
					((Component)item.Value).gameObject.SetActive(true);
				}
				return;
			}
			CustomButton[] array = bodyDefRef.Values.ToArray();
			CustomButton[] source = Tools.FindMatches(array, (CustomButton x) => x.buttonText.text, text);
			CustomButton[] array2 = array;
			foreach (CustomButton customButton in array2)
			{
				((Component)customButton).gameObject.SetActive(source.Contains(customButton));
			}
		}
	}
	public class InteractableManager : MonoBehaviour, IModuleStartup
	{
		[CanBeNull]
		public static SpawnCard[] _spawnCards;

		public GameObject buttonPrefab;

		public GameObject buttonParent;

		public TMP_InputField searchFilter;

		private MenuInfo _info;

		private readonly Dictionary<SpawnCard, CustomButton> cardDefRef = new Dictionary<SpawnCard, CustomButton>();

		private static bool isScalingInteractablePricesConstantly;

		public static Dictionary<SpawnCard, int> startOfRoundScaledInteractableCosts;

		public static SpawnCard[] cards => _spawnCards ?? (_spawnCards = (from x in (from x in (from x in ClassicStageInfo.instance.interactableDccsPool.GenerateWeightedSelection().choices
					where !((object)x).Equals((object?)null) && Object.op_Implicit((Object)(object)x.value)
					select x.value into x
					where !((object)x).Equals((object?)null) && x.categories != null
					select x.categories).SelectMany((Category[] x) => x)
				where !((object)(Category)(ref x)).Equals((object?)null) && !x.cards.Equals(null)
				select x.cards).SelectMany((DirectorCard[] x) => x)
			select x.spawnCard).Union(from x in Object.FindObjectOfType<SceneDirector>().GenerateInteractableCardSelection().choices
			where x.value != null && (Object)(object)x.value.spawnCard != (Object)null
			select x.value.spawnCard).ToArray());

		static InteractableManager()
		{
			isScalingInteractablePricesConstantly = false;
			startOfRoundScaledInteractableCosts = new Dictionary<SpawnCard, int>();
			Run.onRunStartGlobal += delegate
			{
				_spawnCards = null;
			};
		}

		public void ModuleStart()
		{
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Invalid comparison between Unknown and I4
			_info = ((Component)this).GetComponentInParent<MenuInfo>();
			startOfRoundScaledInteractableCosts.Clear();
			foreach (SpawnCard card in cards.OrderBy((SpawnCard x) => (x.prefab.GetComponentInChildren<IDisplayNameProvider>() != null) ? x.prefab.GetComponentInChildren<IDisplayNameProvider>().GetDisplayName() : ((Object)x).name))
			{
				if (!((object)card).Equals((object?)null) && !((object)card).Equals((object?)null))
				{
					GameObject val = Object.Instantiate<GameObject>(buttonPrefab, buttonParent.transform);
					IDisplayNameProvider componentInChildren = card.prefab.GetComponentInChildren<IDisplayNameProvider>();
					CustomButton component = val.GetComponent<CustomButton>();
					component.buttonText.text = ((componentInChildren != null) ? componentInChildren.GetDisplayName() : ((Object)card).name);
					component.image.sprite = PingIndicator.GetInteractableIcon(card.prefab);
					((UnityEvent)component.button.onClick).AddListener((UnityAction)delegate
					{
						SpawnInteractable(card);
					});
					cardDefRef[card] = component;
					GameObject prefab = card.prefab;
					PurchaseInteraction component2 = prefab.GetComponent<PurchaseInteraction>();
					if (Object.op_Implicit((Object)(object)component2) && (int)component2.costType == 1)
					{
						int difficultyScaledCost = Run.instance.GetDifficultyScaledCost(component2.cost);
						startOfRoundScaledInteractableCosts.Add(card, difficultyScaledCost);
					}
				}
			}
			if (Object.op_Implicit((Object)(object)searchFilter))
			{
				((UnityEvent<string>)(object)searchFilter.onValueChanged).AddListener((UnityAction<string>)FilterUpdated);
			}
		}

		public void SpawnInteractable(SpawnCard card)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_info.Master))
			{
				Tools.Log(LogLevel.Error, "Cant Spawn Interactable Localuser Master is null");
				return;
			}
			CharacterBody body = _info.Body;
			if (!Object.op_Implicit((Object)(object)body))
			{
				Tools.Log(LogLevel.Error, "Cant Spawn Interactable Localuser Body is null");
				return;
			}
			Vector3 position = body.transform.position;
			Ray aimRay = body.inputBank.GetAimRay();
			Vector3 val = ((Ray)(ref aimRay)).direction * 1.6f;
			if (NetworkServer.active)
			{
				Spawn((uint)Array.IndexOf(cards, card), position + val);
			}
			else
			{
				ClientScene.readyConnection.SendAerolt(new InteractableSpawnMessage((uint)Array.IndexOf(cards, card), position + val));
			}
		}

		public static void Spawn(uint index, Vector3 position)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0015: 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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			SpawnCard val = cards[index];
			DirectorPlacementRule val2 = new DirectorPlacementRule
			{
				placementMode = (PlacementMode)3,
				maxDistance = 30f,
				minDistance = 10f,
				position = position,
				preventOverhead = true
			};
			DirectorSpawnRequest val3 = new DirectorSpawnRequest(val, val2, RoR2Application.rng);
			GameObject val4 = DirectorCore.instance.TrySpawnObject(val3);
			if (Object.op_Implicit((Object)(object)val4))
			{
				PurchaseInteraction component = val4.GetComponent<PurchaseInteraction>();
				if (Object.op_Implicit((Object)(object)component) && (int)component.costType == 1)
				{
					component.Networkcost = (isScalingInteractablePricesConstantly ? Run.instance.GetDifficultyScaledCost(component.cost) : startOfRoundScaledInteractableCosts[val]);
				}
			}
		}

		private void FilterUpdated(string text)
		{
			if (Utility.IsNullOrWhiteSpace(text))
			{
				foreach (KeyValuePair<SpawnCard, CustomButton> item in cardDefRef)
				{
					((Component)item.Value).gameObject.SetActive(true);
				}
				return;
			}
			CustomButton[] array = cardDefRef.Values.ToArray();
			CustomButton[] source = Tools.FindMatches(array, (CustomButton x) => x.buttonText.text, text);
			CustomButton[] array2 = array;
			foreach (CustomButton customButton in array2)
			{
				((Component)customButton).gameObject.SetActive(source.Contains(customButton));
			}
		}
	}
	[RequireComponent(typeof(ToggleGroup))]
	public class LobbyPlayerManager : MonoBehaviour, IModuleStartup
	{
		public GameObject playerEntryPrefab;

		public Transform playerEntryParent;

		public readonly Dictionary<NetworkUser, PlayerConfigBinding> users = new Dictionary<NetworkUser, PlayerConfigBinding>();

		private LobbyPlayerPageManager _pageManager;

		private MenuInfo info;

		private NetworkUser selectedUser;

		private ToggleGroup toggleGroup;

		private void OnEnable()
		{
			foreach (NetworkUser key in users.Keys)
			{
				UpdateUserLobbyButton(key);
			}
		}

		public void ModuleStart()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			NetworkUser.onPostNetworkUserStart += new NetworkUserGenericDelegate(UserAdded);
			NetworkUser.onNetworkUserLost += new NetworkUserGenericDelegate(UserLost);
			info = ((Component)this).GetComponentInParent<MenuInfo>();
			toggleGroup = ((Component)this).GetComponent<ToggleGroup>();
			_pageManager = ((Component)this).GetComponent<LobbyPlayerPageManager>();
			foreach (NetworkUser instances in NetworkUser.instancesList)
			{
				UserAdded(instances);
			}
		}

		void IModuleStartup.ModuleEnd()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			NetworkUser.onPostNetworkUserStart -= new NetworkUserGenericDelegate(UserAdded);
			NetworkUser.onNetworkUserDiscovered -= new NetworkUserGenericDelegate(UserAdded);
			NetworkUser.onNetworkUserLost -= new NetworkUserGenericDelegate(UserLost);
			foreach (var (_, playerConfigBinding2) in users)
			{
				playerConfigBinding2.OnDestroy();
			}
		}

		private void UpdateUserLobbyButton(NetworkUser user)
		{
			CustomButton customButton = users[user].customButton;
			customButton.buttonText.text = user.userName;
			if (Object.op_Implicit((Object)(object)user.master) && Object.op_Implicit((Object)(object)user.master.bodyPrefab))
			{
				customButton.rawImage.texture = user.master.bodyPrefab.GetComponent<CharacterBody>().portraitIcon;
			}
		}

		private void UserAdded(NetworkUser user)
		{
			NetworkUser user2 = user;
			if (users.ContainsKey(user2))
			{
				return;
			}
			CustomButton component = Object.Instantiate<GameObject>(playerEntryPrefab, playerEntryParent, false).GetComponent<CustomButton>();
			users[user2] = new PlayerConfigBinding(user2, component);
			Toggle component2 = ((Component)component).GetComponent<Toggle>();
			component2.group = toggleGroup;
			((UnityEvent<bool>)(object)component2.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				if (val)
				{
					SetUser(user2);
				}
			});
			if ((Object)(object)user2 == (Object)(object)info.Owner)
			{
				component2.Set(true, true);
			}
			if (Object.op_Implicit((Object)(object)user2.master))
			{
				if (NetworkServer.active)
				{
					BodyStart(user2.master.GetBody());
				}
				user2.master.onBodyStart += BodyStart;
			}
		}

		private void BodyStart(CharacterBody body)
		{
			if (Object.op_Implicit((Object)(object)body))
			{
				NetworkUser networkUser = body.master.playerCharacterMasterController.networkUser;
				users[networkUser].Sync();
			}
		}

		private void UserLost(NetworkUser user)
		{
			if (users.ContainsKey(user))
			{
				Object.Destroy((Object)(object)((Component)users[user].customButton).gameObject);
				users[user].OnDestroy();
				users.Remove(user);
				if ((Object)(object)selectedUser == (Object)(object)user && users.Any())
				{
					SetUser(users.Keys.Last());
				}
				if (Object.op_Implicit((Object)(object)user.master))
				{
					user.master.onBodyStart -= BodyStart;
				}
			}
		}

		private void SetUser(NetworkUser user)
		{
			selectedUser = user;
			_pageManager.SetUser(user);
		}
	}
	public class LobbyPlayerPageManager : MonoBehaviour, IModuleStartup
	{
		[CanBeNull]
		private static PickupDropTable _chest1DropTable;

		public PlayerValuesGenerator bodyStats;

		[Header("Inventory Display")]
		public ItemInventoryDisplay inventoryDisplay;

		public EquipmentIcon equipmentIcon;

		public BuffDisplay buffDisplay;

		[Header("Toggles")]
		public Toggle aimbotToggle;

		public Toggle noclipToggle;

		public Toggle godToggle;

		public Toggle infiniteSkillsToggle;

		public Toggle alwaysSprintToggle;

		public Toggle disableMobSpawnToggle;

		[Header("Sliders")]
		public Slider aimbotWeightSlider;

		public Slider xpSlider;

		[Header("DropDowns")]
		public TMP_Dropdown teamDropdown;

		[Header("InputFields")]
		public TMP_InputField moneyInputField;

		public TMP_InputField lunarCoinsInputField;

		public TMP_InputField voidMarkersInputField;

		public TMP_InputField xpToGiveInputField;

		[Header("Content Display")]
		public GameObject mainContent;

		public EditPlayerItemButton itemContent;

		public EquipmentButtonGenerator equipmentContent;

		public BodyManager bodyContent;

		public EditPlayerBuffButton buffContent;

		public TMP_Text LevelLabel;

		private PlayerConfigBinding _playerConfig;

		private ViewState _state = ViewState.Main;

		private CharacterBody body;

		[Header("Character Info")]
		private NetworkUser currentUser;

		private ValueWrapper<bool> disableMobSpawns;

		private MenuInfo info;

		private CharacterMaster master;

		private bool ownerIsSelected;

		private LobbyPlayerManager playerManager;

		private static List<ItemDef> _giveAllFilteredItems;

		public static PickupDropTable Chest1DropTable => _chest1DropTable ?? (_chest1DropTable = LegacyResourcesAPI.Load<PickupDropTable>("DropTables/dtSmallChest"));

		public static List<ItemDef> GiveAllFilteredItems
		{
			get
			{
				object obj = _giveAllFilteredItems;
				if (obj == null)
				{
					obj = new List<ItemDef>
					{
						Items.DroneWeaponsBoost,
						Items.HealthDecay,
						Items.LunarPrimaryReplacement,
						Items.LunarSecondaryReplacement,
						Items.LunarUtilityReplacement,
						Items.LunarSpecialReplacement
					};
					_giveAllFilteredItems = (List<ItemDef>)obj;
				}
				return (List<ItemDef>)obj;
			}
		}

		private PlayerConfigBinding PlayerConfig
		{
			get
			{
				return _playerConfig;
			}
			set
			{
				if (_playerConfig != null && _playerConfig != value)
				{
					_playerConfig.UnBind(UpdateCheckboxValues);
				}
				_playerConfig = value;
				_playerConfig.Bind(UpdateCheckboxValues);
				UpdateCheckboxValues();
			}
		}

		public void Kick()
		{
			new KickBanMessage(currentUser, kick: true).SendToServer();
		}

		public void Ban()
		{
			new KickBanMessage(currentUser, kick: false, ban: true).SendToServer();
		}

		public void Goto()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)info.Body) && Object.op_Implicit((Object)(object)body))
			{
				new TeleportMessage(info.Body, body.transform.position).SendToAuthority(info.Body);
			}
		}

		public void Bring()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)info.Body) && Object.op_Implicit((Object)(object)body))
			{
				new TeleportMessage(body, info.Body.transform.position).SendToAuthority(body);
			}
		}

		public void Kill()
		{
			if (Object.op_Implicit((Object)(object)master))
			{
				new KillMessage(master).SendToServer();
			}
		}

		public void Revive()
		{
			SetBodyMessage setBodyMessage = new SetBodyMessage(currentUser);
			if (!NetworkServer.active)
			{
				setBodyMessage.Handle();
			}
			setBodyMessage.SendToServer();
		}

		public void GiveAllItems()
		{
			if (Object.op_Implicit((Object)(object)master))
			{
				Dictionary<ItemDef, int> itemCounts = ContentManager.itemDefs.Except(GiveAllFilteredItems).ToDictionary((ItemDef x) => x, (ItemDef def) => master.inventory.GetItemCount(def) + 1);
				new SetItemCountMessage(master.inventory, itemCounts).SendToServer();
			}
		}

		public void GiveRandomItems()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: 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)
			if (!Object.op_Implicit((Object)(object)master))
			{
				return;
			}
			Dictionary<ItemDef, int> dictionary = new Dictionary<ItemDef, int>();
			for (int i = 0; i < Random.Range(0, 100); i++)
			{
				PickupIndex val = Chest1DropTable.GenerateDrop(RoR2Application.rng);
				PickupDef pickupDef = PickupCatalog.GetPickupDef(val);
				ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)((pickupDef == null) ? (-1) : ((int)pickupDef.itemIndex)));
				if (!((Object)(object)itemDef == (Object)null))
				{
					if (!dictionary.ContainsKey(itemDef))
					{
						dictionary[itemDef] = master.inventory.GetItemCount(itemDef);
					}
					dictionary[itemDef] += Random.Range(0, 100);
				}
			}
			new SetItemCountMessage(master.inventory, dictionary).SendToServer();
		}

		public void ClearInventory()
		{
			Dictionary<ItemDef, int> itemCounts = ContentManager.itemDefs.ToDictionary((ItemDef x) => x, (ItemDef _) => 0);
			new SetItemCountMessage(master.inventory, itemCounts).SendToServer();
		}

		public void OpenInventory()
		{
			SwapViewState(ViewState.Inventory);
		}

		public void OpenBuffs()
		{
			SwapViewState(ViewState.Buff);
		}

		public void OpenEquipment()
		{
			SwapViewState(ViewState.Equipment);
		}

		public void OpenSpawnAs()
		{
			SwapViewState(ViewState.Body);
		}

		public void Update()
		{
			//IL_0030: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)currentUser) && Object.op_Implicit((Object)(object)master))
			{
				((TMP_Text)(TextMeshProUGUI)moneyInputField.placeholder).text = master.money.ToString();
				((TMP_Text)(TextMeshProUGUI)voidMarkersInputField.placeholder).text = master.voidCoins.ToString();
				((TMP_Text)(TextMeshProUGUI)lunarCoinsInputField.placeholder).text = currentUser.lunarCoins.ToString();
			}
		}

		private void OnEnable()
		{
			UpdateLevelValues();
		}

		public void ModuleStart()
		{
			info = ((Component)this).GetComponentInParent<MenuInfo>();
			playerManager = ((Component)this).GetComponent<LobbyPlayerManager>();
			bodyStats.Setup();
			GlobalEventManager.onTeamLevelUp += OnTeamLevelUp;
			teamDropdown.options.Clear();
			teamDropdown.AddOptions((from x in Enum.GetNames(typeof(TeamIndex))
				where x != "None"
				select x).ToList());
			((UnityEvent<bool>)(object)godToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				PlayerConfig.GodMode.Value = val;
			});
			((UnityEvent<bool>)(object)aimbotToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				PlayerConfig.Aimbot.Value = val;
			});
			((UnityEvent<float>)(object)aimbotWeightSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float val)
			{
				PlayerConfig.AimbotWeight.Value = val;
			});
			((UnityEvent<bool>)(object)noclipToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				PlayerConfig.Noclip.Value = val;
			});
			((UnityEvent<bool>)(object)infiniteSkillsToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				PlayerConfig.InfiniteSkills.Value = val;
			});
			((UnityEvent<bool>)(object)alwaysSprintToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				PlayerConfig.AlwaysSprint.Value = val;
			});
			((UnityEvent<string>)(object)moneyInputField.onEndEdit).AddListener((UnityAction<string>)delegate(string amt)
			{
				SetCurrency(CurrencyType.Money, amt);
				moneyInputField.SetTextWithoutNotify("");
			});
			((UnityEvent<string>)(object)lunarCoinsInputField.onEndEdit).AddListener((UnityAction<string>)delegate(string amt)
			{
				SetCurrency(CurrencyType.Lunar, amt);
				lunarCoinsInputField.SetTextWithoutNotify("");
			});
			((UnityEvent<string>)(object)voidMarkersInputField.onEndEdit).AddListener((UnityAction<string>)delegate(string amt)
			{
				SetCurrency(CurrencyType.Void, amt);
				lunarCoinsInputField.SetTextWithoutNotify("");
			});
			((UnityEvent<string>)(object)xpToGiveInputField.onEndEdit).AddListener((UnityAction<string>)delegate(string amt)
			{
				SetCurrency(CurrencyType.Level, amt);
				UpdateLevelValues();
				xpToGiveInputField.SetTextWithoutNotify("");
			});
			((UnityEvent<int>)(object)teamDropdown.onValueChanged).AddListener((UnityAction<int>)TeamChanged);
			TeamComponent.onJoinTeamGlobal += TeamJoined;
			disableMobSpawns = ValueWrapper.Get("PlayerMenu", "DisableMobSpawns", defaultValue: false, "");
			disableMobSpawns.settingChanged += MobSpawnsChanged;
			((UnityEvent<bool>)(object)disableMobSpawnToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool val)
			{
				disableMobSpawns.Value = val;
			});
			disableMobSpawns.Sync();
		}

		void IModuleStartup.ModuleEnd()
		{
			disableMobSpawns.settingChanged -= MobSpawnsChanged;
		}

		private void UpdateCheckboxValues()
		{
			godToggle.SetIsOnWithoutNotify(PlayerConfig.GodMode.Value);
			aimbotToggle.SetIsOnWithoutNotify(PlayerConfig.Aimbot.Value);
			noclipToggle.SetIsOnWithoutNotify(PlayerConfig.Noclip.Value);
			infiniteSkillsToggle.SetIsOnWithoutNotify(PlayerConfig.InfiniteSkills.Value);
			alwaysSprintToggle.SetIsOnWithoutNotify(PlayerConfig.AlwaysSprint.Value);
			aimbotWeightSlider.SetValueWithoutNotify(PlayerConfig.AimbotWeight.Value);
		}

		public void SetUser(NetworkUser user)
		{
			if ((Object)(object)currentUser != (Object)null && Object.op_Implicit((Object)(object)currentUser.master))
			{
				currentUser.master.onBodyStart -= SetBody;
			}
			currentUser = user;
			PlayerConfig = playerManager.users[currentUser];
			SwapViewState();
			ownerIsSelected = (Object)(object)currentUser == (Object)(object)info.Owner;
			bodyStats.SetTogglesActive(ownerIsSelected);
			master = currentUser.master;
			UpdateLevelValues();
			if (Object.op_Implicit((Object)(object)master))
			{
				Inventory inventory = master.inventory;
				equipmentIcon.targetInventory = inventory;
				master.onBodyStart += SetBody;
				CharacterBody val = master.GetBody();
				if (Object.op_Implicit((Object)(object)val))
				{
					SetBody(val);
				}
			}
		}

		private void SetBody(CharacterBody bodyIn)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected I4, but got Unknown
			body = bodyIn;
			if (!ownerIsSelected)
			{
				bodyStats.ProfileSelected(0, applyValuesToBody: false);
			}
			buffDisplay.source = body;
			bodyStats.TargetBody = body;
			teamDropdown.SetValueWithoutNotify((int)body.teamComponent.teamIndex);
		}

		private void MobSpawnsChanged()
		{
			disableMobSpawnToggle.SetIsOnWithoutNotify(disableMobSpawns.Value);
			if (!NetworkServer.active)
			{
				return;
			}
			foreach (CombatDirector instances in CombatDirector.instancesList)
			{
				instances.monsterSpawnTimer = (disableMobSpawns.Value ? float.PositiveInfinity : 0f);
			}
		}

		private void TeamJoined(TeamComponent who, TeamIndex team)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected I4, but got Unknown
			if ((Object)(object)who.body == (Object)(object)body)
			{
				teamDropdown.SetValueWithoutNotify((int)team);
			}
		}

		public void SetCurrency(CurrencyType currencyType, string strAmount)
		{
			if (uint.TryParse(strAmount, out var result))
			{
				new CurrencyMessage(master, currencyType, result).SendToServer();
			}
		}

		public void SetXp()
		{
			SetCurrency(CurrencyType.Experience, Mathf.RoundToInt(xpSlider.value).ToString());
			UpdateLevelValues();
		}

		private void OnTeamLevelUp(TeamIndex obj)
		{
			xpSlider.value = TeamManager.instance.GetTeamCurrentLevelExperience((TeamIndex)(sbyte)teamDropdown.value);
			LevelLabel.text = $"Lv : {TeamManager.instance.GetTeamLevel((TeamIndex)(sbyte)teamDropdown.value)}";
		}

		private void UpdateLevelValues()
		{
			LevelLabel.text = $"Lv : {TeamManager.instance.GetTeamLevel((TeamIndex)(sbyte)teamDropdown.value)}";
			xpSlider.minValue = TeamManager.instance.GetTeamCurrentLevelExperience((TeamIndex)(sbyte)teamDropdown.value);
			xpSlider.maxValue = TeamManager.instance.GetTeamNextLevelExperience((TeamIndex)(sbyte)teamDropdown.value);
			xpSlider.value = TeamManager.instance.GetTeamExperience((TeamIndex)(sbyte)teamDropdown.value);
		}

		public void TeamChanged(int team)
		{
			//IL_0017: 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)
			if (Object.op_Implicit((Object)(object)master))
			{
				TeamIndex team2 = (TeamIndex)(sbyte)team;
				new TeamSwitchMessage(master, team2).SendToServer();
				UpdateLevelValues();
			}
		}

		public void SwapViewState(ViewState newState)
		{
			switch (_state)
			{
			case ViewState.Main:
				mainContent.SetActive(false);
				break;
			case ViewState.Inventory:
				((Component)itemContent).gameObject.SetActive(false);
				break;
			case ViewState.Equipment:
				((Component)equipmentContent).gameObject.SetActive(false);
				break;
			case ViewState.Body:
				((Component)bodyContent).gameObject.SetActive(false);
				break;
			case ViewState.Buff:
				((Component)buffContent).gameObject.SetActive(false);
				break;
			default:
				throw new ArgumentOutOfRangeException();
			}
			switch (newState)
			{
			case ViewState.Main:
				mainContent.SetActive(true);
				break;
			case ViewState.Inventory:
				((Component)itemContent).gameObject.SetActive(true);
				itemContent.Initialize(currentUser);
				break;
			case ViewState.Equipment:
				((Component)equipmentContent).gameObject.SetActive(true);
				equipmentContent.Initialize(currentUser);
				break;
			case ViewState.Body:
				((Component)bodyContent).gameObject.SetActive(true);
				bodyContent.Initialize(currentUser);
				break;
			case ViewState.Buff:
				((Component)buffContent).gameObject.SetActive(true);
				buffContent.Initialize(currentUser);
				break;
			default:
				throw new ArgumentOutOfRangeException("newState", newState, null);
			}
			_state = newState;
		}

		public void KillAllMobs()
		{
			new KillAllTeamMessage((TeamIndex)1).SendToServer();
		}

		public void SwapViewState()
		{
			SwapViewState(ViewState.Main);
		}
	}
	public static class NetworkManager
	{
		public static Type[] RegisteredMessages;

		public static void Initialize()
		{
			NetworkManagerSystem.onStartServerGlobal += RegisterMessages;
			NetworkManagerSystem.onStartClientGlobal += RegisterMessages;
			RegisteredMessages = (from x in typeof(AeroltMessageBase).Assembly.GetTypes()
				where typeof(AeroltMessageBase).IsAssignableFrom(x) && x != typeof(AeroltMessageBase)
				select x).ToArray();
		}

		private static void RegisterMessages()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			NetworkServer.RegisterHandler((short)2004, new NetworkMessageDelegate(HandleMessage));
		}

		public static void RegisterMessages(NetworkClient client)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			client.RegisterHandler((short)2004, new NetworkMessageDelegate(HandleMessage));
		}

		private static void HandleMessage(NetworkMessage netmsg)
		{
			AeroltMessage aeroltMessage = netmsg.ReadMessage<AeroltMessage>();
			if (aeroltMessage.message is BroadcastMessage broadcastMessage)
			{
				broadcastMessage.fromConnection = netmsg.conn;
			}
			aeroltMessage.message.Handle();
		}

		public static void SendAerolt<T>(this NetworkConnection connection, T message) where T : AeroltMessageBase
		{
			AeroltMessage aeroltMessage = new AeroltMessage(message);
			connection.Send((short)2004, (MessageBase)(object)aeroltMessage);
		}
	}
	public class AeroltMessageBase : MessageBase
	{
		public virtual void Handle()
		{
		}

		public void SendToServer()
		{
			if (!NetworkServer.active)
			{
				ClientScene.readyConnection.SendAerolt(this);
			}
			else
			{
				Handle();
			}
		}

		public void SendToEveryone()
		{
			Handle();
			new BroadcastMessage(this).SendToServer();
		}

		public void SendToAuthority(NetworkIdentity identity)
		{
			if (!Util.HasEffectiveAuthority(identity) && NetworkServer.active)
			{
				identity.clientAuthorityOwner.SendAerolt(this);
			}
			else if (!NetworkServer.active)
			{
				new NewAuthMessage(identity, this).SendToServer();
			}
			else
			{
				Handle();
			}
		}

		public void SendToAuthority(NetworkUser user)
		{
			SendToAuthority(((NetworkBehaviour)user).netIdentity);
		}

		public void SendToAuthority(CharacterMaster master)
		{
			SendToAuthority(master.networkIdentity);
		}

		public void SendToAuthority(CharacterBody body)
		{
			SendToAuthority(body.networkIdentity);
		}
	}
	public class BroadcastMessage : AeroltMessageBase
	{
		public NetworkConnection fromConnection;

		private AeroltMessageBase message;

		public BroadcastMessage()
		{
		}

		public BroadcastMessage(AeroltMessageBase aeroltMessageBase)
		{
			message = aeroltMessageBase;
		}

		public override void Handle()
		{
			base.Handle();
			foreach (NetworkConnection connection in NetworkServer.connections)
			{
				if (connection != fromConnection && connection.isConnected)
				{
					connection.SendAerolt(message);
				}
			}
			message.Handle();
		}

		public override void Deserialize(NetworkReader reader)
		{
			((MessageBase)this).Deserialize(reader);
			message = reader.ReadMessage<AeroltMessage>().message;
		}

		public override void Serialize(NetworkWriter writer)
		{
			((MessageBase)this).Serialize(writer);
			writer.Write((MessageBase)(object)new AeroltMessage(message));
		}
	}
	public class NewAuthMessage : AeroltMessageBase
	{
		private AeroltMessageBase message;

		private NetworkIdentity target;

		public NewAuthMessage()
		{
		}

		public NewAuthMessage(NetworkIdentity identity, AeroltMessageBase aeroltMessageBase)
		{
			target = identity;
			message = aeroltMessageBase;
		}

		public override void Handle()
		{
			base.Handle();
			message.SendToAuthority(target);
		}

		public override void Deserialize(NetworkReader reader)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Deserialize(reader);
			GameObject val = Util.FindNetworkObject(reader.ReadNetworkId());
			if (Object.op_Implicit((Object)(object)val))
			{
				target = val.GetComponent<NetworkIdentity>();
			}
			message = reader.ReadMessage<AeroltMessage>().message;
		}

		public override void Serialize(NetworkWriter writer)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			((MessageBase)this).Serialize(writer);
			writer.Write(target.netId);
			writer.Write((MessageBase)(object)new AeroltMessage(message));
		}
	}
	internal class AeroltMessage : MessageBase
	{
		public AeroltMessageBase message;

		public uint Type;

		public AeroltMessage()
		{
		}

		public AeroltMessage(AeroltMessageBase aeroltMessageBase)
		{
			message = aeroltMessageBase;
			Type = (uint)Array.IndexOf(NetworkManager.RegisteredMessages, ((object)message).GetType());
		}

		public override void Serialize(NetworkWriter writer)
		{
			((MessageBase)this).Serialize(writer);
			writer.WritePackedUInt32(Type);
			writer.Write((MessageBase)(object)message);
		}

		public override void Deserialize(NetworkReader reader)
		{
			((MessageBase)this).Deserialize(reader);
			Type = reader.ReadPackedUInt32();
			AeroltMessageBase aeroltMessageBase = (AeroltMessageBase)Activator.CreateInstance(NetworkManager.RegisteredMessages[Type]);
			((MessageBase)aeroltMessageBase).Deserialize(reader);
			message = aeroltMessageBase;
		}
	}
	public class PlayerConfigBinding
	{
		public ValueWrapper<bool> Aimbot;

		public ValueWrapper<float> AimbotWeight;

		public ValueWrapper<bool> AlwaysSprint;

		public CustomButton customButton;

		public ValueWrapper<bool> GodMode;

		public ValueWrapper<bool> InfiniteSkills;

		public ValueWrapper<bool> Noclip;

		public ValueWrapper<bool> NoclipInteractForDown;

		private readonly NetworkUser user;

		public PlayerConfigBinding(NetworkUser currentUser, CustomButton button)
		{
			//IL_01df: 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)
			customButton = button;
			user = currentUser;
			AimbotWeight = ValueWrapper.Get("PlayerMenu", "AimbotWeight", 0.5f, "", user);
			AimbotWeight.settingChanged += OnAimbotWeightChanged;
			Aimbot = ValueWrapper.Get("PlayerMenu", "Aimbot", defaultValue: false, "", user);
			Aimbot.settingChanged += OnAimbotChanged;
			InfiniteSkills = ValueWrapper.Get("PlayerMenu", "InfiniteSkills", defaultValue: false, "", user);
			InfiniteSkills.settingChanged += OnInfiniteSkillsChanged;
			AlwaysSprint = ValueWrapper.Get("PlayerMenu", "AlwaysSprint", defaultValue: false, "", user);
			AlwaysSprint.settingChanged += OnAlwaysSprintChanged;
			GodMode = ValueWrapper.Get("PlayerMenu", "GodMode", defaultValue: false, "", user);
			GodMode.settingChanged += OnGodModeChanged;
			Noclip = ValueWrapper.Get("PlayerMenu", "Noclip", defaultValue: false, "", user);
			Noclip.settingChanged += OnNoclipChanged;
			object obj;
			if (!Object.op_Implicit((Object)(object)user) || user.localUser == null)
			{
				obj = "com.Lodington.Aerolt";
			}
			else
			{
				NetworkPlayerName networkPlayerName = user.GetNetworkPlayerName();
				obj = "Aerolt " + ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName();
			}
			string who = (string)obj;
			NoclipInteractForDown = ValueWrapper.Get("PlayerMenu", "NoclipInteractForDown", defaultValue: true, "", user, null, delegate(ZioConfigEntry<bool> config)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				ModSettingsManager.AddOption((BaseOption)new ZioCheckBoxOption(config), who, who);
			});
			NoclipInteractForDown.settingChanged += OnNoclipForInteractDownChanged;
		}

		public void OnDestroy()
		{
			AimbotWeight.settingChanged -= OnAimbotWeightChanged;
			Aimbot.settingChanged -= OnAimbotChanged;
			InfiniteSkills.settingChanged -= OnInfiniteSkillsChanged;
			AlwaysSprint.settingChanged -= OnAlwaysSprintChanged;
			GodMode.settingChanged -= OnGodModeChanged;
			Noclip.settingChanged -= OnNoclipChanged;
			NoclipInteractForDown.settingChanged -= OnNoclipForInteractDownChanged;
		}

		private void OnNoclipForInteractDownChanged()
		{
			if (!Object.op_Implicit((Object)(object)user.master))
			{
				return;
			}
			CharacterBody body = user.master.GetBody();
			if (Object.op_Implicit((Object)(object)body))
			{
				NoclipBehavior component = ((Component)body).GetComponent<NoclipBehavior>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.shouldUseInteractForDown = NoclipInteractForDown.Value;
				}
			}
		}

		private void OnNoclipChanged()
		{
			if (Object.op_Implicit((Object)(object)user.master))
			{
				SetNoclip(user.master.GetBody(), Noclip.Value);
				OnNoclipForInteractDownChanged();
			}
		}

		private void OnGodModeChanged()
		{
			if (Object.op_Implicit((Object)(object)user.master))
			{
				SetGodMode(user.master.GetBody(), GodMode.Value);
			}
		}

		private void OnAlwaysSprintChanged()
		{
			if (Object.op_Implicit((Object)(object)user.master))
			{
				SetAlwaysSprint(user.master.GetBody(), AlwaysSprint.Value);
			}
		}

		private void OnInfiniteSkillsChanged()
		{
			if (Object.op_Implicit((Object)(object)user.master))
			{
				SetInfiniteSkills(user.master.GetBody(), InfiniteSkills.Value);
			}
		}

		private void OnAimbotChanged()
		{
			if (Object.op_Implicit((Object)(object)user.master))
			{
				SetAimbot(user.master.GetBody(), Aimbot.Value, AimbotWeight.Value);
			}
		}

		private void OnAimbotWeightChanged()
		{
			if (Object.op_Implicit((Object)(object)user.master))
			{
				SetAimbotWeight(user.master.GetBody(), AimbotWeight.Value);
			}
		}

		public void Bind(Action updateCheckboxValues)
		{
			AimbotWeight.settingChanged += updateCheckboxValues;
			Aimbot.settingChanged += updateCheckboxValues;
			InfiniteSkills.settingChanged += updateCheckboxValues;
			AlwaysSprint.settingChanged += updat