Decompiled source of Quality Of Lab v1.0.4

QualityLab.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab;
using Il2CppSLZ.Marrow;
using Il2CppSLZ.Marrow.AI;
using Il2CppSLZ.Marrow.Combat;
using Il2CppSLZ.Marrow.Data;
using Il2CppSLZ.Marrow.Interaction;
using Il2CppSLZ.Marrow.Pool;
using Il2CppSLZ.Marrow.PuppetMasta;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSLZ.VRMK;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LabFusion.Data;
using LabFusion.Entities;
using LabFusion.MonoBehaviours;
using LabFusion.Network;
using LabFusion.Network.Serialization;
using LabFusion.Player;
using LabFusion.RPC;
using LabFusion.SDK.Modules;
using LabFusion.Senders;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using Quality_Lab;
using Quality_Lab.Features;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(ModMain), "Quality Of Lab", "2.0.1", "Dynamic Team", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("QualityLab")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QualityLab")]
[assembly: AssemblyTitle("QualityLab")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Quality_Lab
{
	public class ModMain : MelonMod
	{
		public static Instance Log { get; private set; }

		public override void OnInitializeMelon()
		{
			Log = ((MelonBase)this).LoggerInstance;
			Settings.Init();
			Stats.Init();
			ModMenu.Build();
			try
			{
				ModuleManager.RegisterModule<QualityLabFusionModule>();
			}
			catch (Exception ex)
			{
				Log.Warning("Fusion module not registered (LabFusion not installed?): " + ex.Message);
			}
			Hooking.OnLevelLoaded += OnLevelLoaded;
			Hooking.OnLevelUnloaded += OnLevelUnloaded;
			Log.Msg("Quality Of Lab loaded.");
		}

		public override void OnUpdate()
		{
			GodMode.Tick();
			Movement.Tick();
			World.Tick();
			Combat.Tick();
			ObjectScaling.Tick();
			Spawning.Tick();
			Stats.Tick();
			Hud.Tick();
			Hotkeys.Tick();
			WristHud.Tick();
			ServerBrowser.Tick();
			Freecam.Tick();
			Photo.Tick();
			TimeScale.Tick();
		}

		public override void OnFixedUpdate()
		{
			World.FixedTick();
		}

		public override void OnGUI()
		{
			Hud.OnGUI();
		}

		private static void OnLevelLoaded(LevelInfo info)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			KeepInventory.OnLevelLoaded(info);
			World.OnLevelLoaded();
			Hud.OnLevelLoaded();
			HolsterHider.OnLevelLoaded();
			WristHud.OnLevelLoaded();
			Movement.OnLevelLoaded();
			ObjectScaling.OnLevelLoaded();
		}

		private static void OnLevelUnloaded()
		{
			KeepInventory.OnLevelUnloaded();
		}
	}
	public static class ModMenu
	{
		private static readonly Color _teal = new Color(0.2f, 0.8f, 0.8f);

		private static readonly Color _gold = new Color(1f, 0.84f, 0f);

		private static readonly Color _gray = new Color(0.6f, 0.6f, 0.6f);

		private static readonly Color _purple = new Color(0.7f, 0.3f, 1f);

		private static readonly Color _orange = new Color(1f, 0.55f, 0.1f);

		private static readonly Color _blue = new Color(0.3f, 0.6f, 1f);

		private static Page _fusionPlayersPage;

		private static Page _fusionInfoPage;

		private static Page _spawnRecentPage;

		public static void Build()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			Page parent = Page.Root.CreatePage("Quality Of Lab", _teal, 0, true);
			BuildQuickActionsPage(parent);
			BuildPlayerPage(parent);
			BuildMovementPage(parent);
			BuildCombatWorldPage(parent);
			BuildSpawnItemsPage(parent);
			BuildFusionPage(parent);
			BuildDirectorMorePage(parent);
			ModMain.Log.Msg("BoneMenu built.");
		}

		private static void BuildQuickActionsPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Quick Actions", _gold, 0, true);
			obj.CreateFunction("Top Up Health", Color.green, (Action)Combat.TopUpHealth);
			obj.CreateFunction("Top Up Ammo", Color.green, (Action)Combat.TopUpAmmoOnce);
			obj.CreateFunction("Magic Reload", Color.cyan, (Action)Combat.MagicReload);
			obj.CreateFunction("Quick Respawn", Color.red, (Action)Movement.QuickRespawn);
			obj.CreateFunction("Teleport to Aim", Color.green, (Action)Movement.TeleportToReticle);
			BuildQuickActionsMorePage(obj);
		}

		private static void BuildQuickActionsMorePage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("More Quick Actions", _orange, 0, true);
			obj.CreateFunction("Identify Held Item", Color.cyan, (Action)Helpers.Identify);
			obj.CreateFunction("Toggle Slow-Mo", _purple, (Action)TimeScale.ToggleSlowMo);
			obj.CreateFunction("Restore Time Scale", _gray, (Action)TimeScale.Restore);
			obj.CreateFunction("Save Checkpoint 1", Color.green, (Action)delegate
			{
				Checkpoints.Save(0);
			});
			obj.CreateFunction("Restore Checkpoint 1", Color.magenta, (Action)delegate
			{
				Checkpoints.Restore(0);
			});
			obj.CreateFunction("Emergency Stop", Color.red, (Action)Helpers.PanicResetAll);
		}

		private static void BuildPlayerPage(Page parent)
		{
			//IL_0006: 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)
			Page obj = parent.CreatePage("Player", Color.green, 0, true);
			obj.CreateBool("Invincibility (God Mode)", Color.yellow, Settings.GodMode.Value, (Action<bool>)delegate(bool v)
			{
				Settings.GodMode.Value = v;
			});
			BuildKeepInventoryPage(obj);
			BuildAvatarSuitePage(obj);
			BuildHolstersPage(obj);
			BuildItemInspectorPage(obj);
			BuildCheckpointsPage(obj);
		}

		private static void BuildAvatarSuitePage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Avatar", _purple, 0, true);
			BuildAvatarsPage(parent2);
			BuildAvatarScalePage(parent2);
		}

		private static void BuildCheckpointsPage(Page parent)
		{
			//IL_0006: 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_0048: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Checkpoints", _teal, 0, true);
			obj.CreateFunction("Save to Checkpoint 1", Color.green, (Action)delegate
			{
				Checkpoints.Save(0);
			});
			obj.CreateFunction("Restore Checkpoint 1", Color.magenta, (Action)delegate
			{
				Checkpoints.Restore(0);
			});
			BuildCheckpointSlotsPage(obj);
			obj.CreateFunction("Clear All Checkpoints", _gray, (Action)Checkpoints.ClearAll);
			obj.CreateFunction(" - position + health, per-level guarded", _gray, (Action)delegate
			{
			});
		}

		private static void BuildCheckpointSlotsPage(Page parent)
		{
			//IL_0006: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Slots", _teal, 0, true);
			for (int i = 0; i < 5; i++)
			{
				int idx = i;
				Page obj = val.CreatePage($"Checkpoint {idx + 1}", _teal, 0, true);
				obj.CreateFunction("Save Here", Color.green, (Action)delegate
				{
					Checkpoints.Save(idx);
				});
				obj.CreateFunction("Restore", Color.magenta, (Action)delegate
				{
					Checkpoints.Restore(idx);
				});
				obj.CreateFunction("Clear", _gray, (Action)delegate
				{
					Checkpoints.Clear(idx);
				});
			}
		}

		private static void BuildItemInspectorPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Item Inspector", _teal, 0, true);
			obj.CreateFunction("Identify Held Object", Color.cyan, (Action)Helpers.Identify);
			obj.CreateBool("Auto-Identify on Pickup", Color.cyan, Settings.AutoPerception.Value, (Action<bool>)delegate(bool v)
			{
				Settings.AutoPerception.Value = v;
				Settings.Save();
			});
			obj.CreateFunction(" - logs barcode, mass, type for held item", _gray, (Action)delegate
			{
			});
		}

		private static void BuildHolstersPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Holsters", _purple, 0, true);
			obj.CreateFunction("Restore All Holsters", Color.green, (Action)HolsterHider.ResetAll);
			obj.CreateFunction("Conceal All Holsters", _orange, (Action)HolsterHider.HideAll);
			obj.CreateFunction("Re-apply Visibility", Color.cyan, (Action)HolsterHider.ApplyAll);
			BuildHolsterSlotsPage(obj);
		}

		private static void BuildHolsterSlotsPage(Page parent)
		{
			//IL_0006: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Per-Slot Visibility", _purple, 0, true);
			for (int i = 0; i < 8; i++)
			{
				int idx = i;
				string text = HolsterHider.GroupNames[i];
				Page obj = val.CreatePage(text, _purple, 0, true);
				obj.CreateInt("Visibility Mode", Color.cyan, Settings.HolsterVisibility[idx].Value, 1, 0, 2, (Action<int>)delegate(int v)
				{
					HolsterHider.Set(idx, v);
				});
				obj.CreateFunction("Visible", Color.green, (Action)delegate
				{
					HolsterHider.Set(idx, 0);
				});
				obj.CreateFunction("Concealed", _orange, (Action)delegate
				{
					HolsterHider.Set(idx, 1);
				});
				obj.CreateFunction("Disabled", Color.red, (Action)delegate
				{
					HolsterHider.Set(idx, 2);
				});
			}
		}

		private static void BuildKeepInventoryPage(Page parent)
		{
			//IL_0006: 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)
			Page obj = parent.CreatePage("Keep Inventory", _gold, 0, true);
			obj.CreateInt("Active Slot", Color.cyan, Settings.SelectedSlot.Value, 1, 1, 5, (Action<int>)delegate(int v)
			{
				Settings.SelectedSlot.Value = v;
				Settings.Save();
			});
			BuildInventoryQuickActionsPage(obj);
			BuildInventoryToggleablesPage(obj);
			BuildInventoryPerLevelPage(obj);
			BuildInventorySlotsPage(obj);
		}

		private static void BuildInventoryQuickActionsPage(Page parent)
		{
			//IL_0006: 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_0044: 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)
			Page obj = parent.CreatePage("Current Slot Actions", Color.green, 0, true);
			obj.CreateFunction("Capture Current Loadout", Color.green, (Action)KeepInventory.SaveCurrent);
			obj.CreateFunction("Equip Active Slot", Color.magenta, (Action)KeepInventory.ApplyCurrent);
			obj.CreateFunction("Erase Active Slot", _gray, (Action)KeepInventory.ClearCurrent);
		}

		private static void BuildInventoryToggleablesPage(Page parent)
		{
			//IL_0006: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Inventory Behavior", Color.cyan, 0, true);
			obj.CreateBool("Persist Between Levels", Color.cyan, Settings.KeepBetweenLevels.Value, (Action<bool>)delegate(bool v)
			{
				Settings.KeepBetweenLevels.Value = v;
				Settings.Save();
			});
			obj.CreateBool("Restore at Game Launch", Color.cyan, Settings.KeepOnStartup.Value, (Action<bool>)delegate(bool v)
			{
				Settings.KeepOnStartup.Value = v;
				Settings.Save();
			});
			obj.CreateBool("Auto-Capture When Level Ends", Color.cyan, Settings.AutoSaveOnLevelEnd.Value, (Action<bool>)delegate(bool v)
			{
				Settings.AutoSaveOnLevelEnd.Value = v;
				Settings.Save();
			});
			obj.CreateBool("Discard Empty Holsters on Restore", Color.cyan, Settings.StripEmptyHolsters.Value, (Action<bool>)delegate(bool v)
			{
				Settings.StripEmptyHolsters.Value = v;
				Settings.Save();
			});
		}

		private static void BuildInventoryPerLevelPage(Page parent)
		{
			//IL_0006: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Per-Level Loadouts", _purple, 0, true);
			obj.CreateBool("Per-Level Loadouts Active", Color.cyan, Settings.PerLevelLoadouts.Value, (Action<bool>)delegate(bool v)
			{
				Settings.PerLevelLoadouts.Value = v;
				Settings.Save();
			});
			obj.CreateFunction("Assign Slot to Current Level", Color.green, (Action)KeepInventory.BindCurrentLevelToCurrentSlot);
			obj.CreateFunction("Clear All Level Assignments", _gray, (Action)KeepInventory.ClearPerLevelBindings);
		}

		private static void BuildInventorySlotsPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Slots", _gold, 0, true);
			for (int i = 1; i <= 5; i++)
			{
				BuildSlotPage(parent2, i);
			}
		}

		private static void BuildSlotPage(Page parent, int slot)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			string text = $"Slot {slot}: {KeepInventory.GetSlotName(slot)}";
			Page obj = parent.CreatePage(text, _gold, 0, true);
			obj.CreateFunction("Capture to " + KeepInventory.GetSlotName(slot), Color.green, (Action)delegate
			{
				KeepInventory.SaveTo(slot);
			});
			obj.CreateFunction("Equip " + KeepInventory.GetSlotName(slot), Color.magenta, (Action)delegate
			{
				KeepInventory.ApplySlot(slot);
			});
			obj.CreateFunction("Erase " + KeepInventory.GetSlotName(slot), _gray, (Action)delegate
			{
				KeepInventory.ClearSlot(slot);
			});
			obj.CreateFunction("Set as Active Slot", Color.cyan, (Action)delegate
			{
				Settings.SelectedSlot.Value = slot;
				Settings.Save();
			});
		}

		private static void BuildAvatarsPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Avatars", _purple, 0, true);
			obj.CreateFunction("Restore Default Avatar (Ford)", Color.green, (Action)Avatars.ResetToDefault);
			obj.CreateFunction("Random Vanilla Avatar", _orange, (Action)Avatars.RandomVanilla);
			BuildAvatarPresetsPage(obj);
		}

		private static void BuildAvatarPresetsPage(Page parent)
		{
			//IL_0006: 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)
			Page val = parent.CreatePage("Presets", _purple, 0, true);
			(string, string)[] presets = Avatars.Presets;
			for (int i = 0; i < presets.Length; i++)
			{
				(string, string) tuple = presets[i];
				string barcode = tuple.Item2;
				val.CreateFunction(tuple.Item1, Color.yellow, (Action)delegate
				{
					Avatars.SwapToBarcode(barcode);
				});
			}
		}

		private static void BuildAvatarScalePage(Page parent)
		{
			//IL_0006: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Avatar Scale", _purple, 0, true);
			obj.CreateFloat("Avatar Scale", Color.yellow, Settings.AvatarScale.Value, 0.1f, 0.1f, 10f, (Action<float>)delegate(float v)
			{
				Settings.AvatarScale.Value = v;
			});
			obj.CreateFunction("Apply Scale", Color.green, (Action)AvatarScaling.Apply);
			obj.CreateFunction("Restore Default Scale", _gray, (Action)AvatarScaling.Reset);
		}

		private static void BuildMovementPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Movement", _orange, 0, true);
			BuildMovementAirPage(obj);
			BuildMovementTeleportPage(obj);
			obj.CreateFunction("Halt Momentum", Color.cyan, (Action)Movement.StopVelocity);
			obj.CreateFunction("Restore Defaults", _gray, (Action)ResetMovementDefaults);
		}

		private static void BuildMovementAirPage(Page parent)
		{
			//IL_0006: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Air & Jump", Color.cyan, 0, true);
			obj.CreateFloat("Jump Height Multiplier", Color.yellow, Settings.JumpMultiplier.Value, 0.1f, 0.1f, 5f, (Action<float>)delegate(float v)
			{
				Settings.JumpMultiplier.Value = v;
			});
			obj.CreateFunction("Instant Respawn", Color.red, (Action)Movement.QuickRespawn);
		}

		private static void BuildMovementTeleportPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Teleport & Markers", _orange, 0, true);
			obj.CreateFunction("Teleport to Aim Point", Color.green, (Action)Movement.TeleportToReticle);
			obj.CreateFunction("Drop Position Marker", Color.green, (Action)Movement.SavePositionMarker);
			obj.CreateFunction("Return to Marker", Color.magenta, (Action)Movement.TeleportToMarker);
			obj.CreateFunction("Remove Marker", _gray, (Action)Movement.ClearMarker);
			BuildMarkerSlotsPage(obj);
		}

		private static void BuildMarkerSlotsPage(Page parent)
		{
			//IL_0006: 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_0064: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Position Markers A/B/C", _orange, 0, true);
			for (int i = 0; i < 3; i++)
			{
				int slot = i;
				char value = (char)(65 + i);
				Page obj = val.CreatePage($"Marker {value}", _orange, 0, true);
				obj.CreateFunction("Capture Position", Color.green, (Action)delegate
				{
					Movement.SaveMarkerSlot(slot);
				});
				obj.CreateFunction("Travel to Marker", Color.magenta, (Action)delegate
				{
					Movement.TeleportMarkerSlot(slot);
				});
				obj.CreateFunction("Remove Marker", _gray, (Action)delegate
				{
					Movement.ClearMarkerSlot(slot);
				});
			}
		}

		private static void BuildCombatWorldPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Combat & World", Color.red, 0, true);
			BuildCombatSubPage(parent2);
			BuildWorldSubPage(parent2);
			BuildNpcToolsPage(parent2);
			BuildCombatQuickFixPage(parent2);
			BuildTimeScalePage(parent2);
		}

		private static void BuildTimeScalePage(Page parent)
		{
			//IL_0006: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Time Scale", _purple, 0, true);
			obj.CreateBool("Apply Time Scale", Color.cyan, Settings.TimeScaleActive.Value, (Action<bool>)delegate(bool v)
			{
				Settings.TimeScaleActive.Value = v;
				Settings.Save();
			});
			obj.CreateFloat("Time Scale", Color.yellow, Settings.TimeScale.Value, 0.05f, 0.05f, 3f, (Action<float>)delegate(float v)
			{
				Settings.TimeScale.Value = v;
				Settings.Save();
			});
			BuildTimeScalePresetsPage(obj);
			obj.CreateFloat("Slow-Mo Toggle Factor", Color.yellow, Settings.SlowMoFactor.Value, 0.05f, 0.05f, 1f, (Action<float>)delegate(float v)
			{
				Settings.SlowMoFactor.Value = v;
				Settings.Save();
			});
			obj.CreateFunction("Toggle Slow-Mo", _purple, (Action)TimeScale.ToggleSlowMo);
			obj.CreateFunction("Restore (1.00x)", _gray, (Action)TimeScale.Restore);
		}

		private static void BuildTimeScalePresetsPage(Page parent)
		{
			//IL_0006: 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)
			Page val = parent.CreatePage("Presets", _orange, 0, true);
			(string, float)[] presets = TimeScale.Presets;
			for (int i = 0; i < presets.Length; i++)
			{
				(string, float) tuple = presets[i];
				float f = tuple.Item2;
				val.CreateFunction(tuple.Item1, Color.yellow, (Action)delegate
				{
					TimeScale.SetFactor(f);
				});
			}
		}

		private static void BuildCombatSubPage(Page parent)
		{
			//IL_0006: 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_0061: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Combat", Color.red, 0, true);
			obj.CreateFloat("Outgoing Damage Multiplier", Color.yellow, Settings.DamageMultiplier.Value, 0.5f, 0f, 20f, (Action<float>)delegate(float v)
			{
				Settings.DamageMultiplier.Value = v;
			});
			obj.CreateBool("One-Hit Eliminate", Color.yellow, Settings.OneHitKill.Value, (Action<bool>)delegate(bool v)
			{
				Settings.OneHitKill.Value = v;
			});
			obj.CreateBool("Auto-Heal", Color.cyan, Settings.AutoHeal.Value, (Action<bool>)delegate(bool v)
			{
				Settings.AutoHeal.Value = v;
			});
			obj.CreateFloat("Auto-Heal Threshold", Color.cyan, Settings.AutoHealThreshold.Value, 0.05f, 0.05f, 1f, (Action<float>)delegate(float v)
			{
				Settings.AutoHealThreshold.Value = v;
			});
			obj.CreateBool("Unlimited Ammo Reserves", Color.cyan, Settings.InfiniteAmmo.Value, (Action<bool>)delegate(bool v)
			{
				Settings.InfiniteAmmo.Value = v;
			});
			obj.CreateFloat("Incoming Damage Resistance", Color.cyan, Settings.DamageResistance.Value, 0.1f, 0f, 1f, (Action<float>)delegate(float v)
			{
				Settings.DamageResistance.Value = v;
			});
		}

		private static void BuildWorldSubPage(Page parent)
		{
			//IL_0006: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("World Physics", _purple, 0, true);
			obj.CreateFloat("Vertical Gravity", Color.yellow, Settings.GravityY.Value, 0.5f, -30f, 20f, (Action<float>)delegate(float v)
			{
				Settings.GravityY.Value = v;
			});
			obj.CreateFloat("Ragdoll Force Multiplier", Color.yellow, Settings.RagdollForceMul.Value, 0.5f, 0.1f, 10f, (Action<float>)delegate(float v)
			{
				Settings.RagdollForceMul.Value = v;
			});
			obj.CreateFloat("NPC Size Scale", Color.yellow, Settings.NpcScale.Value, 0.1f, 0.1f, 10f, (Action<float>)delegate(float v)
			{
				Settings.NpcScale.Value = v;
			});
			obj.CreateFloat("Explosion & Knockback Force", Color.yellow, Settings.ExplosionForceMul.Value, 0.5f, 0.1f, 20f, (Action<float>)delegate(float v)
			{
				Settings.ExplosionForceMul.Value = v;
			});
		}

		private static void BuildNpcToolsPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("NPC Tools", _orange, 0, true);
			obj.CreateFunction("Detonate at Aim Point", Color.red, (Action)World.ExplodeAtReticle);
			obj.CreateFunction("Repel All NPCs", _orange, (Action)World.PushAllNpcsAway);
			obj.CreateFunction("Summon All NPCs", _orange, (Action)World.PullAllNpcsToMe);
			obj.CreateFunction("Remove Nearest NPC", Color.red, (Action)Helpers.DespawnNearestNpc);
			obj.CreateFunction("Eliminate NPCs (30m)", Color.red, (Action)delegate
			{
				Helpers.KillAllNpcsInRange();
			});
			obj.CreateFunction("Remove NPCs (30m)", Color.red, (Action)delegate
			{
				Helpers.DespawnAllNpcsInRange();
			});
		}

		private static void BuildCombatQuickFixPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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)
			Page obj = parent.CreatePage("Quick Fix-Ups", Color.green, 0, true);
			obj.CreateFunction("Restore Full Health", Color.green, (Action)Combat.TopUpHealth);
			obj.CreateFunction("Refill All Ammo Reserves", Color.green, (Action)Combat.TopUpAmmoOnce);
			obj.CreateFunction("Instantly Reload Held", Color.green, (Action)Combat.MagicReload);
			obj.CreateFunction("Deplete Ammo Reserves", _gray, (Action)Combat.ClearAmmo);
			obj.CreateFunction("Pull Aimed Object to Hand", Color.cyan, (Action)Helpers.PullObjectToHand);
			obj.CreateFunction("Restore Combat Defaults", _gray, (Action)ResetCombatWorldDefaults);
		}

		private static void BuildSpawnItemsPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Spawn & Items", _gold, 0, true);
			BuildQuickSpawnPage(parent2);
			BuildSpawnPresetsPage(parent2);
			BuildSpawnRecentPage(parent2);
			BuildTemplatesWarehousePage(parent2);
			BuildObjectScalePage(parent2);
			BuildClearItemsPage(parent2);
		}

		private static void BuildClearItemsPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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)
			Page obj = parent.CreatePage("Clear Items", Color.red, 0, true);
			obj.CreateFunction("Clear All Items", Color.red, (Action)ClearItems.ClearAll);
			obj.CreateFunction("Clear All Guns", _orange, (Action)ClearItems.ClearGuns);
			obj.CreateFunction("Clear All Melees", _orange, (Action)ClearItems.ClearMelees);
			obj.CreateFunction("Clear All NPCs", Color.yellow, (Action)ClearItems.ClearNpcs);
			obj.CreateFunction("Clear All Props", _gold, (Action)ClearItems.ClearProps);
			obj.CreateFunction(" - host only in Fusion lobbies", _gray, (Action)delegate
			{
			});
		}

		private static void BuildQuickSpawnPage(Page parent)
		{
			//IL_0006: 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_0044: 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)
			Page obj = parent.CreatePage("Quick Spawn", Color.green, 0, true);
			obj.CreateFunction("Respawn Last Held Item", Color.green, (Action)Spawning.SpawnLastHeld);
			obj.CreateFunction("Random Vanilla Preset", _orange, (Action)WarehouseTools.SpawnRandomPreset);
			obj.CreateFunction("Random Item from Warehouse", _orange, (Action)WarehouseTools.SpawnRandomFromWarehouse);
		}

		private static void BuildTemplatesWarehousePage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Templates & Warehouse", _teal, 0, true);
			BuildTemplatesPage(parent2);
			BuildWarehousePage(parent2);
		}

		private static void BuildWarehousePage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Warehouse Tools", _teal, 0, true);
			obj.CreateFunction("Scan Warehouse Counts", Color.cyan, (Action)WarehouseTools.ScanCountsToLog);
			obj.CreateFunction("Print First 200 Barcodes", Color.cyan, (Action)delegate
			{
				WarehouseTools.PrintAllSpawnableBarcodes();
			});
			obj.CreateFunction("Print First 1000 Barcodes", Color.cyan, (Action)delegate
			{
				WarehouseTools.PrintAllSpawnableBarcodes(1000);
			});
			obj.CreateFunction("Random Vanilla Preset", _orange, (Action)WarehouseTools.SpawnRandomPreset);
			obj.CreateFunction("Random Item from Warehouse", _orange, (Action)WarehouseTools.SpawnRandomFromWarehouse);
		}

		private static void BuildTemplatesPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Loadout Templates", _orange, 0, true);
			Templates.Template[] all = Templates.All;
			foreach (Templates.Template template in all)
			{
				Templates.Template template2 = template;
				val.CreateFunction(template2.Name, Color.yellow, (Action)delegate
				{
					Templates.Drop(template2);
				});
			}
		}

		private static void BuildSpawnPresetsPage(Page parent)
		{
			//IL_0006: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Presets", _orange, 0, true);
			BuildPresetCategoryPage(parent2, "Weapons", _blue, new string[4] { "HandgunEder22training", "RifleM1Garand", "RifleMK18HoloForegrip", "MeleeIceAxe" });
			BuildPresetCategoryPage(parent2, "Combatants", Color.red, new string[4] { "NPCCultist", "NPCSecurityGuard", "BulletBanker", "ApolloGiant" });
			BuildPresetCategoryPage(parent2, "Peasants", Color.yellow, new string[7] { "NPCPeasantMaleL", "NPCPeasantMaleM", "NPCPeasantMaleS", "NPCPeasantFemL", "NPCPeasantFemM", "NPCPeasantFemS", "NPCPeasantNull" });
			BuildPresetCategoryPage(parent2, "Apollo & Avatars", _purple, new string[3] { "ApolloGold", "BlueApollo", "ApolloGiant" });
			BuildPresetCategoryPage(parent2, "Throwables", _gold, new string[6] { "BowlingBall", "BowlingPin", "WeightedCube", "BottleMelon", "BottlePill", "SodaCanB" });
			BuildPresetCategoryPage(parent2, "Misc Props", _teal, new string[9] { "DonutBox", "PropHealthPickup", "CombatCrate", "ElectricGuitar", "DestructibleBarrel", "SkeletonSkull", "TargetSnake", "TargetBat", "BoxTurret" });
		}

		private static void BuildPresetCategoryPage(Page parent, string title, Color tint, string[] shortNames)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage(title, tint, 0, true);
			for (int i = 0; i < shortNames.Length; i++)
			{
				(string, string)? tuple = FindPreset(shortNames[i]);
				if (tuple.HasValue)
				{
					string item = tuple.Value.Item1;
					string barcode = tuple.Value.Item2;
					val.CreateFunction(item, Color.yellow, (Action)delegate
					{
						Spawning.SpawnAtReticle(barcode);
					});
				}
			}
		}

		private static (string Name, string Barcode)? FindPreset(string shortName)
		{
			string value = "." + shortName;
			for (int i = 0; i < Spawning.Presets.Length; i++)
			{
				(string, string) value2 = Spawning.Presets[i];
				if (value2.Item2 != null && value2.Item2.EndsWith(value, StringComparison.Ordinal))
				{
					return value2;
				}
			}
			return null;
		}

		private static void BuildSpawnRecentPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			Page obj = (_spawnRecentPage = parent.CreatePage("Recent Spawns", _gold, 0, true));
			obj.CreateFunction("Refresh List", Color.green, (Action)RefreshRecentSpawns);
			obj.CreateFunction("Clear History", _gray, (Action)Spawning.ClearRecent);
		}

		private static void RefreshRecentSpawns()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			Page spawnRecentPage = _spawnRecentPage;
			if (spawnRecentPage == null)
			{
				return;
			}
			try
			{
				spawnRecentPage.RemoveAll();
			}
			catch
			{
				return;
			}
			spawnRecentPage.CreateFunction("Refresh List", Color.green, (Action)RefreshRecentSpawns);
			spawnRecentPage.CreateFunction("Clear History", _gray, (Action)Spawning.ClearRecent);
			IReadOnlyList<string> recentList = Spawning.RecentList;
			if (recentList.Count == 0)
			{
				spawnRecentPage.CreateFunction("(no recent spawns)", _gray, (Action)delegate
				{
				});
				return;
			}
			foreach (string item in recentList)
			{
				string bc = item;
				string text = ShortBarcode(bc);
				spawnRecentPage.CreateFunction(text, Color.yellow, (Action)delegate
				{
					Spawning.SpawnAtReticle(bc);
				});
			}
		}

		private static string ShortBarcode(string barcode)
		{
			if (string.IsNullOrEmpty(barcode))
			{
				return "?";
			}
			int num = barcode.LastIndexOf('.');
			if (num <= 0 || num >= barcode.Length - 1)
			{
				return barcode;
			}
			return barcode.Substring(num + 1);
		}

		private static void BuildObjectScalePage(Page parent)
		{
			//IL_0006: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Object Scale", _purple, 0, true);
			obj.CreateFloat("Object Scale Factor", Color.yellow, Settings.ObjectScale.Value, 0.1f, 0.1f, 10f, (Action<float>)delegate(float v)
			{
				Settings.ObjectScale.Value = v;
			});
			obj.CreateBool("Scale Objects on Pickup", Color.cyan, Settings.ScaleOnPickup.Value, (Action<bool>)delegate(bool v)
			{
				Settings.ScaleOnPickup.Value = v;
			});
			BuildScaleHeldPage(obj);
			BuildScaleFreezePage(obj);
			BuildScaleMemoryPage(obj);
		}

		private static void BuildScaleHeldPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Scale Held Object", Color.green, 0, true);
			obj.CreateFunction("Scale Left-Hand Object", Color.green, (Action)ObjectScaling.ScaleLeft);
			obj.CreateFunction("Scale Right-Hand Object", Color.green, (Action)ObjectScaling.ScaleRight);
			obj.CreateFunction("Scale Both Held Objects", Color.green, (Action)ObjectScaling.ScaleBoth);
			obj.CreateFunction("Restore Held Size", _gray, (Action)ObjectScaling.ResetHeld);
		}

		private static void BuildScaleFreezePage(Page parent)
		{
			//IL_0006: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Freeze / Unfreeze", Color.cyan, 0, true);
			obj.CreateFunction("Freeze Held Object", Color.cyan, (Action)ObjectScaling.FreezeHeld);
			obj.CreateFunction("Unfreeze All Objects", _gray, (Action)ObjectScaling.UnfreezeAll);
		}

		private static void BuildScaleMemoryPage(Page parent)
		{
			//IL_0006: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Remembered Scales", _purple, 0, true);
			obj.CreateBool("Remember Scales This Session", Color.cyan, Settings.RememberBarcodeScales.Value, (Action<bool>)delegate(bool v)
			{
				Settings.RememberBarcodeScales.Value = v;
				Settings.Save();
			});
			obj.CreateFunction("Forget Remembered Scales", _gray, (Action)ObjectScaling.ClearAllBarcodeScales);
		}

		private static void BuildFusionPage(Page parent)
		{
			//IL_0006: 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)
			Page obj = parent.CreatePage("Fusion", _blue, 0, true);
			obj.CreateFunction("Refresh Fusion Status", Color.cyan, (Action)RefreshFusionStatusHeader);
			BuildFusionQuickActionsPage(obj);
			BuildFusionLobbyInfoPage(obj);
			BuildFusionPlayersPage(obj);
			BuildFusionHostAndModesPage(obj);
			BuildFusionMultiplayerToolsPage(obj);
		}

		private static void BuildFusionQuickActionsPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Quick Actions", Color.green, 0, true);
			obj.CreateFunction("Travel to Host", Color.green, (Action)Fusion.TeleportToHost);
			obj.CreateFunction("Summon All Players (Host)", Color.green, (Action)Fusion.TeleportAllToMe);
			obj.CreateFunction("Duplicate Left-Hand Object", _orange, (Action)Fusion.CloneHeldLeft);
			obj.CreateFunction("Duplicate Right-Hand Object", _orange, (Action)Fusion.CloneHeldRight);
		}

		private static void BuildFusionLobbyInfoPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			_fusionInfoPage = parent.CreatePage("Lobby Info", _teal, 0, true);
			RebuildFusionLobbyInfoPage();
		}

		private static void RebuildFusionLobbyInfoPage()
		{
			//IL_001c: 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)
			Page fusionInfoPage = _fusionInfoPage;
			if (fusionInfoPage != null)
			{
				try
				{
					fusionInfoPage.RemoveAll();
				}
				catch
				{
					return;
				}
				fusionInfoPage.CreateFunction("Refresh", Color.green, (Action)RebuildFusionLobbyInfoPage);
				if (!Fusion.HasServer)
				{
					fusionInfoPage.CreateFunction("(offline — not currently in a lobby)", _gray, (Action)delegate
					{
					});
					return;
				}
				BuildFusionLobbyInfoDetailsSub(fusionInfoPage);
				BuildFusionLobbyInfoLoggingSub(fusionInfoPage);
			}
		}

		private static void BuildFusionLobbyInfoDetailsSub(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Details", _teal, 0, true);
			obj.CreateFunction("Status  : " + Fusion.LobbySummary(), _gray, (Action)delegate
			{
			});
			obj.CreateFunction("Name    : " + Trunc(Fusion.LobbyName(), 40), _gray, (Action)delegate
			{
			});
			obj.CreateFunction("Host    : " + Trunc(Fusion.LobbyHostName(), 40), _gray, (Action)delegate
			{
			});
			obj.CreateFunction("Code    : " + Trunc(Fusion.LobbyCode(), 40), _gray, (Action)delegate
			{
			});
			obj.CreateFunction("Level   : " + Trunc(Fusion.LevelTitle(), 40), _gray, (Action)delegate
			{
			});
			obj.CreateFunction($"Players : {Fusion.PlayerCount} / {Fusion.MaxPlayers()}    Privacy: {Fusion.PrivacyString()}", _gray, (Action)delegate
			{
			});
		}

		private static void BuildFusionLobbyInfoLoggingSub(Page parent)
		{
			//IL_0006: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Print to Log", Color.cyan, 0, true);
			obj.CreateFunction("Print Full Lobby Info", Color.cyan, (Action)Fusion.PrintFullLobbyInfo);
			obj.CreateFunction("Print Lobby Settings", Color.cyan, (Action)Fusion.PrintLobbySettings);
		}

		private static string Trunc(string s, int max)
		{
			if (string.IsNullOrEmpty(s))
			{
				return "(none)";
			}
			if (s.Length > max)
			{
				return s.Substring(0, max - 1) + "…";
			}
			return s;
		}

		private static void RefreshFusionStatusHeader()
		{
			Notifications.Info("Fusion: " + Fusion.LobbySummary());
			RebuildFusionLobbyInfoPage();
		}

		private static void BuildFusionHostAndModesPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Host Settings", Color.yellow, 0, true);
			BuildFusionHostTogglesPage(parent2);
			BuildFusionHostCyclesPage(parent2);
			BuildFusionHostPresetsPage(parent2);
		}

		private static void BuildFusionHostTogglesPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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)
			Page obj = parent.CreatePage("Host Toggles", Color.yellow, 0, true);
			obj.CreateFunction("Toggle Name Tags", Color.yellow, (Action)Fusion.ToggleNameTags);
			obj.CreateFunction("Toggle Player Mortality", Color.yellow, (Action)Fusion.ToggleMortality);
			obj.CreateFunction("Toggle Friendly Fire", Color.yellow, (Action)Fusion.ToggleFriendlyFire);
			obj.CreateFunction("Toggle Knockout", Color.yellow, (Action)Fusion.ToggleKnockout);
			obj.CreateFunction("Toggle Player Constraining", Color.yellow, (Action)Fusion.TogglePlayerConstraining);
		}

		private static void BuildFusionHostCyclesPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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)
			Page obj = parent.CreatePage("Host Cycles", _orange, 0, true);
			obj.CreateFunction("Cycle Player Capacity", _orange, (Action)Fusion.CycleMaxPlayers);
			obj.CreateFunction("Cycle Privacy Setting", _orange, (Action)Fusion.CyclePrivacy);
			obj.CreateFunction("Cycle Teleport Permissions", _orange, (Action)Fusion.CycleTeleportationPermission);
			obj.CreateFunction("Cycle Kick Permissions", _orange, (Action)Fusion.CycleKickingPermission);
			obj.CreateFunction("Cycle Dev Tools Permissions", _orange, (Action)Fusion.CycleDevToolsPermission);
		}

		private static void BuildFusionHostPresetsPage(Page parent)
		{
			//IL_0006: 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_0044: 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)
			Page obj = parent.CreatePage("Lobby Presets", _purple, 0, true);
			obj.CreateFunction("Vanilla Defaults", Color.green, (Action)Fusion.ResetLobbyDefaults);
			obj.CreateFunction("Sandbox Configuration", Color.cyan, (Action)Fusion.ResetLobbySandboxFriendly);
			obj.CreateFunction("PvP — Friendly Fire + Mortality", Color.red, (Action)Fusion.ResetLobbyPvP);
		}

		private static void BuildFusionMultiplayerToolsPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Multiplayer Tools", _orange, 0, true);
			BuildFusionTeleportPage(parent2);
			BuildFusionServerBrowserPage(parent2);
			BuildFusionLoadoutSyncPage(parent2);
		}

		private static void BuildFusionTeleportPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Teleport Tools", _orange, 0, true);
			obj.CreateFunction("Travel to Host", Color.green, (Action)Fusion.TeleportToHost);
			obj.CreateFunction("Travel to Next Player", Color.green, (Action)Fusion.TeleportToNextPlayer);
			obj.CreateFunction("Travel to Previous Player", Color.green, (Action)Fusion.TeleportToPreviousPlayer);
			obj.CreateFunction("Summon All Players (Host)", _orange, (Action)Fusion.TeleportAllToMe);
		}

		private static void BuildFusionServerBrowserPage(Page parent)
		{
			//IL_0006: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Server Browser", _gold, 0, true);
			obj.CreateFunction("Save Current as Favorite", Color.green, (Action)delegate
			{
				ServerBrowser.SaveCurrentTo(Mathf.Clamp(Settings.SelectedSlot.Value - 1, 0, 4));
			});
			obj.CreateFunction("Rejoin Previous Lobby", Color.green, (Action)ServerBrowser.RejoinLast);
			obj.CreateFunction("Print Favorites to Log", Color.cyan, (Action)ServerBrowser.PrintFavoritesToLog);
			BuildFusionFavoritesSlotsPage(obj);
		}

		private static void BuildFusionFavoritesSlotsPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Favorites Slots", _gold, 0, true);
			for (int i = 0; i < 5; i++)
			{
				int slot = i;
				string value = Settings.FavoriteName[slot].Value ?? $"Favorite {slot + 1}";
				bool flag = string.IsNullOrEmpty(Settings.FavoriteCode[slot].Value);
				Page obj = val.CreatePage($"Favorite {slot + 1}: {value}{(flag ? " (unassigned)" : "")}", _gold, 0, true);
				obj.CreateFunction("Join This Lobby", Color.green, (Action)delegate
				{
					ServerBrowser.JoinSlot(slot);
				});
				obj.CreateFunction("Assign Current Lobby Here", Color.cyan, (Action)delegate
				{
					ServerBrowser.SaveCurrentTo(slot);
				});
				obj.CreateFunction("Clear Slot", _gray, (Action)delegate
				{
					ServerBrowser.ClearSlot(slot);
				});
			}
		}

		private static void BuildFusionLoadoutSyncPage(Page parent)
		{
			//IL_0006: 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)
			Page obj = parent.CreatePage("Loadout Sync", _orange, 0, true);
			obj.CreateFunction("Open Loadout Folder", Color.cyan, (Action)LoadoutSync.OpenFolder);
			BuildFusionLoadoutSyncSlotsPage(obj);
		}

		private static void BuildFusionLoadoutSyncSlotsPage(Page parent)
		{
			//IL_0006: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Slots", _orange, 0, true);
			for (int i = 1; i <= 5; i++)
			{
				int slot = i;
				Page obj = val.CreatePage($"Slot {slot}: {KeepInventory.GetSlotName(slot)}", _orange, 0, true);
				obj.CreateFunction("Copy to Clipboard", Color.green, (Action)delegate
				{
					LoadoutSync.ExportToClipboard(slot);
				});
				obj.CreateFunction("Export to File", Color.green, (Action)delegate
				{
					LoadoutSync.ExportToFile(slot);
				});
				obj.CreateFunction("Paste from Clipboard", Color.magenta, (Action)delegate
				{
					LoadoutSync.ImportFromClipboard(slot);
				});
				obj.CreateFunction("Import from File", Color.magenta, (Action)delegate
				{
					LoadoutSync.ImportFromFile(slot);
				});
				obj.CreateFunction("Announce Shared Loadout", _gold, (Action)delegate
				{
					LoadoutSync.AnnounceExport(slot);
				});
			}
		}

		private static void BuildFusionPlayersPage(Page parent)
		{
			//IL_0006: 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)
			(_fusionPlayersPage = parent.CreatePage("Players", _blue, 0, true)).CreateFunction("Refresh Player List", Color.green, (Action)RefreshFusionPlayers);
		}

		private static void RefreshFusionPlayers()
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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)
			Page fusionPlayersPage = _fusionPlayersPage;
			if (fusionPlayersPage == null)
			{
				return;
			}
			try
			{
				fusionPlayersPage.RemoveAll();
			}
			catch (Exception ex)
			{
				ModMain.Log.Warning("Player list rebuild failed: " + ex.Message);
				return;
			}
			fusionPlayersPage.CreateFunction("Refresh Player List", Color.green, (Action)RefreshFusionPlayers);
			if (!Fusion.HasServer)
			{
				fusionPlayersPage.CreateFunction("Not currently in a lobby.", _gray, (Action)delegate
				{
				});
				return;
			}
			List<Fusion.PlayerEntry> players = Fusion.GetPlayers();
			if (players.Count == 0)
			{
				fusionPlayersPage.CreateFunction("(no players detected)", _gray, (Action)delegate
				{
				});
				return;
			}
			foreach (Fusion.PlayerEntry item in players)
			{
				string text = Fusion.FormatPlayerLabel(item);
				byte smallID = item.SmallID;
				bool isLocal = item.IsLocal;
				Page parent = fusionPlayersPage.CreatePage(text, _blue, 0, true);
				BuildOnePlayerInfoPage(parent, item, smallID, isLocal);
				if (!isLocal)
				{
					BuildOnePlayerActionsPage(parent, smallID);
				}
			}
			ModMain.Log.Msg($"Players refreshed: {players.Count}.");
		}

		private static void BuildOnePlayerInfoPage(Page parent, Fusion.PlayerEntry p, byte sid, bool isLocal)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Info", _gray, 0, true);
			val.CreateFunction("Username: " + p.Username, _gray, (Action)delegate
			{
			});
			if (!string.IsNullOrEmpty(p.Nickname))
			{
				val.CreateFunction("Nickname: " + p.Nickname, _gray, (Action)delegate
				{
				});
			}
			val.CreateFunction($"Player ID: {sid}", _gray, (Action)delegate
			{
			});
			if (p.IsHost)
			{
				val.CreateFunction("Role: Host", _gold, (Action)delegate
				{
				});
			}
			if (isLocal)
			{
				val.CreateFunction("Role: You", _teal, (Action)delegate
				{
				});
			}
		}

		private static void BuildOnePlayerActionsPage(Page parent, byte sid)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Actions", Color.green, 0, true);
			obj.CreateFunction("Travel to Player", Color.green, (Action)delegate
			{
				Fusion.TeleportToPlayer(sid);
			});
			obj.CreateFunction("Summon Player (Host)", _orange, (Action)delegate
			{
				Fusion.BringPlayer(sid);
			});
		}

		private static void BuildDirectorMorePage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Director & More", _purple, 0, true);
			BuildCinematicsPage(parent2);
			BuildHudPage(parent2);
			BuildHotkeysPage(parent2);
			BuildProfilesAndAboutPage(parent2);
		}

		private static void BuildCinematicsPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Cinematics", _purple, 0, true);
			BuildFreecamPage(parent2);
			BuildCinematicPhotoPage(parent2);
		}

		private static void BuildFreecamPage(Page parent)
		{
			//IL_0006: 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_0052: 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_00c7: 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)
			Page obj = parent.CreatePage("Freecam", _blue, 0, true);
			obj.CreateBool("Freecam Active", Color.cyan, Settings.FreecamEnabled.Value, (Action<bool>)delegate(bool v)
			{
				if (v)
				{
					Freecam.Start();
				}
				else
				{
					Freecam.Stop();
				}
			});
			obj.CreateFloat("Camera Speed (m/s)", Color.yellow, Settings.FreecamSpeed.Value, 0.5f, 0.5f, 25f, (Action<float>)delegate(float v)
			{
				Settings.FreecamSpeed.Value = v;
				Settings.Save();
			});
			obj.CreateFunction("Toggle Freecam", Color.green, (Action)Freecam.Toggle);
			obj.CreateFunction(" - R-stick: translate, L-stick: rotate", _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - A: ascend, B: descend", _gray, (Action)delegate
			{
			});
		}

		private static void BuildCinematicPhotoPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Cinematic Photo", _teal, 0, true);
			obj.CreateFunction("Capture Now", Color.green, (Action)Photo.TakeScreenshot);
			obj.CreateFunction("Capture After Countdown", Color.cyan, (Action)delegate
			{
				Photo.StartCountdown(Settings.PhotoCountdownSecs.Value);
			});
			obj.CreateFunction("Burst Capture", _orange, (Action)delegate
			{
				Photo.StartBurst(Settings.PhotoBurstCount.Value);
			});
			obj.CreateFunction("Open Screenshot Folder", Color.cyan, (Action)Photo.OpenPhotoFolder);
			BuildCinematicPhotoOptionsPage(obj);
		}

		private static void BuildCinematicPhotoOptionsPage(Page parent)
		{
			//IL_0006: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Options", Color.cyan, 0, true);
			obj.CreateBool("Capture at 2x Resolution", Color.cyan, Settings.PhotoSupersize.Value, (Action<bool>)delegate(bool v)
			{
				Settings.PhotoSupersize.Value = v;
				Settings.Save();
			});
			obj.CreateBool("Hide HUD During Countdown", Color.cyan, Settings.PhotoHideHud.Value, (Action<bool>)delegate(bool v)
			{
				Settings.PhotoHideHud.Value = v;
				Settings.Save();
			});
			obj.CreateInt("Countdown Duration (s)", Color.yellow, Settings.PhotoCountdownSecs.Value, 1, 1, 10, (Action<int>)delegate(int v)
			{
				Settings.PhotoCountdownSecs.Value = v;
				Settings.Save();
			});
			obj.CreateInt("Burst Image Count", Color.yellow, Settings.PhotoBurstCount.Value, 1, 2, 12, (Action<int>)delegate(int v)
			{
				Settings.PhotoBurstCount.Value = v;
				Settings.Save();
			});
		}

		private static void BuildHudPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("HUD", _teal, 0, true);
			BuildHudOverlaysPage(obj);
			obj.CreateBool("In-VR Wrist HUD", Color.cyan, Settings.WristHudEnabled.Value, (Action<bool>)delegate(bool v)
			{
				Settings.WristHudEnabled.Value = v;
				Settings.Save();
			});
			BuildHudStatsPage(obj);
			obj.CreateFunction("Restore HUD Defaults", _gray, (Action)ResetHudDefaults);
		}

		private static void BuildHudOverlaysPage(Page parent)
		{
			//IL_0006: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Overlays", Color.cyan, 0, true);
			obj.CreateBool("Performance Stats Overlay", Color.cyan, Settings.StatsOverlay.Value, (Action<bool>)delegate(bool v)
			{
				Settings.StatsOverlay.Value = v;
				Settings.Save();
			});
			obj.CreateBool("Display Lobby Info Banner", Color.cyan, Settings.ShowLobbyInfo.Value, (Action<bool>)delegate(bool v)
			{
				Settings.ShowLobbyInfo.Value = v;
				Settings.Save();
			});
			obj.CreateBool("On-Screen Crosshair", Color.cyan, Settings.Crosshair.Value, (Action<bool>)delegate(bool v)
			{
				Settings.Crosshair.Value = v;
				Settings.Save();
			});
		}

		private static void BuildHudStatsPage(Page parent)
		{
			//IL_0006: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Session Stats", _gray, 0, true);
			obj.CreateFunction("Print Stats to Log", Color.cyan, (Action)PrintStatsToLog);
			obj.CreateFunction("Clear Session Stats", _gray, (Action)Stats.Reset);
			obj.CreateFunction(" - " + Stats.FormatCombatSummary(), _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - " + Stats.FormatSummary(), _gray, (Action)delegate
			{
			});
		}

		private static void PrintStatsToLog()
		{
			ModMain.Log.Msg("---- Quality Of Lab stats ----");
			ModMain.Log.Msg("  " + Stats.FormatSummary());
			ModMain.Log.Msg("  " + Stats.FormatCombatSummary());
		}

		private static void BuildHotkeysPage(Page parent)
		{
			//IL_0006: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Hotkeys", _orange, 0, true);
			for (int i = 0; i < 4; i++)
			{
				BuildOneHotkeyPage(val, i);
			}
			val.CreateFunction("Clear All Hotkey Bindings", _gray, (Action)ResetHotkeys);
			val.CreateFunction("Print Hotkey Reference", Color.yellow, (Action)PrintHotkeyReference);
		}

		private static void BuildOneHotkeyPage(Page parent, int slotIdx)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: 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)
			int value = slotIdx + 1;
			int value2 = Settings.HotkeyTrigger[slotIdx].Value;
			int value3 = Settings.HotkeyAction[slotIdx].Value;
			string text = $"Hotkey {value}: {Hotkeys.TriggerName(value2)} -> {Hotkeys.ActionName(value3)}";
			Page obj = parent.CreatePage(text, _orange, 0, true);
			int idx = slotIdx;
			HotkeyTriggerKind value4 = (HotkeyTriggerKind)Settings.HotkeyTrigger[idx].Value;
			HotkeyActionKind value5 = (HotkeyActionKind)Settings.HotkeyAction[idx].Value;
			obj.CreateEnum("Trigger", Color.cyan, (Enum)value4, (Action<Enum>)delegate(Enum v)
			{
				Settings.HotkeyTrigger[idx].Value = (int)(HotkeyTriggerKind)(object)v;
				Settings.Save();
			});
			obj.CreateEnum("Action", Color.cyan, (Enum)value5, (Action<Enum>)delegate(Enum v)
			{
				Settings.HotkeyAction[idx].Value = (int)(HotkeyActionKind)(object)v;
				Settings.Save();
			});
			obj.CreateFunction("Clear This Binding", _gray, (Action)delegate
			{
				Settings.HotkeyTrigger[idx].Value = 0;
				Settings.HotkeyAction[idx].Value = 0;
				Settings.Save();
			});
		}

		private static void PrintHotkeyReference()
		{
			ModMain.Log.Msg("--- Hotkey Triggers ---");
			for (int i = 0; i < 5; i++)
			{
				ModMain.Log.Msg($"  {i} = {Hotkeys.TriggerName(i)}");
			}
			ModMain.Log.Msg("--- Hotkey Actions ---");
			for (int j = 0; j < 58; j++)
			{
				ModMain.Log.Msg($"  {j} = {Hotkeys.ActionName(j)}");
			}
		}

		private static void BuildProfilesAndAboutPage(Page parent)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Page parent2 = parent.CreatePage("Profiles & About", _gray, 0, true);
			BuildProfilesPage(parent2);
			BuildAboutPage(parent2);
			BuildEmergencyPage(parent2);
		}

		private static void BuildProfilesPage(Page parent)
		{
			//IL_0006: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			Page val = parent.CreatePage("Profiles", _blue, 0, true);
			for (int i = 1; i <= 3; i++)
			{
				int slot = i;
				string text = $"Profile {slot}: {Profiles.GetName(slot)}{(Profiles.HasData(slot) ? "" : " (unassigned)")}";
				Page obj = val.CreatePage(text, _blue, 0, true);
				obj.CreateFunction("Save Current Settings to Profile", Color.green, (Action)delegate
				{
					Profiles.SaveTo(slot);
				});
				obj.CreateFunction("Load Profile", Color.magenta, (Action)delegate
				{
					Profiles.LoadFrom(slot);
				});
				obj.CreateFunction("Erase Profile", _gray, (Action)delegate
				{
					Profiles.Clear(slot);
				});
			}
		}

		private static void BuildAboutPage(Page parent)
		{
			//IL_0006: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("About", _teal, 0, true);
			obj.CreateFunction("Quality Of Lab v2.0.1", Color.white, (Action)delegate
			{
			});
			obj.CreateFunction("by Dynamic Team", _gray, (Action)delegate
			{
			});
			BuildAboutFeaturesPage(obj);
			BuildAboutLogToolsPage(obj);
			obj.CreateFunction("Print Version Info to Log", Color.green, (Action)PrintAbout);
		}

		private static void BuildAboutFeaturesPage(Page parent)
		{
			//IL_0006: 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_004e: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("Features", _teal, 0, true);
			obj.CreateFunction(" - Player suite + 5-slot Keep Inventory", _gray, (Action)delegate
			{
			});
			BuildAboutFeaturesMorePage(obj);
			obj.CreateFunction(" - Spawn presets + Templates + Warehouse", _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - Fusion: lobby + browser + loadout sync", _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - Director: Freecam + Photo", _gray, (Action)delegate
			{
			});
		}

		private static void BuildAboutFeaturesMorePage(Page parent)
		{
			//IL_0006: 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_0048: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			Page obj = parent.CreatePage("More Features", _teal, 0, true);
			obj.CreateFunction(" - Time Scale + Checkpoints", _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - Categorised spawn presets + combat stats", _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - Movement: jump / teleport / markers", _gray, (Action)delegate
			{
			});
			obj.CreateFunction(" - Combat + World physics, NPC tools", _gray, (Action)delegate
			{
			});
		}

		private static void BuildAboutLogToolsPage(Page parent)
		{
			//IL_0006: 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_0044: 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)
			Page obj = parent.CreatePage("Log Tools", Color.cyan, 0, true);
			obj.CreateFunction("Print Settings Snapshot to Log", Color.cyan, (Action)Helpers.PrintSettingsSnapshot);
			obj.CreateFunction("Print Recent Activity to Log", Color.cyan, (Action)Notifications.PrintRecentToLog);
			obj.CreateFunction("Clear Activity Log", _gray, (Action)Notifications.Clear);
		}

		private static void BuildEmergencyPage(Page parent)
		{
			//IL_0006: 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_0044: 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)
			Page obj = parent.CreatePage("Emergency Stop / Reset", Color.red, 0, true);
			obj.CreateFunction("Emergency Stop — Disable All Effects", Color.red, (Action)Helpers.PanicResetAll);
			obj.CreateFunction("Restore All Toggles to Default", _gray, (Action)ResetAll);
			obj.CreateFunction("Clear All Hotkey Bindings", _gray, (Action)ResetHotkeys);
		}

		private static void PrintAbout()
		{
			ModMain.Log.Msg("==== Quality Of Lab v2.0.1 ====");
			ModMain.Log.Msg("by Dynamic Team");
			ModMain.Log.Msg("Root pages (7): Quick Actions / Player / Movement / Combat & World / Spawn & Items / Fusion / Director & More");
			ModMain.Log.Msg($"Loadout slots: {5}");
			ModMain.Log.Msg($"Checkpoint slots: {5}");
			ModMain.Log.Msg($"Hotkey slots: {4}");
			ModMain.Log.Msg($"Hotkey actions: {58}");
			ModMain.Log.Msg("Time scale: " + TimeScale.Status());
			ModMain.Log.Msg("Fusion lobby: " + Fusion.LobbySummary());
		}

		private static void ResetCombatWorldDefaults()
		{
			Settings.DamageMultiplier.Value = 1f;
			Settings.OneHitKill.Value = false;
			Settings.AutoHeal.Value = false;
			Settings.AutoHealThreshold.Value = 0.5f;
			Settings.InfiniteAmmo.Value = false;
			Settings.DamageResistance.Value = 0f;
			Settings.GravityY.Value = -9.81f;
			Settings.RagdollForceMul.Value = 1f;
			Settings.NpcScale.Value = 1f;
			Settings.ExplosionForceMul.Value = 1f;
			Settings.Save();
			ModMain.Log.Msg("Quality Of Lab: combat & world defaults restored.");
		}

		private static void ResetMovementDefaults()
		{
			Settings.JumpMultiplier.Value = 1f;
			Settings.Save();
			ModMain.Log.Msg("Quality Of Lab: movement defaults restored.");
		}

		private static void ResetHudDefaults()
		{
			Settings.StatsOverlay.Value = false;
			Settings.Crosshair.Value = false;
			Settings.ShowLobbyInfo.Value = false;
			Settings.WristHudEnabled.Value = false;
			Settings.Save();
			ModMain.Log.Msg("Quality Of Lab: HUD defaults restored.");
		}

		private static void ResetHotkeys()
		{
			for (int i = 0; i < 4; i++)
			{
				Settings.HotkeyTrigger[i].Value = 0;
				Settings.HotkeyAction[i].Value = 0;
			}
			Settings.Save();
			ModMain.Log.Msg("Quality Of Lab: hotkeys cleared.");
		}

		private static void ResetAll()
		{
			Settings.GodMode.Value = false;
			Settings.KeepBetweenLevels.Value = false;
			Settings.KeepOnStartup.Value = false;
			Settings.AutoSaveOnLevelEnd.Value = false;
			Settings.StripEmptyHolsters.Value = true;
			Settings.AvatarScale.Value = 1f;
			Settings.ObjectScale.Value = 1f;
			Settings.ScaleOnPickup.Value = false;
			Settings.JumpMultiplier.Value = 1f;
			Settings.HasPositionMarker.Value = false;
			Settings.GravityY.Value = -9.81f;
			Settings.RagdollForceMul.Value = 1f;
			Settings.NpcScale.Value = 1f;
			Settings.DamageMultiplier.Value = 1f;
			Settings.OneHitKill.Value = false;
			Settings.AutoHeal.Value = false;
			Settings.AutoHealThreshold.Value = 0.5f;
			Settings.InfiniteAmmo.Value = false;
			Settings.DamageResistance.Value = 0f;
			Settings.StatsOverlay.Value = false;
			Settings.Crosshair.Value = false;
			Settings.ShowLobbyInfo.Value = false;
			Settings.ExplosionForceMul.Value = 1f;
			Settings.FrictionMul.Value = 1f;
			Settings.BouncinessAdd.Value = 0f;
			Settings.WristHudEnabled.Value = false;
			Settings.TimeScaleActive.Value = false;
			Settings.TimeScale.Value = 1f;
			for (int i = 0; i < 4; i++)
			{
				Settings.HotkeyTrigger[i].Value = 0;
				Settings.HotkeyAction[i].Value = 0;
			}
			Settings.Save();
			ModMain.Log.Msg("Quality Of Lab: settings reset.");
		}
	}
	public static class Settings
	{
		public const string Category = "QualityLab";

		public const int LoadoutSlotCount = 5;

		public const int HotkeySlotCount = 4;

		public const int HolsterCount = 8;

		public const int ProfileSlotCount = 3;

		public const int FavoriteCodeCount = 5;

		public const int CheckpointCount = 5;

		public const int MarkerSlotCount = 3;

		public static MelonPreferences_Category Cat { get; private set; }

		public static MelonPreferences_Entry<bool> GodMode { get; private set; }

		public static MelonPreferences_Entry<bool> KeepBetweenLevels { get; private set; }

		public static MelonPreferences_Entry<bool> KeepOnStartup { get; private set; }

		public static MelonPreferences_Entry<int> SelectedSlot { get; private set; }

		public static MelonPreferences_Entry<string>[] SlotName { get; private set; } = new MelonPreferences_Entry<string>[5];

		public static MelonPreferences_Entry<string>[] SlotData { get; private set; } = new MelonPreferences_Entry<string>[5];

		public static MelonPreferences_Entry<float> AvatarScale { get; private set; }

		public static MelonPreferences_Entry<float> ObjectScale { get; private set; }

		public static MelonPreferences_Entry<float> JumpMultiplier { get; private set; }

		public static MelonPreferences_Entry<float> GravityY { get; private set; }

		public static MelonPreferences_Entry<float> RagdollForceMul { get; private set; }

		public static MelonPreferences_Entry<float> NpcScale { get; private set; }

		public static MelonPreferences_Entry<float> DamageMultiplier { get; private set; }

		public static MelonPreferences_Entry<bool> OneHitKill { get; private set; }

		public static MelonPreferences_Entry<bool> AutoHeal { get; private set; }

		public static MelonPreferences_Entry<float> AutoHealThreshold { get; private set; }

		public static MelonPreferences_Entry<bool> InfiniteAmmo { get; private set; }

		public static MelonPreferences_Entry<float> DamageResistance { get; private set; }

		public static MelonPreferences_Entry<bool> Crosshair { get; private set; }

		public static MelonPreferences_Entry<bool> ShowLobbyInfo { get; private set; }

		public static MelonPreferences_Entry<float> ExplosionForceMul { get; private set; }

		public static MelonPreferences_Entry<float> FrictionMul { get; private set; }

		public static MelonPreferences_Entry<float> BouncinessAdd { get; private set; }

		public static MelonPreferences_Entry<int>[] HolsterVisibility { get; private set; } = new MelonPreferences_Entry<int>[8];

		public static MelonPreferences_Entry<string>[] ProfileName { get; private set; } = new MelonPreferences_Entry<string>[3];

		public static MelonPreferences_Entry<string>[] ProfileData { get; private set; } = new MelonPreferences_Entry<string>[3];

		public static MelonPreferences_Entry<bool> StatsOverlay { get; private set; }

		public static MelonPreferences_Entry<bool> HasPositionMarker { get; private set; }

		public static MelonPreferences_Entry<float> MarkerX { get; private set; }

		public static MelonPreferences_Entry<float> MarkerY { get; private set; }

		public static MelonPreferences_Entry<float> MarkerZ { get; private set; }

		public static MelonPreferences_Entry<bool>[] MarkerHas { get; private set; } = new MelonPreferences_Entry<bool>[3];

		public static MelonPreferences_Entry<float>[] MarkerXs { get; private set; } = new MelonPreferences_Entry<float>[3];

		public static MelonPreferences_Entry<float>[] MarkerYs { get; private set; } = new MelonPreferences_Entry<float>[3];

		public static MelonPreferences_Entry<float>[] MarkerZs { get; private set; } = new MelonPreferences_Entry<float>[3];

		public static MelonPreferences_Entry<bool> AutoSaveOnLevelEnd { get; private set; }

		public static MelonPreferences_Entry<bool> StripEmptyHolsters { get; private set; }

		public static MelonPreferences_Entry<bool> PerLevelLoadouts { get; private set; }

		public static MelonPreferences_Entry<string> LevelSlotMap { get; private set; }

		public static MelonPreferences_Entry<bool> ScaleOnPickup { get; private set; }

		public static MelonPreferences_Entry<bool> RememberBarcodeScales { get; private set; }

		public static MelonPreferences_Entry<bool> AutoPerception { get; private set; }

		public static MelonPreferences_Entry<bool> PhotoSupersize { get; private set; }

		public static MelonPreferences_Entry<bool> WristHudEnabled { get; private set; }

		public static MelonPreferences_Entry<string>[] FavoriteCode { get; private set; } = new MelonPreferences_Entry<string>[5];

		public static MelonPreferences_Entry<string>[] FavoriteName { get; private set; } = new MelonPreferences_Entry<string>[5];

		public static MelonPreferences_Entry<string> LastLobbyCode { get; private set; }

		public static MelonPreferences_Entry<int>[] HotkeyTrigger { get; private set; } = new MelonPreferences_Entry<int>[4];

		public static MelonPreferences_Entry<int>[] HotkeyAction { get; private set; } = new MelonPreferences_Entry<int>[4];

		public static MelonPreferences_Entry<bool> FreecamEnabled { get; private set; }

		public static MelonPreferences_Entry<float> FreecamSpeed { get; private set; }

		public static MelonPreferences_Entry<bool> PhotoHideHud { get; private set; }

		public static MelonPreferences_Entry<int> PhotoCountdownSecs { get; private set; }

		public static MelonPreferences_Entry<int> PhotoBurstCount { get; private set; }

		public static MelonPreferences_Entry<float> TimeScale { get; private set; }

		public static MelonPreferences_Entry<bool> TimeScaleActive { get; private set; }

		public static MelonPreferences_Entry<float> SlowMoFactor { get; private set; }

		public static MelonPreferences_Entry<bool> PauseAffectsAudio { get; private set; }

		public static MelonPreferences_Entry<bool>[] CheckpointHas { get; private set; } = new MelonPreferences_Entry<bool>[5];

		public static MelonPreferences_Entry<float>[] CheckpointX { get; private set; } = new MelonPreferences_Entry<float>[5];

		public static MelonPreferences_Entry<float>[] CheckpointY { get; private set; } = new MelonPreferences_Entry<float>[5];

		public static MelonPreferences_Entry<float>[] CheckpointZ { get; private set; } = new MelonPreferences_Entry<float>[5];

		public static MelonPreferences_Entry<float>[] CheckpointHp { get; private set; } = new MelonPreferences_Entry<float>[5];

		public static MelonPreferences_Entry<string>[] CheckpointLevel { get; private set; } = new MelonPreferences_Entry<string>[5];

		public static MelonPreferences_Entry<string>[] CheckpointName { get; private set; } = new MelonPreferences_Entry<string>[5];

		public static void Init()
		{
			Cat = MelonPreferences.CreateCategory("QualityLab", "Quality Of Lab");
			GodMode = Cat.CreateEntry<bool>("GodMode", false, "God Mode", (string)null, false, false, (ValueValidator)null, (string)null);
			KeepBetweenLevels = Cat.CreateEntry<bool>("KeepBetweenLevels", false, "Keep Inventory Between Levels", (string)null, false, false, (ValueValidator)null, (string)null);
			KeepOnStartup = Cat.CreateEntry<bool>("KeepOnStartup", false, "Apply Saved Inventory on Startup", (string)null, false, false, (ValueValidator)null, (string)null);
			SelectedSlot = Cat.CreateEntry<int>("SelectedSlot", 1, "Selected Loadout Slot (1-5)", (string)null, false, false, (ValueValidator)null, (string)null);
			for (int i = 0; i < 5; i++)
			{
				int value = i + 1;
				SlotName[i] = Cat.CreateEntry<string>($"SlotName{value}", $"Slot {value}", $"Loadout slot {value} display name", (string)null, false, false, (ValueValidator)null, (string)null);
				SlotData[i] = Cat.CreateEntry<string>($"SlotData{value}", "", $"Loadout slot {value} serialized data", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			AvatarScale = Cat.CreateEntry<float>("AvatarScale", 1f, "Avatar Scale", (string)null, false, false, (ValueValidator)null, (string)null);
			ObjectScale = Cat.CreateEntry<float>("ObjectScale", 1f, "Object Scale", (string)null, false, false, (ValueValidator)null, (string)null);
			JumpMultiplier = Cat.CreateEntry<float>("JumpMultiplier", 1f, "Jump Multiplier", (string)null, false, false, (ValueValidator)null, (string)null);
			GravityY = Cat.CreateEntry<float>("GravityY", -9.81f, "Gravity Y (default -9.81)", (string)null, false, false, (ValueValidator)null, (string)null);
			RagdollForceMul = Cat.CreateEntry<float>("RagdollForceMul", 1f, "Ragdoll Force Multiplier", (string)null, false, false, (ValueValidator)null, (string)null);
			NpcScale = Cat.CreateEntry<float>("NpcScale", 1f, "NPC Scale Multiplier", (string)null, false, false, (ValueValidator)null, (string)null);
			DamageMultiplier = Cat.CreateEntry<float>("DamageMultiplier", 1f, "Damage Multiplier (you -> enemies)", (string)null, false, false, (ValueValidator)null, (string)null);
			OneHitKill = Cat.CreateEntry<bool>("OneHitKill", false, "One-Hit Kill", (string)null, false, false, (ValueValidator)null, (string)null);
			AutoHeal = Cat.CreateEntry<bool>("AutoHeal", false, "Auto-Heal", (string)null, false, false, (ValueValidator)null, (string)null);
			AutoHealThreshold = Cat.CreateEntry<float>("AutoHealThreshold", 0.5f, "Auto-Heal Threshold (0..1 of max)", (string)null, false, false, (ValueValidator)null, (string)null);
			InfiniteAmmo = Cat.CreateEntry<bool>("InfiniteAmmo", false, "Infinite Ammo (refills hip inventory)", (string)null, false, false, (ValueValidator)null, (string)null);
			DamageResistance = Cat.CreateEntry<float>("DamageResistance", 0f, "Damage Resistance (0=normal, 1=immune)", (string)null, false, false, (ValueValidator)null, (string)null);
			Crosshair = Cat.CreateEntry<bool>("Crosshair", false, "Center crosshair overlay", (string)null, false, false, (ValueValidator)null, (string)null);
			ShowLobbyInfo = Cat.CreateEntry<bool>("ShowLobbyInfo", false, "Show Fusion lobby info in stats", (string)null, false, false, (ValueValidator)null, (string)null);
			ExplosionForceMul = Cat.CreateEntry<float>("ExplosionForceMul", 1f, "Explosion Force Multiplier", (string)null, false, false, (ValueValidator)null, (string)null);
			FrictionMul = Cat.CreateEntry<float>("FrictionMul", 1f, "Surface Friction Multiplier", (string)null, false, false, (ValueValidator)null, (string)null);
			BouncinessAdd = Cat.CreateEntry<float>("BouncinessAdd", 0f, "Bounciness Added (0-1)", (string)null, false, false, (ValueValidator)null, (string)null);
			StatsOverlay = Cat.CreateEntry<bool>("StatsOverlay", false, "On-screen Stats Overlay", (string)null, false, false, (ValueValidator)null, (string)null);
			HasPositionMarker = Cat.CreateEntry<bool>("HasPositionMarker", false, "Position marker set", (string)null, false, false, (ValueValidator)null, (string)null);
			MarkerX = Cat.CreateEntry<float>("MarkerX", 0f, "Marker X", (string)null, false, false, (ValueValidator)null, (string)null);
			MarkerY = Cat.CreateEntry<float>("MarkerY", 0f, "Marker Y", (string)null, false, false, (ValueValidator)null, (string)null);
			MarkerZ = Cat.CreateEntry<float>("MarkerZ", 0f, "Marker Z", (string)null, false, false, (ValueValidator)null, (string)null);
			for (int j = 0; j < 3; j++)
			{
				char value2 = (char)(65 + j);
				MarkerHas[j] = Cat.CreateEntry<bool>($"Marker{value2}_Has", false, $"Marker {value2} set", (string)null, false, false, (ValueValidator)null, (string)null);
				MarkerXs[j] = Cat.CreateEntry<float>($"Marker{value2}_X", 0f, $"Marker {value2} X", (string)null, false, false, (ValueValidator)null, (string)null);
				MarkerYs[j] = Cat.CreateEntry<float>($"Marker{value2}_Y", 0f, $"Marker {value2} Y", (string)null, false, false, (ValueValidator)null, (string)null);
				MarkerZs[j] = Cat.CreateEntry<float>($"Marker{value2}_Z", 0f, $"Marker {value2} Z", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			AutoSaveOnLevelEnd = Cat.CreateEntry<bool>("AutoSaveOnLevelEnd", false, "Auto-Save Loadout on Level End", (string)null, false, false, (ValueValidator)null, (string)null);
			StripEmptyHolsters = Cat.CreateEntry<bool>("StripEmptyHolsters", true, "Don't restore empty holsters", (string)null, false, false, (ValueValidator)null, (string)null);
			PerLevelLoadouts = Cat.CreateEntry<bool>("PerLevelLoadouts", false, "Auto-pick loadout slot by level", (string)null, false, false, (ValueValidator)null, (string)null);
			LevelSlotMap = Cat.CreateEntry<string>("LevelSlotMap", "", "level barcode:slot pairs, ;-separated", (string)null, false, false, (ValueValidator)null, (string)null);
			ScaleOnPickup = Cat.CreateEntry<bool>("ScaleOnPickup", false, "Scale objects automatically on pickup", (string)null, false, false, (ValueValidator)null, (string)null);
			RememberBarcodeScales = Cat.CreateEntry<bool>("RememberBarcodeScales", false, "Remember scales per barcode (session)", (string)null, false, false, (ValueValidator)null, (string)null);
			AutoPerception = Cat.CreateEntry<bool>("AutoPerception", false, "Identify items automatically on pickup", (string)null, false, false, (ValueValidator)null, (string)null);
			PhotoSupersize = Cat.CreateEntry<bool>("PhotoSupersize", false, "Capture screenshots at 2x resolution", (string)null, false, false, (ValueValidator)null, (string)null);
			WristHudEnabled = Cat.CreateEntry<bool>("WristHudEnabled", false, "In-VR wrist HUD (FPS / state flags)", (string)null, false, false, (ValueValidator)null, (string)null);
			for (int k = 0; k < 5; k++)
			{
				int value3 = k + 1;
				FavoriteName[k] = Cat.CreateEntry<string>($"FavName{value3}", $"Favorite {value3}", $"Favorite lobby {value3} display name", (string)null, false, false, (ValueValidator)null, (string)null);
				FavoriteCode[k] = Cat.CreateEntry<string>($"FavCode{value3}", "", $"Favorite lobby {value3} join code", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			LastLobbyCode = Cat.CreateEntry<string>("LastLobbyCode", "", "Last lobby code seen while in a server", (string)null, false, false, (ValueValidator)null, (string)null);
			for (int l = 0; l < 4; l++)
			{
				int value4 = l + 1;
				HotkeyTrigger[l] = Cat.CreateEntry<int>($"HotkeyTrigger{value4}", 0, $"Hotkey {value4} trigger code", (string)null, false, false, (ValueValidator)null, (string)null);
				HotkeyAction[l] = Cat.CreateEntry<int>($"HotkeyAction{value4}", 0, $"Hotkey {value4} action code", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			for (int m = 0; m < 8; m++)
			{
				HolsterVisibility[m] = Cat.CreateEntry<int>($"Holster{m}_Vis", 0, $"Holster slot {m} visibility (0/1/2)", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			for (int n = 0; n < 3; n++)
			{
				int value5 = n + 1;
				ProfileName[n] = Cat.CreateEntry<string>($"Profile{value5}_Name", $"Profile {value5}", $"Profile {value5} display name", (string)null, false, false, (ValueValidator)null, (string)null);
				ProfileData[n] = Cat.CreateEntry<string>($"Profile{value5}_Data", "", $"Profile {value5} serialized data", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			FreecamEnabled = Cat.CreateEntry<bool>("FreecamEnabled", false, "Director freecam active", (string)null, false, false, (ValueValidator)null, (string)null);
			FreecamSpeed = Cat.CreateEntry<float>("FreecamSpeed", 4f, "Freecam fly speed (m/s)", (string)null, false, false, (ValueValidator)null, (string)null);
			PhotoHideHud = Cat.CreateEntry<bool>("PhotoHideHud", true, "Auto-hide HUD on countdown", (string)null, false, false, (ValueValidator)null, (string)null);
			PhotoCountdownSecs = Cat.CreateEntry<int>("PhotoCountdownSecs", 3, "Default photo countdown (s)", (string)null, false, false, (ValueValidator)null, (string)null);
			PhotoBurstCount = Cat.CreateEntry<int>("PhotoBurstCount", 3, "Default burst count", (string)null, false, false, (ValueValidator)null, (string)null);
			TimeScale = Cat.CreateEntry<float>("TimeScale", 1f, "Time scale (0.05..3.0)", (string)null, false, false, (ValueValidator)null, (string)null);
			TimeScaleActive = Cat.CreateEntry<bool>("TimeScaleActive", false, "Apply Quality Of Lab time scale (off = vanilla)", (string)null, false, false, (ValueValidator)null, (string)null);
			SlowMoFactor = Cat.CreateEntry<float>("SlowMoFactor", 0.35f, "Factor used by the Slow-Mo toggle / hotkey", (string)null, false, false, (ValueValidator)null, (string)null);
			PauseAffectsAudio = Cat.CreateEntry<bool>("PauseAffectsAudio", true, "Time scale affects audio pitch", (string)null, false, false, (ValueValidator)null, (string)null);
			try
			{
				if (TimeScale.Value < 0.05f || TimeScale.Value > 3f)
				{
					TimeScale.Value = 1f;
					TimeScaleActive.Value = false;
				}
			}
			catch
			{
			}
			for (int num = 0; num < 5; num++)
			{
				int value6 = num + 1;
				CheckpointHas[num] = Cat.CreateEntry<bool>($"Checkpoint{value6}_Has", false, $"Checkpoint {value6} populated", (string)null, false, false, (ValueValidator)null, (string)null);
				CheckpointX[num] = Cat.CreateEntry<float>($"Checkpoint{value6}_X", 0f, $"Checkpoint {value6} X", (string)null, false, false, (ValueValidator)null, (string)null);
				CheckpointY[num] = Cat.CreateEntry<float>($"Checkpoint{value6}_Y", 0f, $"Checkpoint {value6} Y", (string)null, false, false, (ValueValidator)null, (string)null);
				CheckpointZ[num] = Cat.CreateEntry<float>($"Checkpoint{value6}_Z", 0f, $"Checkpoint {value6} Z", (string)null, false, false, (ValueValidator)null, (string)null);
				CheckpointHp[num] = Cat.CreateEntry<float>($"Checkpoint{value6}_Hp", 1f, $"Checkpoint {value6} health ratio", (string)null, false, false, (ValueValidator)null, (string)null);
				CheckpointLevel[num] = Cat.CreateEntry<string>($"Checkpoint{value6}_Level", "", $"Checkpoint {value6} level barcode", (string)null, false, false, (ValueValidator)null, (string)null);
				CheckpointName[num] = Cat.CreateEntry<string>($"Checkpoint{value6}_Name", $"Checkpoint {value6}", $"Checkpoint {value6} display name", (string)null, false, false, (ValueValidator)null, (string)null);
			}
			Cat.SaveToFile(false);
		}

		public static void Save()
		{
			MelonPreferences_Category cat = Cat;
			if (cat != null)
			{
				cat.SaveToFile(false);
			}
		}
	}
}
namespace Quality_Lab.Features
{
	public static class Avatars
	{
		public static readonly (string Name, string Barcode)[] Presets = new(string, string)[7]
		{
			("Ford", "SLZ.BONELAB.Content.Avatar.FordBW"),
			("Jimmy", "SLZ.BONELAB.Content.Avatar.CharJimmy"),
			("Anime", "SLZ.BONELAB.Content.Avatar.Anime"),
			("Skeleton Pirate", "SLZ.BONELAB.Content.Avatar.SkeletonPirate"),
			("Null Body", "SLZ.BONELAB.Content.Avatar.Nullbody"),
			("Dog (Duck Season)", "SLZ.BONELAB.Content.Avatar.DogDuckSeason"),
			("Peasant Female", "SLZ.BONELAB.Core.Avatar.PeasantFemaleA")
		};

		public static void SwapToBarcode(string barcodeId)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			if (string.IsNullOrEmpty(barcodeId))
			{
				Notifications.Warn("Avatar swap: empty barcode.");
				return;
			}
			RigManager rigManager = Player.RigManager;
			if ((Object)(object)rigManager == (Object)null)
			{
				Notifications.Warn("Avatar swap: no rig (load into a level first).");
				return;
			}
			try
			{
				AssetWarehouse instance = AssetWarehouse.Instance;
				AvatarCrate val = default(AvatarCrate);
				if (instance != null && !instance.TryGetCrate<AvatarCrate>(new Barcode(barcodeId), ref val))
				{
					Notifications.Warn("Avatar not found: " + ShortName(barcodeId));
					return;
				}
				rigManager.SwapAvatarCrate(new Barcode(barcodeId), false, (Action<bool>)null);
				Notifications.Success("Swapped to " + ShortName(barcodeId));
			}
			catch (Exception ex)
			{
				Notifications.Error("Avatar swap failed: " + ex.Message);
			}
		}

		public static void RandomVanilla()
		{
			if (Presets.Length != 0)
			{
				int num = Random.Range(0, Presets.Length);
				SwapToBarcode(Presets[num].Barcode);
			}
		}

		public static void ResetToDefault()
		{
			SwapToBarcode(Presets[0].Barcode);
		}

		private static string ShortName(string barcode)
		{
			if (string.IsNullOrEmpty(barcode))
			{
				return "?";
			}
			int num = barcode.LastIndexOf('.');
			if (num <= 0 || num >= barcode.Length - 1)
			{
				return barcode;
			}
			return barcode.Substring(num + 1);
		}
	}
	public static class AvatarScaling
	{
		private static GameObject _avatarObject;

		public static void Apply()
		{
			ApplyInternal(Settings.AvatarScale.Value);
		}

		public static void Reset()
		{
			ApplyInternal(1f);
		}

		private static void ApplyInternal(float scale)
		{
			RigManager rm = Player.RigManager;
			if ((Object)(object)rm == (Object)null)
			{
				ModMain.Log.Warning("Avatar Scale: no rig.");
			}
			else
			{
				AvatarCrate val = default(AvatarCrate);
				if (!AssetWarehouse.Instance.TryGetCrate<AvatarCrate>(((ScannableReference)rm._avatarCrate)._barcode, ref val))
				{
					return;
				}
				Action<GameObject> action = delegate(GameObject prefab)
				{
					//IL_0027: Unknown result type (might be due to invalid IL or missing references)
					//IL_0055: Unknown result type (might be due to invalid IL or missing references)
					//IL_00ec: 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_0190: Unknown result type (might be due to invalid IL or missing references)
					_avatarObject = Object.Instantiate<GameObject>(prefab);
					_avatarObject.transform.localScale = new Vector3(scale, scale, scale);
					_avatarObject.transform.parent = ((Component)rm).transform;
					_avatarObject.transform.localPosition = Vector3.zero;
					Avatar componentInChildren = _avatarObject.GetComponentInChildren<Avatar>();
					foreach (SkinnedMeshRenderer item in (Il2CppArrayBase<SkinnedMeshRenderer>)(object)componentInChildren.hairMeshes)
					{
						((Renderer)item).enabled = false;
					}
					componentInChildren.PrecomputeAvatar();
					componentInChildren.RefreshBodyMeasurements();
					rm.SwitchAvatar(componentInChildren);
					PlayerRefs.Instance._bodyVitals.PROPEGATE();
					PullCordDevice componentInChildren2 = ((Component)Player.GetPhysicsRig()).GetComponentInChildren<PullCordDevice>(