Decompiled source of ItemRoulette v1.3.12

ItemRoulette.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
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 HarmonyLib;
using ItemRoulette.Compat;
using ItemRoulette.Configuration;
using ItemRoulette.Core;
using ItemRoulette.Hooks;
using ItemRoulette.UI;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Networking;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
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")]
[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.3.12")]
	[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.3.12";

		private static GameObject? _uiRoot;

		private void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			ModConfig.Init(((BaseUnityPlugin)this).Config);
			RiskOfOptionsCompat.Init();
			ZetAspectsCompat.Init();
			NetworkHelper.Init();
			DropSuppressionHooks.Init();
			_uiRoot = new GameObject("ItemRoulette_UIRoot");
			_uiRoot.AddComponent<RouletteUI>();
			_uiRoot.AddComponent<AdminMenuUI>();
			_uiRoot.AddComponent<CasinoRouletteUI>();
			Object.DontDestroyOnLoad((Object)(object)_uiRoot);
			((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("[{0} v{1}] Мод успешно загружен! Рулетка кейса: [{2}], Казино: [{3}], Админ-меню: [{4}]", "ItemRoulette", "1.3.12", ModConfig.HotkeyKey, ModConfig.CasinoToggleHotkeyKey, ModConfig.AdminMenuHotkeyKey));
		}

		private void OnDestroy()
		{
			if ((Object)(object)_uiRoot != (Object)null)
			{
				Object.Destroy((Object)(object)_uiRoot);
			}
		}
	}
}
namespace ItemRoulette.UI
{
	public class AdminMenuUI : MonoBehaviour
	{
		private static AdminMenuUI? _instance;

		private bool _isOpen;

		private Rect _windowRect = new Rect(80f, 60f, 840f, 620f);

		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;

		private bool _hasCapturedCursor;

		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()
		{
			if (!_hasCapturedCursor)
			{
				if ((Object)(object)MPEventSystemManager.kbmEventSystem != (Object)null)
				{
					MPEventSystem kbmEventSystem = MPEventSystemManager.kbmEventSystem;
					int cursorOpenerCount = kbmEventSystem.cursorOpenerCount;
					kbmEventSystem.cursorOpenerCount = cursorOpenerCount + 1;
				}
				_hasCapturedCursor = true;
			}
		}

		private void ReleaseCursor()
		{
			if (_hasCapturedCursor)
			{
				if ((Object)(object)MPEventSystemManager.kbmEventSystem != (Object)null)
				{
					MPEventSystem kbmEventSystem = MPEventSystemManager.kbmEventSystem;
					int cursorOpenerCount = kbmEventSystem.cursorOpenerCount;
					kbmEventSystem.cursorOpenerCount = cursorOpenerCount - 1;
				}
				_hasCapturedCursor = false;
			}
		}

		public void SetOpen(bool open)
		{
			if (_isOpen != open)
			{
				_isOpen = open;
				if (_isOpen)
				{
					CaptureCursor();
				}
				else
				{
					ReleaseCursor();
				}
			}
		}

		private void Update()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Run.instance == (Object)null)
			{
				if (_isOpen)
				{
					SetOpen(open: false);
				}
				return;
			}
			if (Input.GetKeyDown(ModConfig.AdminMenuHotkeyKey))
			{
				if (!ModConfig.IsAdminPanelActive)
				{
					RouletteUI.Instance?.ShowToast("<color=#FF5555>[АДМИН] Панель отключена настройками сессии хоста.</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))
			{
				SetOpen(open: false);
			}
		}

		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()
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedMaster != (Object)null)
			{
				return firstLocalUser.cachedMaster;
			}
			if (PlayerCharacterMasterController.instances.Count > 0)
			{
				PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[0];
				if ((Object)(object)val != (Object)null && (Object)(object)val.master != (Object)null)
				{
					return val.master;
				}
			}
			return null;
		}

		private void OnGUI()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_00a7: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: 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_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0538: Unknown result type (might be due to invalid IL or missing references)
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_0494: Unknown result type (might be due to invalid IL or missing references)
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Unknown result type (might be due to invalid IL or missing references)
			//IL_0838: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
			if (!_isOpen || (Object)(object)Run.instance == (Object)null)
			{
				return;
			}
			InitStyles();
			if (((Rect)(ref _windowRect)).width > (float)Screen.width || ((Rect)(ref _windowRect)).height > (float)Screen.height)
			{
				_windowRect = new Rect(40f, 40f, Mathf.Min(840f, (float)Screen.width - 80f), Mathf.Min(620f, (float)Screen.height - 80f));
			}
			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), $"[ItemRoulette] ТЕСТОВОЕ АДМИН-МЕНЮ ХАОСА [{ModConfig.AdminMenuHotkey.Value}]", _winHeaderStyle);
			if (GUI.Button(new Rect(((Rect)(ref _windowRect)).xMax - 75f, ((Rect)(ref _windowRect)).y + 6f, 65f, 22f), "✕ Закрыть", _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 num = ((Rect)(ref rect)).x + 6f;
			float num2 = ((Rect)(ref rect)).y + 3f;
			if (GUI.Button(new Rect(num, num2, 90f, 22f), "+1,000 Золота", _buttonStyleGood) && (Object)(object)localMaster != (Object)null)
			{
				localMaster.GiveMoney(1000u, true);
			}
			float num3 = num + 95f;
			if (GUI.Button(new Rect(num3, num2, 105f, 22f), "★ Казино-рулетка", _buttonStyleGood))
			{
				_isOpen = false;
				if ((Object)(object)CasinoRouletteUI.Instance != (Object)null)
				{
					CasinoRouletteUI.Instance.Open();
				}
			}
			float num4 = num3 + 110f;
			bool flag = (Object)(object)RouletteUI.Instance != (Object)null && RouletteUI.Instance.IsAutoSpinActive;
			string text = (flag ? "Авто: ВКЛ" : "Авто: ВЫКЛ");
			if (GUI.Button(new Rect(num4, num2, 80f, 22f), text, flag ? _buttonStyleGood : _buttonStyleUtil) && (Object)(object)RouletteUI.Instance != (Object)null)
			{
				RouletteUI.Instance.ToggleAutoSpin();
			}
			float num5 = num4 + 85f;
			if (GUI.Button(new Rect(num5, num2, 95f, 22f), "+5 Бесплатных", _buttonStyleGood))
			{
				RouletteManager.Instance.AddFreeRolls(5);
			}
			float num6 = num5 + 100f;
			if (GUI.Button(new Rect(num6, num2, 85f, 22f), "+1 Красная", _buttonStyleGood))
			{
				RouletteManager.Instance.AddFreeLegendaryRolls(1);
			}
			float num7 = num6 + 90f;
			if (GUI.Button(new Rect(num7, num2, 85f, 22f), "+1 Бездна", _buttonStyleGood))
			{
				RouletteManager.Instance.AddPendingVoidRolls(1);
			}
			float num8 = num7 + 90f;
			if (GUI.Button(new Rect(num8, num2, 80f, 22f), "50/50: ВКЛ", _buttonStyleBad))
			{
				RouletteManager.Instance.FiftyFiftyActive = true;
			}
			float num9 = num8 + 85f;
			if (GUI.Button(new Rect(num9, num2, 95f, 22f), "Сброс штрафа", _buttonStyleUtil))
			{
				RouletteManager.Instance.ChaosCostPenaltyMultiplier = 0f;
			}
			float num10 = num9 + 100f;
			if (GUI.Button(new Rect(num10, num2, 120f, 22f), "+Спектральный x5", _buttonStyleGood) && (Object)(object)localMaster != (Object)null && (Object)(object)localMaster.inventory != (Object)null)
			{
				RouletteItemEntry rouletteItemEntry = ItemPoolHelper.RollRandomEntry();
				if (rouletteItemEntry != null && rouletteItemEntry.PickupDef != null)
				{
					RouletteManager.Instance.GrantSpectralItems(localMaster, rouletteItemEntry.PickupDef.itemIndex, 5);
				}
			}
			float num11 = num10 + 125f;
			if (GUI.Button(new Rect(num11, num2, 110f, 22f), "+Временный x10", _buttonStyleGood) && (Object)(object)localMaster != (Object)null && (Object)(object)localMaster.inventory != (Object)null)
			{
				RouletteItemEntry rouletteItemEntry2 = ItemPoolHelper.RollRandomEntry();
				if (rouletteItemEntry2 != null && rouletteItemEntry2.PickupDef != null)
				{
					RouletteManager.Instance.GrantTemporaryItems(localMaster, rouletteItemEntry2.PickupDef.itemIndex, 10, 60f);
				}
			}
			if (GUI.Button(new Rect(num11 + 115f, num2, 100f, 22f), "☠ Цена жизни", _buttonStyleBad))
			{
				var (num12, num13, num14) = CasinoRouletteHelper.CalculateLifeBetPrice(localMaster);
				if ((Object)(object)CasinoRouletteUI.Instance != (Object)null)
				{
					CasinoRouletteUI.Instance.ShowToast($"[Цена Жизни] Итого: ${num12} (Ур*Этап: ${num13} | Вещи: ${num14})", new Color(1f, 0.4f, 0.4f), 5f);
				}
			}
			float num15 = (((Rect)(ref _windowRect)).width - 32f) / 2f;
			float num16 = ((Rect)(ref _windowRect)).height - 135f;
			Rect rect2 = default(Rect);
			((Rect)(ref rect2))..ctor(((Rect)(ref _windowRect)).x + 12f, ((Rect)(ref _windowRect)).y + 68f, num15, num16);
			Rect rect3 = default(Rect);
			((Rect)(ref rect3))..ctor(((Rect)(ref _windowRect)).x + 16f + num15, ((Rect)(ref _windowRect)).y + 68f, num15, num16);
			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 num17 = (((Object)(object)localMaster != (Object)null) ? localMaster.money : 0u);
			float num18 = (((Object)(object)localMaster != (Object)null) ? RouletteManager.Instance.GetPlayerTierMultiplier(localMaster) : 1f);
			string text2 = "";
			if (Mathf.Abs(num18 - 1f) > 0.01f)
			{
				text2 = ((num18 > 1f) ? $"  |  <b>Редкость:</b> <color=#4ADE80>x{num18:F2}</color>" : $"  |  <b>Редкость:</b> <color=#F87171>x{num18:F2}</color>");
			}
			int chanceDollCount = RouletteManager.GetChanceDollCount((localMaster != null) ? localMaster.inventory : null);
			string text3 = "";
			if (chanceDollCount > 0)
			{
				float num19 = Mathf.Clamp(ModConfig.ChanceDollBaseChancePercent.Value + (float)(chanceDollCount - 1) * ModConfig.ChanceDollStackChancePercent.Value, 0f, 100f);
				text3 = $"  |  <b>Кукла:</b> <color=#38E54D>{chanceDollCount} шт. ({num19:F0}%)</color>";
			}
			int pendingVoidRollsAvailable = RouletteManager.Instance.PendingVoidRollsAvailable;
			string text4 = ((pendingVoidRollsAvailable > 0) ? $"<b>Бездна [{ModConfig.VoidSpinHotkey.Value}]:</b> <color=#C084FC>{pendingVoidRollsAvailable}</color>  |  " : "");
			string text5 = $"<b>Золото:</b> ${num17}  |  <b>След. крутка [{ModConfig.Hotkey.Value}]:</b> ${currentCost}  |  <b>Бесплатных:</b> {freeRollsAvailable}  |  {text4}" + $"<b>Шансы:</b> <color=#4ADE80>● Удача {chaosChances.GoodPercent:F0}%</color> / <color=#C0C0C0>Нейтр. {chaosChances.NeutralPercent:F0}%</color> / <color=#F87171>● Бедствие {chaosChances.BadPercent:F0}%</color>" + text2 + text3;
			GUI.Label(new Rect(((Rect)(ref rect4)).x + 8f, ((Rect)(ref rect4)).y + 3f, ((Rect)(ref rect4)).width - 16f, 20f), text5, _statsStyle);
			GUIHelper.DrawTopCursor(_windowRect);
		}

		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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: 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_0275: 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);
			string text = ((polarity == ChaosPolarity.Good) ? "<color=#4ADE80><b>\ud83d\udfe2 13 ПОЛОЖИТЕЛЬНЫХ СОБЫТИЙ (УДАЧА)</b></color>" : "<color=#F87171><b>\ud83d\udd34 15 НЕГАТИВНЫХ СОБЫТИЙ (БЕДСТВИЕ)</b></color>");
			GUI.Label(new Rect(((Rect)(ref rect)).x + 8f, ((Rect)(ref rect)).y + 4f, ((Rect)(ref rect)).width - 16f, 20f), text, _sectionHeaderStyle);
			ChaosEventType[] array = ((polarity != ChaosPolarity.Good) ? new ChaosEventType[15]
			{
				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
			} : new ChaosEventType[13]
			{
				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
			});
			float num = ((Rect)(ref rect)).y + 26f;
			float num2 = (((Rect)(ref rect)).height - 30f) / (float)array.Length;
			Rect rect2 = default(Rect);
			for (int i = 0; i < array.Length; i++)
			{
				ChaosEventType chaosEventType = array[i];
				ChaosEventDefinition definition = ChaosEventManager.GetDefinition(chaosEventType);
				if (definition == null)
				{
					continue;
				}
				((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + 4f, num + (float)i * num2, ((Rect)(ref rect)).width - 8f, num2 - 2f);
				GUIHelper.DrawRect(rect2, (i % 2 == 0) ? new Color(0.1f, 0.12f, 0.17f, 0.85f) : new Color(0.12f, 0.14f, 0.2f, 0.85f));
				string text2 = $"{i + 1}. " + "<b>" + definition.Title + "</b>";
				GUI.Label(new Rect(((Rect)(ref rect2)).x + 6f, ((Rect)(ref rect2)).y + 4f, ((Rect)(ref rect2)).width - 150f, num2 - 6f), text2, _itemRowStyle);
				Rect val = new Rect(((Rect)(ref rect2)).xMax - 144f, ((Rect)(ref rect2)).y + 3f, 68f, num2 - 6f);
				GUIStyle val2 = ((polarity == ChaosPolarity.Good) ? _buttonStyleGood : _buttonStyleBad);
				if (GUI.Button(val, "Тест", val2))
				{
					ExecuteInstantTest(master, chaosEventType);
				}
				if (GUI.Button(new Rect(((Rect)(ref rect2)).xMax - 72f, ((Rect)(ref rect2)).y + 3f, 68f, num2 - 6f), "Спин", _buttonStyleUtil))
				{
					SetOpen(open: false);
					if ((Object)(object)RouletteUI.Instance != (Object)null)
					{
						RouletteUI.Instance.TriggerSpinAction(chaosEventType);
					}
				}
			}
		}

		private void ExecuteInstantTest(CharacterMaster? master, ChaosEventType evType)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)master == (Object)null))
			{
				RouletteItemEntry rouletteItemEntry = ItemPoolHelper.RollRandomEntry(null, null, null, master);
				if (rouletteItemEntry == null)
				{
					rouletteItemEntry = ItemPoolHelper.CreateEntry(PickupCatalog.FindPickupIndex(Items.Syringe.itemIndex), RouletteTierType.Common);
				}
				rouletteItemEntry.ChaosEvent = evType;
				ChaosEventDefinition definition = ChaosEventManager.GetDefinition(evType);
				rouletteItemEntry.ChaosPolarity = definition?.Polarity ?? ChaosPolarity.None;
				int currentCost = RouletteManager.Instance.GetCurrentCost();
				ChaosEventManager.ExecuteEvent(master, evType, rouletteItemEntry, currentCost);
				if ((Object)(object)RouletteUI.Instance != (Object)null && definition != null)
				{
					string text = ((definition.Polarity == ChaosPolarity.Good) ? "УДАЧА" : "БЕДСТВИЕ");
					RouletteUI.Instance.ShowToast("[" + text + "] <b>" + definition.Title + "</b>: " + definition.Description, definition.Color);
				}
			}
		}
	}
	public class CasinoRouletteUI : MonoBehaviour
	{
		private enum ReelState
		{
			Idle,
			Spinning,
			Finished
		}

		private static CasinoRouletteUI? _instance;

		private bool _isWindowOpen;

		private bool _hasCapturedCursor;

		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 uint _moneyBetAmount = 100u;

		private CasinoBetType _selectedBetType = CasinoBetType.Red;

		private int _targetNumber = 7;

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

		private int _selectedItemIdxIndex;

		private bool _isItemBetActive;

		private bool _isLifeBetActive;

		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;

		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()
		{
			_instance = this;
			BuildInitialTape();
		}

		private void OnDisable()
		{
			ReleaseCursor();
		}

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

		private void CaptureCursor()
		{
			if (!_hasCapturedCursor)
			{
				if ((Object)(object)MPEventSystemManager.kbmEventSystem != (Object)null)
				{
					MPEventSystem kbmEventSystem = MPEventSystemManager.kbmEventSystem;
					int cursorOpenerCount = kbmEventSystem.cursorOpenerCount;
					kbmEventSystem.cursorOpenerCount = cursorOpenerCount + 1;
				}
				_hasCapturedCursor = true;
			}
		}

		private void ReleaseCursor()
		{
			if (_hasCapturedCursor)
			{
				if ((Object)(object)MPEventSystemManager.kbmEventSystem != (Object)null)
				{
					MPEventSystem kbmEventSystem = MPEventSystemManager.kbmEventSystem;
					int cursorOpenerCount = kbmEventSystem.cursorOpenerCount;
					kbmEventSystem.cursorOpenerCount = cursorOpenerCount - 1;
				}
				_hasCapturedCursor = false;
			}
		}

		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()
		{
			if (ModConfig.IsCasinoRouletteActive)
			{
				_isWindowOpen = true;
				_confirmSpinPending = false;
				CaptureCursor();
				RefreshPlayerItems();
			}
		}

		public void Close()
		{
			_isWindowOpen = false;
			_confirmSpinPending = false;
			ReleaseCursor();
		}

		private CharacterMaster? GetLocalMaster()
		{
			LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
			if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedMaster != (Object)null)
			{
				return firstLocalUser.cachedMaster;
			}
			if (PlayerCharacterMasterController.instances != null)
			{
				foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
				{
					if ((Object)(object)instance != (Object)null && (Object)(object)instance.networkUser != (Object)null && ((NetworkBehaviour)instance.networkUser).isLocalPlayer && (Object)(object)instance.master != (Object)null)
					{
						return instance.master;
					}
				}
				if (PlayerCharacterMasterController.instances.Count == 1)
				{
					PlayerCharacterMasterController obj = PlayerCharacterMasterController.instances[0];
					if (obj == null)
					{
						return null;
					}
					return obj.master;
				}
			}
			return null;
		}

		private string GetPlayerName(CharacterMaster? master)
		{
			if ((Object)(object)master == (Object)null)
			{
				return "Игрок";
			}
			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 "Игрок";
		}

		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_0063: 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)
			_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 && 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 || !ModConfig.IsCasinoRouletteActive)
			{
				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_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Run.instance == (Object)null)
			{
				if (_isWindowOpen)
				{
					Close();
				}
				return;
			}
			if (!ModConfig.IsCasinoRouletteActive)
			{
				if (_isWindowOpen)
				{
					Close();
				}
				if (Input.GetKeyDown(ModConfig.CasinoToggleHotkeyKey))
				{
					RouletteUI.Instance?.ShowToast("<color=#FF5555>[КАЗИНО] Казино-рулетка отключена в настройках мода.</color>", new Color(1f, 0.4f, 0.4f), 3f);
				}
				return;
			}
			if (_toastTimer > 0f)
			{
				_toastTimer -= Time.unscaledDeltaTime;
			}
			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))
				{
					Close();
					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_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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 (_reelState == ReelState.Spinning)
			{
				return;
			}
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null)
			{
				return;
			}
			bool num = _isLifeBetActive && ModConfig.IsLifeBetActive && _selectedBetType != CasinoBetType.None;
			bool flag = !_isLifeBetActive && _moneyBetAmount != 0 && _selectedBetType != CasinoBetType.None;
			bool flag2 = _isItemBetActive && _playerAvailableItems.Count > 0;
			if (!num && !flag && !flag2)
			{
				_lastResultSummary = "<color=#FFAA00>Сделайте ставку (деньгами, жизнью или предметом)!</color>";
				PlaySound("Play_UI_insufficient_funds");
				return;
			}
			if (flag && localMaster.money < _moneyBetAmount)
			{
				_lastResultSummary = $"<color=#FF5555>Недостаточно золота! У вас ${localMaster.money}, требуется ${_moneyBetAmount}.</color>";
				PlaySound("Play_UI_insufficient_funds");
				return;
			}
			if (flag2 && _selectedItemIdxIndex >= 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
			{
				ItemIndex val = _playerAvailableItems[_selectedItemIdxIndex];
				if (localMaster.inventory.GetItemCountEffective(val) <= 0)
				{
					_lastResultSummary = "<color=#FF5555>Выбранного предмета больше нет в инвентаре!</color>";
					RefreshPlayerItems();
					return;
				}
			}
			if (!_confirmSpinPending)
			{
				_confirmSpinPending = true;
				_confirmTimer = (_isLifeBetActive ? 5f : 3.5f);
				if (_isLifeBetActive)
				{
					PlaySound("Play_heretic_laugh");
				}
				else
				{
					PlaySound("Play_UI_menuClick");
				}
			}
			else
			{
				_confirmSpinPending = false;
				StartSpin();
			}
		}

		private void StartSpin()
		{
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null)
			{
				return;
			}
			if (_isLifeBetActive && IsPlayerInDroneOrDeadMode(localMaster))
			{
				_isLifeBetActive = false;
				ShowToast("[ОШИБКА] Ставка жизнью недоступна в режиме дрона / спектатора!", new Color(1f, 0.4f, 0.4f), 3f);
				return;
			}
			if ((!_isLifeBetActive || !ModConfig.IsLifeBetActive || _selectedBetType == CasinoBetType.None) && _moneyBetAmount != 0 && _selectedBetType != CasinoBetType.None)
			{
				if (NetworkServer.active)
				{
					localMaster.money = (uint)Math.Max(0L, (long)localMaster.money - (long)_moneyBetAmount);
				}
				else
				{
					localMaster.money = (uint)Math.Max(0L, (long)localMaster.money - (long)_moneyBetAmount);
					string text = Guid.NewGuid().ToString("N");
					string text2 = Uri.EscapeDataString(DropSuppressionHooks.GetMasterIdentifier(localMaster));
					object[] obj = new object[4] { text, null, null, null };
					NetworkInstanceId netId = ((NetworkBehaviour)localMaster).netId;
					obj[1] = ((NetworkInstanceId)(ref netId)).Value;
					obj[2] = text2;
					obj[3] = (int)_moneyBetAmount;
					NetworkHelper.SendToServer(string.Format("[ItemRoulette:ServerMoneyDelta:{0}:{1}:{2}:-{3}]", obj));
				}
			}
			ChaosChances chances = ChaosEventManager.CalculateChances(localMaster, RouletteManager.Instance.FiftyFiftyActive);
			RouletteManager.Instance.FiftyFiftyActive = false;
			int num = CasinoRouletteHelper.EuropeanWheelOrder.Length;
			_tapePockets.Clear();
			for (int i = 0; i < 7; i++)
			{
				for (int j = 0; j < num; 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));
				}
			}
			int num2 = Random.Range(0, num);
			_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_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_08aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0894: Unknown result type (might be due to invalid IL or missing references)
			//IL_08af: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0464: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_046f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: 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_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Expected I4, but got Unknown
			//IL_0589: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Expected I4, but got Unknown
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0693: Unknown result type (might be due to invalid IL or missing references)
			//IL_0698: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_051f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Unknown result type (might be due to invalid IL or missing references)
			//IL_0526: Unknown result type (might be due to invalid IL or missing references)
			//IL_0528: Unknown result type (might be due to invalid IL or missing references)
			//IL_052a: Unknown result type (might be due to invalid IL or missing references)
			//IL_07dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0539: Unknown result type (might be due to invalid IL or missing references)
			//IL_0541: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			_reelState = ReelState.Finished;
			_currentScrollX = _targetScrollX;
			_finishDisplayTimer = Mathf.Max(3f, ModConfig.PostSpinDisplayDuration.Value + 1.5f);
			CharacterMaster localMaster = GetLocalMaster();
			if ((Object)(object)localMaster == (Object)null)
			{
				return;
			}
			int number = _winningPocket.Number;
			RouletteColor color = _winningPocket.Color;
			string colorNameRussian = CasinoRouletteHelper.GetColorNameRussian(color);
			string text = color switch
			{
				RouletteColor.Red => "#E74C3C", 
				RouletteColor.Green => "#2ECC71", 
				_ => "#AAB7B8", 
			};
			List<string> list = new List<string>();
			bool flag = false;
			NetworkInstanceId netId;
			if (_isLifeBetActive && ModConfig.IsLifeBetActive && _selectedBetType != CasinoBetType.None && !IsPlayerInDroneOrDeadMode(localMaster))
			{
				uint item = CasinoRouletteHelper.CalculateLifeBetPrice(localMaster).totalPrice;
				string betTypeNameRussian = CasinoRouletteHelper.GetBetTypeNameRussian(_selectedBetType, _targetNumber);
				string playerName = GetPlayerName(localMaster);
				if (CasinoRouletteHelper.DoesBetWin(_selectedBetType, _targetNumber, number, out var payoutMultiplier))
				{
					uint num = (uint)(item * payoutMultiplier);
					if (NetworkServer.active)
					{
						localMaster.GiveMoney(num, true);
					}
					else
					{
						string text2 = Guid.NewGuid().ToString("N");
						string text3 = Uri.EscapeDataString(DropSuppressionHooks.GetMasterIdentifier(localMaster));
						object[] obj = new object[4] { text2, null, null, null };
						netId = ((NetworkBehaviour)localMaster).netId;
						obj[1] = ((NetworkInstanceId)(ref netId)).Value;
						obj[2] = text3;
						obj[3] = (int)num;
						NetworkHelper.SendToServer(string.Format("[ItemRoulette:ServerMoneyDelta:{0}:{1}:{2}:{3}]", obj));
					}
					list.Add($"<color=#2ECC71>★★★ СТАВКА ЖИЗНИ ВЫИГРАЛА: +${num} ({betTypeNameRussian})! Жизнь сохранена! ★★★</color>");
					flag = true;
					ShowToast($"[ЖИЗНЬ СОХРАНЕНА] +${num}! ({betTypeNameRussian})", new Color(0.25f, 0.95f, 0.45f), 5f);
					try
					{
						NetworkHelper.SendChatMessage($"<color=#2ECC71>[Рулетка-ЖИЗНЬ]</color> Игрок <b>{playerName}</b> рискнул ЖИЗНЬЮ на <color={text}><b>[{betTypeNameRussian}]</b></color> и ВЫИГРАЛ <color=#FFD700><b>+${num}</b></color>!");
					}
					catch
					{
					}
				}
				else
				{
					list.Add("<color=#FF3333>☠ СТАВКА ЖИЗНИ ПРОИГРАНА: Вы погибли (" + betTypeNameRussian + ")! ☠</color>");
					flag = false;
					ShowToast("[СМЕРТЬ] Ставка жизни проиграна на " + betTypeNameRussian + "!", new Color(1f, 0.25f, 0.25f), 5f);
					try
					{
						NetworkHelper.SendChatMessage($"<color=#FF3333>[Рулетка-ЖИЗНЬ]</color> ☠ Игрок <b>{playerName}</b> поставил ЖИЗНЬ на <b>{betTypeNameRussian}</b> и ПРОИГРАЛ (выпало [{number} {colorNameRussian}])! Смерть настигла смельчака...");
					}
					catch
					{
					}
					if (NetworkServer.active)
					{
						CharacterBody body = localMaster.GetBody();
						if ((Object)(object)body != (Object)null && (Object)(object)body.healthComponent != (Object)null)
						{
							body.healthComponent.Suicide((GameObject)null, (GameObject)null, DamageTypeCombo.op_Implicit((DamageType)0));
						}
						else
						{
							localMaster.TrueKill();
						}
					}
					else
					{
						string arg = Guid.NewGuid().ToString("N");
						string arg2 = Uri.EscapeDataString(DropSuppressionHooks.GetMasterIdentifier(localMaster));
						netId = ((NetworkBehaviour)localMaster).netId;
						NetworkHelper.SendToServer($"[ItemRoulette:ServerSuicide:{arg}:{((NetworkInstanceId)(ref netId)).Value}:{arg2}]");
					}
					Close();
				}
			}
			else if (_moneyBetAmount != 0 && _selectedBetType != CasinoBetType.None)
			{
				if (CasinoRouletteHelper.DoesBetWin(_selectedBetType, _targetNumber, number, out var payoutMultiplier2))
				{
					uint num2 = (uint)(_moneyBetAmount * payoutMultiplier2);
					if (NetworkServer.active)
					{
						localMaster.GiveMoney(num2, true);
					}
					else
					{
						string text4 = Guid.NewGuid().ToString("N");
						string text5 = Uri.EscapeDataString(DropSuppressionHooks.GetMasterIdentifier(localMaster));
						object[] obj4 = new object[4] { text4, null, null, null };
						netId = ((NetworkBehaviour)localMaster).netId;
						obj4[1] = ((NetworkInstanceId)(ref netId)).Value;
						obj4[2] = text5;
						obj4[3] = (int)num2;
						NetworkHelper.SendToServer(string.Format("[ItemRoulette:ServerMoneyDelta:{0}:{1}:{2}:{3}]", obj4));
					}
					list.Add($"<color=#4ADE80>★ Ставка деньгами ВЫИГРАЛА: +${num2} ({CasinoRouletteHelper.GetBetTypeNameRussian(_selectedBetType, _targetNumber)})!</color>");
					flag = true;
				}
				else
				{
					list.Add($"<color=#FF6666>☠ Ставка деньгами проиграна: -${_moneyBetAmount} ({CasinoRouletteHelper.GetBetTypeNameRussian(_selectedBetType, _targetNumber)}).</color>");
				}
			}
			if (_isItemBetActive && _playerAvailableItems.Count > 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
			{
				ItemIndex val = _playerAvailableItems[_selectedItemIdxIndex];
				string itemName = ChaosEventManager.GetItemName(val);
				ItemDef itemDef = ItemCatalog.GetItemDef(val);
				string text6 = (((Object)(object)itemDef != (Object)null) ? ((Object)itemDef).name : "");
				if (number == 0)
				{
					if (NetworkServer.active)
					{
						localMaster.inventory.GiveItemPermanent(val, 1);
					}
					else
					{
						string text7 = Guid.NewGuid().ToString("N");
						string text8 = Uri.EscapeDataString(DropSuppressionHooks.GetMasterIdentifier(localMaster));
						object[] obj5 = new object[5] { text7, null, null, null, null };
						netId = ((NetworkBehaviour)localMaster).netId;
						obj5[1] = ((NetworkInstanceId)(ref netId)).Value;
						obj5[2] = text8;
						obj5[3] = (int)val;
						obj5[4] = text6;
						NetworkHelper.SendToServer(string.Format("[ItemRoulette:ServerItemAward:{0}:{1}:{2}:{3}:{4}:1]", obj5));
					}
					try
					{
						if (NetworkHelper.IsLocalMaster(localMaster))
						{
							PickupIndex val2 = PickupCatalog.FindPickupIndex(val);
							if (val2 != PickupIndex.none)
							{
								CharacterMasterNotificationQueue.PushPickupNotification(localMaster, new UniquePickup
								{
									pickupIndex = val2,
									isRental = false
								});
							}
						}
					}
					catch
					{
					}
					list.Add("<color=#2ECC71>★★★ ДЖЕКПОТ НА ЗЕРО! Предмет <b>" + itemName + "</b> УДВОЕН (+1 копия)! ★★★</color>");
					flag = true;
				}
				else
				{
					if (NetworkServer.active)
					{
						localMaster.inventory.RemoveItemPermanent(val, 1);
					}
					else
					{
						string text9 = Guid.NewGuid().ToString("N");
						string text10 = Uri.EscapeDataString(DropSuppressionHooks.GetMasterIdentifier(localMaster));
						object[] obj7 = new object[5] { text9, null, null, null, null };
						netId = ((NetworkBehaviour)localMaster).netId;
						obj7[1] = ((NetworkInstanceId)(ref netId)).Value;
						obj7[2] = text10;
						obj7[3] = (int)val;
						obj7[4] = text6;
						NetworkHelper.SendToServer(string.Format("[ItemRoulette:ServerItemRemove:{0}:{1}:{2}:{3}:{4}:1]", obj7));
					}
					list.Add("<color=#FF4444>☠ Ставка предметом сгорела: потеряна 1 копия <b>" + itemName + "</b>.</color>");
				}
				RefreshPlayerItems();
			}
			if (ModConfig.IsChaosSystemActive && _winningPocket.ChaosPolarity != ChaosPolarity.None && _winningPocket.ChaosEvent != ChaosEventType.None)
			{
				ChaosEventDefinition definition = ChaosEventManager.GetDefinition(_winningPocket.ChaosEvent);
				if (definition != null)
				{
					RouletteItemEntry wonItem = null;
					if (_isItemBetActive && _playerAvailableItems.Count > 0 && _selectedItemIdxIndex < _playerAvailableItems.Count)
					{
						wonItem = ItemPoolHelper.CreateEntry(PickupCatalog.FindPickupIndex(_playerAvailableItems[_selectedItemIdxIndex]), RouletteTierType.Uncommon);
					}
					else if ((Object)(object)localMaster.inventory != (Object)null && localMaster.inventory.itemAcquisitionOrder.Count > 0)
					{
						wonItem = ItemPoolHelper.CreateEntry(PickupCatalog.FindPickupIndex(localMaster.inventory.itemAcquisitionOrder[Random.Range(0, localMaster.inventory.itemAcquisitionOrder.Count)]), RouletteTierType.Uncommon);
					}
					ChaosEventManager.ExecuteEvent(localMaster, _winningPocket.ChaosEvent, wonItem, (int)_moneyBetAmount);
					string text11 = ((definition.Polarity == ChaosPolarity.Good) ? "#4ADE80" : "#F87171");
					string text12 = ((definition.Polarity == ChaosPolarity.Good) ? "УДАЧА" : "БЕДСТВИЕ");
					list.Add("<color=" + text11 + "><b>[" + text12 + "]</b> " + definition.Title + ": " + definition.Description + "</color>");
					ShowToast("[" + text12 + ": " + definition.Title + "] " + definition.Description, definition.Color, 4f);
					if (definition.Polarity == ChaosPolarity.Good)
					{
						PlaySound("Play_UI_coin_collect");
						flag = true;
					}
					else
					{
						PlaySound("Play_heretic_laugh");
					}
					try
					{
						NetworkHelper.SendChatMessage($"<color=#F1C40F>[Рулетка-Хаос]</color> Сектор {_winningPocket.Number} активировал <color={text11}><b>[{definition.Title}]</b></color>! {definition.Description}");
					}
					catch
					{
					}
				}
			}
			_lastResultHeadline = $"Выпало: [{number} {colorNameRussian}]";
			_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");
			}
			try
			{
				NetworkHelper.SendChatMessage(string.Format("<color=#F1C40F>[Рулетка]</color> Выпал сектор <color={0}><b>[{1} {2}]</b></color>! {3}", text, number, colorNameRussian, _lastResultSummary.Replace("\n", " | ")));
			}
			catch
			{
			}
		}

		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
			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;
			}
		}

		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())
				{
					InitStyles();
					HUD hud = HUD.readOnlyInstanceList[0];
					if (_reelState == ReelState.Spinning || _reelState == ReelState.Finished)
					{
						DrawTopReelBanner(hud);
					}
					if (_isWindowOpen)
					{
						DrawBettingSidebar();
					}
				}
			}
			catch (Exception arg)
			{
				Debug.LogWarning((object)$"[ItemRoulette] Exception in CasinoRouletteUI.OnGUI: {arg}");
			}
		}

		private void DrawTopReelBanner(HUD hud)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: 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_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_097c: 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_099a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09be: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: 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_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0454: Unknown result type (might be due to invalid IL or missing references)
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_0717: Unknown result type (might be due to invalid IL or missing references)
			//IL_0753: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_0797: Unknown result type (might be due to invalid IL or missing references)
			//IL_079c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_091b: Unknown result type (might be due to invalid IL or missing references)
			//IL_091d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0908: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0805: Unknown result type (might be due to invalid IL or missing references)
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_090d: Unknown result type (might be due to invalid IL or missing references)
			//IL_090f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Unknown result type (might be due to invalid IL or missing references)
			//IL_0878: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_089f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: 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_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0603: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_064f: Unknown result type (might be due to invalid IL or missing references)
			//IL_067c: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d0: Unknown result type (might be due to invalid IL or missing references)
			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)
			{
				string betTypeNameRussian = CasinoRouletteHelper.GetBetTypeNameRussian(_selectedBetType, _targetNumber);
				if (_isLifeBetActive && ModConfig.EnableLifeBet.Value)
				{
					uint item = CasinoRouletteHelper.CalculateLifeBetPrice(GetLocalMaster()).totalPrice;
					text = $"РУЛЕТКА: ВРАЩЕНИЕ...   |   ☠ СТАВКА ЖИЗНИ: ${item} на [{betTypeNameRussian}] (СМЕРТЬ ПРИ ПОРАЖЕНИИ!)";
					_topLabelStyle.normal.textColor = new Color(1f, 0.35f, 0.35f);
				}
				else
				{
					string text2 = ((_moneyBetAmount != 0) ? $"${_moneyBetAmount} ({betTypeNameRussian})" : "");
					string text3 = ((_isItemBetActive && _playerAvailableItems.Count > 0) ? (" | Предмет: " + ChaosEventManager.GetItemName(_playerAvailableItems[_selectedItemIdxIndex]) + " (на ЗЕРО)") : "");
					text = "РУЛЕТКА: ВРАЩЕНИЕ...   |   Ставка: " + text2 + text3;
					_topLabelStyle.normal.textColor = new Color(1f, 0.85f, 0.35f);
				}
			}
			else
			{
				int number = _winningPocket.Number;
				RouletteColor color = _winningPocket.Color;
				string colorNameRussian = CasinoRouletteHelper.GetColorNameRussian(color);
				string text4 = color switch
				{
					RouletteColor.Red => "#E74C3C", 
					RouletteColor.Green => "#2ECC71", 
					_ => "#AAB7B8", 
				};
				string text5 = _lastResultSummary.Replace("\n", "  |  ");
				text = $"РУЛЕТКА: ВЫПАЛО <color={text4}><b>[{number} {colorNameRussian}]</b></color>!   {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 = "ЗЕРО";
					((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 = "КРАСНОЕ";
					((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 = "ЧЁРНОЕ";
					((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 = 28f;
					float num9 = 28f;
					float num10 = ((Rect)(ref val3)).x + 60f;
					float num11 = ((Rect)(ref val3)).y + 4f;
					((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(12f, val6);
					_questionMarkStyle.fontSize = 20;
					_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 == 0 && _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();
			float num12 = num3 + num4 / 2f;
			Color color5 = default(Color);
			((Color)(ref color5))..ctor(1f, 0.82f, 0.12f, 1f);
			GUIHelper.DrawRect(new Rect(num12 - 1f, num, 2f, num2), color5);
			GUIHelper.DrawRect(new Rect(num12 - 4f, num, 8f, 2f), color5);
			GUIHelper.DrawRect(new Rect(num12 - 2f, num + 2f, 4f, 2f), color5);
			GUIHelper.DrawRect(new Rect(num12 - 2f, num + num2 - 4f, 4f, 2f), color5);
			GUIHelper.DrawRect(new Rect(num12 - 4f, num + num2 - 2f, 8f, 2f), color5);
			DrawToastNotification(inventoryFieldRect);
		}

		private void DrawBettingSidebar()
		{
			//IL_0063: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_0514: Unknown result type (might be due to invalid IL or missing references)
			//IL_056d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: 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_0676: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0488: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_072f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0749: Unknown result type (might be due to invalid IL or missing references)
			//IL_076d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0787: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07db: Unknown result type (might be due to invalid IL or missing references)
			//IL_080b: Unknown result type (might be due to invalid IL or missing references)
			//IL_083a: Unknown result type (might be due to invalid IL or missing references)
			//IL_086a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_092f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0965: Unknown result type (might be due to invalid IL or missing references)
			//IL_0360: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0abe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0adf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b92: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d28: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d12: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d3f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d46: Unknown result type (might be due to invalid IL or missing references)
			//IL_1046: Unknown result type (might be due to invalid IL or missing references)
			//IL_1050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d72: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dcc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1144: Unknown result type (might be due to invalid IL or missing references)
			//IL_10c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1345: Unknown result type (might be due to invalid IL or missing references)
			//IL_134f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e11: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e95: Unknown result type (might be due to invalid IL or missing references)
			//IL_127b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1265: Unknown result type (might be due to invalid IL or missing references)
			//IL_121c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1206: Unknown result type (might be due to invalid IL or missing references)
			//IL_130d: Unknown result type (might be due to invalid IL or missing references)
			//IL_12df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0edd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1285: Unknown result type (might be due to invalid IL or missing references)
			//IL_1226: Unknown result type (might be due to invalid IL or missing references)
			//IL_13d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef9: Unknown result type (might be due to invalid IL or missing references)
			//IL_11af: Unknown result type (might be due to invalid IL or missing references)
			//IL_13ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_13be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f52: Unknown result type (might be due to invalid IL or missing references)
			float num = 370f;
			float num2 = Mathf.Clamp(600f, 400f, (float)Screen.height - 40f);
			float num3 = (float)Screen.width - num - 16f;
			float num4 = Mathf.Clamp(((float)Screen.height - num2) / 2f, 20f, (float)Screen.height - num2 - 20f);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num3, num4, num, num2);
			GUIHelper.DrawRect(val, new Color(0.07f, 0.08f, 0.12f, 0.96f));
			GUIHelper.DrawBorder(val, new Color(0.85f, 0.7f, 0.25f, 0.95f), 1);
			CharacterMaster localMaster = GetLocalMaster();
			uint num5 = (((Object)(object)localMaster != (Object)null) ? localMaster.money : 0u);
			float num6 = ((Rect)(ref val)).y + 10f;
			float num7 = ((Rect)(ref val)).x + 12f;
			float num8 = num - 24f;
			GUI.Label(new Rect(num7, num6, num8 - 32f, 22f), "★ РУЛЕТКА ★", _winHeaderStyle);
			if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 36f, num6, 24f, 22f), "X"))
			{
				Close();
				PlaySound("Play_UI_menuClick");
			}
			num6 += 24f;
			GUI.Label(new Rect(num7, num6, num8, 18f), $"Баланс: <color=#2ECC71><b>${num5}</b></color>", _labelSmallStyle);
			num6 += 18f;
			if (ModConfig.IsChaosSystemActive)
			{
				ChaosChances chaosChances = ChaosEventManager.CalculateChances(localMaster, RouletteManager.Instance.FiftyFiftyActive);
				GUI.Label(new Rect(num7, num6, num8, 16f), $"Хаос на секторах: <color=#4ADE80>● {chaosChances.GoodPercent:F0}%</color> / <color=#C0C0C0>{chaosChances.NeutralPercent:F0}%</color> / <color=#F87171>● {chaosChances.BadPercent:F0}%</color>", _labelSmallStyle);
				num6 += 18f;
			}
			GUIHelper.DrawRect(new Rect(num7, num6, num8, 1f), new Color(0.25f, 0.28f, 0.38f, 0.8f));
			num6 += 6f;
			if (ModConfig.IsLifeBetActive)
			{
				float num9 = (num8 - 6f) / 2f;
				Color backgroundColor = GUI.backgroundColor;
				bool flag = IsPlayerInDroneOrDeadMode(localMaster);
				if (flag && _isLifeBetActive)
				{
					_isLifeBetActive = false;
				}
				GUI.backgroundColor = ((!_isLifeBetActive) ? new Color(0.2f, 0.75f, 0.35f) : new Color(0.2f, 0.24f, 0.32f));
				if (GUI.Button(new Rect(num7, num6, num9, 22f), (!_isLifeBetActive) ? "★ ЗОЛОТО" : "ЗОЛОТО"))
				{
					_isLifeBetActive = false;
					_confirmSpinPending = false;
				}
				GUI.backgroundColor = (flag ? new Color(0.25f, 0.25f, 0.25f) : (_isLifeBetActive ? new Color(0.92f, 0.2f, 0.25f) : new Color(0.35f, 0.15f, 0.18f)));
				string text = (flag ? "☠ Жизнь (Дрон)" : (_isLifeBetActive ? "☠ СТАВКА ЖИЗНИ ☠" : "☠ СТАВКА ЖИЗНИ"));
				if (GUI.Button(new Rect(num7 + num9 + 6f, num6, num9, 22f), text))
				{
					if (flag)
					{
						ShowToast("[ОШИБКА] Ставка жизнью недоступна в режиме дрона / спектатора!", new Color(1f, 0.4f, 0.4f), 3f);
						PlaySound("Play_UI_insufficient_funds");
					}
					else
					{
						_isLifeBetActive = true;
						_confirmSpinPending = false;
					}
				}
				GUI.backgroundColor = backgroundColor;
				num6 += 26f;
			}
			else
			{
				_isLifeBetActive = false;
			}
			if (_isLifeBetActive)
			{
				(uint totalPrice, uint levelStagePart, uint itemsPart) tuple = CasinoRouletteHelper.CalculateLifeBetPrice(localMaster);
				uint item = tuple.totalPrice;
				uint item2 = tuple.levelStagePart;
				uint item3 = tuple.itemsPart;
				CharacterBody val2 = ((localMaster != null) ? localMaster.GetBody() : null);
				int num10 = ((!((Object)(object)val2 != (Object)null)) ? 1 : Mathf.Max(1, Mathf.FloorToInt(val2.level)));
				int num11 = ((!((Object)(object)Run.instance != (Object)null)) ? 1 : Mathf.Max(1, Run.instance.stageClearCount + 1));
				GUI.Label(new Rect(num7, num6, num8, 18f), $"<b>1. СТАВКА:</b> <color=#FF4444><b>ЖИЗНЬ (${item})</b></color>", _labelBoldStyle);
				num6 += 18f;
				GUI.Label(new Rect(num7, num6, num8, 16f), $"Расчёт: Ур.{num10} * Этап{num11} (${item2}) + Вещи (${item3})", _labelSmallStyle);
				num6 += 16f;
				GUI.Label(new Rect(num7, num6, num8, 16f), "<color=#FF4444>⚠ ВНИМАНИЕ: При проигрыше персонаж погибает!</color>", _labelSmallStyle);
				num6 += 20f;
			}
			else
			{
				GUI.Label(new Rect(num7, num6, num8, 18f), $"<b>1. СТАВКА ЗОЛОТА:</b> <color=#2ECC71><b>${_moneyBetAmount}</b></color>", _labelBoldStyle);
				num6 += 20f;
				float num12 = (num8 - 20f) / 6f;
				if (GUI.Button(new Rect(num7 + 0f * (num12 + 4f), num6, num12, 20f), "+50"))
				{
					_moneyBetAmount += 50u;
					_confirmSpinPending = false;
				}
				if (GUI.Button(new Rect(num7 + 1f * (num12 + 4f), num6, num12, 20f), "+250"))
				{
					_moneyBetAmount += 250u;
					_confirmSpinPending = false;
				}
				if (GUI.Button(new Rect(num7 + 2f * (num12 + 4f), num6, num12, 20f), "+1000"))
				{
					_moneyBetAmount += 1000u;
					_confirmSpinPending = false;
				}
				if (GUI.Button(new Rect(num7 + 3f * (num12 + 4f), num6, num12, 20f), "x2"))
				{
					_moneyBetAmount *= 2u;
					_confirmSpinPending = false;
				}
				if (GUI.Button(new Rect(num7 + 4f * (num12 + 4f), num6, num12, 20f), "All-In"))
				{
					_moneyBetAmount = num5;
					_confirmSpinPending = false;
				}
				if (GUI.Button(new Rect(num7 + 5f * (num12 + 4f), num6, num12, 20f), "$0"))
				{
					_moneyBetAmount = 0u;
					_confirmSpinPending = false;
				}
				num6 += 26f;
			}
			GUI.Label(new Rect(num7, num6, num8, 16f), "<b>2. ВЫБОР ПОЛЯ СТАВКИ:</b>", _labelBoldStyle);
			num6 += 18f;
			float num13 = (num8 - 6f) / 2f;
			float num14 = (num8 - 10f) / 3f;
			DrawBetButton(new Rect(num7, num6, num13, 20f), "КРАСНОЕ (x2)", CasinoBetType.Red, (Color?)new Color(0.85f, 0.2f, 0.2f));
			DrawBetButton(new Rect(num7 + num13 + 6f, num6, num13, 20f), "ЧЁРНОЕ (x2)", CasinoBetType.Black, (Color?)new Color(0.2f, 0.22f, 0.28f));
			num6 += 23f;
			DrawBetButton(new Rect(num7, num6, num13, 20f), "ЧЁТНОЕ (x2)", CasinoBetType.Even);
			DrawBetButton(new Rect(num7 + num13 + 6f, num6, num13, 20f), "НЕЧЁТНОЕ (x2)", CasinoBetType.Odd);
			num6 += 23f;
			DrawBetButton(new Rect(num7, num6, num13, 20f), "1 - 18 (x2)", CasinoBetType.Low1_18);
			DrawBetButton(new Rect(num7 + num13 + 6f, num6, num13, 20f), "19 - 36 (x2)", CasinoBetType.High19_36);
			num6 += 23f;
			DrawBetButton(new Rect(nu