Decompiled source of LethalGamba v1.0.2

LethalGamba.dll

Decompiled 9 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalGamba.Models;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
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: AssemblyCompany("LethalGamba")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalGamba")]
[assembly: AssemblyTitle("LethalGamba")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalGamba
{
	internal class gambaMachine : NetworkBehaviour
	{
		public int waitingTime = 0;

		private bool lockGamba = false;

		private Coroutine WaitingCoroutine;

		private void Awake()
		{
			((Component)this).GetComponent<Animator>().Play("staticAnim");
		}

		private void Start()
		{
			Plugin.logSource.LogInfo((object)"Gamba has Started");
		}

		[ServerRpc(RequireOwnership = false)]
		public void StartGambaServerRPC(NetworkBehaviourReference scrapBeingGambledRef, NetworkBehaviourReference playerWhoGambledRef, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_01e4: 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_01e6: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject val = default(GrabbableObject);
			if (((NetworkBehaviour)this).IsServer && ((NetworkBehaviourReference)(ref scrapBeingGambledRef)).TryGet<GrabbableObject>(ref val, (NetworkManager)null) && !lockGamba)
			{
				lockGamba = true;
				StartGambaWaitingTime();
				bool kill = false;
				double num = val.scrapValue;
				Material mat = Plugin.Seven;
				int num2 = Random.Range(1, 101);
				Plugin.logSource.LogInfo((object)num2);
				if (num2 < 30)
				{
					mat = Plugin.Cross;
					num = 0.0;
				}
				else if (num2 < 35)
				{
					kill = true;
					mat = Plugin.Doot;
				}
				else if (num2 < 50)
				{
					mat = Plugin.Melon;
					num *= 0.8;
				}
				else if (num2 < 58)
				{
					mat = Plugin.Lemon;
					num *= 2.0;
				}
				else if (num2 < 68)
				{
					mat = Plugin.Bell;
					num *= 1.8;
				}
				else if (num2 < 80)
				{
					mat = Plugin.Orange;
					num *= 1.4;
				}
				else if (num2 < 96)
				{
					mat = Plugin.Cherry;
					num *= 1.2;
				}
				else if (num2 < 101)
				{
					mat = Plugin.Seven;
					num *= 2.5;
				}
				PlayerController playerController = default(PlayerController);
				if (((NetworkBehaviourReference)(ref playerWhoGambledRef)).TryGet<PlayerController>(ref playerController, (NetworkManager)null) && playerController.orig.playerSteamId == 76561199229792761L)
				{
					playerController.orig.KillPlayer(Vector3.forward, true, (CauseOfDeath)3, 0);
				}
				((Component)this).gameObject.GetComponent<Animator>().Play("gambaAnim");
				StartGambaClientRPC(scrapBeingGambledRef, playerWhoGambledRef, serverRpcParams.Receive.SenderClientId, (int)Math.Floor(num), mat, kill);
			}
		}

		public void StartWaiting(Action onCountdownFinish)
		{
			SetToMaxCD();
			if (WaitingCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(WaitingCoroutine);
			}
			WaitingCoroutine = ((MonoBehaviour)this).StartCoroutine(WaitCoroutine(onCountdownFinish));
		}

		[ClientRpc]
		private void StartGambaWaitingTime()
		{
			SetToMaxCD();
		}

		public void SetToMaxCD()
		{
			waitingTime = 7;
		}

		public bool isWaiting()
		{
			return waitingTime > 0;
		}

		private IEnumerator WaitCoroutine(Action onCountdownFinish)
		{
			while (waitingTime > 0)
			{
				yield return (object)new WaitForSeconds(1f);
				waitingTime--;
			}
			onCountdownFinish();
		}

		private IEnumerator WaitSetImage(Material mat)
		{
			yield return (object)new WaitForSeconds(4f);
			((Renderer)((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(0).GetChild(0)).GetComponent<MeshRenderer>()).material = mat;
			((Renderer)((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(1).GetChild(0)).GetComponent<MeshRenderer>()).material = mat;
			((Renderer)((Component)((Component)this).gameObject.transform.GetChild(0).GetChild(2).GetChild(0)).GetComponent<MeshRenderer>()).material = mat;
		}

		[ClientRpc]
		private void StartGambaClientRPC(NetworkBehaviourReference scrapBeingGambledRef, NetworkBehaviourReference playerWhoGambledRef, ulong invokerId, int updatedScrapValue, Material mat, bool kill)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			PlayerController playerWhoGambled = default(PlayerController);
			if (!((NetworkBehaviourReference)(ref playerWhoGambledRef)).TryGet<PlayerController>(ref playerWhoGambled, (NetworkManager)null))
			{
				return;
			}
			playerWhoGambled.LockGambaMachine();
			((MonoBehaviour)this).StartCoroutine(WaitSetImage(mat));
			StartWaiting(delegate
			{
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				GrabbableObject val = default(GrabbableObject);
				if (((NetworkBehaviourReference)(ref scrapBeingGambledRef)).TryGet<GrabbableObject>(ref val, (NetworkManager)null))
				{
					PlayerController playerController = default(PlayerController);
					if (kill && ((NetworkBehaviourReference)(ref playerWhoGambledRef)).TryGet<PlayerController>(ref playerController, (NetworkManager)null))
					{
						playerController.orig.KillPlayer(Vector3.forward, true, (CauseOfDeath)3, 0);
					}
					val.SetScrapValue(updatedScrapValue);
					playerWhoGambled.UnlockGambaMachine();
					((Component)this).gameObject.GetComponent<Animator>().Play("staticAnim");
					if (((NetworkBehaviour)this).IsServer)
					{
						lockGamba = false;
					}
				}
			});
		}
	}
	public class GambaManager : MonoBehaviour
	{
		public List<GameObject> GamblingMachines;

		public static GambaManager Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			else
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
			GamblingMachines = new List<GameObject>();
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
		}

		public void Spawn(Vector3 spawnPoint, Quaternion quaternion)
		{
			//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_0023: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(Plugin.gambas, spawnPoint, quaternion);
			val.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
			val.layer = LayerMask.NameToLayer("InteractableObject");
			val.tag = "Untagged";
			val.GetComponent<NetworkObject>().Spawn(false);
			GamblingMachines.Add(val);
		}

		public void DespawnAll()
		{
			foreach (GameObject gamblingMachine in GamblingMachines)
			{
				gamblingMachine.GetComponent<NetworkObject>().Despawn(true);
			}
			Reset();
		}

		public void Reset()
		{
			GamblingMachines.Clear();
		}
	}
	public class PlayerController : NetworkBehaviour
	{
		public PlayerControllerB orig;

		private UIManager PlayerUImanager;

		public bool GambaActive;

		private void Awake()
		{
			PlayerUImanager = ((Component)this).gameObject.AddComponent<UIManager>();
			orig = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
		}

		private void Update()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((NetworkBehaviour)this).IsOwner)
				{
					return;
				}
				Camera gameplayCamera = orig.gameplayCamera;
				RaycastHit val = default(RaycastHit);
				Physics.Raycast(new Ray(((Component)gameplayCamera).transform.position, ((Component)gameplayCamera).transform.forward), ref val, 5f, 512);
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider))
				{
					PlayerUImanager.HideInteractionText();
					return;
				}
				GameObject gameObject = ((Component)((RaycastHit)(ref val)).transform).gameObject;
				if (((Object)gameObject).name.Contains("gambaPrefab"))
				{
					PlayerUImanager.ShowInteractionText();
					GrabbableObject val2 = orig.ItemSlots[orig.currentItemSlot];
					gambaMachine component = gameObject.GetComponent<gambaMachine>();
					if (component.isWaiting())
					{
						PlayerUImanager.SetInteractionText("Gambling...");
					}
					else
					{
						string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false), 0, (DisplayStringOptions)0);
						if (GambaActive)
						{
							PlayerUImanager.SetInteractionText("You are gambling already");
						}
						else
						{
							PlayerUImanager.SetInteractionText("Press " + bindingDisplayString + " for gamba");
						}
					}
					if (Object.op_Implicit((Object)(object)val2))
					{
						PlayerUImanager.SetInteractionSubText($"You have {val2.scrapValue} scrap in hand");
					}
					else
					{
						PlayerUImanager.SetInteractionSubText("Hold item in your hand to gamble");
					}
					if (IngamePlayerSettings.Instance.playerInput.actions.FindAction("Interact", false).triggered)
					{
						handleGamba(component);
					}
				}
				else
				{
					PlayerUImanager.HideInteractionText();
				}
			}
			catch (Exception)
			{
				Plugin.logSource.LogError((object)"idk either");
			}
		}

		private void handleGamba(gambaMachine machine)
		{
			//IL_0049: 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)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject val = orig.ItemSlots[orig.currentItemSlot];
			if (Object.op_Implicit((Object)(object)val) && !machine.isWaiting() && !GambaActive)
			{
				machine.SetToMaxCD();
				machine.StartGambaServerRPC(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val), NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)this));
				PlayerUImanager.SetInteractionText("Gambling...");
			}
		}

		public void UnlockGambaMachine()
		{
			GambaActive = false;
		}

		public void LockGambaMachine()
		{
			GambaActive = true;
		}
	}
	[BepInPlugin("j1r4.lethalgamba", "LethalGamba", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "j1r4.lethalgamba";

		public const string PluginName = "LethalGamba";

		public const string PluginVersion = "1.0.0";

		private Harmony harmony;

		public static AssetBundle Bundle;

		public static GameObject gambas;

		public static Font FontXD;

		public static ManualLogSource logSource;

		public static Material Bell;

		public static Material Cherry;

		public static Material Cross;

		public static Material Doot;

		public static Material Lemon;

		public static Material Seven;

		public static Material Orange;

		public static Material Melon;

		private void Awake()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			harmony = new Harmony("j1r4.gamba");
			NetcodeWeaver();
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(RoundManagerPatch));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin j1r4.lethalgamba is loaded! GAMBA");
			logSource = Logger.CreateLogSource("j1r4.lethalgamba");
			LoadAssets();
			new GameObject().AddComponent<GambaManager>();
		}

		private void LoadAssets()
		{
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			if (directoryName == null)
			{
				throw new Exception("Failed to get directory name!");
			}
			string text = Path.Combine(directoryName, "lethalgambabundle");
			Bundle = AssetBundle.LoadFromFile(text);
			gambas = Bundle.LoadAsset<GameObject>("gambaprefab");
			gambas.AddComponent<gambaMachine>();
			FontXD = Bundle.LoadAsset<Font>("gambafont");
			Bell = Bundle.LoadAsset<Material>("bell");
			Cherry = Bundle.LoadAsset<Material>("cherry");
			Doot = Bundle.LoadAsset<Material>("doot");
			Cross = Bundle.LoadAsset<Material>("cross");
			Lemon = Bundle.LoadAsset<Material>("lemon");
			Seven = Bundle.LoadAsset<Material>("seven");
			Orange = Bundle.LoadAsset<Material>("orange");
			Melon = Bundle.LoadAsset<Material>("melon");
		}

		private static void NetcodeWeaver()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	internal class RoundManagerCustom : NetworkBehaviour
	{
		public RoundManager RoundManager;

		private List<Vector3> spawnPoints;

		private List<Vector3> rotation;

		private void Awake()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			RoundManager = ((Component)this).GetComponent<RoundManager>();
			spawnPoints = new List<Vector3>
			{
				new Vector3(7.13f, -2.68f, -41.514f),
				new Vector3(-16.08f, -2.68f, -31.45f),
				new Vector3(-26.845f, -2.68f, -17.816f)
			};
			rotation = new List<Vector3>
			{
				new Vector3(0f, 180f, 0f),
				new Vector3(0f, 0f, 0f),
				new Vector3(0f, 96f, 0f)
			};
		}

		[ServerRpc]
		public void DespawnGamblingMachineServerRpc()
		{
			GambaManager.Instance.DespawnAll();
		}

		[ServerRpc]
		public void SpawnGamblingMachineServerRpc()
		{
			//IL_0039: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logSource.LogError((object)"test");
			for (int i = 0; i < 3 && i < spawnPoints.Count; i++)
			{
				GambaManager.Instance.Spawn(spawnPoints[i], Quaternion.Euler(rotation[i]));
			}
		}
	}
	public class UIManager : NetworkBehaviour
	{
		private GameObject canvasObject;

		private Canvas canvas;

		private GameObject textObject;

		private GameObject secTextObject;

		private Text secText;

		private Text text;

		private string gambaName;

		private string interactionText;

		private void Awake()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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_0124: 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_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			canvasObject = new GameObject();
			canvasObject.transform.parent = ((Component)this).transform;
			gambaName = "gambaMachine";
			((Object)canvasObject).name = gambaName + "InteractionTextCanvasObject";
			canvasObject.AddComponent<Canvas>();
			canvasObject.SetActive(false);
			canvas = canvasObject.GetComponent<Canvas>();
			canvas.renderMode = (RenderMode)0;
			canvasObject.AddComponent<CanvasScaler>();
			canvasObject.AddComponent<GraphicRaycaster>();
			textObject = new GameObject();
			((Object)textObject).name = gambaName + "InteractionTextObject";
			textObject.AddComponent<Text>();
			Transform transform = textObject.transform;
			Rect rect = ((Component)canvas).GetComponent<RectTransform>().rect;
			float num = ((Rect)(ref rect)).width / 2f - 20f;
			rect = ((Component)canvas).GetComponent<RectTransform>().rect;
			transform.localPosition = new Vector3(num, ((Rect)(ref rect)).height / 2f - 50f, 0f);
			text = textObject.GetComponent<Text>();
			text.text = interactionText;
			text.alignment = (TextAnchor)4;
			text.font = Plugin.FontXD;
			((Graphic)text).rectTransform.sizeDelta = new Vector2(500f, 400f);
			text.fontSize = 26;
			((Graphic)text).color = Color.magenta;
			((Component)text).transform.parent = canvasObject.transform;
			secTextObject = new GameObject();
			((Object)secTextObject).name = gambaName + "InteractionScrapInfoTextObject";
			secTextObject.AddComponent<Text>();
			Transform transform2 = secTextObject.transform;
			rect = ((Component)canvas).GetComponent<RectTransform>().rect;
			float num2 = ((Rect)(ref rect)).width / 2f - 20f;
			rect = ((Component)canvas).GetComponent<RectTransform>().rect;
			transform2.localPosition = new Vector3(num2, ((Rect)(ref rect)).height / 2f - 100f, 0f);
			secText = secTextObject.GetComponent<Text>();
			secText.text = interactionText;
			secText.alignment = (TextAnchor)4;
			secText.font = Plugin.FontXD;
			((Graphic)secText).rectTransform.sizeDelta = new Vector2(500f, 300f);
			secText.fontSize = 18;
			((Graphic)secText).color = Color.yellow;
			((Component)secText).transform.parent = canvasObject.transform;
		}

		public void SetInteractionText(string text)
		{
			this.text.text = text;
		}

		public void SetInteractionSubText(string text)
		{
			secText.text = text;
		}

		public void ShowInteractionText()
		{
			canvasObject.SetActive(true);
		}

		public void HideInteractionText()
		{
			canvasObject.SetActive(false);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalGamba";

		public const string PLUGIN_NAME = "LethalGamba";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LethalGamba.Models
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPatch(GameNetworkManager __instance)
		{
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.gambas);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void StartDisconnectPatch()
		{
			GambaManager.Instance.Reset();
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void Awake(PlayerControllerB __instance)
		{
			((Component)__instance).gameObject.AddComponent<PlayerController>();
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		public static RoundManagerCustom RoundManagerCustom;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void AwakePatch(RoundManager __instance)
		{
			RoundManagerCustom = ((Component)__instance).gameObject.AddComponent<RoundManagerCustom>();
		}

		[HarmonyPatch("LoadNewLevelWait")]
		[HarmonyPrefix]
		public static void LoadNewLevelWaitPatch(RoundManager __instance)
		{
			if (__instance.currentLevel.levelID != 3)
			{
				RoundManagerCustom.DespawnGamblingMachineServerRpc();
			}
			if (__instance.currentLevel.levelID == 3)
			{
				RoundManagerCustom.SpawnGamblingMachineServerRpc();
			}
		}

		[HarmonyPatch("DespawnPropsAtEndOfRound")]
		[HarmonyPostfix]
		public static void DespawnPropsAtEndOfRoundPatch()
		{
			RoundManagerCustom.DespawnGamblingMachineServerRpc();
		}
	}
}