Decompiled source of ShiftStoneRandomizer v1.0.0

Mods/ShiftStoneRandomizer.dll

Decompiled 2 weeks ago
using System;
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 Il2CppRUMBLE.Combat.ShiftStones;
using Il2CppRUMBLE.Input;
using Il2CppRUMBLE.Interactions.InteractionBase;
using Il2CppRUMBLE.Players;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppRootMotion;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Il2CppTMPro;
using MelonLoader;
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(Class1), "ShiftStoneRandomizer", "1.0.0", "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("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShiftStoneRandomizer;

internal class StoneItem
{
	private static int _blacklistCount;

	private bool _isEnabled;

	private GameObject _icon;

	public static int BlackListCount => _blacklistCount;

	public ShiftStone ShiftStone { get; 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 (value)
			{
				_blacklistCount++;
			}
			else
			{
				_blacklistCount--;
			}
			if (!((Object)(object)_icon == (Object)null))
			{
				_icon.SetActive(!_isEnabled);
			}
		}
	}

	public GameObject Icon
	{
		set
		{
			_icon = value;
			_icon.SetActive(false);
		}
	}

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

	public StoneItem()
	{
		ShiftStone = null;
	}
}
public class Class1 : MelonMod
{
	private enum HandLock
	{
		Neither = -1,
		Left,
		Right
	}

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

	private const string BLACKLIST_FILE = "blacklist.txt";

	private const string LOADOUT_FILE = "loadout.txt";

	private const string DEBUG_FILE = ".debug";

	private Random random = new Random();

	private StoneItem[] stones;

	private StoneItem[] defaultStones = new StoneItem[2]
	{
		new StoneItem(),
		new StoneItem()
	};

	private bool debugMode = false;

	private bool firstLoad = true;

	private string CurrentScene;

	private int lockedHand = -1;

	private GameObject RandomizerAssets;

	private GameObject IndicatorsBase;

	private GameObject leftHand;

	private GameObject rightHand;

	private GameObject dropSign;

	private PlayerHaptics haptics;

	private GameObject glasses;

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

	public void logOnMatchEnded()
	{
		Log("Match Ended", debugOnly: true);
	}

	private void SceneReady()
	{
		InitializeShiftStones();
		if (CurrentScene == "Gym")
		{
			if (firstLoad)
			{
				IndicatorsBase = Object.Instantiate<GameObject>(Calls.LoadAssetFromStream<GameObject>((MelonMod)(object)this, "ShiftStoneRandomizer.assets.randomizer", "ShiftstoneRandomizer"));
				Object.DontDestroyOnLoad((Object)(object)IndicatorsBase);
				IndicatorsBase.SetActive(false);
			}
			CreatePhysicalGUI();
			GameObject gameObject = Cabinet.GetGameObject();
			for (int i = 0; i < stones.Length; i++)
			{
				stones[i].Icon = CreateBlackListIcons(((Component)gameObject.transform.GetChild(i)).gameObject);
			}
			LoadLoadOut(dontEquip: true, !firstLoad);
			ShowHandLock();
			firstLoad = false;
		}
		CreateButtonsForAll();
		LoadBlackListFile();
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		CurrentScene = sceneName;
	}

	private void LoadBlackListFile()
	{
		if (!Directory.Exists("Userdata/ShiftStoneRandomizer/"))
		{
			Directory.CreateDirectory("Userdata/ShiftStoneRandomizer/");
		}
		if (File.Exists(Path.Combine("Userdata/ShiftStoneRandomizer/", ".debug")))
		{
			debugMode = true;
			Log("Debug mode enabled");
		}
		else
		{
			debugMode = false;
			Log("Debug mode disabled");
		}
		if (File.Exists(Path.Combine("Userdata/ShiftStoneRandomizer/", "blacklist.txt")))
		{
			string[] array = File.ReadAllLines(Path.Combine("Userdata/ShiftStoneRandomizer/", "blacklist.txt"));
			Log("BlackListing stones from file");
			for (int i = 0; i < array.Length; i++)
			{
				StoneItem[] array2 = stones;
				foreach (StoneItem stoneItem in array2)
				{
					if (stoneItem.Name == array[i])
					{
						stoneItem.IsEnabled = false;
						Log("\t" + stoneItem.Name);
					}
				}
			}
		}
		else
		{
			Log("No blacklist file found");
		}
	}

	private void LoadLoadOut(bool dontEquip = false, bool skipLock = false)
	{
		if (File.Exists(Path.Combine("Userdata/ShiftStoneRandomizer/", "loadout.txt")))
		{
			string[] array = File.ReadAllLines(Path.Combine("Userdata/ShiftStoneRandomizer/", "loadout.txt"));
			HandLock result;
			bool flag = Enum.TryParse<HandLock>(array[0], out result);
			if (!skipLock)
			{
				Log("Parsed string:\n " + string.Join("\n\t ", array), debugOnly: true);
				if (!flag)
				{
					Log("Failed to parse hand lock from file: " + array[0] + ". Defaulting to None.", debugOnly: true);
					result = HandLock.Neither;
				}
				else
				{
					Log($"Parsed hand lock from file: {result}", debugOnly: true);
					lockedHand = (int)result;
				}
			}
			for (int i = 1; i < array.Length; i++)
			{
				if (array[i] == "Empty")
				{
					defaultStones[i - 1] = new StoneItem();
					continue;
				}
				StoneItem[] array2 = stones;
				foreach (StoneItem stoneItem in array2)
				{
					if (stoneItem.Name == array[i])
					{
						defaultStones[i - 1] = stoneItem;
						Log("Loaded " + stoneItem.Name + " from file", debugOnly: true);
					}
				}
			}
		}
		if (!dontEquip)
		{
			EquipStones(defaultStones);
		}
	}

	private void InitializeShiftStones()
	{
		stones = 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>())
		};
	}

	private void BlackListStones(int[] Hand)
	{
		bool flag = false;
		foreach (int num in Hand)
		{
			if (num > -1 && stones[num].IsEnabled)
			{
				flag = true;
				stones[num].IsEnabled = false;
			}
		}
		if (flag)
		{
			EquipStones(new StoneItem(), new StoneItem());
		}
		else
		{
			foreach (int num2 in Hand)
			{
				if (num2 > -1)
				{
					stones[num2].IsEnabled = true;
				}
			}
		}
		string text = "";
		Log("Blacklisted stones: ", debugOnly: true);
		StoneItem[] array = stones;
		foreach (StoneItem stoneItem in array)
		{
			if (!stoneItem.IsEnabled)
			{
				Log("\t" + stoneItem.Name, debugOnly: true);
				text = text + stoneItem.Name + "\n";
			}
		}
		File.WriteAllText(Path.Combine("Userdata/ShiftStoneRandomizer/", "blacklist.txt"), text);
		ActivateEffect(left: true, right: true);
	}

	private void CycleHandLock()
	{
		lockedHand++;
		if (lockedHand > 1)
		{
			lockedHand = -1;
		}
		HandLock handLock = (HandLock)lockedHand;
		Log($"Hand lock set to: {handLock}");
		switch (handLock)
		{
		case HandLock.Neither:
			ActivateEffect(left: true, right: true);
			break;
		case HandLock.Left:
			ActivateEffect(left: true, right: false);
			break;
		case HandLock.Right:
			ActivateEffect(left: false, right: true);
			break;
		}
		ShowHandLock();
	}

	private void ShowHandLock()
	{
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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)
		HandLock handLock = (HandLock)lockedHand;
		Color color = default(Color);
		((Color)(ref color))..ctor(1f, 1f, 1f, 0.2f);
		Color color2 = default(Color);
		((Color)(ref color2))..ctor(1f, 1f, 1f, 1f);
		switch (handLock)
		{
		case HandLock.Neither:
			((Graphic)((Component)leftHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
			((Graphic)((Component)rightHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
			break;
		case HandLock.Left:
			((Graphic)((Component)leftHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color;
			((Graphic)((Component)rightHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
			break;
		case HandLock.Right:
			((Graphic)((Component)leftHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color2;
			((Graphic)((Component)rightHand.transform.GetChild(0)).GetComponent<RawImage>()).color = color;
			break;
		}
	}

	private void SignFall()
	{
		//IL_0069: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b5: 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)
		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));
		}
	}

	private void SaveLoadOut(int[] Equipped)
	{
		StoneItem stoneItem = ((Equipped[0] != -1) ? stones[Equipped[0]] : new StoneItem());
		StoneItem stoneItem2 = ((Equipped[1] != -1) ? stones[Equipped[1]] : new StoneItem());
		string text = $"{(HandLock)lockedHand} \n{stoneItem.Name}\n{stoneItem2.Name}";
		File.WriteAllText(Path.Combine("Userdata/ShiftStoneRandomizer/", "loadout.txt"), text);
		Log("Saved loadout: " + text, debugOnly: true);
		defaultStones[0] = stoneItem;
		defaultStones[1] = stoneItem2;
		ActivateEffect(left: true, right: true);
		SignFall();
	}

	private void ActivateEffect(bool left, bool right)
	{
		if (left)
		{
			((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().ActivateUseShiftstoneEffects((Hand)1);
		}
		if (right)
		{
			((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().ActivateUseShiftstoneEffects((Hand)2);
		}
	}

	private void RandomizeStones(int[] Equipped)
	{
		List<StoneItem> list = new List<StoneItem>();
		Log("Stone check:", debugOnly: true);
		string text = "";
		for (int i = 0; i < stones.Length; i++)
		{
			StoneItem stoneItem = stones[i];
			if (stoneItem.IsEnabled && Array.IndexOf(Equipped, i) == -1)
			{
				list.Add(stoneItem);
				text = text + stoneItem.Name + ", ";
			}
		}
		int num = 0;
		Log("Enabled stones pre-check: " + text.TrimEnd(',', ' '), debugOnly: true);
		if (list.Count <= 2 && lockedHand == -1)
		{
			Log("Not enough stones to disallow repeats", debugOnly: true);
			for (int j = 0; j < Equipped.Length; j++)
			{
				int num2 = Equipped[j];
				Log(num2.ToString(), debugOnly: true);
				if (num2 > -1)
				{
					Log($"{list.Contains(stones[num2])}", debugOnly: true);
					if (!list.Contains(stones[num2]) && stones[num2].IsEnabled)
					{
						list.Add(stones[num2]);
						text = text + ", " + stones[num2].Name;
						num++;
					}
				}
			}
		}
		Log("Enabled stones post-check: " + text.TrimEnd(',', ' ') + "\n", debugOnly: true);
		if (list.Count < 1)
		{
			Log("Not enough stones enabled.");
			return;
		}
		if (num == list.Count)
		{
			Log("Enabled stones already equipped. Not randomizing.");
			return;
		}
		list = list.OrderBy((StoneItem x) => random.Next()).ToList();
		switch ((HandLock)lockedHand)
		{
		case HandLock.Neither:
			EquipStones(list[0], (list.Count > 1) ? list[1] : null);
			break;
		case HandLock.Left:
			EquipStones(null, list[0]);
			break;
		case HandLock.Right:
			EquipStones(list[0], null);
			break;
		}
	}

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

	private void EquipStones(StoneItem leftStone, StoneItem rightStone)
	{
		Log("Equipping stones: " + ((leftStone != null) ? leftStone.Name : "Null") + " | " + ((rightStone != null) ? rightStone.Name : "Null"), debugOnly: true);
		if (rightStone != null)
		{
			((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().RemoveShiftStone(1, true, true);
		}
		if (leftStone != null)
		{
			((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().RemoveShiftStone(0, true, true);
			if ((Object)(object)leftStone.ShiftStone != (Object)null)
			{
				((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().AttachShiftStone(leftStone.ShiftStone, 0, true, true);
				((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().RemoveAndReattachShiftstones(true, true);
			}
		}
		if (rightStone != null)
		{
			((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().RemoveShiftStone(1, true, true);
			if ((Object)(object)rightStone.ShiftStone != (Object)null)
			{
				((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().AttachShiftStone(rightStone.ShiftStone, 1, true, true);
				((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().RemoveAndReattachShiftstones(true, true);
			}
		}
		ActivateEffect(leftStone != null, rightStone != null);
	}

	private void Log(string message, bool debugOnly = false)
	{
		if (!debugOnly)
		{
			((MelonBase)this).LoggerInstance.Msg(message);
		}
		else if (debugMode)
		{
			((MelonBase)this).LoggerInstance.Msg(message);
		}
	}

	private void CreateButtonsForAll()
	{
		GameObject[] array = ((IEnumerable<GameObject>)Object.FindObjectsOfType<GameObject>()).Where((GameObject go) => ((Object)go).name == "ShiftstoneQuickswapper").ToArray();
		GameObject[] array2 = array;
		foreach (GameObject val in array2)
		{
			if (val.transform.GetChild(0).GetChildCount() < 4)
			{
				CreateQSSRandomButton(val);
			}
		}
	}

	private GameObject CreateBlackListIcons(GameObject TargetParent)
	{
		//IL_004a: 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_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		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 * 0.0002f;
		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, 0f + (float)random.Next(-100, 100) * 0.0001f, 0f + (float)random.Next(-100, 100) * 0.0001f);
		return val;
	}

	private void CreatePhysicalGUI()
	{
		//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)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0282: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fa: 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_0444: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0506: Unknown result type (might be due to invalid IL or missing references)
		//IL_0527: Unknown result type (might be due to invalid IL or missing references)
		//IL_0548: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0643: Unknown result type (might be due to invalid IL or missing references)
		GameObject gameObject = ((Component)GameObject.Find("ShiftstoneQuickswapper").transform.GetChild(0).GetChild(2)).gameObject;
		GameObject val = Object.Instantiate<GameObject>(TitleBar.GetGameObject());
		GameObject val2 = Object.Instantiate<GameObject>(TitleText.GetGameObject());
		val2.transform.localRotation = Quaternion.Euler(0f, 90f, 90f);
		val2.transform.localPosition = new Vector3(-0.09f, 0.736f, 0.0002f);
		val2.transform.localScale = new Vector3(6.8f, 4.9f, 1f);
		val2.transform.SetParent(val.transform, false);
		GameObject val3 = Object.Instantiate<GameObject>(gameObject);
		val3.transform.parent = GameObject.Find("ShiftstoneCabinet").transform;
		val3.transform.localPosition = new Vector3(-0.0509f, 1.6473f, 0.6836f);
		val3.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		((Component)val3.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		GameObject val4 = Object.Instantiate<GameObject>(val);
		val4.transform.SetParent(val3.transform, false);
		val4.transform.localScale = new Vector3(0.09f, 0.3f, 0.3f);
		val4.transform.localPosition = new Vector3(0.118f, 0f, 0.212f);
		val4.transform.localRotation = Quaternion.Euler(0.3f, 83.491f, 275.6874f);
		((TMP_Text)((Component)val4.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>()).text = "Blacklist";
		GameObject val5 = Object.Instantiate<GameObject>(gameObject);
		val5.transform.parent = GameObject.Find("ShiftstoneCabinet").transform;
		val5.transform.localPosition = new Vector3(-0.0509f, 1.2537f, 0.6836f);
		val5.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		((Component)val5.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		GameObject val6 = Object.Instantiate<GameObject>(val);
		val6.transform.SetParent(val5.transform, false);
		val6.transform.localScale = new Vector3(0.09f, 0.3f, 0.3f);
		val6.transform.localPosition = new Vector3(0.168f, 0.02f, 0.212f);
		val6.transform.localRotation = Quaternion.Euler(1.9346f, 97f, 268.269f);
		((TMP_Text)((Component)val6.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>()).text = "Hand";
		leftHand = Object.Instantiate<GameObject>(((Component)IndicatorsBase.transform.GetChild(2)).gameObject);
		rightHand = Object.Instantiate<GameObject>(((Component)IndicatorsBase.transform.GetChild(1)).gameObject);
		leftHand.transform.SetParent(val5.transform.GetChild(0), false);
		leftHand.transform.localPosition = new Vector3(-0.14f, 0.01f, 0.07f);
		leftHand.transform.localRotation = Quaternion.Euler(90f, 90f, 0f);
		leftHand.transform.localScale = new Vector3(0.0003f, 0.0003f, 0.0003f);
		rightHand.transform.SetParent(val5.transform.GetChild(0), false);
		rightHand.transform.localPosition = new Vector3(-0.14f, 0.01f, -0.07f);
		rightHand.transform.localRotation = Quaternion.Euler(90f, 90f, 0f);
		rightHand.transform.localScale = new Vector3(0.0003f, 0.0003f, 0.0003f);
		GameObject val7 = Object.Instantiate<GameObject>(gameObject);
		val7.transform.parent = GameObject.Find("ShiftstoneCabinet").transform;
		val7.transform.localPosition = new Vector3(-0.0509f, 1.6473f, -1.0164f);
		val7.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		((Component)val7.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		GameObject val8 = Object.Instantiate<GameObject>(val);
		val8.transform.SetParent(val7.transform, false);
		val8.transform.localPosition = new Vector3(0.128f, 0.025f, 0.212f);
		val8.transform.localScale = new Vector3(0.09f, 0.3f, 0.3f);
		val8.transform.localRotation = Quaternion.Euler(5.0254f, 87.0001f, 271.7236f);
		((TMP_Text)((Component)val8.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>()).text = "Loadout";
		GameObject val9 = Object.Instantiate<GameObject>(val);
		val9.transform.SetParent(val7.transform.GetChild(0), false);
		val9.transform.localPosition = new Vector3(0.208f, -0.05f, 0.212f);
		val9.transform.localScale = new Vector3(0.09f, 0.2f, 0.3f);
		val9.transform.localRotation = Quaternion.Euler(5.0254f, 82.3274f, 274.8562f);
		((TMP_Text)((Component)val9.transform.GetChild(0)).gameObject.GetComponent<TextMeshPro>()).text = "Save";
		((Component)val9.transform.GetChild(0)).gameObject.transform.localScale = new Vector3(9.7f, 4.9f, 1f);
		dropSign = val9;
		((Component)val3.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			BlackListStones(Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration()));
		}));
		((Component)val5.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			CycleHandLock();
		}));
		((Component)val7.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			SaveLoadOut(Il2CppArrayBase<int>.op_Implicit((Il2CppArrayBase<int>)(object)((Component)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration()));
		}));
	}

	private void CreateQSSRandomButton(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)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: 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)Managers.GetPlayerManager().LocalPlayer.Controller).GetComponent<PlayerShiftstoneSystem>().GetCurrentShiftStoneConfiguration()));
		}));
		GameObject gameObject2 = ((Component)swapper.transform.GetChild(0).GetChild(2)).gameObject;
		GameObject val2 = Object.Instantiate<GameObject>(gameObject2);
		val2.transform.parent = swapper.transform.GetChild(0);
		val2.transform.localPosition = new Vector3(0.1835f, -0.001f, -0.02f);
		val2.transform.localRotation = Quaternion.Euler(43.108f, 348.0498f, 275.3816f);
		((Component)val2.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		((Component)val2.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			LoadLoadOut(dontEquip: false, skipLock: true);
		}));
		GameObject gameObject3 = ((Component)swapper.transform.GetChild(0).GetChild(2)).gameObject;
		GameObject val3 = Object.Instantiate<GameObject>(gameObject3);
		val3.transform.parent = swapper.transform.GetChild(0);
		val3.transform.localPosition = new Vector3(0.0531f, 0.054f, -0.1023f);
		val3.transform.localRotation = Quaternion.Euler(292.25f, 6.781f, 350.6181f);
		((Component)val3.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().isToggleButton = false;
		((Component)val3.transform.GetChild(0)).gameObject.GetComponent<InteractionButton>().onPressed.AddListener(UnityAction.op_Implicit((Action)delegate
		{
			EquipStones(new StoneItem(), new StoneItem());
		}));
	}

	public GameObject LoadAsset()
	{
		using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream("ShiftStoneRandomizer.assets.randomizer");
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		Il2CppAssetBundle val = Il2CppAssetBundleManager.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(array));
		return Object.Instantiate<GameObject>(val.LoadAsset<GameObject>("ShiftstoneRandomizer"));
	}

	private void CreateCosmetics()
	{
		glasses = LoadAssetBundle("Shift_Stone_Randomizer.assets.glasses", "Glasses");
		Object.DontDestroyOnLoad((Object)(object)glasses);
		glasses.SetActive(false);
	}

	private void AddCosmetics()
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: 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_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: 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)
		bool flag = Players.GetLocalPlayer().Data.GeneralData.PlayFabMasterId == "91D650B737D47020";
		List<Player> allPlayers = Players.GetAllPlayers();
		Enumerator<Player> enumerator = allPlayers.GetEnumerator();
		while (enumerator.MoveNext())
		{
			Player current = enumerator.Current;
			if (current.Data.GeneralData.PlayFabMasterId == "91D650B737D47020")
			{
				GameObject val = Object.Instantiate<GameObject>(glasses);
				val.transform.parent = ((Component)current.Controller).gameObject.transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Neck/Bone_Head");
				val.transform.localPosition = new Vector3(0.0035f, 0.0431f, 0.0846f);
				val.transform.localRotation = Quaternion.Euler(5.2364f, 0f, 0f);
				val.transform.localScale = new Vector3(1.1576f, 1.1958f, 1.3094f);
				val.SetActive(!flag);
			}
		}
		if (flag)
		{
			GameObject val2 = GameObject.Find("Preview Player Controller");
			GameObject val3 = Object.Instantiate<GameObject>(glasses);
			val3.transform.parent = val2.transform.FindChild("Visuals/Skelington/Bone_Pelvis/Bone_Spine_A/Bone_Chest/Bone_Neck/Bone_Head");
			val3.transform.localPosition = new Vector3(0.0035f, 0.0431f, 0.0846f);
			val3.transform.localRotation = Quaternion.Euler(5.2364f, 0f, 0f);
			val3.transform.localScale = new Vector3(1.1576f, 1.1958f, 1.3094f);
			val3.SetActive(true);
		}
	}

	private GameObject LoadAssetBundle(string bundleName, string objectName)
	{
		using Stream stream = ((MelonBase)this).MelonAssembly.Assembly.GetManifestResourceStream(bundleName);
		byte[] array = new byte[stream.Length];
		stream.Read(array, 0, array.Length);
		Il2CppStructArray<byte> val = new Il2CppStructArray<byte>((long)array.Length);
		for (int i = 0; i < array.Length; i++)
		{
			((Il2CppArrayBase<byte>)(object)val)[i] = array[i];
		}
		Il2CppAssetBundle val2 = Il2CppAssetBundleManager.LoadFromMemory(val);
		return Object.Instantiate<GameObject>(val2.LoadAsset<GameObject>(objectName));
	}
}