Decompiled source of ItemRoulette v1.5.5

ItemRoulette.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HG;
using ItemRoulette.Artifacts;
using ItemRoulette.Compat;
using ItemRoulette.Configuration;
using ItemRoulette.Core;
using ItemRoulette.Core.Modules;
using ItemRoulette.Hooks;
using ItemRoulette.UI;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Networking;
using RoR2.UI;
using SimpleJSON;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.EventSystems;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

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

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ItemRoulette
{
	[BepInPlugin("com.user.itemroulette", "ItemRoulette", "1.5.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ItemRoulettePlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.user.itemroulette";

		public const string PluginName = "ItemRoulette";

		public const string PluginVersion = "1.5.5";

		private void Awake()
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			ModuleManager.RegisterModule(new ConfigurationModule(((BaseUnityPlugin)this).Config));
			ModuleManager.RegisterModule(new LocalizationModule(((BaseUnityPlugin)this).Info.Location));
			ModuleManager.RegisterModule(new NetworkModule());
			ModuleManager.RegisterModule(new ServerEventsModule());
			ModuleManager.RegisterModule(new ServerSpinServiceModule());
			ModuleManager.RegisterModule(new CasinoServerServiceModule());
			ModuleManager.RegisterModule(new RunStateModule());
			ModuleManager.RegisterModule(new DropSuppressionModule());
			ModuleManager.RegisterModule(new RouletteUIModule());
			ModuleManager.InitializeAll();
			RouletteArtifact.Register();
			RouletteGate.Init();
			((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("[{0} v{1}] All modules successfully loaded! Roulette: [{2}], Casino: [{3}], Admin: [{4}]", "ItemRoulette", "1.5.5", ModConfig.HotkeyKey, ModConfig.CasinoToggleHotkeyKey, ModConfig.AdminMenuHotkeyKey));
		}

		private void OnDestroy()
		{
			ModuleManager.CleanupAll();
		}
	}
}
namespace ItemRoulette.UI
{
	public class AdminMenuUI : MonoBehaviour
	{
		private static AdminMenuUI? _instance;

		private bool _isOpen;

		private Rect _windowRect = new Rect(50f, 40f, 1040f, 640f);

		private Vector2 _scrollPos = Vector2.zero;

		private GUIStyle? _winHeaderStyle;

		private GUIStyle? _sectionHeaderStyle;

		private GUIStyle? _itemRowStyle;

		private GUIStyle? _buttonStyleGood;

		private GUIStyle? _buttonStyleBad;

		private GUIStyle? _buttonStyleUtil;

		private GUIStyle? _statsStyle;

		public static AdminMenuUI? Instance => _instance;

		public bool IsOpen => _isOpen;

		private void Awake()
		{
			_instance = this;
		}

		private void OnDisable()
		{
			ReleaseCursor();
		}

		private void OnDestroy()
		{
			ReleaseCursor();
			if ((Object)(object)_instance == (Object)(object)this)
			{
				_instance = null;
			}
		}

		private void CaptureCursor()
		{
			UiCommon.AcquireCursor(this);
		}

		private void ReleaseCursor()
		{
			UiCommon.ReleaseCursor(this);
		}

		public void SetOpen(bool open)
		{
			if (_isOpen == open)
			{
				return;
			}
			_isOpen = open;
			if (_isOpen)
			{
				CaptureCursor();
				return;
			}
			ReleaseCursor();
			try
			{
				CharacterMaster localMaster = GetLocalMaster();
				if ((Object)(object)localMaster != (Object)null && (Object)(object)localMaster.playerCharacterMasterController != (Object)null)
				{
					CasinoRouletteUI.SuppressPlayerButtons(localMaster.playerCharacterMasterController);
				}
			}
			catch
			{
			}
		}

		private void Update()
		{
			//IL_0025: 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)
			if ((Object)(object)Run.instance == (Object)null)
			{
				if (_isOpen)
				{
					SetOpen(open: false);
				}
			}
			else
			{
				if (GUIHelper.IsTypingOrInputBlocked())
				{
					return;
				}
				if (Input.GetKeyDown(ModConfig.AdminMenuHotkeyKey))
				{
					if (!ModConfig.IsAdminPanelActive)
					{
						RouletteUI.Instance?.ShowToast(Localization.Get("<color=#FF5555>[АДМИН] Панель отключена в настройках хоста.</color>", "<color=#FF5555>[ADMIN] Panel is disabled in host settings.</color>"), new Color(1f, 0.4f, 0.4f), 3f);
						if (_isOpen)
						{
							SetOpen(open: false);
						}
						return;
					}
					SetOpen(!_isOpen);
				}
				if (!ModConfig.IsAdminPanelActive && _isOpen)
				{
					SetOpen(open: false);
				}
				else if (_isOpen && Input.GetKeyDown((KeyCode)27))
				{
					UiCommon.CloseOpenMenus();
				}
			}
		}

		private void LateUpdate()
		{
		}

		private void InitStyles()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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)
			//IL_00c2: 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)
			//IL_00e6: Expected O, but got Unknown
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Expected O, but got Unknown
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Expected O, but got Unknown
			if (_winHeaderStyle == null)
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 15,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				val.normal.textColor = new Color(1f, 0.88f, 0.35f);
				_winHeaderStyle = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 12,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3,
					richText = true
				};
				val2.normal.textColor = Color.white;
				_sectionHeaderStyle = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)0,
					alignment = (TextAnchor)3,
					richText = true
				};
				val3.normal.textColor = new Color(0.9f, 0.9f, 0.9f);
				_itemRowStyle = val3;
				GUIStyle val4 = new GUIStyle(GUI.skin.button)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1
				};
				val4.normal.textColor = new Color(0.2f, 1f, 0.4f);
				_buttonStyleGood = val4;
				GUIStyle val5 = new GUIStyle(GUI.skin.button)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1
				};
				val5.normal.textColor = new Color(1f, 0.35f, 0.35f);
				_buttonStyleBad = val5;
				GUIStyle val6 = new GUIStyle(GUI.skin.button)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1
				};
				val6.normal.textColor = new Color(0.85f, 0.9f, 1f);
				_buttonStyleUtil = val6;
				GUIStyle val7 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)0,
					alignment = (TextAnchor)3,
					richText = true
				};
				val7.normal.textColor = new Color(0.8f, 0.85f, 0.95f);
				_statsStyle = val7;
			}
		}

		private CharacterMaster? GetLocalMaster()
		{
			return PlayerUtil.GetLocalMaster();
		}

		private void OnGUI()
		{
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: 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_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_047d: Unknown result type (might be due to invalid IL or missing references)
			//IL_050c: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_062d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0679: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0848: Unknown result type (might be due to invalid IL or missing references)
			//IL_085e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0868: Unknown result type (might be due to invalid IL or missing references)
			//IL_087e: Unknown result type (might be due to invalid IL or missing references)
			//IL_075b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b25: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3f: Unknown result type (might be due to invalid IL or missing references)
			if (!_isOpen || (Object)(object)Run.instance == (Object)null)
			{
				return;
			}
			bool enabled = GUI.enabled;
			if (GUIHelper.IsTypingOrInputBlocked())
			{
				GUI.enabled = false;
			}
			try
			{
				InitStyles();
				float safeWindowsScale = GUIHelper.SafeWindowsScale;
				float num = 1040f;
				float num2 = 640f;
				float num3 = num * safeWindowsScale;
				float num4 = num2 * safeWindowsScale;
				float num5 = Mathf.Max(10f, ((float)Screen.width - num3) / 2f);
				float num6 = Mathf.Max(20f, ((float)Screen.height - num4) / 2f);
				_windowRect = new Rect(num5, num6, num, num2);
				using (GUIHelper.UseScale(safeWindowsScale, ((Rect)(ref _windowRect)).position))
				{
					GUI.color = Color.white;
					GUIHelper.DrawRect(_windowRect, new Color(0.06f, 0.08f, 0.12f, 0.98f));
					GUIHelper.DrawBorder(_windowRect, new Color(0.35f, 0.45f, 0.65f, 0.95f));
					GUI.Label(new Rect(((Rect)(ref _windowRect)).x + 10f, ((Rect)(ref _windowRect)).y + 6f, ((Rect)(ref _windowRect)).width - 90f, 24f), Localization.Format("[ItemRoulette] ТЕСТОВОЕ АДМИН-МЕНЮ ХАОСА [{0}]", "[ItemRoulette] CHAOS ADMIN TEST MENU [{0}]", ModConfig.AdminMenuHotkey.Value), _winHeaderStyle);
					if (GUI.Button(new Rect(((Rect)(ref _windowRect)).xMax - 75f, ((Rect)(ref _windowRect)).y + 6f, 65f, 22f), Localization.Get("✕ Закрыть", "✕ Close"), _buttonStyleUtil))
					{
						SetOpen(open: false);
						return;
					}
					CharacterMaster localMaster = GetLocalMaster();
					Rect rect = default(Rect);
					((Rect)(ref rect))..ctor(((Rect)(ref _windowRect)).x + 12f, ((Rect)(ref _windowRect)).y + 34f, ((Rect)(ref _windowRect)).width - 24f, 28f);
					GUIHelper.DrawRect(rect, new Color(0.1f, 0.13f, 0.18f, 0.95f));
					GUIHelper.DrawBorder(rect, new Color(0.2f, 0.25f, 0.35f, 0.85f), 1);
					float num7 = ((Rect)(ref rect)).x + 4f;
					float num8 = ((Rect)(ref rect)).y + 3f;
					if (GUI.Button(new Rect(num7, num8, 82f, 22f), Localization.Get("+1,000 Золота", "+1,000 Gold"), _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "AddMoney", 1000);
					}
					float num9 = num7 + 86f;
					if (GUI.Button(new Rect(num9, num8, 78f, 22f), Localization.Get("★ Казино", "★ Casino"), _buttonStyleGood))
					{
						_isOpen = false;
						CasinoRouletteUI.Instance?.Open();
					}
					float num10 = num9 + 82f;
					bool flag = (Object)(object)RouletteUI.Instance != (Object)null && RouletteUI.Instance.IsAutoSpinActive;
					string text = (flag ? Localization.Get("Авто: ВКЛ", "Auto: ON") : Localization.Get("Авто: ВЫКЛ", "Auto: OFF"));
					if (GUI.Button(new Rect(num10, num8, 74f, 22f), text, flag ? _buttonStyleGood : _buttonStyleUtil) && (Object)(object)RouletteUI.Instance != (Object)null)
					{
						RouletteUI.Instance.ToggleAutoSpin();
					}
					float num11 = num10 + 78f;
					if (GUI.Button(new Rect(num11, num8, 72f, 22f), Localization.Get("+5 Беспл.", "+5 Free"), _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "AddFreeRolls", 5);
					}
					float num12 = num11 + 76f;
					if (GUI.Button(new Rect(num12, num8, 68f, 22f), Localization.Get("+1 Красн.", "+1 Red"), _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "AddFreeLegendary", 1);
					}
					float num13 = num12 + 72f;
					if (GUI.Button(new Rect(num13, num8, 72f, 22f), Localization.Get("+1 Бездна", "+1 Void"), _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "AddPendingVoid", 1);
					}
					float num14 = num13 + 76f;
					if (GUI.Button(new Rect(num14, num8, 74f, 22f), Localization.Get("50/50: ВКЛ", "50/50: ON"), _buttonStyleBad) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "SetFiftyFifty", 1);
						RouletteManager.Instance.FiftyFiftyActive = true;
						RouletteUI.Instance?.ShowToast(Localization.Get("Режим 50/50 активен!", "50/50 mode active!"), new Color(1f, 0.5f, 0.2f), 2.5f);
					}
					float num15 = num14 + 78f;
					if (GUI.Button(new Rect(num15, num8, 78f, 22f), Localization.Get("Сброс цены", "Reset Cost"), _buttonStyleUtil) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "ResetCost");
						RouletteManager.Instance.ChaosCostPenaltyMultiplier = 0f;
						RouletteUI.Instance?.ShowToast(Localization.Get("Штраф цены рулетки сброшен!", "Cost penalty reset!"), new Color(0.4f, 0.95f, 0.5f), 2.5f);
					}
					float num16 = num15 + 82f;
					if (GUI.Button(new Rect(num16, num8, 82f, 22f), Localization.Get("Сброс редк.", "Reset Luck"), _buttonStyleUtil) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "ResetLuck");
						RouletteManager.Instance.ClearPlayerTierMultipliers();
						RouletteUI.Instance?.ShowToast(Localization.Get("Модификатор редкости сброшен (x1.00)!", "Rarity odds modifier reset (x1.00)!"), new Color(0.4f, 0.95f, 0.5f), 2.5f);
					}
					float num17 = num16 + 86f;
					if (GUI.Button(new Rect(num17, num8, 80f, 22f), Localization.Get("+Спектр x5", "+Spectral x5"), _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "GrantSpectral", 5);
					}
					float num18 = num17 + 84f;
					if (GUI.Button(new Rect(num18, num8, 76f, 22f), Localization.Get("+Врем x10", "+Temp x10"), _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
					{
						SendAdminAction(localMaster, "GrantTemp", 10);
					}
					if (GUI.Button(new Rect(num18 + 80f, num8, 88f, 22f), Localization.Get("☠ Цена жизни", "☠ Life Price"), _buttonStyleBad))
					{
						var (num19, num20, num21) = CasinoRouletteHelper.CalculateLifeBetPrice(localMaster);
						if ((Object)(object)CasinoRouletteUI.Instance != (Object)null)
						{
							CasinoRouletteUI.Instance.ShowToast(Localization.Format("[Цена Жизни] Итого: ${0} (Ур*Этап: ${1} | Вещи: ${2})", "[Life Price] Total: ${0} (Lvl*Stage: ${1} | Items: ${2})", num19, num20, num21), new Color(1f, 0.4f, 0.4f), 5f);
						}
					}
					float num22 = (((Rect)(ref _windowRect)).width - 32f) / 2f;
					float num23 = ((Rect)(ref _windowRect)).height - 135f;
					Rect rect2 = default(Rect);
					((Rect)(ref rect2))..ctor(((Rect)(ref _windowRect)).x + 12f, ((Rect)(ref _windowRect)).y + 68f, num22, num23);
					Rect rect3 = default(Rect);
					((Rect)(ref rect3))..ctor(((Rect)(ref _windowRect)).x + 16f + num22, ((Rect)(ref _windowRect)).y + 68f, num22, num23);
					DrawEventsColumn(rect2, ChaosPolarity.Good, localMaster);
					DrawEventsColumn(rect3, ChaosPolarity.Bad, localMaster);
					Rect rect4 = default(Rect);
					((Rect)(ref rect4))..ctor(((Rect)(ref _windowRect)).x + 12f, ((Rect)(ref _windowRect)).yMax - 28f, ((Rect)(ref _windowRect)).width - 24f, 24f);
					GUIHelper.DrawRect(rect4, new Color(0.09f, 0.11f, 0.16f, 0.95f));
					GUIHelper.DrawBorder(rect4, new Color(0.25f, 0.3f, 0.4f, 0.85f), 1);
					ChaosChances chaosChances = ChaosEventManager.CalculateChances(localMaster, RouletteManager.Instance.FiftyFiftyActive);
					int currentCost = RouletteManager.Instance.GetCurrentCost();
					int freeRollsAvailable = RouletteManager.Instance.FreeRollsAvailable;
					uint num24 = (((Object)(object)localMaster != (Object)null) ? localMaster.money : 0u);
					float num25 = (((Object)(object)localMaster != (Object)null) ? RouletteManager.Instance.GetPlayerTierMultiplier(localMaster) : 1f);
					string text2 = "";
					if (Mathf.Abs(num25 - 1f) > 0.01f)
					{
						text2 = ((num25 > 1f) ? Localization.Format("  |  <b>{0}:</b> <color=#4ADE80>x{1:F2}</color>", "  |  <b>{0}:</b> <color=#4ADE80>x{1:F2}</color>", Localization.Get("Редкость", "Rarity"), num25) : Localization.Format("  |  <b>{0}:</b> <color=#F87171>x{1:F2}</color>", "  |  <b>{0}:</b> <color=#F87171>x{1:F2}</color>", Localization.Get("Редкость", "Rarity"), num25));
					}
					int chanceDollCount = RouletteManager.GetChanceDollCount((localMaster != null) ? localMaster.inventory : null);
					string text3 = "";
					if (chanceDollCount > 0)
					{
						float num26 = Mathf.Clamp(ModConfig.ChanceDollBaseChancePercent.Value + (float)(chanceDollCount - 1) * ModConfig.ChanceDollStackChancePercent.Value, 0f, 100f);
						text3 = Localization.Format("  |  <b>{0}:</b> <color=#38E54D>{1} шт. ({2:F0}%)</color>", "  |  <b>{0}:</b> <color=#38E54D>{1}x ({2:F0}%)</color>", Localization.Get("Кукла", "Doll"), chanceDollCount, num26);
					}
					int solitudeCount = RouletteManager.GetSolitudeCount((localMaster != null) ? localMaster.inventory : null);
					int solitudeRollsAvailable = RouletteManager.Instance.SolitudeRollsAvailable;
					string text4 = "";
					if (solitudeCount > 0 || solitudeRollsAvailable > 0)
					{
						float solitudeRarityMultiplierBonus = RouletteManager.Instance.SolitudeRarityMultiplierBonus;
						text4 = Localization.Format("  |  <b>{0}:</b> <color=#4ADEDE>{1} шт. ({2} кр., +x{3:F2})</color>", "  |  <b>{0}:</b> <color=#4ADEDE>{1}x ({2} spins, +x{3:F2})</color>", Localization.Get("Одиночество", "Solitude"), solitudeCount, solitudeRollsAvailable, solitudeRarityMultiplierBonus);
					}
					int pendingVoidRollsAvailable = RouletteManager.Instance.PendingVoidRollsAvailable;
					string text5 = ((pendingVoidRollsAvailable > 0) ? Localization.Format("<b>{0} [{1}]:</b> <color=#C084FC>{2}</color>  |  ", "<b>{0} [{1}]:</b> <color=#C084FC>{2}</color>  |  ", Localization.Get("Бездна", "Void"), ModConfig.VoidSpinHotkey.Value, pendingVoidRollsAvailable) : "");
					string text6 = Localization.Format("<b>{0}:</b> ${1}  |  <b>{2} [{3}]:</b> ${4}  |  <b>{5}:</b> {6}  |  {7}<b>{8}:</b> <color=#4ADE80>● {9} {10:F0}%</color> / <color=#C0C0C0>{11} {12:F0}%</color> / <color=#F87171>● {13} {14:F0}%</color>{15}{16}{17}", "<b>{0}:</b> ${1}  |  <b>{2} [{3}]:</b> ${4}  |  <b>{5}:</b> {6}  |  {7}<b>{8}:</b> <color=#4ADE80>● {9} {10:F0}%</color> / <color=#C0C0C0>{11} {12:F0}%</color> / <color=#F87171>● {13} {14:F0}%</color>{15}{16}{17}", Localization.Get("Золото", "Gold"), num24, Localization.Get("След. крутка", "Next Spin"), ModConfig.Hotkey.Value, currentCost, Localization.Get("Бесплатных", "Free"), freeRollsAvailable, text5, Localization.Get("Шансы", "Odds"), Localization.Get("Удача", "Fortune"), chaosChances.GoodPercent, Localization.Get("Нейтр.", "Neutral"), chaosChances.NeutralPercent, Localization.Get("Бедствие", "Calamity"), chaosChances.BadPercent, text2, text3, text4);
					GUI.Label(new Rect(((Rect)(ref rect4)).x + 8f, ((Rect)(ref rect4)).y + 3f, ((Rect)(ref rect4)).width - 16f, 20f), text6, _statsStyle);
					GUIHelper.DrawTopCursor(_windowRect, safeWindowsScale, ((Rect)(ref _windowRect)).position);
				}
			}
			finally
			{
				GUI.enabled = enabled;
			}
		}

		private void DrawEventsColumn(Rect rect, ChaosPolarity polarity, CharacterMaster? master)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			GUIHelper.DrawRect(rect, new Color(0.08f, 0.1f, 0.14f, 0.92f));
			Color color = ((polarity == ChaosPolarity.Good) ? new Color(0.25f, 0.8f, 0.4f, 0.85f) : new Color(0.9f, 0.3f, 0.35f, 0.85f));
			GUIHelper.DrawBorder(rect, color, 1);
			List<ChaosEventType> list;
			if (polarity == ChaosPolarity.Good)
			{
				list = new List<ChaosEventType>
				{
					ChaosEventType.DoubleItem,
					ChaosEventType.TemporaryDuplicates,
					ChaosEventType.SpectralDuplicates,
					ChaosEventType.QualityCashback,
					ChaosEventType.DoubleGold,
					ChaosEventType.NextStageFreeRolls,
					ChaosEventType.KillEnemies30,
					ChaosEventType.AllyMirror,
					ChaosEventType.Heal50Percent,
					ChaosEventType.FriendlyClone,
					ChaosEventType.ElementalAspectDrop,
					ChaosEventType.TierOddsBoost,
					ChaosEventType.AlliedDroneSquad
				};
				if (QualityCompat.IsQualityLoaded)
				{
					list.Add(ChaosEventType.ForgeAnomaly);
				}
			}
			else
			{
				list = new List<ChaosEventType>
				{
					ChaosEventType.LoseGold30,
					ChaosEventType.CostIncrease10,
					ChaosEventType.RandomLunarOrVoid,
					ChaosEventType.TierDownSacrifice,
					ChaosEventType.NextSpinFiftyFifty,
					ChaosEventType.HallowedCurse,
					ChaosEventType.DamageHp30,
					ChaosEventType.ConvertHpToBarrier,
					ChaosEventType.EnemyItemMimic,
					ChaosEventType.EvilClone,
					ChaosEventType.RandomStageArtifact,
					ChaosEventType.CombatShrineX2,
					ChaosEventType.LowGravityMoonX2,
					ChaosEventType.TierOddsPenalty,
					ChaosEventType.HostileDroneSquad
				};
				if (QualityCompat.IsQualityLoaded)
				{
					list.Add(ChaosEventType.VoidCorrosion);
				}
			}
			ChaosEventType[] array = list.ToArray();
			int num = 0;
			for (int i = 0; i < array.Length; i++)
			{
				if (ChaosEventManager.IsEventAllowed(array[i]))
				{
					num++;
				}
			}
			string text = ((polarity == ChaosPolarity.Good) ? Localization.Format("<color=#4ADE80><b>\ud83d\udfe2 {0}/{1} ПОЛОЖИТЕЛЬНЫХ СОБЫТИЙ (УДАЧА)</b></color>", "<color=#4ADE80><b>\ud83d\udfe2 {0}/{1} POSITIVE EVENTS (FORTUNE)</b></color>", num, array.Length) : Localization.Format("<color=#F87171><b>\ud83d\udd34 {0}/{1} НЕГАТИВНЫХ СОБЫТИЙ (БЕДСТВИЕ)</b></color>", "<color=#F87171><b>\ud83d\udd34 {0}/{1} NEGATIVE EVENTS (CALAMITY)</b></color>", num, array.Length));
			GUI.Label(new Rect(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y + 4f, ((Rect)(ref rect)).width - 16f, 20f), text, _sectionHeaderStyle);
			float num2 = ((Rect)(ref rect)).y + 26f;
			float num3 = (((Rect)(ref rect)).height - 30f) / (float)array.Length;
			Rect rect2 = default(Rect);
			for (int j = 0; j < array.Length; j++)
			{
				ChaosEventType chaosEventType = array[j];
				ChaosEventDefinition definition = ChaosEventManager.GetDefinition(chaosEventType);
				if (definition == null)
				{
					continue;
				}
				((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + 4f, num2 + (float)j * num3, ((Rect)(ref rect)).width - 8f, num3 - 2f);
				GUIHelper.DrawRect(rect2, (j % 2 == 0) ? new Color(0.1f, 0.12f, 0.17f, 0.85f) : new Color(0.12f, 0.14f, 0.2f, 0.85f));
				string text2 = $"{j + 1}. ";
				string text3 = (ChaosEventManager.IsEventAllowed(chaosEventType) ? "" : (Localization.IsRussian ? " <color=#6B7280>[ВЫКЛ]</color>" : " <color=#6B7280>[OFF]</color>"));
				string text4 = text2 + "<b>" + definition.Title + "</b>" + text3;
				GUI.Label(new Rect(((Rect)(ref rect2)).x + 6f, ((Rect)(ref rect2)).y + 4f, ((Rect)(ref rect2)).width - 150f, num3 - 6f), text4, _itemRowStyle);
				Rect val = new Rect(((Rect)(ref rect2)).xMax - 144f, ((Rect)(ref rect2)).y + 3f, 68f, num3 - 6f);
				GUIStyle val2 = ((polarity == ChaosPolarity.Good) ? _buttonStyleGood : _buttonStyleBad);
				if (GUI.Button(val, Localization.Get("Тест", "Test"), val2))
				{
					ExecuteInstantTest(master, chaosEventType);
				}
				if (GUI.Button(new Rect(((Rect)(ref rect2)).xMax - 72f, ((Rect)(ref rect2)).y + 3f, 68f, num3 - 6f), Localization.Get("Спин", "Spin"), _buttonStyleUtil))
				{
					SetOpen(open: false);
					if ((Object)(object)RouletteUI.Instance != (Object)null)
					{
						RouletteUI.Instance.TriggerSpinAction(chaosEventType);
					}
				}
			}
		}

		private void SendAdminAction(CharacterMaster master, string actionKind, int param = 0)
		{
			//IL_004b: 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)
			if (!((Object)(object)master == (Object)null))
			{
				if (NetworkServer.active)
				{
					DropSuppressionHooks.ExecuteAdminActionServer(master, actionKind, param);
					return;
				}
				string text = Guid.NewGuid().ToString("N");
				string text2 = Uri.EscapeDataString(PlayerUtil.GetMasterIdentifier(master));
				object[] obj = new object[5] { text, null, null, null, null };
				NetworkInstanceId netId = ((NetworkBehaviour)master).netId;
				obj[1] = ((NetworkInstanceId)(ref netId)).Value;
				obj[2] = text2;
				obj[3] = actionKind;
				obj[4] = param;
				NetworkHelper.SendToServer(string.Format("[ItemRoulette:AdminAction:{0}:{1}:{2}:{3}:{4}]", obj));
			}
		}

		private void ExecuteInstantTest(CharacterMaster? master, ChaosEventType evType)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)master == (Object)null))
			{
				SendAdminAction(master, "TestChaos", (int)evType);
				ChaosEventDefinition chaosEventDefinition = ChaosEventManager.GetDisplayDefinition(evType) ?? ChaosEventManager.GetDefinition(evType);
				if ((Object)(object)RouletteUI.Instance != (Object)null && chaosEventDefinition != null)
				{
					string text = ((chaosEventDefinition.Polarity == ChaosPolarity.Good) ? Localization.Get("УДАЧА", "FORTUNE") : Localization.Get("БЕДСТВИЕ", "CALAMITY"));
					RouletteUI.Instance.ShowToast("[" + text + "] <b>" + chaosEventDefinition.Title + "</b>: " + chaosEventDefinition.Description, chaosEventDefinition.Color);
				}
			}
		}
	}
	public class CasinoRouletteUI : MonoBehaviour
	{
		private enum ReelState
		{
			Idle,
			Spinning,
			Finished
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static hook_PollButtonInput <0>__OnPollButtonInput;

			public static hook_PollInputToButtonBuffers <1>__OnPollInputToButtonBuffers;

			public static hook_TogglePauseScreen <2>__OnTogglePauseScreen;

			public static hook_OpenMinimalPauseScreen <3>__OnOpenMinimalPauseScreen;

			public static hook_InstantiatePauseScreen <4>__OnInstantiatePauseScreen;
		}

		private static CasinoRouletteUI? _instance;

		private bool _isWindowOpen;

		private bool _confirmSpinPending;

		private float _confirmTimer;

		private ReelState _reelState;

		private const int TapeLoops = 7;

		private const float CardWidth = 94f;

		private const float CardHeight = 94f;

		private const float CardSpacing = 8f;

		private const float SlotWidth = 102f;

		private List<RoulettePocket> _tapePockets = new List<RoulettePocket>();

		private int _winningTapeIndex;

		private float _currentScrollX;

		private float _targetScrollX;

		private float _spinTimer;

		private float _finishDisplayTimer;

		private int _lastTickedPocket = -1;

		private RoulettePocket _winningPocket;

		private Rect _windowRect = new Rect(100f, 100f, 960f, 320f);

		private bool _isWindowPosInitialized;

		private bool _isDraggingWindow;

		private Vector2 _dragMouseStart;

		private Vector2 _dragWindowStart;

		private CasinoFeltBets _feltBets = new CasinoFeltBets();

		private int _selectedChipDenomination = 25;

		private bool _isPlacingLifeBet;

		private bool _isLifeBetPlaced;

		private CasinoBetType _lifeBetType;

		private int _lifeBetTarget;

		private bool _isPlacingItemBet;

		private bool _isItemBetActive;

		private int _itemBetTargetNumber;

		private List<ItemIndex> _playerAvailableItems = new List<ItemIndex>();

		private int _selectedItemIdxIndex;

		private string? _pendingSpinTxId;

		private bool _spinRequestInFlight;

		private CasinoSpinResultMessage? _lastSpinResult;

		private float _toastTimer;

		private string _toastMessage = "";

		private Color _toastColor = Color.white;

		private string _lastResultSummary = "";

		private string _lastResultHeadline = "";

		private Color _lastResultColor = Color.white;

		private GUIStyle? _winHeaderStyle;

		private GUIStyle? _labelBoldStyle;

		private GUIStyle? _labelSmallStyle;

		private GUIStyle? _pocketNumStyle;

		private GUIStyle? _pocketSubStyle;

		private GUIStyle? _spinBtnStyle;

		private GUIStyle? _spinConfirmBtnStyle;

		private GUIStyle? _resultStyle;

		private GUIStyle? _topLabelStyle;

		private GUIStyle? _questionMarkStyle;

		private GUIStyle? _toastStyle;

		private GUIStyle? _feltNumberStyle;

		private GUIStyle? _feltHeaderStyle;

		private GUIStyle? _feltBadgeStyle;

		private GUIStyle? _dragHandleStyle;

		private GUIStyle? _unifiedBtnStyle;

		private static readonly MethodInfo? _suppressAllButtonsMethod = typeof(PlayerCharacterMasterController).GetMethod("SuppressAllButtonsUntilReleased", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

		public static CasinoRouletteUI? Instance => _instance;

		public static bool IsOpen
		{
			get
			{
				if ((Object)(object)_instance != (Object)null)
				{
					return _instance._isWindowOpen;
				}
				return false;
			}
		}

		public static bool IsSpinning
		{
			get
			{
				if ((Object)(object)_instance != (Object)null)
				{
					return _instance._reelState == ReelState.Spinning;
				}
				return false;
			}
		}

		public static bool IsBannerActive
		{
			get
			{
				if ((Object)(object)_instance != (Object)null)
				{
					if (_instance._reelState != ReelState.Spinning)
					{
						return _instance._reelState == ReelState.Finished;
					}
					return true;
				}
				return false;
			}
		}

		public void ForceFinishSpinImmediate()
		{
			if (_reelState == ReelState.Spinning)
			{
				FinishSpin();
			}
		}

		public static bool IsPlayerInDroneOrDeadMode(CharacterMaster? master)
		{
			if ((Object)(object)master == (Object)null)
			{
				return true;
			}
			if (master.lostBodyToDeath || !master.hasBody)
			{
				return true;
			}
			CharacterBody body = master.GetBody();
			if ((Object)(object)body == (Object)null)
			{
				return true;
			}
			if ((Object)(object)body.healthComponent != (Object)null && !body.healthComponent.alive)
			{
				return true;
			}
			string text = ((Object)body).name ?? "";
			if (text.IndexOf("drone", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			if (text.IndexOf("spectat", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			if (text.IndexOf("turret", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			if (text.IndexOf("death", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			string text2 = body.baseNameToken ?? "";
			if (text2.IndexOf("DRONE", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			if (text2.IndexOf("TURRET", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
			return false;
		}

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			_instance = this;
			BuildInitialTape();
			CasinoServerService.OnCasinoSpinResultReceived += HandleCasinoSpinResultReceived;
			object obj = <>O.<0>__OnPollButtonInput;
			if (obj == null)
			{
				hook_PollButtonInput val = OnPollButtonInput;
				<>O.<0>__OnPollButtonInput = val;
				obj = (object)val;
			}
			PlayerCharacterMasterController.PollButtonInput += (hook_PollButtonInput)obj;
			object obj2 = <>O.<1>__OnPollInputToButtonBuffers;
			if (obj2 == null)
			{
				hook_PollInputToButtonBuffers val2 = OnPollInputToButtonBuffers;
				<>O.<1>__OnPollInputToButtonBuffers = val2;
				obj2 = (object)val2;
			}
			PlayerCharacterMasterController.PollInputToButtonBuffers += (hook_PollInputToButtonBuffers)obj2;
			object obj3 = <>O.<2>__OnTogglePauseScreen;
			if (obj3 == null)
			{
				hook_TogglePauseScreen val3 = OnTogglePauseScreen;
				<>O.<2>__OnTogglePauseScreen = val3;
				obj3 = (object)val3;
			}
			PauseManager.TogglePauseScreen += (hook_TogglePauseScreen)obj3;
			object obj4 = <>O.<3>__OnOpenMinimalPauseScreen;
			if (obj4 == null)
			{
				hook_OpenMinimalPauseScreen val4 = OnOpenMinimalPauseScreen;
				<>O.<3>__OnOpenMinimalPauseScreen = val4;
				obj4 = (object)val4;
			}
			PauseManager.OpenMinimalPauseScreen += (hook_OpenMinimalPauseScreen)obj4;
			object obj5 = <>O.<4>__OnInstantiatePauseScreen;
			if (obj5 == null)
			{
				hook_InstantiatePauseScreen val5 = OnInstantiatePauseScreen;
				<>O.<4>__OnInstantiatePauseScreen = val5;
				obj5 = (object)val5;
			}
			PauseScreenController.InstantiatePauseScreen += (hook_InstantiatePauseScreen)obj5;
		}

		public static void SuppressPlayerButtons(PlayerCharacterMasterController? pcmc)
		{
			if ((Object)(object)pcmc == (Object)null)
			{
				return;
			}
			try
			{
				_suppressAllButtonsMethod?.Invoke(pcmc, null);
				CharacterBody val = (((Object)(object)pcmc.master != (Object)null) ? pcmc.master.GetBody() : null);
				if ((Object)(object)val != (Object)null && (Object)(object)val.inputBank != (Object)null)
				{
					((ButtonState)(ref val.inputBank.skill1)).PushState(false);
					((ButtonState)(ref val.inputBank.skill2)).PushState(false);
					((ButtonState)(ref val.inputBank.skill3)).PushState(false);
					((ButtonState)(ref val.inputBank.skill4)).PushState(false);
					((ButtonState)(ref val.inputBank.interact)).PushState(false);
					((ButtonState)(ref val.inputBank.jump)).PushState(false);
					((ButtonState)(ref val.inputBank.activateEquipment)).PushState(false);
					((ButtonState)(ref val.inputBank.sprint)).PushState(false);
					((ButtonState)(ref val.inputBank.ping)).PushState(false);
				}
			}
			catch
			{
			}
		}

		private static void OnPollInputToButtonBuffers(orig_PollInputToButtonBuffers orig, PlayerCharacterMasterController self)
		{
			if ((Object)(object)self != (Object)null && (Object)(object)self.networkUser != (Object)null && ((NetworkBehaviour)self.networkUser).isLocalPlayer && (IsOpen || ((Object)(object)AdminMenuUI.Instance != (Object)null && AdminMenuUI.Instance.IsOpen)))
			{
				SuppressPlayerButtons(self);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private static void OnTogglePauseScreen(orig_TogglePauseScreen orig)
		{
			if (UiCommon.ShouldSuppressPauseScreen())
			{
				UiCommon.CloseOpenMenus();
			}
			else
			{
				orig.Invoke();
			}
		}

		private static void OnOpenMinimalPauseScreen(orig_OpenMinimalPauseScreen orig)
		{
			if (UiCommon.ShouldSuppressPauseScreen())
			{
				UiCommon.CloseOpenMenus();
			}
			else
			{
				orig.Invoke();
			}
		}

		private static GameObject? OnInstantiatePauseScreen(orig_InstantiatePauseScreen orig, bool minimal)
		{
			if (UiCommon.ShouldSuppressPauseScreen())
			{
				UiCommon.CloseOpenMenus();
				return null;
			}
			return orig.Invoke(minimal);
		}

		private void OnDisable()
		{
			ReleaseCursor();
		}

		private void OnDestroy()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			ReleaseCursor();
			CasinoServerService.OnCasinoSpinResultReceived -= HandleCasinoSpinResultReceived;
			object obj = <>O.<0>__OnPollButtonInput;
			if (obj == null)
			{
				hook_PollButtonInput val = OnPollButtonInput;
				<>O.<0>__OnPollButtonInput = val;
				obj = (object)val;
			}
			PlayerCharacterMasterController.PollButtonInput -= (hook_PollButtonInput)obj;
			object obj2 = <>O.<1>__OnPollInputToButtonBuffers;
			if (obj2 == null)
			{
				hook_PollInputToButtonBuffers val2 = OnPollInputToButtonBuffers;
				<>O.<1>__OnPollInputToButtonBuffers = val2;
				obj2 = (object)val2;
			}
			PlayerCharacterMasterController.PollInputToButtonBuffers -= (hook_PollInputToButtonBuffers)obj2;
			object obj3 = <>O.<2>__OnTogglePauseScreen;
			if (obj3 == null)
			{
				hook_TogglePauseScreen val3 = OnTogglePauseScreen;
				<>O.<2>__OnTogglePauseScreen = val3;
				obj3 = (object)val3;
			}
			PauseManager.TogglePauseScreen -= (hook_TogglePauseScreen)obj3;
			object obj4 = <>O.<3>__OnOpenMinimalPauseScreen;
			if (obj4 == null)
			{
				hook_OpenMinimalPauseScreen val4 = OnOpenMinimalPauseScreen;
				<>O.<3>__OnOpenMinimalPauseScreen = val4;
				obj4 = (object)val4;
			}
			PauseManager.OpenMinimalPauseScreen -= (hook_OpenMinimalPauseScreen)obj4;
			object obj5 = <>O.<4>__OnInstantiatePauseScreen;
			if (obj5 == null)
			{
				hook_InstantiatePauseScreen val5 = OnInstantiatePauseScreen;
				<>O.<4>__OnInstantiatePauseScreen = val5;
				obj5 = (object)val5;
			}
			PauseScreenController.InstantiatePauseScreen -= (hook_InstantiatePauseScreen)obj5;
			if ((Object)(object)_instance == (Object)(object)this)
			{
				_instance = null;
			}
		}

		private static void OnPollButtonInput(orig_PollButtonInput orig, PlayerCharacterMasterController self)
		{
			if ((Object)(object)self != (Object)null && (Object)(object)self.networkUser != (Object)null && ((NetworkBehaviour)self.networkUser).isLocalPlayer && (IsOpen || ((Object)(object)AdminMenuUI.Instance != (Object)null && AdminMenuUI.Instance.IsOpen)))
			{
				SuppressPlayerButtons(self);
			}
			else
			{
				orig.Invoke(self);
			}
		}

		private void CaptureCursor()
		{
			UiCommon.AcquireCursor(this);
		}

		private void ReleaseCursor()
		{
			UiCommon.ReleaseCursor(this);
		}

		public void ShowToast(string message, Color color, float duration = 3.5f)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			_toastMessage = message;
			_toastColor = color;
			_toastTimer = duration;
		}

		private void BuildInitialTape()
		{
			_tapePockets.Clear();
			ChaosChances chances = ChaosEventManager.CalculateChances(GetLocalMaster(), RouletteManager.Instance.FiftyFiftyActive);
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < CasinoRouletteHelper.EuropeanWheelOrder.Length; j++)
				{
					int number = CasinoRouletteHelper.EuropeanWheelOrder[j];
					RouletteColor colorForNumber = CasinoRouletteHelper.GetColorForNumber(number);
					ChaosEventType chaosEventType = ChaosEventManager.RollEvent(chances);
					ChaosPolarity polarity = ChaosEventManager.GetDefinition(chaosEventType)?.Polarity ?? ChaosPolarity.None;
					_tapePockets.Add(new RoulettePocket(number, colorForNumber, polarity, chaosEventType));
				}
			}
			_winningTapeIndex = 3 * CasinoRouletteHelper.EuropeanWheelOrder.Length;
			_winningPocket = _tapePockets[_winningTapeIndex];
		}

		public void Open()
		{
			_isWindowOpen = true;
			_confirmSpinPending = false;
			CaptureCursor();
			RefreshPlayerItems();
			UpdateSelectedCellsStake();
		}

		public void Close()
		{
			_isWindowOpen = false;
			_confirmSpinPending = false;
			_isPlacingLifeBet = false;
			_isPlacingItemBet = false;
			_isDraggingWindow = false;
			ReleaseCursor();
			try
			{
				CharacterMaster localMaster = GetLocalMaster();
				if ((Object)(object)localMaster != (Object)null && (Object)(object)localMaster.playerCharacterMasterController != (Object)null)
				{
					SuppressPlayerButtons(localMaster.playerCharacterMasterController);
				}
			}
			catch
			{
			}
		}

		private CharacterMaster? GetLocalMaster()
		{
			return PlayerUtil.GetLocalMaster();
		}

		private string GetPlayerName(CharacterMaster? master)
		{
			if ((Object)(object)master == (Object)null)
			{
				return Localization.Get("Игрок", "Player");
			}
			CharacterBody body = master.GetBody();
			if ((Object)(object)body != (Object)null && !string.IsNullOrEmpty(body.GetUserName()))
			{
				return body.GetUserName();
			}
			if ((Object)(object)master.playerCharacterMasterController != (Object)null && (Object)(object)master.playerCharacterMasterController.networkUser != (Object)null)
			{
				return master.playerCharacterMasterController.networkUser.userName;
			}
			return Localization.Get("Игрок", "Player");
		}

		private void RefreshPlayerItems()
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Invalid comparison between Unknown and I4
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			_playerAvailableItems.Clear();
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null || (Object)(object)localMaster.inventory == (Object)null)
			{
				return;
			}
			foreach (ItemIndex item in localMaster.inventory.itemAcquisitionOrder)
			{
				ItemDef itemDef = ItemCatalog.GetItemDef(item);
				if ((Object)(object)itemDef != (Object)null && !itemDef.hidden && (int)itemDef.tier != 5 && localMaster.inventory.GetItemCountEffective(item) > 0)
				{
					_playerAvailableItems.Add(item);
				}
			}
			if (_selectedItemIdxIndex >= _playerAvailableItems.Count)
			{
				_selectedItemIdxIndex = Mathf.Max(0, _playerAvailableItems.Count - 1);
			}
		}

		private bool ShouldDisplayUI()
		{
			if ((Object)(object)Run.instance == (Object)null)
			{
				return false;
			}
			if (PauseManager.isPaused)
			{
				return false;
			}
			if ((Object)(object)GameOverController.instance != (Object)null)
			{
				return false;
			}
			if (HUD.readOnlyInstanceList == null || HUD.readOnlyInstanceList.Count == 0)
			{
				return false;
			}
			HUD val = HUD.readOnlyInstanceList[0];
			if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy)
			{
				return false;
			}
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null || (Object)(object)localMaster.inventory == (Object)null)
			{
				return false;
			}
			return true;
		}

		private void Update()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Run.instance == (Object)null)
			{
				if (_isWindowOpen)
				{
					Close();
				}
				return;
			}
			if (_toastTimer > 0f)
			{
				_toastTimer -= Time.unscaledDeltaTime;
			}
			if (GUIHelper.IsTypingOrInputBlocked())
			{
				return;
			}
			if (Input.GetKeyDown(ModConfig.CasinoToggleHotkeyKey))
			{
				if (_isWindowOpen)
				{
					Close();
					PlaySound("Play_UI_menuClick");
				}
				else
				{
					Open();
					PlaySound("Play_UI_menuClick");
				}
			}
			if (_isWindowOpen)
			{
				if (Input.GetKeyDown((KeyCode)27))
				{
					UiCommon.CloseOpenMenus();
					return;
				}
				if (_confirmSpinPending)
				{
					_confirmTimer -= Time.unscaledDeltaTime;
					if (_confirmTimer <= 0f)
					{
						_confirmSpinPending = false;
					}
				}
			}
			if (_reelState == ReelState.Spinning)
			{
				_spinTimer += Time.unscaledDeltaTime;
				float num = Mathf.Max(1f, ModConfig.SpinDuration.Value);
				float num2 = Mathf.Clamp01(_spinTimer / num);
				float num3 = 1f - Mathf.Pow(1f - num2, 4.4f);
				_currentScrollX = Mathf.Lerp(0f, _targetScrollX, num3);
				HUD val = ((HUD.readOnlyInstanceList.Count > 0) ? HUD.readOnlyInstanceList[0] : null);
				if ((Object)(object)val != (Object)null)
				{
					Rect inventoryFieldRect = RouletteUI.GetInventoryFieldRect(val);
					float num4 = ((Rect)(ref inventoryFieldRect)).width - 16f;
					int num5 = Mathf.FloorToInt((_currentScrollX + num4 / 2f) / 102f);
					if (num5 != _lastTickedPocket)
					{
						_lastTickedPocket = num5;
						PlaySound("Play_UI_button_hover");
					}
				}
				if (num2 >= 1f)
				{
					FinishSpin();
				}
			}
			else if (_reelState == ReelState.Finished)
			{
				_finishDisplayTimer -= Time.unscaledDeltaTime;
				if (_finishDisplayTimer <= 0f)
				{
					_reelState = ReelState.Idle;
				}
			}
		}

		private void LateUpdate()
		{
		}

		private void RequestSpin()
		{
			//IL_010c: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			if (_reelState == ReelState.Spinning || _spinRequestInFlight)
			{
				return;
			}
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null)
			{
				return;
			}
			int totalMoneyBet = _feltBets.GetTotalMoneyBet();
			int requiredLunarCoins = _feltBets.GetRequiredLunarCoins();
			uint localPlayerLunarCoins = RouletteUI.GetLocalPlayerLunarCoins();
			bool flag = _isLifeBetPlaced && ModConfig.IsLifeBetActive;
			bool flag2 = totalMoneyBet > 0;
			bool flag3 = _isItemBetActive && _playerAvailableItems.Count > 0;
			if (!flag && !flag2 && !flag3)
			{
				_lastResultSummary = Localization.Get("<color=#FFAA00>Сделайте ставку на столе (деньгами, жизнью или предметом)!</color>", "<color=#FFAA00>Place a bet on the table (gold, life, or item)!</color>");
				ShowToast(Localization.Get("Сделайте ставку на столе!", "Place a bet on the table!"), new Color(1f, 0.7f, 0.2f), 3f);
				PlaySound("Play_UI_insufficient_funds");
				return;
			}
			if (flag2 && totalMoneyBet < 25)
			{
				_lastResultSummary = Localization.Get("<color=#FF5555>Минимальная ставка в казино: $25!</color>", "<color=#FF5555>Minimum casino bet is $25!</color>");
				ShowToast(Localization.Get("Минимальная ставка в казино: $25!", "Minimum casino bet is $25!"), new Color(1f, 0.4f, 0.4f), 3f);
				PlaySound("Play_UI_insufficient_funds");
				return;
			}
			if (flag2 && localMaster.money < totalMoneyBet)
			{
				_lastResultSummary = Localization.Format("<color=#FF5555>Недостаточно золота! У вас ${0}, требуется ${1}.</color>", "<color=#FF5555>Not enough gold! You have ${0}, need ${1}.</color>", localMaster.money, totalMoneyBet);
				ShowToast(Localization.Get("Недостаточно золота для всех ставок!", "Not enough gold for all bets!"), new Color(1f, 0.4f, 0.4f), 3f);
				PlaySound("Play_UI_insufficient_funds");
				return;
			}
			if (requiredLunarCoins > 0 && localPlayerLunarCoins < (uint)requiredLunarCoins)
			{
				ShowToast(Localization.Format("Недостаточно Лунных монет для мульти-ставок! (Требуется: {0} ☾, у вас: {1} ☾)", "Not enough Lunar Coins for multi-bets! (Need: {0} ☾, have: {1} ☾)", requiredLunarCoins, localPlayerLunarCoins), new Color(0.4f, 0.8f, 1f));
				PlaySound("Play_UI_insufficient_funds");
				return;
			}
			if (flag3 && _selectedItemIdxIndex >= 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
			{
				ItemIndex val = _playerAvailableItems[_selectedItemIdxIndex];
				if ((Object)(object)localMaster.inventory != (Object)null && localMaster.inventory.GetItemCountEffective(val) <= 0)
				{
					_lastResultSummary = Localization.Get("<color=#FF5555>Выбранного предмета больше нет в инвентаре!</color>", "<color=#FF5555>Selected item is no longer in inventory!</color>");
					RefreshPlayerItems();
					return;
				}
			}
			if (flag && !_confirmSpinPending)
			{
				_confirmSpinPending = true;
				_confirmTimer = 5f;
				PlaySound("Play_heretic_laugh");
				ShowToast(Localization.Get("⚠ СТАВКА ЖИЗНИ! Нажмите [ SPIN ] повторно для подтверждения!", "⚠ LIFE BET! Click [ SPIN ] again to confirm!"), new Color(1f, 0.3f, 0.3f), 4f);
			}
			else
			{
				_confirmSpinPending = false;
				StartSpin();
			}
		}

		private void StartSpin()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Expected I4, but got Unknown
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null || _spinRequestInFlight)
			{
				return;
			}
			if (_isLifeBetPlaced && IsPlayerInDroneOrDeadMode(localMaster))
			{
				_isLifeBetPlaced = false;
				ShowToast(Localization.Get("[ОШИБКА] Ставка жизнью недоступна в режиме дрона / спектатора!", "[ERROR] Life bet is not available in drone / spectator mode!"), new Color(1f, 0.4f, 0.4f), 3f);
				return;
			}
			string txId = (_pendingSpinTxId = Guid.NewGuid().ToString("N"));
			_spinRequestInFlight = true;
			int itemIndex = -1;
			if (_isItemBetActive && _playerAvailableItems.Count > 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
			{
				itemIndex = (int)_playerAvailableItems[_selectedItemIdxIndex];
			}
			CasinoSpinRequestMessage casinoSpinRequestMessage = new CasinoSpinRequestMessage
			{
				txId = txId,
				isLifeBet = (_isLifeBetPlaced && ModConfig.IsLifeBetActive),
				itemIndex = itemIndex,
				itemTargetNumber = _itemBetTargetNumber
			};
			if (casinoSpinRequestMessage.isLifeBet)
			{
				casinoSpinRequestMessage.betType = (byte)_lifeBetType;
				casinoSpinRequestMessage.targetNumber = _lifeBetTarget;
				casinoSpinRequestMessage.moneyBetAmount = 0;
			}
			else
			{
				List<CasinoBet> allActiveBets = _feltBets.GetAllActiveBets();
				if (allActiveBets.Count > 0)
				{
					casinoSpinRequestMessage.betType = (byte)allActiveBets[0].Type;
					casinoSpinRequestMessage.targetNumber = allActiveBets[0].TargetNumber;
					casinoSpinRequestMessage.moneyBetAmount = allActiveBets[0].Amount;
					if (allActiveBets.Count > 1)
					{
						int num = allActiveBets.Count - 1;
						casinoSpinRequestMessage.extraBetTypes = new byte[num];
						casinoSpinRequestMessage.extraTargetNumbers = new int[num];
						casinoSpinRequestMessage.extraBetAmounts = new int[num];
						for (int i = 0; i < num; i++)
						{
							casinoSpinRequestMessage.extraBetTypes[i] = (byte)allActiveBets[i + 1].Type;
							casinoSpinRequestMessage.extraTargetNumbers[i] = allActiveBets[i + 1].TargetNumber;
							casinoSpinRequestMessage.extraBetAmounts[i] = allActiveBets[i + 1].Amount;
						}
					}
				}
			}
			PlaySound("Play_UI_menuClick");
			CasinoServerService.SendCasinoSpinRequest(casinoSpinRequestMessage);
		}

		private void HandleCasinoSpinResultReceived(CasinoSpinResultMessage result)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: 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)
			if (result == null || result.txId != _pendingSpinTxId)
			{
				return;
			}
			_spinRequestInFlight = false;
			_pendingSpinTxId = null;
			if (!result.success)
			{
				switch (result.rejectReason)
				{
				case 1:
					ShowToast(Localization.Get("Недостаточно золота для ставки!", "Not enough gold for bet!"), new Color(1f, 0.4f, 0.4f));
					break;
				case 2:
					ShowToast(Localization.Get("Выбранного предмета нет в инвентаре!", "Selected item is missing!"), new Color(1f, 0.4f, 0.4f));
					break;
				case 3:
					ShowToast(Localization.Get("Ставка жизнью недоступна в режиме дрона / спектатора!", "Life bet not available in drone / spectator mode!"), new Color(1f, 0.4f, 0.4f));
					break;
				case 5:
					ShowToast(Localization.Get("Недостаточно Лунных монет для мульти-ставок!", "Not enough Lunar Coins for multi-bets!"), new Color(0.4f, 0.8f, 1f));
					break;
				default:
					ShowToast(Localization.Get("Казино отключено на сервере!", "Casino disabled on server!"), new Color(1f, 0.4f, 0.4f));
					break;
				}
				PlaySound("Play_UI_insufficient_funds");
				_reelState = ReelState.Idle;
				return;
			}
			_lastSpinResult = result;
			ChaosChances chances = ChaosEventManager.CalculateChances(GetLocalMaster());
			int num = CasinoRouletteHelper.EuropeanWheelOrder.Length;
			_tapePockets.Clear();
			int num2 = 0;
			for (int i = 0; i < num; i++)
			{
				if (CasinoRouletteHelper.EuropeanWheelOrder[i] == result.winningNumber)
				{
					num2 = i;
					break;
				}
			}
			for (int j = 0; j < 7; j++)
			{
				for (int k = 0; k < num; k++)
				{
					int number = CasinoRouletteHelper.EuropeanWheelOrder[k];
					RouletteColor colorForNumber = CasinoRouletteHelper.GetColorForNumber(number);
					ChaosEventType chaosEventType = ((j == 4 && k == num2) ? ((ChaosEventType)result.chaosEvent) : ChaosEventManager.RollEvent(chances));
					ChaosPolarity polarity = ChaosEventManager.GetDefinition(chaosEventType)?.Polarity ?? ChaosPolarity.None;
					_tapePockets.Add(new RoulettePocket(number, colorForNumber, polarity, chaosEventType));
				}
			}
			_winningTapeIndex = 4 * num + num2;
			_winningPocket = _tapePockets[_winningTapeIndex];
			HUD val = ((HUD.readOnlyInstanceList.Count > 0) ? HUD.readOnlyInstanceList[0] : null);
			float num3 = 800f;
			if ((Object)(object)val != (Object)null)
			{
				Rect inventoryFieldRect = RouletteUI.GetInventoryFieldRect(val);
				num3 = ((Rect)(ref inventoryFieldRect)).width - 16f;
			}
			float num4 = num3 / 2f;
			float num5 = (float)_winningTapeIndex * 102f + 47f;
			_targetScrollX = num5 - num4;
			_currentScrollX = 0f;
			_spinTimer = 0f;
			_lastTickedPocket = -1;
			_reelState = ReelState.Spinning;
			_lastResultSummary = "";
			_lastResultHeadline = "";
			PlaySound("Play_UI_menuClick");
		}

		private void FinishSpin()
		{
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0292: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: 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)
			if (_reelState == ReelState.Finished)
			{
				return;
			}
			_reelState = ReelState.Finished;
			_currentScrollX = _targetScrollX;
			_finishDisplayTimer = Mathf.Max(3f, ModConfig.PostSpinDisplayDuration.Value + 1.5f);
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null || _lastSpinResult == null)
			{
				return;
			}
			if (!string.IsNullOrEmpty(_lastSpinResult.txId))
			{
				CasinoServerService.SendCasinoClaimAwardRequest(_lastSpinResult.txId);
			}
			CasinoSpinResultMessage lastSpinResult = _lastSpinResult;
			int winningNumber = lastSpinResult.winningNumber;
			string colorName = CasinoRouletteHelper.GetColorName((RouletteColor)lastSpinResult.winningColor);
			List<string> list = new List<string>();
			bool flag = false;
			if (lastSpinResult.isLifeBet)
			{
				string betTypeName = CasinoRouletteHelper.GetBetTypeName(_lifeBetType, _lifeBetTarget);
				if (lastSpinResult.lifeBetSurvived)
				{
					list.Add(Localization.Format("<color=#2ECC71>★★★ СТАВКА ЖИЗНИ ВЫИГРАЛА: +${0} ({1})! Жизнь сохранена! ★★★</color>", "<color=#2ECC71>★★★ LIFE BET WON: +${0} ({1})! Life spared! ★★★</color>", lastSpinResult.lifeBetJackpot, betTypeName));
					flag = true;
					ShowToast(Localization.Format("[ЖИЗНЬ СОХРАНЕНА] +${0}! ({1})", "[LIFE SPARED] +${0}! ({1})", lastSpinResult.lifeBetJackpot, betTypeName), new Color(0.25f, 0.95f, 0.45f), 5f);
				}
				else
				{
					list.Add(Localization.Format("<color=#FF3333>☠ СТАВКА ЖИЗНИ ПРОИГРАНА: Вы погибли ({0})! ☠</color>", "<color=#FF3333>☠ LIFE BET LOST: You perished ({0})! ☠</color>", betTypeName));
					flag = false;
					ShowToast(Localization.Format("[СМЕРТЬ] Ставка жизни проиграна на {0}!", "[DEATH] Life bet lost on {0}!", betTypeName), new Color(1f, 0.25f, 0.25f), 5f);
					Close();
				}
			}
			else if (lastSpinResult.wonMoney)
			{
				list.Add(Localization.Format("<color=#4ADE80>★ Ставки на столе ВЫИГРАЛИ: +${0}!</color>", "<color=#4ADE80>★ Table bets WON: +${0}!</color>", lastSpinResult.totalPayout));
				flag = true;
			}
			else if (_feltBets.GetTotalMoneyBet() > 0)
			{
				list.Add(Localization.Format("<color=#FF6666>☠ Ставки деньгами проиграли: -${0}.</color>", "<color=#FF6666>☠ Table bets lost: -${0}.</color>", _feltBets.GetTotalMoneyBet()));
			}
			if (_isItemBetActive && _playerAvailableItems.Count > 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
			{
				string itemName = ChaosEventManager.GetItemName(_playerAvailableItems[_selectedItemIdxIndex]);
				if (lastSpinResult.duplicatedItemIndex >= 0)
				{
					try
					{
						PickupIndex val = PickupCatalog.FindPickupIndex((ItemIndex)lastSpinResult.duplicatedItemIndex);
						if (val != PickupIndex.none)
						{
							CharacterMasterNotificationQueue.PushPickupNotification(localMaster, new UniquePickup
							{
								pickupIndex = val,
								isRental = false
							});
						}
					}
					catch
					{
					}
					list.Add(Localization.Format("<color=#2ECC71>★★★ ДЖЕКПОТ НА ЧИСЛЕ {0}! Предмет <b>{1}</b> УДВОЕН (+1 копия)! ★★★</color>", "<color=#2ECC71>★★★ JACKPOT ON NUMBER {0}! Item <b>{1}</b> DOUBLED (+1 copy)! ★★★</color>", _itemBetTargetNumber, itemName));
					flag = true;
				}
				else
				{
					list.Add(Localization.Format("<color=#FF4444>☠ Ставка предметом сгорела: потеряна 1 копия <b>{0}</b> (выпало {1}, ставка была на {2}).</color>", "<color=#FF4444>☠ Item bet lost: lost 1 copy of <b>{0}</b> (rolled {1}, bet on {2}).</color>", itemName, winningNumber, _itemBetTargetNumber));
				}
				RefreshPlayerItems();
			}
			if (ModConfig.IsChaosSystemActive && lastSpinResult.chaosEvent != 0)
			{
				ChaosEventDefinition chaosEventDefinition = ChaosEventManager.GetDisplayDefinition((ChaosEventType)lastSpinResult.chaosEvent) ?? ChaosEventManager.GetDefinition((ChaosEventType)lastSpinResult.chaosEvent);
				if (chaosEventDefinition != null)
				{
					string text = ((chaosEventDefinition.Polarity == ChaosPolarity.Good) ? "#4ADE80" : "#F87171");
					string text2 = ((chaosEventDefinition.Polarity == ChaosPolarity.Good) ? Localization.Get("УДАЧА", "FORTUNE") : Localization.Get("БЕДСТВИЕ", "CALAMITY"));
					list.Add("<color=" + text + "><b>[" + text2 + "]</b> " + chaosEventDefinition.Title + ": " + chaosEventDefinition.Description + "</color>");
					ShowToast("[" + text2 + ": " + chaosEventDefinition.Title + "] " + chaosEventDefinition.Description, chaosEventDefinition.Color, 4f);
					if (chaosEventDefinition.Polarity == ChaosPolarity.Good)
					{
						flag = true;
					}
				}
			}
			_lastResultHeadline = Localization.Format("Выпало: [{0} {1}]", "Rolled: [{0} {1}]", winningNumber, colorName);
			_lastResultSummary = string.Join("\n", list);
			_lastResultColor = (flag ? new Color(0.35f, 0.95f, 0.5f) : new Color(0.95f, 0.4f, 0.4f));
			if (flag)
			{
				PlaySound("Play_UI_shrine_gamble_win");
			}
			else
			{
				PlaySound("Play_heretic_laugh");
			}
		}

		private void PlaySound(string soundString)
		{
			try
			{
				if ((Object)(object)RoR2Application.instance != (Object)null)
				{
					Util.PlaySound(soundString, ((Component)RoR2Application.instance).gameObject);
				}
			}
			catch
			{
			}
		}

		private void InitStyles()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: 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)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Expected O, but got Unknown
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: 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_0155: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Expected O, but got Unknown
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Expected O, but got Unknown
			//IL_01e8: 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_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Expected O, but got Unknown
			//IL_0239: 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_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Expected O, but got Unknown
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Expected O, but got Unknown
			//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0316: Expected O, but got Unknown
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0343: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Expected O, but got Unknown
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Expected O, but got Unknown
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Expected O, but got Unknown
			if (_winHeaderStyle == null)
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3
				};
				val.normal.textColor = new Color(1f, 0.85f, 0.35f);
				_winHeaderStyle = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)3,
					richText = true
				};
				val2.normal.textColor = Color.white;
				_labelBoldStyle = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 10,
					alignment = (TextAnchor)3,
					richText = true
				};
				val3.normal.textColor = new Color(0.75f, 0.78f, 0.85f);
				_labelSmallStyle = val3;
				GUIStyle val4 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 28,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				val4.normal.textColor = Color.white;
				_pocketNumStyle = val4;
				GUIStyle val5 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 10,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				val5.normal.textColor = Color.white;
				_pocketSubStyle = val5;
				_spinBtnStyle = new GUIStyle(GUI.skin.button)
				{
					fontSize = 13,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_spinConfirmBtnStyle = new GUIStyle(GUI.skin.button)
				{
					fontSize = 12,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				_resultStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
				GUIStyle val6 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
				val6.normal.textColor = new Color(0.85f, 0.88f, 0.95f);
				_topLabelStyle = val6;
				GUIStyle val7 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 38,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				val7.normal.textColor = Color.white;
				_questionMarkStyle = val7;
				GUIStyle val8 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					wordWrap = true,
					richText = true
				};
				val8.normal.textColor = Color.white;
				_toastStyle = val8;
				_feltNumberStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
				_feltHeaderStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
				GUIStyle val9 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 9,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
				val9.normal.textColor = Color.white;
				_feltBadgeStyle = val9;
				GUIStyle val10 = new GUIStyle(GUI.skin.label)
				{
					fontSize = 14,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4
				};
				val10.normal.textColor = new Color(0.4f, 0.85f, 0.95f);
				_dragHandleStyle = val10;
				_unifiedBtnStyle = new GUIStyle(GUI.skin.label)
				{
					fontSize = 11,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = true
				};
			}
		}

		private void DrawToastNotification(Rect boxRect)
		{
			//IL_0071: 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_00ec: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (!(_toastTimer <= 0f) && !string.IsNullOrEmpty(_toastMessage))
			{
				float num = Mathf.Clamp01(_toastTimer / 0.5f);
				float num2 = Mathf.Min(((Rect)(ref boxRect)).width, 560f);
				float num3 = 24f;
				float num4 = ((Rect)(ref boxRect)).x + (((Rect)(ref boxRect)).width - num2) / 2f;
				float num5 = ((Rect)(ref boxRect)).yMax + 6f;
				Rect val = new Rect(num4, num5, num2, num3);
				Color color = default(Color);
				((Color)(ref color))..ctor(0.06f, 0.08f, 0.12f, 0.92f * num);
				Color color2 = default(Color);
				((Color)(ref color2))..ctor(_toastColor.r, _toastColor.g, _toastColor.b, 0.95f * num);
				Color textColor = default(Color);
				((Color)(ref textColor))..ctor(_toastColor.r, _toastColor.g, _toastColor.b, num);
				GUIHelper.DrawRect(val, color);
				GUIHelper.DrawBorder(val, color2, 1);
				_toastStyle.normal.textColor = textColor;
				GUI.Label(val, _toastMessage, _toastStyle);
			}
		}

		private void OnGUI()
		{
			try
			{
				if (!ShouldDisplayUI())
				{
					return;
				}
				InitStyles();
				HUD hud = HUD.readOnlyInstanceList[0];
				if (_reelState == ReelState.Spinning || _reelState == ReelState.Finished)
				{
					DrawTopReelBanner(hud);
				}
				if (!_isWindowOpen)
				{
					return;
				}
				bool enabled = GUI.enabled;
				if (GUIHelper.IsTypingOrInputBlocked())
				{
					GUI.enabled = false;
				}
				try
				{
					DrawCasinoTableWindow();
				}
				finally
				{
					GUI.enabled = enabled;
				}
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"[ItemRoulette] Exception in CasinoRouletteUI.OnGUI: {arg}");
			}
		}

		private void DrawTopReelBanner(HUD hud)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: 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_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_09df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_081e: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0930: Unknown result type (might be due to invalid IL or missing references)
			//IL_0946: Unknown result type (might be due to invalid IL or missing references)
			//IL_0522: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0990: Unknown result type (might be due to invalid IL or missing references)
			//IL_0975: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_087a: Unknown result type (might be due to invalid IL or missing references)
			//IL_088d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0892: Unknown result type (might be due to invalid IL or missing references)
			//IL_0562: Unknown result type (might be due to invalid IL or missing references)
			//IL_0568: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0579: Unknown result type (might be due to invalid IL or missing references)
			//IL_0995: Unknown result type (might be due to invalid IL or missing references)
			//IL_0997: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_0900: Unknown result type (might be due to invalid IL or missing references)
			//IL_0919: Unknown result type (might be due to invalid IL or missing references)
			//IL_0923: Unknown result type (might be due to invalid IL or missing references)
			//IL_0927: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_061b: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_063d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_0652: Unknown result type (might be due to invalid IL or missing references)
			//IL_0666: Unknown result type (might be due to invalid IL or missing references)
			//IL_0685: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_074b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0752: Unknown result type (might be due to invalid IL or missing references)
			using (GUIHelper.UseScale(GUIHelper.SafeRouletteScale, new Vector2((float)Screen.width / 2f, 0f)))
			{
				Rect inventoryFieldRect = RouletteUI.GetInventoryFieldRect(hud);
				GUIHelper.DrawRect(inventoryFieldRect, new Color(0.07f, 0.08f, 0.11f, 0.96f));
				GUIHelper.DrawBorder(inventoryFieldRect, new Color(0.26f, 0.29f, 0.38f, 0.92f), 1);
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(((Rect)(ref inventoryFieldRect)).x, ((Rect)(ref inventoryFieldRect)).y + 2f, ((Rect)(ref inventoryFieldRect)).width, 16f);
				string text;
				if (_reelState == ReelState.Spinning)
				{
					if (_isLifeBetPlaced && ModConfig.EnableLifeBet.Value)
					{
						string betTypeName = CasinoRouletteHelper.GetBetTypeName(_lifeBetType, _lifeBetTarget);
						uint item = CasinoRouletteHelper.CalculateLifeBetPrice(GetLocalMaster()).totalPrice;
						text = Localization.Format("РУЛЕТКА: ВРАЩЕНИЕ...   |   ☠ СТАВКА ЖИЗНИ: ${0} на [{1}] (СМЕРТЬ ПРИ ПОРАЖЕНИИ!)", "ROULETTE: SPINNING...   |   ☠ LIFE BET: ${0} on [{1}] (DEATH ON LOSS!)", item, betTypeName);
						_topLabelStyle.normal.textColor = new Color(1f, 0.35f, 0.35f);
					}
					else
					{
						int totalMoneyBet = _feltBets.GetTotalMoneyBet();
						string text2 = ((totalMoneyBet > 0) ? $"${totalMoneyBet}" : "");
						string text3 = ((_isItemBetActive && _playerAvailableItems.Count > 0) ? Localization.Format(" | Предмет: {0} (на #{1})", " | Item: {0} (on #{1})", ChaosEventManager.GetItemName(_playerAvailableItems[_selectedItemIdxIndex]), _itemBetTargetNumber) : "");
						text = Localization.Format("РУЛЕТКА: ВРАЩЕНИЕ...   |   Ставка: {0}{1}", "ROULETTE: SPINNING...   |   Bet: {0}{1}", text2, text3);
						_topLabelStyle.normal.textColor = new Color(1f, 0.85f, 0.35f);
					}
				}
				else
				{
					int number = _winningPocket.Number;
					RouletteColor color = _winningPocket.Color;
					string colorName = CasinoRouletteHelper.GetColorName(color);
					string text4 = color switch
					{
						RouletteColor.Red => "#E74C3C", 
						RouletteColor.Green => "#2ECC71", 
						_ => "#AAB7B8", 
					};
					string text5 = _lastResultSummary.Replace("\n", "  |  ");
					text = Localization.Format("РУЛЕТКА: ВЫПАЛО <color={0}><b>[{1} {2}]</b></color>!   {3}", "ROULETTE: WON <color={0}><b>[{1} {2}]</b></color>!   {3}", text4, number, colorName, text5);
					_topLabelStyle.normal.textColor = _lastResultColor;
				}
				GUI.Label(val, text, _topLabelStyle);
				float num = ((Rect)(ref inventoryFieldRect)).y + 20f;
				float num2 = Mathf.Max(98f, ((Rect)(ref inventoryFieldRect)).height - 26f);
				float num3 = ((Rect)(ref inventoryFieldRect)).x + 8f;
				float num4 = ((Rect)(ref inventoryFieldRect)).width - 16f;
				Rect val2 = new Rect(num3, num, num4, num2);
				GUIHelper.DrawRect(val2, new Color(0.03f, 0.04f, 0.06f, 0.95f));
				GUI.BeginGroup(val2);
				float num5 = (num2 - 94f) / 2f;
				Rect val3 = default(Rect);
				Color color2 = default(Color);
				Color color3 = default(Color);
				Color textColor = default(Color);
				Rect val5 = default(Rect);
				Vector2 val6 = default(Vector2);
				Rect val9 = default(Rect);
				for (int i = 0; i < _tapePockets.Count; i++)
				{
					float num6 = (float)i * 102f - _currentScrollX;
					if (num6 + 94f < -10f || num6 > num4 + 10f)
					{
						continue;
					}
					((Rect)(ref val3))..ctor(num6, num5, 94f, 94f);
					RoulettePocket roulettePocket = _tapePockets[i];
					bool num7 = _reelState == ReelState.Finished && i == _winningTapeIndex;
					bool flag = roulettePocket.ChaosPolarity != ChaosPolarity.None;
					string text6;
					if (roulettePocket.Number == 0)
					{
						((Color)(ref color2))..ctor(0.04f, 0.22f, 0.1f, 0.95f);
						((Color)(ref color3))..ctor(0.18f, 0.85f, 0.44f, 0.95f);
						text6 = Localization.Get("ЗЕРО", "ZERO");
						((Color)(ref textColor))..ctor(0.2f, 0.95f, 0.5f);
					}
					else if (roulettePocket.Color == RouletteColor.Red)
					{
						((Color)(ref color2))..ctor(0.26f, 0.05f, 0.07f, 0.95f);
						((Color)(ref color3))..ctor(0.92f, 0.25f, 0.25f, 0.9f);
						text6 = Localization.Get("КРАСНОЕ", "RED");
						((Color)(ref textColor))..ctor(0.95f, 0.45f, 0.45f);
					}
					else
					{
						((Color)(ref color2))..ctor(0.09f, 0.1f, 0.14f, 0.95f);
						((Color)(ref color3))..ctor(0.45f, 0.5f, 0.6f, 0.85f);
						text6 = Localization.Get("ЧЁРНОЕ", "BLACK");
						((Color)(ref textColor))..ctor(0.7f, 0.75f, 0.85f);
					}
					GUIHelper.DrawRect(val3, color2);
					if (flag)
					{
						Color topRightColor = ((roulettePocket.ChaosPolarity == ChaosPolarity.Good) ? new Color(0.1f, 0.35f, 0.16f, 1f) : new Color(0.4f, 0.08f, 0.12f, 1f));
						Color dividerColor = ((roulettePocket.ChaosPolarity == ChaosPolarity.Good) ? new Color(0.35f, 0.98f, 0.45f, 1f) : new Color(0.98f, 0.3f, 0.35f, 1f));
						Texture2D val4 = GUIHelper.CreateDiagonalOverlayTexture(94, 94, topRightColor, dividerColor, 2, 0.72f);
						GUI.DrawTexture(val3, (Texture)(object)val4);
						float num8 = 22f;
						float num9 = 22f;
						float num10 = ((Rect)(ref val3)).x + 67f;
						float num11 = ((Rect)(ref val3)).y + 7f;
						((Rect)(ref val5))..ctor(num10, num11, num8, num9);
						Color textColor2 = ((roulettePocket.ChaosPolarity == ChaosPolarity.Good) ? new Color(1f, 0.92f, 0.25f, 1f) : new Color(1f, 0.35f, 0.38f, 1f));
						Color textColor3 = ((roulettePocket.ChaosPolarity == ChaosPolarity.Good) ? new Color(0.02f, 0.12f, 0.04f, 0.95f) : new Color(0.14f, 0.02f, 0.04f, 0.95f));
						Matrix4x4 matrix = GUI.matrix;
						((Vector2)(ref val6))..ctor(((Rect)(ref val5)).center.x, ((Rect)(ref val5)).center.y);
						GUIUtility.RotateAroundPivot(4f, val6);
						_questionMarkStyle.fontSize = 18;
						_questionMarkStyle.normal.textColor = textColor3;
						GUI.Label(new Rect(((Rect)(ref val5)).x - 1f, ((Rect)(ref val5)).y, num8, num9), "?", _questionMarkStyle);
						GUI.Label(new Rect(((Rect)(ref val5)).x + 1f, ((Rect)(ref val5)).y, num8, num9), "?", _questionMarkStyle);
						GUI.Label(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y - 1f, num8, num9), "?", _questionMarkStyle);
						GUI.Label(new Rect(((Rect)(ref val5)).x, ((Rect)(ref val5)).y + 1f, num8, num9), "?", _questionMarkStyle);
						_questionMarkStyle.normal.textColor = textColor2;
						GUI.Label(val5, "?", _questionMarkStyle);
						GUI.matrix = matrix;
					}
					Rect val7 = new Rect(((Rect)(ref val3)).x, ((Rect)(ref val3)).y + 14f, ((Rect)(ref val3)).width, 36f);
					_pocketNumStyle.normal.textColor = Color.white;
					GUI.Label(val7, roulettePocket.Label, _pocketNumStyle);
					Rect val8 = new Rect(((Rect)(ref val3)).x, ((Rect)(ref val3)).y + 56f, ((Rect)(ref val3)).width, 18f);
					_pocketSubStyle.normal.textColor = textColor;
					GUI.Label(val8, text6, _pocketSubStyle);
					GUIHelper.DrawRect(new Rect(((Rect)(ref val3)).x, ((Rect)(ref val3)).yMax - 3f, ((Rect)(ref val3)).width, 3f), color3);
					if (roulettePocket.Number == _itemBetTargetNumber && _isItemBetActive && _playerAvailableItems.Count > 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
					{
						(Sprite? sprite, Texture? tex, Rect uv) tuple = ItemPoolHelper.ResolveIcon(PickupCatalog.FindPickupIndex(_playerAvailableItems[_selectedItemIdxIndex]));
						Texture item2 = tuple.tex;
						Rect item3 = tuple.uv;
						if ((Object)(object)item2 != (Object)null)
						{
							((Rect)(ref val9))..ctor(((Rect)(ref val3)).x + 4f, ((Rect)(ref val3)).y + 4f, 22f, 22f);
							GUIHelper.DrawRect(new Rect(((Rect)(ref val9)).x - 1f, ((Rect)(ref val9)).y - 1f, ((Rect)(ref val9)).width + 2f, ((Rect)(ref val9)).height + 2f), new Color(0f, 0f, 0f, 0.85f));
							GUI.DrawTextureWithTexCoords(val9, item2, item3);
						}
					}
					if (num7)
					{
						GUIHelper.DrawBorder(val3, new Color(1f, 0.85f, 0.15f, 1f), 3);
					}
					else if (flag)
					{
						Color color4 = ((roulettePocket.ChaosPolarity == ChaosPolarity.Good) ? new Color(0.25f, 0.85f, 0.35f, 0.9f) : new Color(0.95f, 0.25f, 0.3f, 0.9f));
						GUIHelper.DrawBorder(val3, color4, 1);
					}
					else
					{
						GUIHelper.DrawBorder(val3, color3, 1);
					}
				}
				GUI.EndGroup();
				UiCommon.DrawCenterNeedle(num3 + num4 / 2f, num, num2);
				DrawToastNotification(inventoryFieldRect);
			}
		}

		private void EnsureWindowPosition()
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (!_isWindowPosInitialized)
			{
				float safeWindowsScale = GUIHelper.SafeWindowsScale;
				float num = 948f;
				float num2 = 330f;
				float num3 = num * safeWindowsScale;
				float num4 = num2 * safeWindowsScale;
				float num5 = ((ModConfig.CasinoWindowPosX != null) ? ModConfig.CasinoWindowPosX.Value : (-1f));
				float num6 = ((ModConfig.CasinoWindowPosY != null) ? ModConfig.CasinoWindowPosY.Value : (-1f));
				if (num5 < 0f || num6 < 0f)
				{
					num5 = Mathf.Max(10f, ((float)Screen.width - num3) / 2f);
					num6 = Mathf.Max(60f, (float)Screen.height - num4 - 50f);
				}
				num5 = Mathf.Clamp(num5, 0f, Mathf.Max(0f, (float)Screen.width - num3));
				num6 = Mathf.Clamp(num6, 0f, Mathf.Max(0f, (float)Screen.height - num4));
				_windowRect = new Rect(num5, num6, num, num2);
				_isWindowPosInitialized = true;
			}
		}

		private void HandleWindowDrag(Rect dragHandleRect)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL