Decompiled source of GambleInShop v1.0.0

GambleInShop.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("khalliv")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GambleInShop")]
[assembly: AssemblyTitle("GambleInShop")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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 GambleInShop
{
	[BepInPlugin("khalliv.GambleInShop", "GambleInShop", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class GambleInShop : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <FadeGambleTextRoutine>d__36 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GambleInShop <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (((TMP_Text)<>4__this.gambleText).alpha > 0f)
				{
					if (<>4__this.gambleTextTimer > 0f)
					{
						return false;
					}
					TextMeshProUGUI gambleText = <>4__this.gambleText;
					((TMP_Text)gambleText).alpha = ((TMP_Text)gambleText).alpha - Time.fixedDeltaTime * 3f;
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 1;
					return true;
				}
				((Component)<>4__this.gambleText).gameObject.SetActive(false);
				return false;
			}

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

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

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

			private object <>2__current;

			public string text;

			public string text2;

			public GambleInShop <>4__this;

			private int <i>5__1;

			private int <tagEnd>5__2;

			private int <tagEnd>5__3;

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

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

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

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

			private bool MoveNext()
			{
				//IL_023a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: Expected O, but got Unknown
				//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e6: Expected O, but got Unknown
				//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03b1: Expected O, but got Unknown
				TextMeshProUGUI gambleText4;
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>4__this.gambleTextTimer = 99999f;
					((TMP_Text)<>4__this.gambleText).text = "";
					((TMP_Text)<>4__this.gambleText).alpha = 1f;
					((Component)<>4__this.gambleText).gameObject.SetActive(true);
					<i>5__1 = 0;
					goto IL_01f7;
				case 1:
					<>1__state = -1;
					goto IL_01f7;
				case 2:
					<>1__state = -1;
					<i>5__1 = 0;
					break;
				case 3:
					{
						<>1__state = -1;
						break;
					}
					IL_01f7:
					if (<i>5__1 < text.Length)
					{
						if (text[<i>5__1] == '<')
						{
							<tagEnd>5__2 = text.IndexOf('>', <i>5__1);
							if (<tagEnd>5__2 != -1)
							{
								TextMeshProUGUI gambleText = <>4__this.gambleText;
								((TMP_Text)gambleText).text = ((TMP_Text)gambleText).text + text.Substring(<i>5__1, <tagEnd>5__2 - <i>5__1 + 1);
								<i>5__1 = <tagEnd>5__2 + 1;
							}
							else
							{
								TextMeshProUGUI gambleText2 = <>4__this.gambleText;
								((TMP_Text)gambleText2).text = ((TMP_Text)gambleText2).text + text[<i>5__1];
								<i>5__1++;
							}
						}
						else
						{
							TextMeshProUGUI gambleText3 = <>4__this.gambleText;
							((TMP_Text)gambleText3).text = ((TMP_Text)gambleText3).text + text[<i>5__1];
							<i>5__1++;
						}
						MenuManager.instance.MenuEffectClick((MenuClickEffectType)4, (MenuPage)null, 2f, 0.2f, true);
						<>2__current = (object)new WaitForFixedUpdate();
						<>1__state = 1;
						return true;
					}
					gambleText4 = <>4__this.gambleText;
					((TMP_Text)gambleText4).text = ((TMP_Text)gambleText4).text + "\n";
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 2;
					return true;
				}
				if (<i>5__1 < text2.Length)
				{
					if (text2[<i>5__1] == '<')
					{
						<tagEnd>5__3 = text2.IndexOf('>', <i>5__1);
						if (<tagEnd>5__3 != -1)
						{
							TextMeshProUGUI gambleText5 = <>4__this.gambleText;
							((TMP_Text)gambleText5).text = ((TMP_Text)gambleText5).text + text2.Substring(<i>5__1, <tagEnd>5__3 - <i>5__1 + 1);
							<i>5__1 = <tagEnd>5__3 + 1;
						}
						else
						{
							TextMeshProUGUI gambleText6 = <>4__this.gambleText;
							((TMP_Text)gambleText6).text = ((TMP_Text)gambleText6).text + text2[<i>5__1];
							<i>5__1++;
						}
					}
					else
					{
						TextMeshProUGUI gambleText7 = <>4__this.gambleText;
						((TMP_Text)gambleText7).text = ((TMP_Text)gambleText7).text + text2[<i>5__1];
						<i>5__1++;
					}
					MenuManager.instance.MenuEffectClick((MenuClickEffectType)4, (MenuPage)null, 2f, 0.2f, true);
					<>2__current = (object)new WaitForFixedUpdate();
					<>1__state = 3;
					return true;
				}
				<>4__this.gambleTextTimer = <>4__this.GambleWinTextDuration.Value;
				return false;
			}

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

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

		private TextMeshProUGUI gambleText;

		private float gambleTextTimer = 0f;

		private Coroutine gambleTextRoutine;

		private ConfigEntry<bool> EnableSinglePlayerChat;

		private ConfigEntry<bool> OnlyHostCanGamble;

		private ConfigEntry<int> GambleWinChance;

		private ConfigEntry<float> GambleWinMultiplierMin;

		private ConfigEntry<float> GambleWinMultiplierMax;

		private ConfigEntry<int> GambleWinTextDuration;

		internal static NetworkedEvent GambleEvent;

		internal static NetworkedEvent GambleSetTextEvent;

		private string[] winFlavorTexts = new string[8] { "Praise the dice!", "Don't tell TAXMAN", "Luck is on their side!", "Fortune smiles on them!", "R I G G E D", "What a boss!", "Happy leprechaun sounds", "Follow them on Kick for more depravity" };

		internal static GambleInShop Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			SetupConfig();
			SetupEvents();
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		private void Update()
		{
			if (gambleTextTimer > 0f)
			{
				gambleTextTimer -= Time.deltaTime;
				if (gambleTextTimer <= 0f)
				{
					((MonoBehaviour)this).StartCoroutine(FadeGambleTextRoutine());
				}
			}
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll(typeof(GambleInShopPatches));
			if (EnableSinglePlayerChat.Value)
			{
				Harmony.PatchAll(typeof(SinglePlayerChat));
			}
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void SetupConfig()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Expected O, but got Unknown
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Expected O, but got Unknown
			EnableSinglePlayerChat = ((BaseUnityPlugin)this).Config.Bind<bool>("Utils", "EnableSinglePlayerChat", true, new ConfigDescription("Allows the chat to be used in single player mode.", (AcceptableValueBase)null, Array.Empty<object>()));
			OnlyHostCanGamble = ((BaseUnityPlugin)this).Config.Bind<bool>("General/ServerSide", "OnlyHostCanGamble", false, new ConfigDescription("Should only the host be able to gamble?", (AcceptableValueBase)null, Array.Empty<object>()));
			GambleWinChance = ((BaseUnityPlugin)this).Config.Bind<int>("General/ServerSide", "GambleWinChance", 50, new ConfigDescription("Chance to win the gamble", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			GambleWinMultiplierMin = ((BaseUnityPlugin)this).Config.Bind<float>("General/ServerSide", "GambleWinMultiplierMin", 1.25f, new ConfigDescription("Minimum multiplier for a gamble win.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.01f, 9999f), Array.Empty<object>()));
			GambleWinMultiplierMax = ((BaseUnityPlugin)this).Config.Bind<float>("General/ServerSide", "GambleWinMultiplierMax", 3.25f, new ConfigDescription("Maximum multiplier for a gamble win.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1.01f, 9999f), Array.Empty<object>()));
			GambleWinTextDuration = ((BaseUnityPlugin)this).Config.Bind<int>("General/ClientSide", "GambleWinTextDuration", 4, new ConfigDescription("How long does the gamble info text stay after it's printed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>()));
		}

		private void SetupEvents()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			GambleEvent = new NetworkedEvent("GambleInShop.GambleEvent", (Action<EventData>)OnGamble);
			GambleSetTextEvent = new NetworkedEvent("GambleInShop.GambleSetTextEvent", (Action<EventData>)OnSetText);
		}

		private void OnGamble(EventData eventData)
		{
			if (!OnlyHostCanGamble.Value)
			{
				object[] array = (object[])eventData.CustomData;
				Gamble((int)array[0], (string)array[1]);
			}
		}

		private void OnSetText(EventData eventData)
		{
			object[] array = (object[])eventData.CustomData;
			SetGambleText((string)array[0], (string)array[1]);
		}

		internal void Gamble(int amount, string playerName = "")
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Invalid comparison between Unknown and I4
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Invalid comparison between Unknown and I4
			//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
			if (!SemiFunc.RunIsShop())
			{
				return;
			}
			if (SemiFunc.IsMultiplayer() && !SemiFunc.IsMasterClient())
			{
				GambleEvent.RaiseEvent((object)new object[2] { amount, playerName }, NetworkingEvents.RaiseMasterClient, SendOptions.SendReliable);
				return;
			}
			ExtractionPoint component = ((Component)ShopManager.instance.extractionPoint).GetComponent<ExtractionPoint>();
			if ((int)component.currentState != 2 && (int)component.currentState != 1)
			{
				Logger.LogWarning((object)"Extraction point is not active or idle, cannot gamble in this state.");
				return;
			}
			amount = Mathf.Clamp(Mathf.Abs(amount), 0, SemiFunc.StatGetRunCurrency());
			int num = Random.Range(1, 101);
			string text = "";
			string text2 = "";
			if (num <= GambleWinChance.Value)
			{
				float num2 = Random.Range(Mathf.Min(GambleWinMultiplierMin.Value, GambleWinMultiplierMax.Value), Mathf.Max(GambleWinMultiplierMin.Value, GambleWinMultiplierMax.Value));
				int num3 = Mathf.CeilToInt((float)amount * num2);
				int num4 = SemiFunc.StatGetRunCurrency() - amount + num3;
				SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() - amount + num3);
				string text3 = ((amount * 1000 > 1000000) ? $"{amount * 1000 / 1000000}M" : $"{amount * 1000:N0}");
				string text4 = ((num3 * 1000 > 1000000) ? $"{num3 * 1000 / 1000000}M" : $"{num3 * 1000:N0}");
				text = playerName;
				text = text + " gambled with <b><color=yellow>$" + text3 + "</color></b> and won <b><color=green>$" + text4 + "</color></b>";
				text2 = "<b><color=orange>" + winFlavorTexts[Random.Range(0, winFlavorTexts.Length)] + "</color></b>";
			}
			else
			{
				int num5 = SemiFunc.StatGetRunCurrency();
				int num6 = SemiFunc.StatGetRunCurrency() - amount;
				SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() - amount);
				string text5 = ((amount * 1000 > 1000000) ? $"{amount * 1000 / 1000000}M" : $"{amount * 1000:N0}");
				text = playerName;
				text = text + " gambled with <b><color=yellow>$" + text5 + "</color></b> and <b><color=red>LOST</color></b>.";
				text2 = $"That was <b><color=red>{Mathf.RoundToInt((1f - (float)num6 / (float)num5) * 100f)}%</color></b> of your stash.";
			}
			SetGambleText(text, text2);
			GambleSetTextEvent.RaiseEvent((object)new object[2] { text, text2 }, NetworkingEvents.RaiseOthers, SendOptions.SendReliable);
		}

		private void SetGambleText(string text, string text2)
		{
			if ((Object)(object)gambleText == (Object)null)
			{
				CreateGambleText();
			}
			if (gambleTextRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(gambleTextRoutine);
			}
			gambleTextRoutine = ((MonoBehaviour)this).StartCoroutine(GambleTextRoutine(text, text2));
		}

		[IteratorStateMachine(typeof(<GambleTextRoutine>d__34))]
		private IEnumerator GambleTextRoutine(string text, string text2)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <GambleTextRoutine>d__34(0)
			{
				<>4__this = this,
				text = text,
				text2 = text2
			};
		}

		private void CreateGambleText()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("pauseText");
			val.transform.SetParent(((Component)HUD.instance).transform.GetChild(0).GetChild(0));
			gambleText = val.AddComponent<TextMeshProUGUI>();
			((TMP_Text)gambleText).rectTransform.pivot = new Vector2(0.5f, 0.5f);
			((TMP_Text)gambleText).rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			((TMP_Text)gambleText).rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			((TMP_Text)gambleText).rectTransform.anchoredPosition = new Vector2(0f, 50f);
			((TMP_Text)gambleText).font = ((TMP_Text)BigMessageUI.instance.Text).font;
			((TMP_Text)gambleText).fontMaterial = ((TMP_Text)BigMessageUI.instance.Text).fontMaterial;
			((TMP_Text)gambleText).fontSize = ((TMP_Text)BigMessageUI.instance.Text).fontSize;
			((TMP_Text)gambleText).alignment = (TextAlignmentOptions)514;
			((TMP_Text)gambleText).enableWordWrapping = false;
			((TMP_Text)gambleText).characterSpacing = ((TMP_Text)BigMessageUI.instance.Text).characterSpacing;
			((TMP_Text)gambleText).fontSize = 20f;
			((Graphic)gambleText).color = Color.white;
			((TMP_Text)gambleText).richText = true;
			((TMP_Text)gambleText).outlineColor = Color32.op_Implicit(Color.black);
			((TMP_Text)gambleText).outlineWidth = 0.075f;
		}

		[IteratorStateMachine(typeof(<FadeGambleTextRoutine>d__36))]
		private IEnumerator FadeGambleTextRoutine()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <FadeGambleTextRoutine>d__36(0)
			{
				<>4__this = this
			};
		}
	}
	internal static class GambleInShopPatches
	{
		[HarmonyPatch(typeof(ChatManager), "MessageSend")]
		[HarmonyPrefix]
		private static bool ChatManager_MessageSend_Prefix(ChatManager __instance)
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			string chatMessage = __instance.chatMessage;
			chatMessage = chatMessage.Trim().ToLower();
			if (chatMessage.StartsWith("/gamble"))
			{
				if (SemiFunc.StatGetRunCurrency() <= 0)
				{
					GambleInShop.Logger.LogWarning((object)"You have no money to gamble with.");
					return false;
				}
				string text = chatMessage.Substring("/gamble".Length).Trim();
				int result = 0;
				if (string.Equals(text, "all", StringComparison.OrdinalIgnoreCase))
				{
					result = SemiFunc.StatGetRunCurrency();
				}
				else if (int.TryParse(text, out result))
				{
					result /= 1000;
				}
				__instance.ChatReset();
				__instance.chatActive = false;
				if (result > 0)
				{
					if ((float)result < 1f)
					{
						GambleInShop.Logger.LogWarning((object)"Gamble amount must be at least 1000.");
					}
					string text2 = ColorUtility.ToHtmlStringRGB(PlayerAvatar.instance.playerAvatarVisuals.color);
					GambleInShop.Instance.Gamble(result, "<b><color=#" + text2 + ">" + PlayerAvatar.instance.playerName + "</color></b>");
				}
				return false;
			}
			return true;
		}
	}
	internal static class SinglePlayerChat
	{
		[HarmonyPatch(typeof(ChatManager), "Update")]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected O, but got Unknown
			int num = 0;
			List<CodeInstruction> list = instructions.ToList();
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Call && list[i].operand.ToString().Equals("Boolean IsMultiplayer()"))
				{
					CodeInstruction value = new CodeInstruction(OpCodes.Ldc_I4_1, (object)null)
					{
						labels = list[i].labels
					};
					list[i] = value;
					num++;
				}
			}
			return list.AsEnumerable();
		}
	}
}