Decompiled source of ShiftStoneRandomizer v2.0.1

Mods/ShiftStoneRandomizer.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppPhoton.Pun;
using Il2CppRUMBLE.Combat.ShiftStones;
using Il2CppRUMBLE.Input;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Managers;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRUMBLE.Utilities;
using Il2CppRootMotion;
using Il2CppSmartLocalization.Editor;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using RumbleModdingAPI;
using ShiftStoneRandomizer;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(global::ShiftStoneRandomizer.ShiftStoneRandomizer), "ShiftStoneRandomizer", "2.0.1", "iListen2Sound, Darkener", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonAuthorColor(255, 87, 166, 80)]
[assembly: MelonColor(255, 87, 166, 80)]
[assembly: AssemblyTitle("ShiftStoneRandomizer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShiftStoneRandomizer")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f1b108b0-ec9a-4b69-acca-82b8509ea7b9")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.0.1.0")]
namespace ShiftStoneRandomizer;

public class ShiftStoneRandomizer : MelonMod
{
	private const string BLACKLIST_FILE = "blacklist.txt";

	private const string LOADOUT_FILE = "loadout.txt";

	private const string DEBUG_FILE = ".debug";

	private static Random random = new Random();

	private ShiftStonePrefs[] defaultStones = new ShiftStonePrefs[2]
	{
		ShiftStonePrefs.Random,
		ShiftStonePrefs.Random
	};

	private static string CurrentScene;

	private static string LastScene;

	private bool firstLoad = true;

	private static bool IsSceneLoaded = false;

	private GameObject leftHand;

	private GameObject rightHand;

	public static Hands EnabledHand;

	private GameObject dropSign;

	private PlayerHaptics haptics;

	public static GameObject leftPoint;

	public static GameObject rightPoint;

	public static GameObject DDOLParent;

	private const string USER_DATA = "UserData/ShiftStoneRandomizer/";

	private const string CONFIG_FILE = "config.cfg";

	public static MelonPreferences_Category CatSettings;

	public static MelonPreferences_Entry<bool> CatDebugMode;

	public static MelonPreferences_Entry<string> PrefEnabledHand;

	public static MelonPreferences_Entry<string> PrefAutomation;

	private static MelonPreferences_Category CatEnabledStones;

	public static MelonPreferences_Entry<bool> PrefAdamant;

	public static MelonPreferences_Entry<bool> PrefCharge;

	public static MelonPreferences_Entry<bool> PrefFlow;

	public static MelonPreferences_Entry<bool> PrefGuard;

	public static MelonPreferences_Entry<bool> PrefStubborn;

	public static MelonPreferences_Entry<bool> PrefSurge;

	public static MelonPreferences_Entry<bool> PrefVigor;

	public static MelonPreferences_Entry<bool> PrefVolitile;

	private static MelonPreferences_Category CatMap0;

	private static MelonPreferences_Category CatMap1;

	public static AutomationPrefs AutomationMode;

	public static GameObject SmallButtonSource;

	private GameObject LoadCluster;

	private GameObject SaveCluster;

	public GameObject QssSaveCluster;

	private LoadoutInteractor saveInteractor;

	private LoadoutInteractor loadInteractor;

	private LoadoutInteractor qssSaveInteractor;

	private GameObject ShiftStoneBoxSource;

	private GameObject PortableStoneCase;

	private bool isQssReplacementPressed = false;

	public static ShiftStoneRandomizer Instance { get; private set; }

	public static string CurrentLoadedScene => CurrentScene.ToLower().Trim();

	public static string LastLoadedScene => LastScene.ToLower().Trim();

	public static bool IsFirstMatchLoad { get; private set; }

	public static List<Player> Players { get; set; }

	public static int PlayerCount => Players.Count;

	public static bool IsInMatch => CurrentLoadedScene.Contains("map") && Players.Count > 0;

	public static bool IsHost => PhotonNetwork.IsMasterClient;

	public static GameObject RandomizerAssets { get; private set; }

	public static GameObject IndicatorsBase { get; private set; }

	public static PlayerController Player0 { get; set; }

	public static PlayerController Player1 => (Players.Count > 1) ? Players[1].Controller : null;

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

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

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

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

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

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

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

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

	public override void OnLateInitializeMelon()
	{
		Instance = this;
		Calls.onMapInitialized += SceneReady;
		Calls.onMatchEnded += CreateButtonsForAll;
		InitPreferences();
	}

	public override void OnSceneWasUnloaded(int buildIndex, string sceneName)
	{
		IsSceneLoaded = false;
		Debug.Log("Unloaded: \"" + sceneName + "\"", debugOnly: true);
		if (sceneName == "Gym" || sceneName == "Park" || sceneName.Contains("Map"))
		{
			StoneItem.ResetAllIcons();
			LoadoutInteractor.UnsubAll();
		}
	}

	public override void OnUpdate()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: 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_0050: 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_0137: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = (Vector3)(((Object)(object)leftPoint != (Object)null) ? leftPoint.transform.position : new Vector3(0f, 0f, 0f));
		Vector3 val2 = (Vector3)(((Object)(object)rightPoint != (Object)null) ? rightPoint.transform.position : new Vector3(0f, 0f, 0f));
		string text = "Left Point: " + ((object)(Vector3)(ref val)).ToString() + " \nRight Point: " + ((object)(Vector3)(ref val2)).ToString();
		if (!IsSceneLoaded)
		{
			return;
		}
		Debug.PrintInGame(LoadoutInteractor.Selection[0].ToString() + " \n" + LoadoutInteractor.Selection[1]);
		if (!((Object)(object)LoadoutInteractor.LeftSocket != (Object)null) || !((Object)(object)LoadoutInteractor.RightSocket != (Object)null))
		{
			return;
		}
		try
		{
			GameObject[] displayedItem = LoadoutInteractor.DisplayedItem;
			foreach (GameObject val3 in displayedItem)
			{
				if ((Object)(object)val3 != (Object)null)
				{
					val3.transform.rotation = Quaternion.LookRotation(val3.transform.position - ((Component)Camera.main).transform.position, Vector3.up);
				}
			}
		}
		catch (Exception)
		{
		}
	}

	private void SceneReady()
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		Players = Singleton<PlayerManager>.instance.AllPlayers;
		if (CurrentLoadedScene == "gym")
		{
			if (firstLoad)
			{
				DDOLParent = new GameObject("ShiftStoneRandomizer_DDOLParent");
				Object.DontDestroyOnLoad((Object)(object)DDOLParent);
				IndicatorsBase = Object.Instantiate<GameObject>(Calls.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "ShiftStoneRandomizer.assets.randomizer", "ShiftstoneRandomizer"));
				IndicatorsBase.transform.SetParent(DDOLParent.transform);
				IndicatorsBase.SetActive(false);
				GrabBoxSource();
			}
			GameObject gameObject = Cabinet.GetGameObject();
			for (int i = 0; i < StoneItem.AllStones.Length; i++)
			{
				StoneItem.AllStones[i].AddIcon(CreateBlackListIcons(((Component)gameObject.transform.GetChild(i)).gameObject));
			}
			firstLoad = false;
		}
		ApplyPrefsToState();
		if (CurrentLoadedScene != "loader")
		{
			Player0 = Players[0].Controller;
			Debug.CreateDebugUi(((Component)((Component)Player0).gameObject.transform.GetChild(6).GetChild(0)).gameObject);
			IsSceneLoaded = true;
			leftPoint = ((Component)((Component)Player0).gameObject.transform.Find("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Shoulderblade_L/Bone_Shoulder_L/Bone_Lowerarm_L/Bone_HandAlpha_L/Bone_Pointer_A_L/Bone_Pointer_B_L/Bone_Pointer_C_L")).gameObject;
			rightPoint = ((Component)((Component)Player0).gameObject.transform.Find("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Shoulderblade_R/Bone_Shoulder_R/Bone_Lowerarm_R/Bone_HandAlpha_R/Bone_Pointer_A_R/Bone_Pointer_B_R/Bone_Pointer_C_R")).gameObject;
			GameObject gameObject2 = ((Component)((Component)Player0).gameObject.transform.Find("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Shoulderblade_L/Bone_Shoulder_L/Bone_Lowerarm_L")).gameObject;
			GameObject gameObject3 = ((Component)((Component)Player0).gameObject.transform.Find("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Shoulderblade_R/Bone_Shoulder_R/Bone_Lowerarm_R")).gameObject;
			LoadoutInteractor.LeftSocket = ((Component)gameObject2.transform.DeepFind("SnapTransform")).gameObject;
			LoadoutInteractor.RightSocket = ((Component)gameObject3.transform.DeepFind("SnapTransform")).gameObject;
			LoadoutInteractor.HighlightCurrentEquippedStones();
			LoadoutInteractor.OnMatchLoad();
			CreateButtonsForAll();
		}
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		LastScene = CurrentScene;
		CurrentScene = sceneName;
		IsFirstMatchLoad = CurrentLoadedScene.Contains("map") && LastLoadedScene == "gym";
	}

	private void SignFall()
	{
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		string[] array = new string[6] { "Player", "Floor", "PedestalFloor", "CombatFloor", "Environment", "Clouds" };
		if (random.Next(50) == 1)
		{
			Rigidbody val = dropSign.AddComponent<Rigidbody>();
			val.AddForce(new Vector3(1.5f, 1f, 0f), (ForceMode)1);
			val.angularVelocity = new Vector3(0f, 0f, 0f);
			val.AddRelativeTorque(new Vector3(0f, -100000f, -100000f), (ForceMode)1);
			val.includeLayers = LayerMaskExtensions.AddToMask(default(LayerMask), Il2CppStringArray.op_Implicit(array));
		}
	}

	public static void ActivateEffect(bool left, bool right)
	{
		if (left)
		{
			((Component)Player0).GetComponent<PlayerShiftstoneSystem>().ActivateUseShiftstoneEffects((Hand)1);
		}
		if (right)
		{
			((Component)Player0).GetComponent<PlayerShiftstoneSystem>().ActivateUseShiftstoneEffects((Hand)2);
		}
	}

	private static List<ShiftStonePrefs> GetRandomStones(ShiftStonePrefs[] equipped, Hands hand = Hands.Both, bool includeDisabled = false)
	{
		List<StoneItem> source = StoneItem.AllStones.Where((StoneItem s) => s.IsEnabled || includeDisabled).ToList();
		int num = ((hand != Hands.Both) ? 1 : 2);
		List<StoneItem> list = source.Where((StoneItem x) => !equipped.Contains(x.GetEnum())).ToList();
		if (list.Count >= num)
		{
			source = list;
		}
		source.OrderBy((StoneItem x) => random.Next()).Take(num).ToList();
		return new List<ShiftStonePrefs>();
	}

	public static void RandomizeStones(int[] Equipped, Hands hand = Hands.Both)
	{
		int num = ((hand == Hands.Left) ? 1 : 0);
		List<StoneItem> list = new List<StoneItem>();
		Debug.Log("Stone check:", debugOnly: true);
		for (int i = 0; i < StoneItem.AllStones.Length; i++)
		{
			StoneItem stoneItem = StoneItem.AllStones[i];
			Debug.Log($"\t{stoneItem.Name} - Enabled: {stoneItem.IsEnabled}", debugOnly: true);
			if (stoneItem.IsEnabled && Array.IndexOf(Equipped, i) == -1)
			{
				Debug.Log("\t Added", debugOnly: true);
				list.Add(stoneItem);
			}
			else
			{
				Debug.Log("\t Not added", debugOnly: true);
			}
		}
		if (list.Count <= 2 && hand == Hands.Both)
		{
			Debug.Log("Not enough stones to disallow repeats", debugOnly: true);
			foreach (int num2 in Equipped)
			{
				if (num2 > -1)
				{
					list.Add(StoneItem.AllStones[num2]);
				}
			}
		}
		list = list.OrderBy((StoneItem x) => random.Next()).ToList();
		if (list.Count < 2)
		{
			Debug.Log("Not enough stones to randomize, using equipped stones instead.", debugOnly: false, 1);
			if (hand == Hands.Both)
			{
				list.AddRange(new StoneItem[2]
				{
					StoneItem.AllStones[Equipped[0]],
					StoneItem.AllStones[Equipped[1]]
				});
			}
			else
			{
				list.Add(StoneItem.AllStones[Equipped[(int)hand]]);
			}
		}
		switch (hand)
		{
		case Hands.Both:
			EquipStones(list[0], list[1]);
			break;
		case Hands.Right:
			EquipStones(null, list[0]);
			break;
		case Hands.Left:
			EquipStones(list[0], null);
			break;
		}
	}

	private static void EquipStones(StoneItem[] StonesToEquip)
	{
		EquipStones(StonesToEquip[0], StonesToEquip[1]);
	}

	public static void EquipStones(StoneItem leftStone, StoneItem rightStone, bool applyEffect = true)
	{
		Debug.Log("Equipping stones: " + ((leftStone != null) ? leftStone.Name : "Null") + " | " + ((rightStone != null) ? rightStone.Name : "Null"), debugOnly: true);
		if (rightStone != null)
		{
			((Component)Player0).GetComponent<PlayerShiftstoneSystem>().RemoveShiftStone(1, true, true);
		}
		if (leftStone != null)
		{
			((Component)Player0).GetComponent<PlayerShiftstoneSystem>().RemoveShiftStone(0, true, true);
			if ((Object)(object)leftStone.ShiftStone != (Object)null)
			{
				((Component)Player0).GetComponent<PlayerShiftstoneSystem>().AttachShiftStone(leftStone.ShiftStone, 0, true, true);
				((Component)Player0).GetComponent<PlayerShiftstoneSystem>().RemoveAndReattachShiftstones(true, true);
			}
		}
		if (rightStone != null)
		{
			((Component)Player0).GetComponent<PlayerShiftstoneSystem>().RemoveShiftStone(1, true, true);
			if ((Object)(object)rightStone.ShiftStone != (Object)null)
			{
				((Component)Player0).GetComponent<PlayerShiftstoneSystem>().AttachShiftStone(rightStone.ShiftStone, 1, true, true);
				((Component)Player0).GetComponent<PlayerShiftstoneSystem>().RemoveAndReattachShiftstones(true, true);
			}
		}
		if (applyEffect)
		{
			ActivateEffect(leftStone != null, rightStone != null);
		}
	}

	public static void EquipStones(ShiftStonePrefs single, Hands hand)
	{
		switch (hand)
		{
		case Hands.Left:
			EquipStones(single, ShiftStonePrefs.Stay);
			break;
		case Hands.Right:
			EquipStones(ShiftStonePrefs.Stay, single);
			break;
		default:
			Debug.Log("EquipStones: Single Equip method given invalid hand either neither or both");
			break;
		}
	}

	public static void EquipStones(ShiftStonePrefs left, ShiftStonePrefs right)
	{
		StoneItem stoneItem = null;
		StoneItem stoneItem2 = null;
		if (left == ShiftStonePrefs.Empty)
		{
			stoneItem = new StoneItem();
		}
		else if (left == ShiftStonePrefs.Random)
		{
			stoneItem = PickRandomStoneExcept(stoneItem2);
		}
		else if (left == ShiftStonePrefs.Stay)
		{
			stoneItem = null;
		}
		else if (left >= ShiftStonePrefs.Empty)
		{
			stoneItem = StoneItem.AllStones[(int)left];
		}
		if (right == ShiftStonePrefs.Empty)
		{
			stoneItem2 = new StoneItem();
		}
		else if (right == ShiftStonePrefs.Random)
		{
			stoneItem2 = PickRandomStoneExcept(stoneItem);
		}
		else if (right == ShiftStonePrefs.Stay)
		{
			stoneItem2 = null;
		}
		else if (right >= ShiftStonePrefs.Empty)
		{
			stoneItem2 = StoneItem.AllStones[(int)right];
		}
		EquipStones(stoneItem, stoneItem2);
	}

	private static StoneItem PickRandomStoneExcept(StoneItem excludeStone = null)
	{
		StoneItem stoneItem = null;
		List<StoneItem> list = StoneItem.AllStones.Where((StoneItem s) => s.IsEnabled).ToList();
		if (list.Count() >= 2)
		{
			do
			{
				stoneItem = list[random.Next(0, list.Count())];
			}
			while (stoneItem.Name == excludeStone.Name);
			return stoneItem;
		}
		return null;
	}

	private static void InitPreferences()
	{
		if (!Directory.Exists("UserData/ShiftStoneRandomizer/"))
		{
			Debug.Log("Userdata folder not found. Creating...");
			Directory.CreateDirectory("UserData/ShiftStoneRandomizer/");
		}
		CatSettings = MelonPreferences.CreateCategory("Preferences");
		CatSettings.SetFilePath(Path.Combine("UserData/ShiftStoneRandomizer/", "config.cfg"));
		CatDebugMode = CatSettings.CreateEntry<bool>("Enable Debug Mode", false, (string)null, "Enable for more verbose logging", false, false, (ValueValidator)null, (string)null);
		PrefEnabledHand = CatSettings.CreateEntry<string>("Randomized Hand", "Both", (string)null, "Hand where randomization is Enabled", false, false, (ValueValidator)null, (string)null);
		PrefAutomation = CatSettings.CreateEntry<string>("Auto-Equip Mode", "Random", (string)null, "Random: Randomize every match | Auto: Based on Map automation config | Mirror: Copy opponent's shift stones | None: No action", false, false, (ValueValidator)null, (string)null);
		CatEnabledStones = MelonPreferences.CreateCategory("Enabled Stones", "Black List");
		CatEnabledStones.SetFilePath(Path.Combine("UserData/ShiftStoneRandomizer/", "config.cfg"));
		PrefAdamant = CatEnabledStones.CreateEntry<bool>("Adamant Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefCharge = CatEnabledStones.CreateEntry<bool>("Charge Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefFlow = CatEnabledStones.CreateEntry<bool>("Flow Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefGuard = CatEnabledStones.CreateEntry<bool>("Guard Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefStubborn = CatEnabledStones.CreateEntry<bool>("Stubborn Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefSurge = CatEnabledStones.CreateEntry<bool>("Surge Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefVigor = CatEnabledStones.CreateEntry<bool>("Vigor Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		PrefVolitile = CatEnabledStones.CreateEntry<bool>("Volatile Stone", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
		CatMap0 = MelonPreferences.CreateCategory("Ring Automation Settings");
		CatMap0.SetFilePath(Path.Combine("UserData/ShiftStoneRandomizer/", "config.cfg"));
		PrefMap0HostLeft = CatMap0.CreateEntry<string>("Ring Left Hand for Host: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		PrefMap0HostRight = CatMap0.CreateEntry<string>("Ring Right Hand for Host: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		PrefMap0ClientLeft = CatMap0.CreateEntry<string>("Ring Left Hand for Client: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		PrefMap0ClientRight = CatMap0.CreateEntry<string>("Ring Right Hand for Client: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		CatMap1 = MelonPreferences.CreateCategory("Pit Automation Settings");
		CatMap1.SetFilePath(Path.Combine("UserData/ShiftStoneRandomizer/", "config.cfg"));
		PrefMap1HostLeft = CatMap1.CreateEntry<string>("Pit Left Hand for Host: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		PrefMap1HostRight = CatMap1.CreateEntry<string>("Pit Right Hand for Host: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror| Empty", false, false, (ValueValidator)null, (string)null);
		PrefMap1ClientLeft = CatMap1.CreateEntry<string>("Pit Left Hand for Client: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		PrefMap1ClientRight = CatMap1.CreateEntry<string>("Pit Right Hand for Client: ", "Random", (string)null, "[Preferred Stone] | Random | Mirror | Empty", false, false, (ValueValidator)null, (string)null);
		Debug.debugMode = CatDebugMode.Value;
	}

	private void ReadPrefs()
	{
		CatSettings.LoadFromFile(true);
		CatEnabledStones.LoadFromFile(true);
		CatMap0.LoadFromFile(true);
		CatMap1.LoadFromFile(true);
	}

	public void SavePrefs()
	{
		CatSettings.SaveToFile(true);
		CatEnabledStones.SaveToFile(true);
		CatMap0.SaveToFile(true);
		CatMap1.SaveToFile(true);
	}

	private void ApplyPrefsToState()
	{
		StoneItem.AllStones[0].IsEnabled = PrefAdamant.Value;
		StoneItem.AllStones[1].IsEnabled = PrefCharge.Value;
		StoneItem.AllStones[2].IsEnabled = PrefFlow.Value;
		StoneItem.AllStones[3].IsEnabled = PrefGuard.Value;
		StoneItem.AllStones[4].IsEnabled = PrefStubborn.Value;
		StoneItem.AllStones[5].IsEnabled = PrefSurge.Value;
		StoneItem.AllStones[6].IsEnabled = PrefVigor.Value;
		StoneItem.AllStones[7].IsEnabled = PrefVolitile.Value;
		if (!Enum.TryParse<Hands>(PrefEnabledHand.Value, out EnabledHand))
		{
			Debug.Log("Failed to parse enabled hand preference: " + PrefEnabledHand.Value);
		}
		if (!Enum.TryParse<AutomationPrefs>(PrefAutomation.Value, out AutomationMode))
		{
			Debug.Log("Failed to parse automation mode preference: " + PrefAutomation.Value);
		}
		if (!Enum.TryParse<Hands>(PrefEnabledHand.Value, out EnabledHand))
		{
			Debug.Log("Failed to parse enabled hand preference: " + PrefEnabledHand.Value);
			EnabledHand = Hands.Both;
		}
		if (!(CurrentScene == "Gym"))
		{
		}
	}

	private static void UpdatePrefsFromState()
	{
		PrefAdamant.Value = StoneItem.AllStones[0].IsEnabled;
		PrefCharge.Value = StoneItem.AllStones[1].IsEnabled;
		PrefFlow.Value = StoneItem.AllStones[2].IsEnabled;
		PrefGuard.Value = StoneItem.AllStones[3].IsEnabled;
		PrefStubborn.Value = StoneItem.AllStones[4].IsEnabled;
		PrefSurge.Value = StoneItem.AllStones[5].IsEnabled;
		PrefVigor.Value = StoneItem.AllStones[6].IsEnabled;
		PrefVolitile.Value = StoneItem.AllStones[7].IsEnabled;
		PrefEnabledHand.Value = EnabledHand.ToString();
	}

	public static void ToggleStones(int[] equipped, Hands hand = Hands.Both)
	{
		StoneItem stoneItem = ((equipped[0] != -1) ? StoneItem.AllStones[equipped[0]] : new StoneItem());
		StoneItem stoneItem2 = ((equipped[1] != -1) ? StoneItem.AllStones[equipped[1]] : new StoneItem());
		if (hand == Hands.Both)
		{
			if (stoneItem.IsEnabled || stoneItem2.IsEnabled)
			{
				stoneItem.IsEnabled = false;
				stoneItem2.IsEnabled = false;
				EquipStones(new StoneItem(), new StoneItem());
			}
			else
			{
				stoneItem.IsEnabled = true;
				stoneItem2.IsEnabled = true;
			}
		}
		else
		{
			StoneItem stoneItem3;
			switch (hand)
			{
			case Hands.Left:
				stoneItem3 = stoneItem;
				break;
			case Hands.Right:
				stoneItem3 = stoneItem2;
				break;
			default:
				return;
			}
			stoneItem3.IsEnabled = !stoneItem3.IsEnabled;
			if (stoneItem3.IsEnabled)
			{
				EquipStones(stoneItem3.GetEnum(), hand);
			}
			else
			{
				EquipStones(ShiftStonePrefs.Empty, hand);
			}
		}
		UpdatePrefsFromState();
		CatEnabledStones.SaveToFile(true);
	}

	private void CreateButtonsForAll()
	{
		GameObject[] array = ((IEnumerable<GameObject>)Object.FindObjectsOfType<GameObject>()).Where((GameObject go) => ((Object)go).name == "ShiftstoneQuickswapper").ToArray();
		GameObject[] array2 = array;
		foreach (GameObject swapper in array2)
		{
			try
			{
				CreateQuickSwapButtons(swapper);
			}
			catch (Exception arg)
			{
				Debug.Log("-------", debugOnly: false, 1);
				Debug.Log($"Error creating quickswap buttons: {arg}", debugOnly: false, 2);
				Debug.Log("-------", debugOnly: false, 1);
			}
		}
	}

	public static GameObject CreateBlackListIcons(GameObject TargetParent)
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		Random random = new Random(((Object)TargetParent).GetHashCode());
		GameObject val = Object.Instantiate<GameObject>(((Component)IndicatorsBase.transform.GetChild(0)).gameObject);
		val.SetActive(false);
		val.transform.SetParent(TargetParent.transform, false);
		val.transform.localScale = Vector3.one * 7.5E-05f;
		val.transform.localRotation = Quaternion.Euler(-0f, 90f * (float)random.Next(1, 2), 90f * (float)random.Next(4) + (float)random.Next(-10, 10));
		val.transform.localPosition = new Vector3(-0.053f, -0.02f + (float)random.Next(-100, 100) * 0.0001f, 0.02f + (float)random.Next(-100, 100) * 0.0001f);
		return val;
	}

	private void CreateQuickSwapButtons(GameObject swapper)
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ((Component)swapper.transform.GetChild(0).GetChild(2)).gameObject;
		GameObject val = Object.Instantiate<GameObject>(gameObject);
		val.transform.parent = swapper.transform.GetChild(0);
		val.transform.localPosition = new Vector3(-0.096f, 0.064f, -0.025f);
		val.transform.localRotation = Quaternion.Euler(298.0022f, 83.3369f, 359.8999f);
		((Component)val.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		((Component)val.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			RandomizeStones(Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)Player0).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration()), EnabledHand);
		}));
		PortableCabinet portableCabinet = new PortableCabinet(swapper);
		gameObject.SetActive(false);
	}

	private void GrabBoxSource()
	{
		ShiftStoneBoxSource = Object.Instantiate<GameObject>(ShiftstoneBox___________.GetGameObject());
		ShiftStoneBoxSource.SetActive(false);
		((Object)ShiftStoneBoxSource).name = "ShiftStoneBoxSource";
		ShiftStoneBoxSource.transform.SetParent(DDOLParent.transform, false);
		SmallButtonSource = Object.Instantiate<GameObject>(PageDownButton.GetGameObject());
	}
}
public static class Debug
{
	public static bool debugMode { get; set; } = true;


	public static GameObject DebugUi { get; private set; }

	public static TextMeshPro DebugUiText { get; private set; }

	public static void Log(string message, bool debugOnly = false, int logLevel = 0)
	{
		if (!debugOnly || debugMode)
		{
			switch (logLevel)
			{
			case 1:
				Melon<ShiftStoneRandomizer>.Logger.Warning("Warn: " + message);
				break;
			case 2:
				Melon<ShiftStoneRandomizer>.Logger.Error("Error: " + message);
				break;
			default:
				Melon<ShiftStoneRandomizer>.Logger.Msg(message);
				break;
			}
		}
	}

	public static GameObject CreateDebugUi(GameObject PlayerUi)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		DebugUi = Create.NewText("Placeholder text.", 1f, Color.white, new Vector3(0f, 0.1f, 1f), Quaternion.Euler(0f, 0f, 0f));
		DebugUi.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
		DebugUi.transform.localPosition = new Vector3(0f, 0.1f, 0.96f);
		DebugUi.transform.SetParent(PlayerUi.transform, false);
		DebugUiText = DebugUi.GetComponent<TextMeshPro>();
		DebugUi.SetActive(debugMode);
		return DebugUi;
	}

	public static void PrintInGame(string message)
	{
		if (DebugUi != null)
		{
			((TMP_Text)DebugUiText).enableWordWrapping = false;
			((TMP_Text)DebugUiText).text = message;
		}
		else
		{
			Log("Can't print message: \"" + message + "\" to debug ui. Not created and assigned", debugOnly: true, 2);
		}
	}
}
public enum Hands
{
	Both = -1,
	Left,
	Right
}
public enum ShiftStonePrefs
{
	Special = -6,
	Invalid,
	Mirror,
	Stay,
	Random,
	Empty,
	Adamant,
	Charge,
	Flow,
	Guard,
	Stubborn,
	Surge,
	Vigor,
	Volatile
}
public enum AutomationPrefs
{
	None,
	Random,
	Auto,
	Mirror
}
public static class Extensions
{
	public static Transform DeepFind(this Transform parent, string name)
	{
		Queue<Transform> queue = new Queue<Transform>();
		queue.Enqueue(parent);
		while (queue.Count > 0)
		{
			Transform val = queue.Dequeue();
			if (((Object)val).name == name)
			{
				return val;
			}
			for (int i = 0; i < val.childCount; i++)
			{
				queue.Enqueue(val.GetChild(i));
			}
		}
		return null;
	}
}
public class LoadoutInteractor
{
	public class Slot
	{
		public static Vector3[] Sections = (Vector3[])(object)new Vector3[4]
		{
			new Vector3(-0.04f, 0.06f, 0.07f),
			new Vector3(-0.04f, -0.06f, 0.07f),
			new Vector3(0.04f, 0.06f, 0.07f),
			new Vector3(0.04f, -0.06f, 0.07f)
		};

		private GameObject _leftStoneSlot;

		private StoneItem _leftStoneItem;

		private GameObject _rightStoneSlot;

		private StoneItem _rightStoneItem;

		private Quadrants _quadrant;

		public Quadrants Quadrant;

		public GameObject Button { get; private set; }

		public GameObject ActualButton => ((Component)Button.transform.GetChild(0)).gameObject;

		public GameObject LeftStoneSlot
		{
			get
			{
				return _leftStoneSlot;
			}
			private set
			{
				_leftStoneSlot = value;
			}
		}

		public StoneItem LeftStoneItem
		{
			get
			{
				return _leftStoneItem;
			}
			set
			{
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				_leftStoneItem = value;
				GameObject val = Object.Instantiate<GameObject>(((Component)value.ShiftStone).gameObject);
				val.transform.SetParent(_leftStoneSlot.transform, false);
				if (value.Name == "Charge")
				{
					val.transform.localRotation = Quaternion.Euler(0f, 0f, 270f);
				}
				else
				{
					val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
				}
			}
		}

		public MelonPreferences_Entry<string> LeftHandPref { get; set; }

		public GameObject RightStoneSlot
		{
			get
			{
				return _rightStoneSlot;
			}
			private set
			{
				_rightStoneSlot = value;
			}
		}

		public MelonPreferences_Entry<string> RightHandPref { get; set; }

		public Slot(Quadrants quadrant, MelonPreferences_Entry<string> leftPref, MelonPreferences_Entry<string> rightPref, bool isSaveButton)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00c6: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			LeftHandPref = leftPref;
			RightHandPref = rightPref;
			Quadrant = quadrant;
			Button = Object.Instantiate<GameObject>(ButtonSource);
			((Object)Button).name = "Loadout Button";
			Button.transform.localPosition = Sections[(int)Quadrant];
			if (isSaveButton)
			{
				ActualButton.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
			}
			Button.SetActive(true);
			_leftStoneSlot = new GameObject("LeftSlot");
			_leftStoneSlot.transform.localPosition = new Vector3(0.05f, 0.07f, 0.01f);
			_leftStoneSlot.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
			_leftStoneSlot.transform.SetParent(Button.transform, false);
			_leftStoneSlot.SetActive(true);
			_rightStoneSlot = new GameObject("Right Slot");
			_rightStoneSlot.transform.localPosition = new Vector3(0.05f, 0.07f, -0.01f);
			_rightStoneSlot.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f);
			_rightStoneSlot.transform.SetParent(Button.transform, false);
			_rightStoneSlot.SetActive(true);
			Display += DisplayShiftStones;
			DisplayShiftStones(Quadrant, Selection[0], Selection[1]);
			if (isSaveButton)
			{
				ActualButton.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					SaveSelectedToLoadout();
					Debug.Log("Slot: Event handler assigned for save", debugOnly: true);
				}));
			}
			else
			{
				ActualButton.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
				{
					ApplyLoadOut();
					IsNextSelectionPrimed = false;
				}));
			}
		}

		private void SaveSelectedToLoadout()
		{
			Debug.Log("Saving Loadout...");
			int[] array = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player0).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
			for (int i = 0; i < 2; i++)
			{
				if (Selection[i] >= ShiftStonePrefs.Empty)
				{
					Selection[i] = (ShiftStonePrefs)array[i];
				}
			}
			LeftHandPref.Value = Selection[0].ToString();
			RightHandPref.Value = Selection[1].ToString();
			ShiftStoneRandomizer.Instance.SavePrefs();
			UpdateAllDisplays(Quadrant, Selection[0], Selection[1]);
		}

		public void ApplyLoadOut()
		{
			Debug.Log("Applying Loadout...");
			if (!Enum.TryParse<ShiftStonePrefs>(LeftHandPref.Value, out var result))
			{
				Debug.Log("AppyloLoadout Failed to parse: " + LeftHandPref.Value);
			}
			if (!Enum.TryParse<ShiftStonePrefs>(RightHandPref.Value, out var result2))
			{
				Debug.Log("AppyloLoadout Failed to parse: " + RightHandPref.Value);
			}
			ShiftStonePrefs[] array = new ShiftStonePrefs[2] { result, result2 };
			int[] array2 = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player0).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
			if (result == ShiftStonePrefs.Random && result2 == ShiftStonePrefs.Random)
			{
				ShiftStoneRandomizer.RandomizeStones(array2);
			}
			else
			{
				ShiftStoneRandomizer.EquipStones(new StoneItem(), new StoneItem());
				for (int i = 0; i < 2; i++)
				{
					Hands hands = (Hands)i;
					ClearSlot(Sockets[i]);
					switch (array[i])
					{
					case ShiftStonePrefs.Random:
						ShiftStoneRandomizer.RandomizeStones(array2, (Hands)i);
						break;
					case ShiftStonePrefs.Mirror:
						if (ShiftStoneRandomizer.IsInMatch && (Object)(object)ShiftStoneRandomizer.Player1 != (Object)null)
						{
							int[] array3 = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player1).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
							switch (hands)
							{
							case Hands.Left:
								ShiftStoneRandomizer.EquipStones((array3[0] >= 0) ? StoneItem.AllStones[array3[0]] : new StoneItem(), null);
								break;
							case Hands.Right:
								ShiftStoneRandomizer.EquipStones(null, (array3[1] >= 0) ? StoneItem.AllStones[array3[1]] : new StoneItem());
								break;
							}
						}
						break;
					case ShiftStonePrefs.Stay:
						ShiftStoneRandomizer.EquipStones((hands == Hands.Left) ? StoneItem.AllStones[array2[i]] : null, (hands == Hands.Right) ? StoneItem.AllStones[array2[i]] : null);
						break;
					case ShiftStonePrefs.Empty:
						ShiftStoneRandomizer.EquipStones(new StoneItem(), new StoneItem());
						break;
					default:
						switch (i)
						{
						case 0:
							ShiftStoneRandomizer.EquipStones(StoneItem.AllStones[(int)array[i]], null);
							break;
						case 1:
							ShiftStoneRandomizer.EquipStones(null, StoneItem.AllStones[(int)array[i]]);
							break;
						}
						break;
					}
				}
			}
			UpdateAllDisplays(Quadrant, result, result2);
		}

		internal void DisplayShiftStones(Quadrants quadrant, ShiftStonePrefs left, ShiftStonePrefs right)
		{
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			if (quadrant != Quadrant)
			{
				return;
			}
			if ((Object)(object)LeftStoneSlot == (Object)null || (Object)(object)RightStoneSlot == (Object)null)
			{
				Debug.Log("DisplayShiftStones: One or both stone slots are null!", debugOnly: true, 2);
				return;
			}
			Infanticide(LeftStoneSlot);
			Infanticide(RightStoneSlot);
			if (!Enum.TryParse<ShiftStonePrefs>(LeftHandPref.Value, out left))
			{
				Debug.Log("Failed to parse left: " + LeftHandPref.Value + ", defaulting to Empty", debugOnly: false, 1);
			}
			if (!Enum.TryParse<ShiftStonePrefs>(RightHandPref.Value, out right))
			{
				Debug.Log("Failed to parse right: " + RightHandPref.Value + ", defaulting to Empty", debugOnly: false, 1);
			}
			GameObject displayObject = StoneItem.GetDisplayObject(left);
			if (left == ShiftStonePrefs.Charge)
			{
				displayObject.transform.localRotation = Quaternion.Euler(0f, 0f, 270f);
			}
			displayObject.transform.SetParent(LeftStoneSlot.transform, false);
			displayObject.SetActive(true);
			GameObject displayObject2 = StoneItem.GetDisplayObject(right);
			if (right == ShiftStonePrefs.Charge)
			{
				displayObject2.transform.localRotation = Quaternion.Euler(0f, 0f, 270f);
			}
			displayObject2.transform.SetParent(RightStoneSlot.transform, false);
			displayObject2.SetActive(true);
		}

		public static void Infanticide(GameObject parent)
		{
			for (int i = 0; i < parent.transform.childCount; i++)
			{
				try
				{
					Object.Destroy((Object)(object)((Component)parent.transform.GetChild(i)).gameObject);
				}
				catch (Exception ex)
				{
					Debug.Log(ex.Message);
				}
			}
		}
	}

	public enum Quadrants
	{
		TopLeft,
		TopRight,
		BottomLeft,
		BottomRight
	}

	[CompilerGenerated]
	private sealed class <ContinuousCopy>d__11 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Hands hand;

		private int[] <selfEquipped>5__1;

		private int[] <opponentEquipped>5__2;

		private ShiftStonePrefs <left>5__3;

		private ShiftStonePrefs <right>5__4;

		private Stopwatch <sw>5__5;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <ContinuousCopy>d__11(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<selfEquipped>5__1 = null;
			<opponentEquipped>5__2 = null;
			<sw>5__5 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<left>5__3 = ShiftStonePrefs.Stay;
				<right>5__4 = ShiftStonePrefs.Stay;
				<sw>5__5 = new Stopwatch();
				<sw>5__5.Start();
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			<selfEquipped>5__1 = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player0).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
			<opponentEquipped>5__2 = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player1).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
			if (hand == Hands.Left || hand == Hands.Both)
			{
				<left>5__3 = ((<opponentEquipped>5__2[0] == <selfEquipped>5__1[0]) ? ShiftStonePrefs.Stay : ((ShiftStonePrefs)<opponentEquipped>5__2[0]));
			}
			else if (hand == Hands.Right || hand == Hands.Both)
			{
				<right>5__4 = ((<opponentEquipped>5__2[1] == <selfEquipped>5__1[1]) ? ShiftStonePrefs.Stay : ((ShiftStonePrefs)<opponentEquipped>5__2[1]));
			}
			if (<sw>5__5.ElapsedMilliseconds >= 1000)
			{
				if (<selfEquipped>5__1[1] == (int)<left>5__3)
				{
					ShiftStoneRandomizer.EquipStones(ShiftStonePrefs.Empty, <left>5__3);
				}
				if (<selfEquipped>5__1[0] == (int)<right>5__4)
				{
					ShiftStoneRandomizer.EquipStones(ShiftStonePrefs.Empty, <right>5__4);
				}
				ShiftStoneRandomizer.EquipStones(<left>5__3, <right>5__4);
				<sw>5__5.Restart();
			}
			<>2__current = null;
			<>1__state = 1;
			return true;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public static List<ShiftStonePrefs> Selection;

	public static List<ShiftStonePrefs> NextSelection;

	public static GameObject ButtonSource;

	private static GameObject[] Sockets;

	public static GameObject[] DisplayedItem;

	public static GameObject ClusterSource;

	public static LoadoutInteractor MainInteractor;

	private Slot _map0Host;

	private Slot _map1Host;

	private Slot _map0Client;

	private Slot _map1Client;

	public static List<MelonPreferences_Entry<string>> PrefList;

	public readonly List<Slot> SlotList;

	public static bool IsNextSelectionPrimed { get; set; }

	public static AutomationPrefs AutomationMode
	{
		get
		{
			return ShiftStoneRandomizer.AutomationMode;
		}
		set
		{
			ShiftStoneRandomizer.AutomationMode = value;
		}
	}

	public static GameObject LeftSocket
	{
		get
		{
			return Sockets[0];
		}
		set
		{
			Sockets[0] = value;
		}
	}

	public static GameObject RightSocket
	{
		get
		{
			return Sockets[1];
		}
		set
		{
			Sockets[1] = value;
		}
	}

	public Slot Map0Host => _map0Host;

	public Slot Map1Host => _map1Host;

	public Slot Map0Client => _map0Client;

	public Slot Map1Client => _map1Client;

	public GameObject Cluster { get; private set; }

	public static event Action<Quadrants, ShiftStonePrefs, ShiftStonePrefs> Display;

	public static void OnMatchLoad()
	{
		Debug.Log("LoadoutInteractor: OnMatchLoad called", debugOnly: true);
		if (ShiftStoneRandomizer.IsFirstMatchLoad)
		{
			AutoApply(isFirstMatchLoad: true);
			Debug.Log("LoadoutInteractor: OnMatchLoad applying stones for first match load", debugOnly: true);
			if (AutomationMode == AutomationPrefs.Mirror && IsNextSelectionPrimed)
			{
				AutoApply(isFirstMatchLoad: false);
			}
		}
	}

	public static void ReplayPrep()
	{
		IsNextSelectionPrimed = AutomationMode != AutomationPrefs.None;
		AutoApply(isFirstMatchLoad: false);
	}

	public static void AutoApply(bool isFirstMatchLoad)
	{
		if (!IsNextSelectionPrimed)
		{
			return;
		}
		if (AutomationMode == AutomationPrefs.Auto)
		{
			int num = (ShiftStoneRandomizer.IsHost ? 2 : 0);
			if (isFirstMatchLoad)
			{
				num = ((!ShiftStoneRandomizer.IsHost) ? 2 : 0);
			}
			int num2 = ((!(ShiftStoneRandomizer.CurrentLoadedScene == "map0")) ? 1 : 0);
			MainInteractor.SlotList[num + num2].ApplyLoadOut();
		}
		else if (AutomationMode == AutomationPrefs.Mirror)
		{
			if ((Object)(object)ShiftStoneRandomizer.Player1 != (Object)null)
			{
				int[] array = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player1).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
				ShiftStoneRandomizer.EquipStones((array[0] >= 0) ? StoneItem.AllStones[array[0]] : new StoneItem(), (array[1] >= 0) ? StoneItem.AllStones[array[1]] : new StoneItem());
			}
		}
		else if (AutomationMode == AutomationPrefs.Random)
		{
			ShiftStoneRandomizer.RandomizeStones(Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player0).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration()), ShiftStoneRandomizer.EnabledHand);
		}
	}

	[IteratorStateMachine(typeof(<ContinuousCopy>d__11))]
	public static IEnumerator ContinuousCopy(Hands hand)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <ContinuousCopy>d__11(0)
		{
			hand = hand
		};
	}

	public static void ClearAllSlots()
	{
		ClearSlot(Sockets[0]);
		ClearSlot(Sockets[1]);
	}

	public static void ClearSlot(GameObject parent)
	{
		for (int i = 0; i < parent.transform.childCount; i++)
		{
			GameObject gameObject = ((Component)parent.transform.GetChild(i)).gameObject;
			if (((Object)gameObject).name.Contains("Indicator"))
			{
				try
				{
					Debug.Log("Clearing slot: " + ((Object)gameObject).name, debugOnly: true);
					Object.Destroy((Object)(object)((Component)parent.transform.GetChild(i)).gameObject);
				}
				catch (Exception ex)
				{
					Debug.Log(ex.Message, debugOnly: false, 1);
				}
			}
		}
	}

	public static void HighlightItem(ShiftStonePrefs item, Hands hand)
	{
		//IL_00b2: 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)
		int num = ((hand == Hands.Left) ? 1 : 0);
		ClearSlot(Sockets[(int)hand]);
		if (item <= ShiftStonePrefs.Empty)
		{
			ShiftStoneRandomizer.EquipStones((hand == Hands.Left) ? new StoneItem() : null, (hand == Hands.Right) ? new StoneItem() : null, applyEffect: false);
			Selection[(int)hand] = ((Selection[(int)hand] == item) ? ShiftStonePrefs.Empty : item);
			if (Selection[(int)hand] != ShiftStonePrefs.Empty)
			{
				DisplayedItem[(int)hand] = StoneItem.GetDisplayObject(Selection[(int)hand]);
				DisplayedItem[(int)hand].transform.localPosition = new Vector3(0f, 0.025f, 0f);
				DisplayedItem[(int)hand].transform.SetParent(Sockets[(int)hand].transform, false);
				DisplayedItem[(int)hand].transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
				DisplayedItem[(int)hand].SetActive(true);
			}
		}
		else
		{
			int[] array = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
			if (array[num] != (int)item)
			{
				StoneItem stoneItem = ((array[(int)hand] == (int)item) ? new StoneItem() : StoneItem.AllStones[(int)item]);
				ShiftStoneRandomizer.EquipStones((hand == Hands.Left) ? stoneItem : null, (hand == Hands.Right) ? stoneItem : null, applyEffect: false);
				Selection[(int)hand] = stoneItem.GetEnum();
			}
		}
	}

	public static void HighlightCurrentEquippedStones()
	{
		int[] array = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
		Selection[0] = (ShiftStonePrefs)array[0];
		Selection[1] = (ShiftStonePrefs)array[1];
	}

	public static void UpdateAllDisplays(Quadrants quadrant, ShiftStonePrefs left, ShiftStonePrefs right)
	{
		LoadoutInteractor.Display?.Invoke(quadrant, left, right);
	}

	public static void UnsubAll()
	{
		LoadoutInteractor.Display = null;
	}

	static LoadoutInteractor()
	{
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Expected O, but got Unknown
		IsNextSelectionPrimed = true;
		Selection = new List<ShiftStonePrefs>
		{
			ShiftStonePrefs.Stay,
			ShiftStonePrefs.Stay
		};
		NextSelection = new List<ShiftStonePrefs>
		{
			ShiftStonePrefs.Invalid,
			ShiftStonePrefs.Invalid
		};
		Sockets = (GameObject[])(object)new GameObject[2];
		DisplayedItem = (GameObject[])(object)new GameObject[2];
		MainInteractor = null;
		PrefList = new List<MelonPreferences_Entry<string>>
		{
			ShiftStoneRandomizer.PrefMap0HostLeft,
			ShiftStoneRandomizer.PrefMap0HostRight,
			ShiftStoneRandomizer.PrefMap1HostLeft,
			ShiftStoneRandomizer.PrefMap1HostRight,
			ShiftStoneRandomizer.PrefMap0ClientLeft,
			ShiftStoneRandomizer.PrefMap0ClientRight,
			ShiftStoneRandomizer.PrefMap1ClientLeft,
			ShiftStoneRandomizer.PrefMap1ClientRight
		};
		ButtonSource = ShiftStoneRandomizer.SmallButtonSource;
		((Behaviour)((Component)ButtonSource.transform.GetChild(0)).GetComponent<InteractionButton>()).enabled = true;
		ButtonSource.transform.localRotation = Quaternion.Euler(0f, 270f, 90f);
		ButtonSource.transform.localPosition = Vector3.zero;
		ButtonSource.SetActive(false);
		ButtonSource.transform.SetParent(ShiftStoneRandomizer.DDOLParent.transform, false);
		ClusterSource = new GameObject("Loadout Cluster");
		ClusterSource.transform.SetParent(ShiftStoneRandomizer.DDOLParent.transform, false);
		Calls.onMatchEnded += ReplayPrep;
	}

	public static void SelectBaseStone()
	{
		int[] array = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
		for (int i = 0; i < 2; i++)
		{
			Selection[i] = (ShiftStonePrefs)array[i];
		}
	}

	public static void SelectCommandStone(ShiftStonePrefs commandStone)
	{
		Hands index = Hands.Left;
		if (Selection[(int)index] == commandStone)
		{
			Selection[(int)index] = ShiftStonePrefs.Empty;
		}
		else
		{
			Selection[(int)index] = commandStone;
		}
	}

	public static void DisplayCommandOnHand(ShiftStonePrefs command, Hands hand)
	{
	}

	public LoadoutInteractor(bool isForSaving)
	{
		//IL_010a: 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_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0339: Unknown result type (might be due to invalid IL or missing references)
		//IL_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_0376: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		SlotList = new List<Slot> { Map0Host, Map1Host, Map0Client, Map1Client };
		Cluster = Object.Instantiate<GameObject>(ClusterSource);
		for (int i = 0; i < 4; i++)
		{
			SlotList[i] = new Slot((Quadrants)i, PrefList[i * 2], PrefList[i * 2 + 1], isForSaving);
			SlotList[i].Button.transform.SetParent(Cluster.transform, false);
		}
		Cluster.SetActive(false);
		if (MainInteractor == null && !isForSaving)
		{
			MainInteractor = this;
		}
		GameObject val = Create.NewText(isForSaving ? "Save Loadout" : "Apply Loadout", 0.4f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		val.transform.SetParent(Cluster.transform, false);
		val.transform.localPosition = new Vector3(0f, -0.12f, 0f);
		val.SetActive(true);
		((TMP_Text)val.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		GameObject val2 = Create.NewText("Host", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		val2.transform.SetParent(Cluster.transform, false);
		((Object)val2).name = "Position Label";
		((TMP_Text)val2.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val2.transform.localPosition = new Vector3(-0.04f, 0.14f, 0f);
		GameObject val3 = Create.NewText("Client", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		val3.transform.SetParent(Cluster.transform, false);
		((Object)val3).name = "Position Label";
		((TMP_Text)val3.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val3.transform.localPosition = new Vector3(0.04f, 0.14f, 0f);
		GameObject val4 = Create.NewText("Ring", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		val4.transform.SetParent(Cluster.transform, false);
		((Object)val4).name = "Position Label";
		((TMP_Text)val4.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val4.transform.localPosition = new Vector3(0.1f, 0.06f, 0f);
		GameObject val5 = Create.NewText("Pit", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		val5.transform.SetParent(Cluster.transform, false);
		((Object)val5).name = "Position Label";
		((TMP_Text)val5.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val5.transform.localPosition = new Vector3(0.1f, -0.06f, 0f);
	}
}
public class StoneItem
{
	private static GameObject ObjMirror;

	private static GameObject ObjStay;

	private static GameObject ObjRandom;

	private static GameObject ObjEmpty;

	public static readonly GameObject[] Specials;

	public static StoneItem[] AllStones;

	private static int _blacklistCount;

	private bool _isEnabled;

	private List<GameObject> _iconList = new List<GameObject>();

	public static int BlackListCount => _blacklistCount;

	public ShiftStone ShiftStone { get; private set; }

	public string Name => ((Object)(object)ShiftStone != (Object)null) ? ((Object)ShiftStone).name.Replace("Stone", "") : "Empty";

	public bool IsEnabled
	{
		get
		{
			return _isEnabled;
		}
		set
		{
			_isEnabled = value;
			if (ShiftStone == null)
			{
				return;
			}
			if (value)
			{
				_blacklistCount++;
			}
			else
			{
				_blacklistCount--;
			}
			if (_iconList == null)
			{
				return;
			}
			foreach (GameObject icon in _iconList)
			{
				try
				{
					icon.SetActive(!_isEnabled);
				}
				catch (Exception ex)
				{
					Debug.Log(ex.Message, debugOnly: false, 1);
				}
			}
		}
	}

	public List<GameObject> IconList
	{
		get
		{
			return _iconList;
		}
		set
		{
			_iconList = value;
		}
	}

	static StoneItem()
	{
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
		ObjMirror = Object.Instantiate<GameObject>(((Component)ShiftStoneRandomizer.IndicatorsBase.transform.GetChild(3)).gameObject);
		ObjStay = Object.Instantiate<GameObject>(((Component)ShiftStoneRandomizer.IndicatorsBase.transform.GetChild(4)).gameObject);
		ObjRandom = Object.Instantiate<GameObject>(((Component)ShiftStoneRandomizer.IndicatorsBase.transform.GetChild(5)).gameObject);
		ObjEmpty = Object.Instantiate<GameObject>(((Component)ShiftStoneRandomizer.IndicatorsBase.transform.GetChild(6)).gameObject);
		Specials = (GameObject[])(object)new GameObject[4] { ObjMirror, ObjStay, ObjRandom, ObjEmpty };
		AllStones = new StoneItem[8]
		{
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("AdamantStone")).gameObject.GetComponent<UnyieldingStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("ChargeStone")).gameObject.GetComponent<ChargeStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("FlowStone")).gameObject.GetComponent<FlowStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("GuardStone")).gameObject.GetComponent<GuardStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("StubbornStone")).gameObject.GetComponent<StubbornStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("SurgeStone")).gameObject.GetComponent<CounterStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("VigorStone")).gameObject.GetComponent<VigorStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("VolatileStone")).gameObject.GetComponent<VolatileStone>())
		};
		_blacklistCount = 0;
		((Object)ObjMirror).name = "Indicator_Mirror";
		((Graphic)((Component)ObjMirror.transform.GetChild(0)).GetComponent<RawImage>()).color = Color.blue;
		((Object)ObjStay).name = "Indicator_Stay";
		((Graphic)((Component)ObjStay.transform.GetChild(0)).GetComponent<RawImage>()).color = Color.red;
		((Object)ObjRandom).name = "Indicator_Random";
		((Graphic)((Component)ObjRandom.transform.GetChild(0)).GetComponent<RawImage>()).color = Color.green;
		((Object)ObjEmpty).name = "Indicator_Empty";
		((Graphic)((Component)ObjEmpty.transform.GetChild(0)).GetComponent<RawImage>()).color = Color.black;
		GameObject[] specials = Specials;
		foreach (GameObject val in specials)
		{
			val.transform.localScale = Vector3.one * 0.00015f;
			val.transform.localRotation = Quaternion.Euler(90f, 90f, 0f);
			val.transform.SetParent(ShiftStoneRandomizer.DDOLParent.transform);
			val.SetActive(false);
		}
	}

	public static GameObject GetDisplayObject(ShiftStonePrefs stoneEnum)
	{
		Debug.Log($"GetDisplayObject called for {stoneEnum} Index: {(int)stoneEnum}", debugOnly: true);
		if (stoneEnum >= ShiftStonePrefs.Adamant && stoneEnum <= ShiftStonePrefs.Volatile)
		{
			try
			{
				return Object.Instantiate<GameObject>(((Component)AllStones[(int)stoneEnum].ShiftStone).gameObject);
			}
			catch (Exception ex)
			{
				Debug.Log($"Error instantiating stone object for {stoneEnum}: {ex.Message}", debugOnly: false, 2);
				return Object.Instantiate<GameObject>(((Component)RecreateStoneItems()[(int)stoneEnum].ShiftStone).gameObject);
			}
		}
		if (stoneEnum >= ShiftStonePrefs.Mirror && stoneEnum <= ShiftStonePrefs.Empty)
		{
			return Object.Instantiate<GameObject>(Specials[(int)(stoneEnum + 4)]);
		}
		Debug.Log($"GetDisplayObject: Invalid stone enum {stoneEnum} index for GetDisplayObject {(int)stoneEnum}", debugOnly: false, 2);
		return null;
	}

	public static void ResetAllIcons()
	{
		StoneItem[] allStones = AllStones;
		foreach (StoneItem stoneItem in allStones)
		{
			stoneItem.ResetIcons();
		}
	}

	public static StoneItem[] RecreateStoneItems()
	{
		return AllStones = new StoneItem[8]
		{
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("AdamantStone")).gameObject.GetComponent<UnyieldingStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("ChargeStone")).gameObject.GetComponent<ChargeStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("FlowStone")).gameObject.GetComponent<FlowStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("GuardStone")).gameObject.GetComponent<GuardStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("StubbornStone")).gameObject.GetComponent<StubbornStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("SurgeStone")).gameObject.GetComponent<CounterStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("VigorStone")).gameObject.GetComponent<VigorStone>()),
			new StoneItem((ShiftStone)(object)((Component)Managers.GetPoolManager().GetPooledObject("VolatileStone")).gameObject.GetComponent<VolatileStone>())
		};
	}

	public ShiftStonePrefs GetEnum()
	{
		if (!Enum.TryParse<ShiftStonePrefs>(Name, out var result))
		{
			Debug.Log("Error: Failed to parse stone item enum");
			return ShiftStonePrefs.Invalid;
		}
		return result;
	}

	public StoneItem(ShiftStone shiftStone)
	{
		((Component)shiftStone).gameObject.SetActive(false);
		ShiftStone = shiftStone;
		_isEnabled = true;
	}

	public StoneItem(ShiftStonePrefs stoneSelection)
	{
		ShiftStone shiftStone = AllStones[(int)stoneSelection].ShiftStone;
		_isEnabled = true;
	}

	public StoneItem()
	{
		ShiftStone = null;
		_isEnabled = false;
	}

	public void AddIcon(GameObject icon)
	{
		_iconList.Add(icon);
		icon.SetActive(!_isEnabled);
	}

	public void ResetIcons()
	{
		_iconList.Clear();
		_iconList = new List<GameObject>();
	}
}
public class PortableCabinet : MelonMod
{
	[CompilerGenerated]
	private sealed class <Debouncer>d__25 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public InteractionButton ib;

		public PortableCabinet <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <Debouncer>d__25(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.5f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				((Behaviour)ib).enabled = true;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	private static GameObject qssReplacementBase;

	private static GameObject ShiftStoneBoxSource;

	private LoadoutInteractor loadInteractor;

	private GameObject LoadCluster;

	private LoadoutInteractor qssSaveInteractor;

	private GameObject QssSaveCluster;

	private GameObject leftHand;

	private GameObject rightHand;

	private GameObject Cubbies { get; set; }

	public GameObject StoneCase { get; private set; }

	private GameObject NewQssButton { get; set; }

	static PortableCabinet()
	{
		qssReplacementBase = Object.Instantiate<GameObject>(InteractionButtonToggleVariant.GetGameObject());
		qssReplacementBase.transform.SetParent(ShiftStoneRandomizer.DDOLParent.transform, false);
		ShiftStoneBoxSource = Object.Instantiate<GameObject>(ShiftstoneBox___________.GetGameObject());
		ShiftStoneBoxSource.transform.SetParent(ShiftStoneRandomizer.DDOLParent.transform, false);
		qssReplacementBase.SetActive(false);
		ShiftStoneBoxSource.SetActive(false);
	}

	public void ShowRandomedHand()
	{
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)leftHand == (Object)null) && !((Object)(object)rightHand == (Object)null))
		{
			Hands enabledHand = ShiftStoneRandomizer.EnabledHand;
			Color color = default(Color);
			((Color)(ref color))..ctor(1f, 1f, 1f, 0.25f);
			Color color2 = default(Color);
			((Color)(ref color2))..ctor(1f, 1f, 1f, 1f);
			switch (enabledHand)
			{
			case Hands.Both:
				((Graphic)((Component)leftHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
				((Graphic)((Component)rightHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
				break;
			case Hands.Left:
				((Graphic)((Component)leftHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
				((Graphic)((Component)rightHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color;
				break;
			case Hands.Right:
				((Graphic)((Component)leftHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color;
				((Graphic)((Component)rightHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
				break;
			}
		}
	}

	public void CycleHandLock()
	{
		ShiftStoneRandomizer.EnabledHand++;
		if (ShiftStoneRandomizer.EnabledHand > Hands.Right)
		{
			ShiftStoneRandomizer.EnabledHand = Hands.Both;
		}
		Hands enabledHand = ShiftStoneRandomizer.EnabledHand;
		Debug.Log($"Hand lock set to: {enabledHand}", debugOnly: true);
		switch (enabledHand)
		{
		case Hands.Both:
			ShiftStoneRandomizer.ActivateEffect(left: true, right: true);
			break;
		case Hands.Left:
			ShiftStoneRandomizer.ActivateEffect(left: true, right: false);
			break;
		case Hands.Right:
			ShiftStoneRandomizer.ActivateEffect(left: false, right: true);
			break;
		}
		ShiftStoneRandomizer.PrefEnabledHand.Value = ShiftStoneRandomizer.EnabledHand.ToString();
		ShiftStoneRandomizer.CatSettings.SaveToFile(true);
		ShowRandomedHand();
	}

	public PortableCabinet(GameObject swapper)
	{
		//IL_0084: 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)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Expected O, but got Unknown
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0255: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_041f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0447: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_050a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0560: Unknown result type (might be due to invalid IL or missing references)
		//IL_0581: Unknown result type (might be due to invalid IL or missing references)
		//IL_05af: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_067b: Unknown result type (might be due to invalid IL or missing references)
		//IL_068f: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_071e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0754: Unknown result type (might be due to invalid IL or missing references)
		//IL_0779: Unknown result type (might be due to invalid IL or missing references)
		//IL_0836: Unknown result type (might be due to invalid IL or missing references)
		//IL_0840: Expected O, but got Unknown
		//IL_0c26: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c47: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cb1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cb8: Expected O, but got Unknown
		//IL_0ce3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d04: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d82: Unknown result type (might be due to invalid IL or missing references)
		//IL_0da7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0dcc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e0a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e2f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e54: Unknown result type (might be due to invalid IL or missing references)
		//IL_0e91: Unknown result type (might be due to invalid IL or missing references)
		//IL_08df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0905: Unknown result type (might be due to invalid IL or missing references)
		//IL_0931: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a00: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a14: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a5d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a7e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ace: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bcd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0b03: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ((Component)swapper.transform.GetChild(0).GetChild(2)).gameObject;
		gameObject.SetActive(false);
		loadInteractor = new LoadoutInteractor(isForSaving: false);
		LoadCluster = loadInteractor.Cluster;
		LoadCluster.transform.SetParent(swapper.transform, false);
		LoadCluster.transform.localPosition = new Vector3(0.144f, 0.53f, 0f);
		LoadCluster.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
		LoadCluster.SetActive(true);
		qssSaveInteractor = new LoadoutInteractor(isForSaving: true);
		QssSaveCluster = qssSaveInteractor.Cluster;
		QssSaveCluster.transform.SetParent(swapper.transform, false);
		QssSaveCluster.transform.localPosition = new Vector3(0.144f, 0.77f, 0.055f);
		QssSaveCluster.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
		QssSaveCluster.SetActive(false);
		GameObject auxPanel = new GameObject("Aux Buttons");
		auxPanel.transform.SetParent(swapper.transform, false);
		auxPanel.transform.localPosition = new Vector3(0.385f, 0.36f, -0.06f);
		GameObject val = Object.Instantiate<GameObject>(LoadoutInteractor.ButtonSource);
		GameObject automationButtonLabel = Create.NewText("Auto Mode\n" + ShiftStoneRandomizer.AutomationMode, 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		((Object)automationButtonLabel).name = "AutomationLabel";
		((TMP_Text)automationButtonLabel.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		automationButtonLabel.transform.SetParent(val.transform, false);
		automationButtonLabel.transform.localRotation = Quaternion.Euler(90f, 270f, 0f);
		automationButtonLabel.transform.localPosition = new Vector3(0.05f, 0.09f, 0f);
		((Object)val).name = "Auto Enable";
		val.transform.localPosition = new Vector3(0.04f, 0.11f, -0.01f);
		val.transform.localRotation = Quaternion.Euler(0f, 270f, 270f);
		val.transform.SetParent(auxPanel.transform, false);
		val.SetActive(true);
		((Behaviour)((Component)val.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>()).enabled = true;
		((Component)val.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			int num3 = (int)(ShiftStoneRandomizer.AutomationMode + 1);
			if (num3 > 3)
			{
				ShiftStoneRandomizer.AutomationMode = AutomationPrefs.None;
			}
			else
			{
				ShiftStoneRandomizer.AutomationMode = (AutomationPrefs)num3;
			}
			ShiftStoneRandomizer.PrefAutomation.Value = ShiftStoneRandomizer.AutomationMode.ToString();
			ShiftStoneRandomizer.CatSettings.SaveToFile(true);
			Debug.PrintInGame($"Automation Mode: {LoadoutInteractor.AutomationMode}");
			((TMP_Text)automationButtonLabel.GetComponent<TextMeshPro>()).text = "Auto Mode\n" + ShiftStoneRandomizer.AutomationMode;
		}));
		GameObject val2 = Object.Instantiate<GameObject>(LoadoutInteractor.ButtonSource);
		GameObject val3 = Create.NewText("Clear Stones", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		((Object)val3).name = "Clear Label";
		((TMP_Text)val3.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val3.transform.SetParent(val2.transform, false);
		val3.transform.localRotation = Quaternion.Euler(90f, 270f, 0f);
		val3.transform.localPosition = new Vector3(0.05f, 0.09f, 0f);
		((Object)val2).name = "Clear Shift Stones";
		val2.transform.localPosition = new Vector3(-0.04f, 0.11f, -0.01f);
		val2.SetActive(true);
		val2.transform.localRotation = Quaternion.Euler(0f, 270f, 270f);
		val2.transform.SetParent(auxPanel.transform, false);
		((Behaviour)((Component)val2.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>()).enabled = true;
		((Component)val2.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			ShiftStoneRandomizer.EquipStones(new StoneItem(), new StoneItem());
		}));
		GameObject val4 = Object.Instantiate<GameObject>(LoadoutInteractor.ButtonSource);
		GameObject val5 = Create.NewText("Copy Stones", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		((Object)val5).name = "Copy Label";
		((TMP_Text)val5.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val5.transform.SetParent(val4.transform, false);
		val5.transform.localRotation = Quaternion.Euler(90f, 270f, 0f);
		val5.transform.localPosition = new Vector3(0.05f, 0.09f, 0f);
		((Object)val4).name = "Mirror Shift Stones";
		val4.transform.localPosition = new Vector3(0.04f, 0.22f, -0.01f);
		val4.transform.localRotation = Quaternion.Euler(0f, 270f, 270f);
		val4.transform.SetParent(auxPanel.transform, false);
		val4.SetActive(true);
		((Behaviour)((Component)val4.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>()).enabled = true;
		((Component)val4.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			if ((Object)(object)ShiftStoneRandomizer.Player1 != (Object)null)
			{
				int[] array = Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player1).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration());
				ShiftStoneRandomizer.EquipStones((array[0] == -1) ? new StoneItem() : StoneItem.AllStones[array[0]], (array[1] == -1) ? new StoneItem() : StoneItem.AllStones[array[0]]);
			}
		}));
		GameObject blackListButton = Object.Instantiate<GameObject>(LoadoutInteractor.ButtonSource);
		GameObject val6 = Create.NewText("Blacklist", 0.2f, Color.white, new Vector3(0f, 0f, 0f), Quaternion.Euler(0f, 0f, 0f));
		((Object)val6).name = "BlackListLabel";
		((TMP_Text)val6.GetComponent<TextMeshPro>()).alignment = (TextAlignmentOptions)514;
		val6.transform.SetParent(blackListButton.transform, false);
		val6.transform.localRotation = Quaternion.Euler(90f, 270f, 0f);
		val6.transform.localPosition = new Vector3(0.05f, 0.09f, 0f);
		((Object)blackListButton).name = "BlackList";
		blackListButton.transform.localPosition = new Vector3(-0.04f, 0.22f, -0.01f);
		blackListButton.transform.localRotation = Quaternion.Euler(0f, 270f, 270f);
		blackListButton.transform.SetParent(auxPanel.transform, false);
		blackListButton.SetActive(true);
		((Behaviour)((Component)blackListButton.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>()).enabled = true;
		((Component)blackListButton.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			ShiftStoneRandomizer.ToggleStones(Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)ShiftStoneRandomizer.Player0).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration()));
			ShiftStoneRandomizer.ActivateEffect(left: true, right: true);
		}));
		double num = 0.1;
		double num2 = 0.12;
		StoneCase = new GameObject("Portable Stone Case");
		for (int i = 0; i < 12; i++)
		{
			ShiftStonePrefs currentStonePref = (ShiftStonePrefs)((i < 8) ? i : (i - 12));
			GameObject box = Object.Instantiate<GameObject>(ShiftStoneBoxSource);
			((Object)box).name = currentStonePref.ToString() + "_Case";
			box.transform.localPosition = new Vector3((float)(num * (double)(i % 4) * -1.0), (float)(num2 * (double)(i / 4) * -1.0), 0.07f);
			box.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
			box.transform.GetChild(0).localPosition = new Vector3(-0.03f, -0.04f, -0f);
			((Behaviour)((Component)box.transform.GetChild(0)).gameObject.GetComponent<LocalizedTextTMPro>()).enabled = false;
			((Behaviour)((Component)box.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>()).enabled = false;
			box.transform.SetParent(StoneCase.transform, false);
			box.SetActive(true);
			if (i < 8)
			{
				StoneItem.AllStones[i].AddIcon(ShiftStoneRandomizer.CreateBlackListIcons(box));
			}
			GameObject val7 = Create.NewText(currentStonePref.ToString(), 0.2f, Color.white, new Vector3(0f, -0f, 0f), Quaternion.Euler(0f, 0f, 0f));
			((Object)val7).name = "ReplacementLabel";
			val7.transform.SetParent(box.transform, false);
			val7.transform.localPosition = new Vector3(-0.03f, -0.04f, -0.332f);
			val7.transform.localRotation = Quaternion.Euler(0f, 90f, 0f);
			GameObject displayObject = StoneItem.GetDisplayObject(currentStonePref);
			if (currentStonePref >= ShiftStonePrefs.Adamant && currentStonePref != ShiftStonePrefs.Charge)
			{
				displayObject.transform.rotation = Quaternion.Euler(0f, 0f, 90f);
			}
			else if (currentStonePref < ShiftStonePrefs.Adamant)
			{
				displayObject.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
			}
			displayObject.transform.SetParent(box.transform, false);
			displayObject.SetActive(true);
			((Component)box.transform.GetChild(1)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
			{
				Hands hand = FindCulprit(box);
				LoadoutInteractor.HighlightItem(currentStonePref, hand);
				InteractionButton component = ((Component)box.transform.GetChild(1)).gameObject.GetComponent<InteractionButton>();
				((Behaviour)component).enabled = false;
				MelonCoroutines.Start(Debouncer(component));
			}));
			((Behaviour)((Component)box.transform.GetChild(1)).gameObject.GetComponent<InteractionButton>()).enabled = true;
			StoneCase.transform.SetParent(swapper.transform, false);
			StoneCase.SetActive(false);
			StoneCase.transform.localPosition = new Vector3(0.3f, 0.6f, 0f);
		}
		GameObject val8 = Object.Instantiate<GameObject>(gameObject);
		val8.transform.SetParent(swapper.transform.GetChild(0), false);
		val8.transform.localPosition = new Vector3(0.1835f, -0.001f, -0.02f);
		val8.transform.localRotation = Quaternion.Euler(43.108f, 348.0498f, 275.3816f);
		((Component)val8.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		((Component)val8.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			CycleHandLock();
		}));
		val8.SetActive(true);
		GameObject val9 = new GameObject("Hand Holder");
		val9.transform.SetParent(val8.transform, false);
		val9.transform.localPosition = new Vector3(-0.04f, 0.25f, -0.16f);
		val9.transform.localRotation = Quaternion.Euler(285f, 315f, 150f);
		leftHand = Object.Instantiate<GameObject>(((Component)ShiftStoneRandomizer.IndicatorsBase.transform.GetChild(2)).gameObject);
		rightHand = Object.Instantiate<GameObject>(((Component)ShiftStoneRandomizer.IndicatorsBase.transform.GetChild(1)).gameObject);
		leftHand.transform.SetParent(val9.transform, false);
		leftHand.transform.localPosition = new Vector3(-0.18f, 0.01f, 0.05f);
		leftHand.transform.localRotation = Quaternion.Euler(90f, 45f, 0f);
		leftHand.transform.localScale = new Vector3(0.0003f, 0.0003f, 0.0003f);
		rightHand.transform.SetParent(val9.transform, false);
		rightHand.transform.localPosition = new Vector3(-0.14f, 0.01f, -0.07f);
		rightHand.transform.localRotation = Quaternion.Euler(90f, 105f, 0f);
		rightHand.transform.localScale = new Vector3(0.0003f, 0.0003f, 0.0003f);
		ShowRandomedHand();
		NewQssButton = Object.Instantiate<GameObject>(qssReplacementBase);
		NewQssButton.transform.localPosition = new Vector3(0.0131f, 0.0179f, 0.0577f);
		NewQssButton.transform.SetParent(swapper.transform.GetChild(0), false);
		NewQssButton.SetActive(true);
		InteractionButton interaction = ((Component)NewQssButton.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>();
		((UnityEvent<bool>)(object)((Component)NewQssButton.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onToggleStateChanged).AddListener(UnityAction<bool>.op_Implicit((Action<bool>)delegate
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log("Pressed", debugOnly: true);
			StoneCase.SetActive(interaction.IsPressed);
			QssSaveCluster.SetActive(interaction.IsPressed);
			blackListButton.SetActive(interaction.IsPressed);
			loadInteractor.Cluster.SetActive(!interaction.IsPressed);
			auxPanel.transform.localPosition = (interaction.IsPressed ? new Vector3(0.385f, 0.6f, -0.005f) : new Vector3(0.385f, 0.36f, -0.06f));
			LoadoutInteractor.ClearAllSlots();
			LoadoutInteractor.HighlightCurrentEquippedStones();
		}));
	}

	private Hands FindCulprit(GameObject selectedButton)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		float num = Vector3.Distance(ShiftStoneRandomizer.leftPoint.transform.position, selectedButton.transform.position);
		float num2 = Vector3.Distance(ShiftStoneRandomizer.rightPoint.transform.position, selectedButton.transform.position);
		Debug.Log($"LeftDist: {num} RightDist: {num2}", debugOnly: true);
		return (!(num < num2)) ? Hands.Right : Hands.Left;
	}

	[IteratorStateMachine(typeof(<Debouncer>d__25))]
	private IEnumerator Debouncer(InteractionButton ib)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <Debouncer>d__25(0)
		{
			<>4__this = this,
			ib = ib
		};
	}
}