Decompiled source of LethalCasino v1.1.2

mrgrm7.LethalCasino.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCasino.Config;
using LethalCasino.Custom;
using LethalCasino.Patches;
using LethalCasino.Types;
using LethalCasino.patches;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.SceneManagement;
using mrgrm7.LethalCasino.NetcodePatcher;

[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("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("mrgrm7.LethalCasino")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("The Company is investing in a new vertical")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+dc48dae2810e2ae1a0bec0d4f68b9631bd4fc928")]
[assembly: AssemblyProduct("LethalCasino")]
[assembly: AssemblyTitle("mrgrm7.LethalCasino")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
}
public struct NetworkStringIntDictionary : INetworkSerializable
{
	public Dictionary<string, int> Dictionary;

	public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		if (Dictionary == null && !serializer.IsReader)
		{
			Dictionary = new Dictionary<string, int>();
		}
		int num = ((!serializer.IsReader) ? Dictionary.Count : 0);
		((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref num, default(ForPrimitives));
		if (serializer.IsReader)
		{
			Dictionary = new Dictionary<string, int>(num);
		}
		for (int i = 0; i < num; i++)
		{
			string key = string.Empty;
			int value = 0;
			if (!serializer.IsReader)
			{
				key = Dictionary.Keys.ElementAt(i);
				value = Dictionary[key];
			}
			serializer.SerializeValue(ref key, false);
			((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref value, default(ForPrimitives));
			if (serializer.IsReader)
			{
				Dictionary[key] = value;
			}
		}
	}
}
public struct NetworkStringBoolDictionary : INetworkSerializable
{
	public Dictionary<string, bool> Dictionary;

	public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		if (Dictionary == null && !serializer.IsReader)
		{
			Dictionary = new Dictionary<string, bool>();
		}
		int num = ((!serializer.IsReader) ? Dictionary.Count : 0);
		((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref num, default(ForPrimitives));
		if (serializer.IsReader)
		{
			Dictionary = new Dictionary<string, bool>(num);
		}
		for (int i = 0; i < num; i++)
		{
			string key = string.Empty;
			bool value = false;
			if (!serializer.IsReader)
			{
				key = Dictionary.Keys.ElementAt(i);
				value = Dictionary[key];
			}
			serializer.SerializeValue(ref key, false);
			((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref value, default(ForPrimitives));
			if (serializer.IsReader)
			{
				Dictionary[key] = value;
			}
		}
	}
}
namespace LethalCasino
{
	[BepInPlugin("mrgrm7.LethalCasino", "LethalCasino", "1.1.2")]
	public class Plugin : BaseUnityPlugin
	{
		private static Harmony harmony;

		public static ManualLogSource logger;

		public static Dictionary<string, GameObject> Prefabs;

		public static Dictionary<string, AudioClip> Sounds;

		public static Dictionary<string, Material> Materials;

		public static int numSongs = 10;

		public static LethalCasinoConfig configFile;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			Instance = this;
			harmony = new Harmony("mrgrm7.LethalCasino");
			NetcodeWeaver();
			logger = Logger.CreateLogSource("mrgrm7.LethalCasino");
			configFile = new LethalCasinoConfig(((BaseUnityPlugin)this).Config);
			LoadAllAssets();
			Patch();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"mrgrm7.LethalCasino v1.1.2 has loaded!");
		}

		private void LoadAllAssets()
		{
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Expected O, but got Unknown
			Prefabs = new Dictionary<string, GameObject>();
			Sounds = new Dictionary<string, AudioClip>();
			Materials = new Dictionary<string, Material>();
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lethalcasinoassets"));
			if (!Object.op_Implicit((Object)(object)val))
			{
				logger.LogError((object)"Failed to load asset bundle");
				return;
			}
			logger.LogInfo((object)"Asset bundle loaded successfully");
			Prefabs.Add("CasinoBuilding", LoadAsset<GameObject>(val, "CasinoBuilding"));
			Prefabs["CasinoBuilding"].AddComponent<CasinoBuilding>();
			Prefabs.Add("SlotMachine", LoadAsset<GameObject>(val, "SlotMachine"));
			Prefabs["SlotMachine"].AddComponent<SlotMachine>();
			Prefabs["SlotMachine"].AddComponent<InteractableCasinoComponent>();
			Prefabs.Add("Roulette", LoadAsset<GameObject>(val, "Roulette"));
			Prefabs["Roulette"].AddComponent<Roulette>();
			((Component)Prefabs["Roulette"].transform.Find("Wheel")).gameObject.AddComponent<InteractableCasinoComponent>();
			foreach (Transform item in Prefabs["Roulette"].transform.Find("BetContainer"))
			{
				Transform val2 = item;
				((Component)val2).gameObject.AddComponent<InteractableCasinoComponent>();
			}
			Prefabs.Add("Coin1", LoadAsset<GameObject>(val, "Coin1"));
			Prefabs.Add("Coin10", LoadAsset<GameObject>(val, "Coin10"));
			Prefabs.Add("Coin50", LoadAsset<GameObject>(val, "Coin50"));
			Prefabs.Add("Coin100", LoadAsset<GameObject>(val, "Coin100"));
			Prefabs.Add("Blackjack", LoadAsset<GameObject>(val, "Blackjack"));
			Prefabs["Blackjack"].AddComponent<Blackjack>();
			Prefabs.Add("BlackjackBetControls", LoadAsset<GameObject>(val, "BlackjackBetControls"));
			foreach (Transform item2 in Prefabs["Blackjack"].transform)
			{
				Transform val3 = item2;
				if (((Object)((Component)val3).gameObject).name.StartsWith("Player") || ((Object)((Component)val3).gameObject).name.StartsWith("DealerHand"))
				{
					((Component)val3).gameObject.AddComponent<InteractableCasinoComponent>();
				}
			}
			Prefabs.Add("Card", LoadAsset<GameObject>(val, "Card"));
			string[] pLAYING_CARD_SUITS = Constants.PLAYING_CARD_SUITS;
			foreach (string text in pLAYING_CARD_SUITS)
			{
				string[] pLAYING_CARD_VALUES = Constants.PLAYING_CARD_VALUES;
				foreach (string text2 in pLAYING_CARD_VALUES)
				{
					string text3 = text2.ToLower() + "_" + text.ToLower();
					Materials.Add(text3, LoadAsset<Material>(val, text3));
				}
			}
			Sounds.Add("ShuffleDeck", LoadAsset<AudioClip>(val, "ShuffleDeck"));
			for (int k = 0; k < Constants.ASSETS_NUM_CARD_DEAL_SOUNDS; k++)
			{
				string text4 = $"CardDeal{k + 1}";
				Sounds.Add(text4, LoadAsset<AudioClip>(val, text4));
			}
			for (int l = 0; l < Constants.ASSETS_NUM_CARD_FLIP_SOUNDS; l++)
			{
				string text5 = $"CardFlip{l + 1}";
				Sounds.Add(text5, LoadAsset<AudioClip>(val, text5));
			}
			for (int m = 0; m < Constants.ASSETS_NUM_BLACKJACK_WIN_SOUNDS; m++)
			{
				string text6 = $"BlackjackWin{m + 1}";
				Sounds.Add(text6, LoadAsset<AudioClip>(val, text6));
			}
			Sounds.Add("BlackjackDealerWins", LoadAsset<AudioClip>(val, "BlackjackDealerWins"));
			Sounds.Add("BlackjackButtonHard", LoadAsset<AudioClip>(val, "BlackjackButtonHard"));
			Sounds.Add("BlackjackButtonSoft", LoadAsset<AudioClip>(val, "BlackjackButtonSoft"));
			Prefabs.Add("Jukebox", LoadAsset<GameObject>(val, "Jukebox"));
			Prefabs.Add("ATM", LoadAsset<GameObject>(val, "ATM"));
			Prefabs["ATM"].AddComponent<AtmMachine>();
			Prefabs["ATM"].AddComponent<InteractableCasinoComponent>();
			((Component)Prefabs["ATM"].transform.Find("Buy10")).gameObject.AddComponent<InteractableCasinoComponent>();
			((Component)Prefabs["ATM"].transform.Find("Buy50")).gameObject.AddComponent<InteractableCasinoComponent>();
			((Component)Prefabs["ATM"].transform.Find("Buy100")).gameObject.AddComponent<InteractableCasinoComponent>();
			Prefabs.Add("TheWheel", LoadAsset<GameObject>(val, "TheWheel"));
			Prefabs["TheWheel"].AddComponent<TheWheel>();
			((Component)Prefabs["TheWheel"].transform.Find("WheelPivot/Wheel")).gameObject.AddComponent<InteractableCasinoComponent>();
			Prefabs.Add("ChipBag", LoadAsset<GameObject>(val, "ChipBag"));
			Prefabs.Add("PoofParticle", LoadAsset<GameObject>(val, "PoofParticle"));
			Prefabs.Add("SmokingPipe", LoadAsset<GameObject>(val, "SmokingPipe"));
			Prefabs.Add("Beer", LoadAsset<GameObject>(val, "Beer"));
			string[] array = Constants.BEER_POUR_SOUNDS.Concat(Constants.BEER_DRINK_SOUNDS).Concat(Constants.BEER_GULP_SOUNDS).Concat(Constants.GLASS_CLINK_SOUNDS)
				.ToArray();
			string[] array2 = array;
			foreach (string text7 in array2)
			{
				Sounds.Add(text7, LoadAsset<AudioClip>(val, text7));
			}
			Sounds.Add("PullLever", LoadAsset<AudioClip>(val, "PullLever"));
			Sounds.Add("ReelClick", LoadAsset<AudioClip>(val, "ReelClick"));
			Sounds.Add("SlotsPlaying1", LoadAsset<AudioClip>(val, "SlotsPlaying1"));
			Sounds.Add("SlotsPlaying2", LoadAsset<AudioClip>(val, "SlotsPlaying2"));
			Sounds.Add("SlotsPlaying3", LoadAsset<AudioClip>(val, "SlotsPlaying3"));
			Sounds.Add("SlotsDing", LoadAsset<AudioClip>(val, "SlotsDing"));
			Sounds.Add("CoinDispense", LoadAsset<AudioClip>(val, "CoinDispense"));
			Sounds.Add("SlotsBigJackpot", LoadAsset<AudioClip>(val, "SlotsBigJackpot"));
			Sounds.Add("SlotsMediumJackpot", LoadAsset<AudioClip>(val, "SlotsMediumJackpot"));
			Sounds.Add("SlotsSmallJackpot", LoadAsset<AudioClip>(val, "SlotsSmallJackpot"));
			Sounds.Add("SlotsBuzzer1", LoadAsset<AudioClip>(val, "SlotsBuzzer1"));
			Sounds.Add("SlotsBuzzer2", LoadAsset<AudioClip>(val, "SlotsBuzzer2"));
			Sounds.Add("SlotsLose", LoadAsset<AudioClip>(val, "SlotsLose"));
			Sounds.Add("ButtonPush", LoadAsset<AudioClip>(val, "ButtonPush"));
			Sounds.Add("RouletteBallRoll", LoadAsset<AudioClip>(val, "RouletteBallRoll"));
			Sounds.Add("Chips1", LoadAsset<AudioClip>(val, "Chips1"));
			Sounds.Add("Chips2", LoadAsset<AudioClip>(val, "Chips2"));
			Sounds.Add("Chips3", LoadAsset<AudioClip>(val, "Chips3"));
			Sounds.Add("Chips4", LoadAsset<AudioClip>(val, "Chips4"));
			Sounds.Add("PlaceMultipleChips", LoadAsset<AudioClip>(val, "PlaceMultipleChips"));
			Sounds.Add("ChipBagDrop1", LoadAsset<AudioClip>(val, "ChipBagDrop1"));
			Sounds.Add("ChipBagDrop2", LoadAsset<AudioClip>(val, "ChipBagDrop2"));
			Sounds.Add("ATMClick", LoadAsset<AudioClip>(val, "ATMClick"));
			Sounds.Add("PopSound", LoadAsset<AudioClip>(val, "PopSound"));
			Sounds.Add("ChaChing", LoadAsset<AudioClip>(val, "ChaCHing"));
			Sounds.Add("WheelClick1", LoadAsset<AudioClip>(val, "WheelClick1"));
			Sounds.Add("WheelClick2", LoadAsset<AudioClip>(val, "WheelClick2"));
			Sounds.Add("WheelClick3", LoadAsset<AudioClip>(val, "WheelClick3"));
			Sounds.Add("WheelClick4", LoadAsset<AudioClip>(val, "WheelClick4"));
			Sounds.Add("WheelClick5", LoadAsset<AudioClip>(val, "WheelClick5"));
			Sounds.Add("WheelClick6", LoadAsset<AudioClip>(val, "WheelClick6"));
			Sounds.Add("WheelClick7", LoadAsset<AudioClip>(val, "WheelClick7"));
			Sounds.Add("WheelClick8", LoadAsset<AudioClip>(val, "WheelClick8"));
			Sounds.Add("WheelClick9", LoadAsset<AudioClip>(val, "WheelClick9"));
			Sounds.Add("WheelClick10", LoadAsset<AudioClip>(val, "WheelClick10"));
			Sounds.Add("WheelLoseBig", LoadAsset<AudioClip>(val, "WheelLoseBig"));
			Sounds.Add("WheelLoseSmall", LoadAsset<AudioClip>(val, "WheelLoseSmall"));
			Sounds.Add("WheelTokenDrop", LoadAsset<AudioClip>(val, "WheelTokenDrop"));
			Sounds.Add("WheelWinMedium", LoadAsset<AudioClip>(val, "WheelWinMedium"));
			Sounds.Add("WheelWinLarge", LoadAsset<AudioClip>(val, "WheelWinLarge"));
			Sounds.Add("PipeLighter", LoadAsset<AudioClip>(val, "PipeLighter"));
			Sounds.Add("PipeBurn1", LoadAsset<AudioClip>(val, "PipeBurn1"));
			Sounds.Add("PipeBurn2", LoadAsset<AudioClip>(val, "PipeBurn2"));
			Sounds.Add("PipeBurn3", LoadAsset<AudioClip>(val, "PipeBurn3"));
			string[] sONG_TYPES = Constants.SONG_TYPES;
			foreach (string text8 in sONG_TYPES)
			{
				for (int num2 = 1; num2 <= numSongs; num2++)
				{
					Sounds.Add($"{text8}Song{num2}", LoadAsset<AudioClip>(val, $"{text8}Song{num2}"));
				}
				Sounds.Add(text8 + "Song99", LoadAsset<AudioClip>(val, text8 + "Song99"));
			}
		}

		private T LoadAsset<T>(AssetBundle bundle, string asset) where T : Object
		{
			T val = bundle.LoadAsset<T>(asset);
			if (!Object.op_Implicit((Object)(object)val))
			{
				logger.LogError((object)(asset + " asset failed to load"));
			}
			return val;
		}

		private void Patch()
		{
			((BaseUnityPlugin)this).Logger.LogDebug((object)"Patching...");
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogDebug((object)"Finished Patching!");
		}

		private void Unpatch()
		{
			((BaseUnityPlugin)this).Logger.LogDebug((object)"Unpatching...");
			harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogDebug((object)"Finished Unpatching!");
		}

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

		[ServerRpc(RequireOwnership = false)]
		public T GetHostConfigValueServerRpc<T>(string configField)
		{
			logger.LogInfo((object)"GetHostConfigValueServerRpc");
			if (typeof(T) == typeof(string))
			{
				return (T)(object)configFile.configStrings[configField];
			}
			if (typeof(T) == typeof(float))
			{
				return (T)(object)configFile.configValues[configField];
			}
			if (typeof(T) == typeof(bool))
			{
				return (T)(object)configFile.configFlags[configField];
			}
			if (typeof(T) == typeof(int))
			{
				return (T)(object)configFile.configInts[configField];
			}
			return default(T);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "mrgrm7.LethalCasino";

		public const string PLUGIN_NAME = "LethalCasino";

		public const string PLUGIN_VERSION = "1.1.2";
	}
}
namespace LethalCasino.Types
{
	internal class RouletteResult
	{
		public List<GrabbableObject> winningScrap = new List<GrabbableObject>();

		public int lostValue;

		public int wonValue;
	}
}
namespace LethalCasino.patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch : NetworkBehaviour
	{
		public static CasinoManager CasinoManager;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void AwakePatch(RoundManager __instance)
		{
			Plugin.logger.LogInfo((object)"RoundManagerPatch has awoken");
			CasinoManager = ((Component)__instance).gameObject.AddComponent<CasinoManager>();
		}

		[HarmonyPatch("LoadNewLevelWait")]
		[HarmonyPrefix]
		public static void LoadNewLevelWaitPatch(RoundManager __instance)
		{
			if (__instance.currentLevel.levelID == 3)
			{
				Plugin.logger.LogInfo((object)"Spawning casino objects");
				CasinoManager.SpawnCasinoServerRpc();
			}
		}

		[HarmonyPatch("DespawnPropsAtEndOfRound")]
		[HarmonyPostfix]
		public static void DespawnPropsAtEndOfRoundPatch(RoundManager __instance)
		{
			if (__instance.currentLevel.levelID == 3)
			{
				Plugin.logger.LogInfo((object)"Despawning casino objects");
				if (((NetworkBehaviour)CasinoManager).IsServer)
				{
					CasinoManager.DespawnCasinoServerRpc();
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "RoundManagerPatch";
		}
	}
}
namespace LethalCasino.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPatch(GameNetworkManager __instance)
		{
			Plugin.logger.LogInfo((object)"Adding slot machine to network prefab");
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["CasinoBuilding"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["SlotMachine"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Roulette"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Blackjack"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["TheWheel"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Jukebox"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["ATM"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["ChipBag"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["SmokingPipe"]);
			NetworkManager.Singleton.AddNetworkPrefab(Plugin.Prefabs["Beer"]);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void StartDisconnectPatch()
		{
			Plugin.logger.LogInfo((object)"Player disconnected.");
			RoundManagerPatch.CasinoManager.Destroy();
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class GrabbableObjectPatch : NetworkBehaviour
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		public static void Start(GrabbableObject __instance)
		{
			CustomScrapController customScrapController = default(CustomScrapController);
			if (!((Component)__instance).gameObject.TryGetComponent<CustomScrapController>(ref customScrapController))
			{
				((Component)__instance).gameObject.AddComponent<CustomScrapController>();
			}
		}

		[HarmonyPatch("SetScrapValue")]
		[HarmonyPostfix]
		public static void SetScrapValue(GrabbableObject __instance)
		{
			//IL_0094: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			CustomScrapController customScrapController = default(CustomScrapController);
			if (((Component)__instance).gameObject.TryGetComponent<CustomScrapController>(ref customScrapController) && __instance.scrapValue <= 0 && customScrapController.destroyOnZeroValue && !customScrapController.tempDisablePoofOnZero)
			{
				if (__instance.isHeld || __instance.isPocketed)
				{
					Plugin.logger.LogInfo((object)"Object is held or pocketed");
					RoundManagerPatch.CasinoManager.DespawnCasinoItemServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), needsNetworkDespawn: false);
				}
				else
				{
					Plugin.logger.LogInfo((object)"Destroying object on ground");
					CreatePoofParticle(((Component)__instance).transform, default(Vector3), 0.7f);
					RoundManagerPatch.CasinoManager.DespawnCasinoItemServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), needsNetworkDespawn: true);
				}
			}
		}

		public static void CreatePoofParticle(Transform transform, Vector3 offset, float volume)
		{
			//IL_0011: 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)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(Plugin.Prefabs["PoofParticle"], transform.position + offset, transform.rotation);
			val.AddComponent<PoofParticle>();
			val.GetComponent<AudioSource>().PlayOneShot(Plugin.Sounds["PopSound"], volume);
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "GrabbableObjectPatch";
		}
	}
	[HarmonyPatch(typeof(MenuManager))]
	internal class MenuManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void StartPatch(MenuManager __instance)
		{
			CheckModConflicts(__instance);
		}

		private static void CheckModConflicts(MenuManager menuManager)
		{
			foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos)
			{
				BepInPlugin metadata = pluginInfo.Value.Metadata;
				if (metadata.GUID.Equals("LC_API"))
				{
					menuManager.DisplayMenuNotification("LC_API IS BROKEN. UNINSTALL IT.", "Ignore");
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		internal static Dictionary<PlayerControllerB, CustomPlayerController> customPlayers = new Dictionary<PlayerControllerB, CustomPlayerController>();

		private const float minDrunknessToAffectVoice = 0.3f;

		private const float timeToLoseDrunkness = 300f;

		[HarmonyPatch("Awake")]
		[HarmonyPrefix]
		public static void Awake(PlayerControllerB __instance)
		{
			CustomPlayerController value = ((Component)__instance).gameObject.AddComponent<CustomPlayerController>();
			customPlayers.Add(__instance, value);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void AfterUpdate(PlayerControllerB __instance)
		{
			ProcessDrunkness(__instance);
		}

		private static void ProcessDrunkness(PlayerControllerB player)
		{
			CustomPlayerController customPlayerController = customPlayers[player];
			if (customPlayerController.beerDrunkness > 0.3f)
			{
				float num = 1f - (customPlayerController.beerDrunkness - 0.3f) * 0.4f;
				Plugin.logger.LogInfo((object)$"setting player pitchTarget from {SoundManager.Instance.playerVoicePitchTargets[player.playerClientId]} to {num}");
				SoundManager.Instance.playerVoicePitchTargets[player.playerClientId] = num;
			}
			if (customPlayerController.beerDrunkness > 0f)
			{
				player.drunkness = Mathf.Pow(customPlayerController.beerDrunkness, 2f);
				customPlayerController.beerDrunkness -= Time.deltaTime / 300f;
				if (customPlayerController.beerDrunkness < 0f)
				{
					customPlayerController.beerDrunkness = 0f;
				}
			}
		}

		[HarmonyPatch("SetHoverTipAndCurrentInteractTrigger")]
		[HarmonyPostfix]
		private static void ShowScrapValueHoverTip(PlayerControllerB __instance)
		{
			InteractableCasinoComponent interactableCasinoComponent = default(InteractableCasinoComponent);
			if (!Object.op_Implicit((Object)(object)__instance.hoveringOverTrigger) || !Object.op_Implicit((Object)(object)((Component)__instance.hoveringOverTrigger).gameObject) || !((Component)__instance.hoveringOverTrigger).gameObject.TryGetComponent<InteractableCasinoComponent>(ref interactableCasinoComponent))
			{
				return;
			}
			GrabbableObject val = __instance.ItemSlots[__instance.currentItemSlot];
			if (interactableCasinoComponent.hoverTipCurrentBlackjackHand)
			{
				string text = "Hand";
				if (interactableCasinoComponent.hoverTipIsBlackjackDealer)
				{
					text = "Dealer hand";
				}
				((TMP_Text)__instance.cursorTip).text = text + ": " + interactableCasinoComponent.currentBlackjackHand;
			}
			else if (Object.op_Implicit((Object)(object)val) && interactableCasinoComponent.hoverTipCurrentScrapValue && !((TMP_Text)__instance.cursorTip).text.Contains("Holding ■") && !interactableCasinoComponent.hoverTipIsBlackjackDealer)
			{
				TextMeshProUGUI cursorTip = __instance.cursorTip;
				((TMP_Text)cursorTip).text = ((TMP_Text)cursorTip).text + "\nHolding ■" + val.scrapValue;
			}
			else if (interactableCasinoComponent.requireScrap && !Object.op_Implicit((Object)(object)val) && !interactableCasinoComponent.gameInProgress)
			{
				((TMP_Text)__instance.cursorTip).text = interactableCasinoComponent.requireScrapMessage;
			}
		}
	}
}
namespace LethalCasino.Custom
{
	internal class BarMenu : NetworkBehaviour
	{
		public Material signWithoutPricesMat;

		private void OnEnable()
		{
			if (SomeBarPricesAreChanged())
			{
				MeshRenderer component = ((Component)((Component)this).transform.Find("Sign")).GetComponent<MeshRenderer>();
				((Renderer)component).material = signWithoutPricesMat;
			}
		}

		private bool SomeBarPricesAreChanged()
		{
			return Plugin.configFile.hostConfigInts[Constants.PRICE_LIGHT_BEER] != Constants.DEFAULT_PRICE_LIGHT_BEER || Plugin.configFile.hostConfigInts[Constants.PRICE_SPECIALTY_BEER] != Constants.DEFAULT_PRICE_SPECIALTY_BEER || Plugin.configFile.hostConfigInts[Constants.PRICE_LUCKY_PIPE] != Constants.DEFAULT_PRICE_LUCKY_PIPE;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BarMenu";
		}
	}
	internal class BeerMugSpawner : NetworkBehaviour
	{
		private const int maxPreppedGlasses = 4;

		private const float spawnNewMugDelay = 60f;

		private const float preppedGlassFrontOffset = 0.2f;

		private const float preppedGlassSideOffset = 0.3f;

		private Vector3 beerMugSpawnRotation = new Vector3(0f, 0f, 0f);

		private float timeSinceMissingMugs = 0f;

		private List<CasinoBeer> preppedGlasses = new List<CasinoBeer>();

		private void Start()
		{
			SpawnPreppedGlasses(showPoofs: false);
		}

		private void LateUpdate()
		{
			if (((NetworkBehaviour)this).IsServer && GetNumPreppedGlasses() < 4 && ((NetworkBehaviour)this).IsServer)
			{
				timeSinceMissingMugs += Time.deltaTime;
				if (timeSinceMissingMugs > 60f)
				{
					SpawnPreppedGlasses(showPoofs: true);
					timeSinceMissingMugs = 0f;
				}
			}
		}

		public CasinoBeer GetNextCasinoBeer()
		{
			CasinoBeer result = preppedGlasses[preppedGlasses.Count - 1];
			preppedGlasses.RemoveAt(preppedGlasses.Count - 1);
			if (GetNumPreppedGlasses() == 1)
			{
				timeSinceMissingMugs = 59f;
			}
			else if (GetNumPreppedGlasses() == 0)
			{
				SpawnPreppedGlasses(showPoofs: true);
			}
			return result;
		}

		private int GetNumPreppedGlasses()
		{
			return preppedGlasses.Count;
		}

		private void SpawnPreppedGlasses(bool showPoofs)
		{
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			Plugin.logger.LogDebug((object)"spawnning new beer glasses");
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			Vector3 val = default(Vector3);
			while (GetNumPreppedGlasses() < 4)
			{
				int num = 4 - GetNumPreppedGlasses() - 1;
				int num2 = num % 2;
				int num3 = num / 2;
				((Vector3)(ref val))..ctor(0.3f * (float)num3 - 0.3f, 0f, 0.2f * (float)num2 - 0.2f);
				GameObject val2 = CasinoManager.Spawn("Beer", ((Component)this).transform.position + val, Quaternion.Euler(beerMugSpawnRotation));
				preppedGlasses.Add(val2.GetComponent<CasinoBeer>());
				if (showPoofs)
				{
					CreatePoofParticleClientRpc(val2.transform.position, new Vector3(0f, 0.4f, 0f), 0.1f);
				}
			}
		}

		[ClientRpc]
		public void CreatePoofParticleClientRpc(Vector3 position, Vector3 offset, float volume)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_00b1: 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_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3909558591u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref position);
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref offset);
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref volume, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3909558591u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					GameObject val3 = Object.Instantiate<GameObject>(Plugin.Prefabs["PoofParticle"], position + offset, Quaternion.Euler(0f, 0f, 0f));
					val3.AddComponent<PoofParticle>();
					val3.GetComponent<AudioSource>().PlayOneShot(Plugin.Sounds["PopSound"], volume);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BeerMugSpawner()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3909558591u, new RpcReceiveHandler(__rpc_handler_3909558591));
		}

		private static void __rpc_handler_3909558591(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Vector3 position = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref position);
				Vector3 offset = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref offset);
				float volume = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref volume, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BeerMugSpawner)(object)target).CreatePoofParticleClientRpc(position, offset, volume);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BeerMugSpawner";
		}
	}
	internal class BeerTap : NetworkBehaviour
	{
		public int beerCost = 20;

		public bool isHeavyBeer = false;

		public string beerName;

		public Material beerLiquidMaterial;

		private const float moveToTargetTime = 1.3f;

		private const float delayBeforeMoveToTarget = 0.4f;

		private bool isBeingUsed = false;

		private CasinoBeer currentPouringBeer;

		private Vector3 currentBeerTarget;

		private bool movingToBeerTarget = false;

		private bool playedPickupSound = false;

		private bool beerIsAtTarget = false;

		private bool playerHasGrabbedBeer = false;

		private bool isDonePouring = false;

		private float timeMovingToBeerTarget = 0f;

		private Transform parentTapContainer;

		private AudioSource beerAudioSource;

		private BeerMugSpawner beerMugSpawner;

		private InteractTrigger interactTrigger;

		private void Start()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			parentTapContainer = ((Component)this).transform.parent.parent;
			beerMugSpawner = ((Component)parentTapContainer.Find("BeerMugSpawner")).GetComponent<BeerMugSpawner>();
			interactTrigger = ((Component)this).GetComponent<InteractTrigger>();
			InteractEvent val = new InteractEvent();
			((UnityEvent<PlayerControllerB>)(object)val).AddListener((UnityAction<PlayerControllerB>)BuyBeer);
			interactTrigger.onInteract = val;
			SyncHostConfigs();
		}

		private void SyncHostConfigs()
		{
			if (isHeavyBeer)
			{
				beerCost = Plugin.configFile.hostConfigInts[Constants.PRICE_SPECIALTY_BEER];
			}
			else
			{
				beerCost = Plugin.configFile.hostConfigInts[Constants.PRICE_LIGHT_BEER];
			}
			interactTrigger.hoverTip = $"Buy {beerName} (■{beerCost}) : [E]";
		}

		private void LateUpdate()
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			if ((!movingToBeerTarget && !beerIsAtTarget) || playerHasGrabbedBeer)
			{
				return;
			}
			timeMovingToBeerTarget += Time.deltaTime;
			if (timeMovingToBeerTarget >= 0.4f)
			{
				if (!playedPickupSound)
				{
					beerAudioSource.PlayOneShot(Plugin.Sounds[Constants.GLASS_CLINK_SOUNDS[0]], 0.9f);
					playedPickupSound = true;
				}
				float num = timeMovingToBeerTarget - 0.4f;
				float num2 = Mathf.Clamp(num / 1.3f, 0f, 1f);
				((Component)currentPouringBeer).transform.position = Vector3.Lerp(((Component)currentPouringBeer).transform.position, currentBeerTarget, num2);
				if (num2 == 1f && !beerIsAtTarget)
				{
					beerAudioSource.PlayOneShot(Plugin.Sounds[Constants.GLASS_CLINK_SOUNDS[1]], 1f);
					TriggerTapFillAnimation();
					movingToBeerTarget = false;
					beerIsAtTarget = true;
				}
			}
		}

		[ClientRpc]
		public void ShowWarningMessageClientRpc(NetworkBehaviourReference playerRef, string header, string body, bool isWarning)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0114: 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_012e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2696953337u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
				bool flag = header != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(header, false);
				}
				bool flag2 = body != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(body, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isWarning, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2696953337u, val, (RpcDelivery)0);
			}
			PlayerControllerB val3 = default(PlayerControllerB);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviourReference)(ref playerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null) && !((Object)(object)val3 != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				HUDManager.Instance.DisplayTip(header, body, isWarning, false, "LC_Tip1");
			}
		}

		private void BuyBeer(PlayerControllerB playerController)
		{
			//IL_0035: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			if (isBeingUsed)
			{
				if (isDonePouring)
				{
					ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), "Cannot use tap", "Pick up the previous beer first", isWarning: false);
				}
				else
				{
					ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), "Cannot use tap", "Another beer is already being poured", isWarning: false);
				}
				return;
			}
			GrabbableObject val = playerController.ItemSlots[playerController.currentItemSlot];
			if (!((Object)(object)val == (Object)null))
			{
				if (val.scrapValue < beerCost)
				{
					ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController), "Cannot afford", $"A pint of {beerName} costs ■{beerCost}. Your scrap is only worth ■{val.scrapValue}.", isWarning: true);
					return;
				}
				Plugin.logger.LogInfo((object)"triggered BuyBeer from this client");
				BuyBeerServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)playerController));
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void BuyBeerServerRpc(NetworkBehaviourReference playerControllerRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0097: 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_0176: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(960726601u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref playerControllerRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 960726601u, val, (RpcDelivery)0);
			}
			PlayerControllerB val3 = default(PlayerControllerB);
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || isBeingUsed || !((NetworkBehaviourReference)(ref playerControllerRef)).TryGet<PlayerControllerB>(ref val3, (NetworkManager)null))
			{
				return;
			}
			GrabbableObject val4 = val3.ItemSlots[val3.currentItemSlot];
			if (!((Object)(object)val4 == (Object)null))
			{
				if (((Component)val4).GetComponent<CustomScrapController>().lockFromGambling)
				{
					ShowWarningMessageClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val3), "Cannot buy beer", "Scrap is being gambled", isWarning: true);
				}
				else if (val4.scrapValue >= beerCost)
				{
					isBeingUsed = true;
					CasinoBeer nextCasinoBeer = beerMugSpawner.GetNextCasinoBeer();
					BuyBeerClientRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)nextCasinoBeer), NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val4));
				}
			}
		}

		[ClientRpc]
		private void BuyBeerClientRpc(NetworkBehaviourReference beerRef, NetworkBehaviourReference scrapRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_01e1: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1862352400u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref beerRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref scrapRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1862352400u, val, (RpcDelivery)0);
				}
				CasinoBeer casinoBeer = default(CasinoBeer);
				GrabbableObject val3 = default(GrabbableObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkBehaviourReference)(ref beerRef)).TryGet<CasinoBeer>(ref casinoBeer, (NetworkManager)null) && ((NetworkBehaviourReference)(ref scrapRef)).TryGet<GrabbableObject>(ref val3, (NetworkManager)null))
				{
					isBeingUsed = true;
					currentPouringBeer = casinoBeer;
					movingToBeerTarget = true;
					beerIsAtTarget = false;
					playerHasGrabbedBeer = false;
					timeMovingToBeerTarget = 0f;
					playedPickupSound = false;
					isDonePouring = false;
					val3.SetScrapValue(val3.scrapValue - beerCost);
					CasinoBeer component = ((Component)casinoBeer).GetComponent<CasinoBeer>();
					beerAudioSource = ((Component)((Component)currentPouringBeer).transform.Find("BeerMug")).GetComponent<AudioSource>();
					component.SetBeerType(beerLiquidMaterial, isHeavyBeer);
					component.TriggerBeerFill(OnDoneFillingBeer, OnGrabBeerServerRpc);
					currentBeerTarget = ((Component)((Component)this).transform.Find("MugTarget")).transform.position;
				}
			}
		}

		private void setStreamEmission(bool setActive)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem component = ((Component)((Component)this).transform.Find("Particles")).GetComponent<ParticleSystem>();
			EmissionModule emission = component.emission;
			((EmissionModule)(ref emission)).enabled = setActive;
		}

		private void TriggerTapFillAnimation()
		{
			currentPouringBeer.StartFill();
			setStreamEmission(setActive: true);
			Random random = new Random();
			string key = Constants.BEER_POUR_SOUNDS[random.Next(1, Constants.BEER_POUR_SOUNDS.Length)];
			beerAudioSource.PlayOneShot(Plugin.Sounds[key], 0.5f);
		}

		private void OnDoneFillingBeer()
		{
			isDonePouring = true;
			setStreamEmission(setActive: false);
		}

		[ServerRpc(RequireOwnership = false)]
		private void OnGrabBeerServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(274521252u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 274521252u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					OnGrabBeerClientRpc();
				}
			}
		}

		[ClientRpc]
		private void OnGrabBeerClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3946222049u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3946222049u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					beerIsAtTarget = false;
					isBeingUsed = false;
					playerHasGrabbedBeer = true;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BeerTap()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2696953337u, new RpcReceiveHandler(__rpc_handler_2696953337));
			NetworkManager.__rpc_func_table.Add(960726601u, new RpcReceiveHandler(__rpc_handler_960726601));
			NetworkManager.__rpc_func_table.Add(1862352400u, new RpcReceiveHandler(__rpc_handler_1862352400));
			NetworkManager.__rpc_func_table.Add(274521252u, new RpcReceiveHandler(__rpc_handler_274521252));
			NetworkManager.__rpc_func_table.Add(3946222049u, new RpcReceiveHandler(__rpc_handler_3946222049));
		}

		private static void __rpc_handler_2696953337(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference playerRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerRef, default(ForNetworkSerializable));
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string header = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref header, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string body = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref body, false);
				}
				bool isWarning = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isWarning, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BeerTap)(object)target).ShowWarningMessageClientRpc(playerRef, header, body, isWarning);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_960726601(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference playerControllerRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref playerControllerRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BeerTap)(object)target).BuyBeerServerRpc(playerControllerRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1862352400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkBehaviourReference beerRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref beerRef, default(ForNetworkSerializable));
				NetworkBehaviourReference scrapRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref scrapRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BeerTap)(object)target).BuyBeerClientRpc(beerRef, scrapRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_274521252(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BeerTap)(object)target).OnGrabBeerServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3946222049(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BeerTap)(object)target).OnGrabBeerClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "BeerTap";
		}
	}
	internal class CasinoBeer : PhysicsProp
	{
		private const float drinkSoundInterval = 0.2f;

		private const float gulpSoundInterval = 5f;

		private const float gulpChance = 0.2f;

		private Vector3 groundPosition;

		private Quaternion groundRotation;

		private Vector3 restingPositionOffset = new Vector3(-0.05f, 0.12f, 0.2f);

		private Vector3 restingRotationOffset = new Vector3(330f, 90f, 340f);

		private Quaternion restingRotation;

		private Vector3 activePositionOffset = new Vector3(0.06f, 0.18f, -0.18f);

		private Vector3 activeRotationOffset = new Vector3(310f, 220f, 340f);

		private Quaternion activeRotation;

		private Vector3 positionVelocity;

		private const float rotationSpeed = 20f;

		private const float smoothTime = 0.03f;

		private const float maxDrinkTime = 12f;

		private float originalLiquidHeight = 0f;

		private List<int> liquidVerticesTopIndexes;

		private float[] originalVerticesOffsetH;

		private float originalBeerLiquidTopVerticeHeight;

		private float originalBeerLiquidBottomVerticeHeight;

		private const float liquidRotationWhenActive = -45f;

		private const float liquidRotationWhenActiveForOtherPlayers = -20f;

		private const float fizzRate = 10f;

		private const float verticeMultiplier = 1f;

		private const float fillDelay = 1f;

		private const float fillTime = 5f;

		private bool startMethodComplete = false;

		private bool isActive;

		private bool isFlipping;

		private bool isFilling;

		private Action? doneFillCallback;

		private Action? grabItemCallback;

		private float fillDelayTimer;

		private float percentFilled = 0f;

		private float timeUntilDrinkSound = 0f;

		private float timeUntilGulpSound = 0f;

		private float percentUsed = 0f;

		private bool isEquiped;

		private PlayerControllerB lastPlayerHeldBy;

		private bool isFlatteningVerticesHorizontal;

		private bool hasSetBeerType = false;

		private Material beerLiquidMaterial;

		private bool isHeavyBeer = false;

		private float beerSipVolume;

		private Random randGen;

		private AudioSource audioSource;

		private GameObject beerMug;

		private GameObject beerLiquidContainer;

		private MeshFilter beerLiquidMeshFilter;

		private Mesh beerLiquidMesh;

		private ParticleSystem particleSystem;

		private Animator mugAnimator;

		public override void Start()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: 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)
			((GrabbableObject)this).Start();
			randGen = new Random();
			audioSource = ((Component)this).GetComponent<AudioSource>();
			beerMug = ((Component)((Component)this).transform.Find("BeerMug")).gameObject;
			beerLiquidContainer = ((Component)((Component)this).transform.Find("BeerMug/LiquidContainer")).gameObject;
			beerLiquidMeshFilter = ((Component)beerLiquidContainer.transform.Find("BeerLiquid")).GetComponent<MeshFilter>();
			beerLiquidMesh = beerLiquidMeshFilter.mesh;
			originalLiquidHeight = beerLiquidContainer.transform.localScale.y;
			particleSystem = ((Component)((Component)this).transform.Find("BeerMug/LiquidContainer/BeerParticles")).GetComponent<ParticleSystem>();
			mugAnimator = beerMug.GetComponent<Animator>();
			groundPosition = beerMug.transform.localPosition;
			groundRotation = beerMug.transform.localRotation;
			restingRotation = Quaternion.Euler(restingRotationOffset);
			activeRotation = Quaternion.Euler(activeRotationOffset);
			liquidVerticesTopIndexes = new List<int>();
			if ((Object)(object)beerLiquidMesh != (Object)null)
			{
				Vector3[] vertices = beerLiquidMesh.vertices;
				originalVerticesOffsetH = new float[vertices.Length];
				for (int i = 0; i < vertices.Length; i++)
				{
					originalVerticesOffsetH[i] = vertices[i].y;
					float z = vertices[i].z;
					Bounds bounds = beerLiquidMesh.bounds;
					if (Mathf.Approximately(z, ((Bounds)(ref bounds)).max.z))
					{
						originalBeerLiquidTopVerticeHeight = vertices[i].z;
						liquidVerticesTopIndexes.Add(i);
						continue;
					}
					float z2 = vertices[i].z;
					bounds = beerLiquidMesh.bounds;
					if (Mathf.Approximately(z2, ((Bounds)(ref bounds)).min.z))
					{
						originalBeerLiquidBottomVerticeHeight = vertices[i].z;
					}
				}
			}
			beerLiquidContainer.active = false;
			((GrabbableObject)this).grabbable = false;
			((GrabbableObject)this).customGrabTooltip = "(Disabled) Use tap handles";
			beerSipVolume = Plugin.configFile.configValues[Constants.MISC_BEER_SIPPING_VOLUME] / 100f;
			startMethodComplete = true;
		}

		public override void Update()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: 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_0434: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: 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_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0552: Unknown result type (might be due to invalid IL or missing references)
			//IL_065f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (((GrabbableObject)this).isPocketed)
			{
				return;
			}
			if (startMethodComplete && !hasSetBeerType)
			{
				UpdateBeerType();
				hasSetBeerType = true;
			}
			if (isActive)
			{
				activeRotation = Quaternion.Euler(activeRotationOffset);
				beerMug.transform.localPosition = Vector3.SmoothDamp(beerMug.transform.localPosition, activePositionOffset, ref positionVelocity, 0.03f);
				beerMug.transform.localRotation = Quaternion.Lerp(beerMug.transform.localRotation, activeRotation, 20f * Time.deltaTime);
				timeUntilDrinkSound -= Time.deltaTime;
				timeUntilGulpSound -= Time.deltaTime;
				if (timeUntilDrinkSound <= 0f && !audioSource.isPlaying)
				{
					if (timeUntilGulpSound <= 0f && randGen.NextDouble() <= 0.20000000298023224)
					{
						int num = randGen.Next(0, Constants.BEER_GULP_SOUNDS.Length);
						audioSource.PlayOneShot(Plugin.Sounds[Constants.BEER_GULP_SOUNDS[num]], beerSipVolume);
					}
					else
					{
						int num2 = randGen.Next(0, Constants.BEER_DRINK_SOUNDS.Length);
						audioSource.PlayOneShot(Plugin.Sounds[Constants.BEER_DRINK_SOUNDS[num2]], beerSipVolume);
					}
					timeUntilDrinkSound = 0.2f;
					timeUntilGulpSound = 5f;
				}
				percentUsed += Time.deltaTime / 12f;
				Vector3 localScale = beerLiquidContainer.transform.localScale;
				localScale.y = originalLiquidHeight * (1f - percentUsed);
				beerLiquidContainer.transform.localScale = localScale;
				EmissionModule emission = particleSystem.emission;
				((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(10f * (1f - percentUsed));
				if (isHeavyBeer)
				{
					IncreaseDrunknessHeavy();
				}
				else
				{
					IncreaseDrunkessLight();
				}
				if (((NetworkBehaviour)this).IsServer && percentUsed >= 1f)
				{
					FinishDrinkingClientRpc();
				}
			}
			else if (isEquiped)
			{
				restingRotation = Quaternion.Euler(restingRotationOffset);
				beerMug.transform.localPosition = Vector3.SmoothDamp(beerMug.transform.localPosition, restingPositionOffset, ref positionVelocity, 0.03f);
				beerMug.transform.localRotation = Quaternion.Lerp(beerMug.transform.localRotation, restingRotation, 20f * Time.deltaTime);
			}
			else if (isFilling)
			{
				Vector3 localScale2 = beerLiquidContainer.transform.localScale;
				localScale2.y = originalLiquidHeight * percentFilled;
				beerLiquidContainer.transform.localScale = localScale2;
				if (fillDelayTimer >= 1f)
				{
					if (!beerLiquidContainer.active)
					{
						beerLiquidContainer.active = true;
					}
					percentFilled += Time.deltaTime / 5f;
					if (percentFilled >= 1f)
					{
						DoneFilling();
					}
				}
				else
				{
					fillDelayTimer += Time.deltaTime;
				}
			}
			if (!((Object)(object)beerLiquidMesh != (Object)null))
			{
				return;
			}
			Vector3 forward = beerLiquidContainer.transform.forward;
			Vector3[] vertices = beerLiquidMesh.vertices;
			foreach (int liquidVerticesTopIndex in liquidVerticesTopIndexes)
			{
				float num3 = (float)Math.Pow((double)percentUsed * 1.2, 2.0) * 2.5f;
				if (isActive)
				{
					num3 *= 10f;
				}
				float num4 = Vector3.Dot(Vector3.down, forward) * (float)Math.Sin(vertices[liquidVerticesTopIndex].y * (1f + num3));
				float num5 = originalBeerLiquidTopVerticeHeight - num4;
				if (num5 < originalBeerLiquidBottomVerticeHeight)
				{
					num5 = originalBeerLiquidBottomVerticeHeight;
				}
				vertices[liquidVerticesTopIndex].z = num5;
			}
			if (isActive)
			{
				for (int i = 0; i < vertices.Length; i++)
				{
					float num6 = 0f - (1f - percentUsed);
					Bounds bounds = beerLiquidMesh.bounds;
					float num7 = num6 * ((Bounds)(ref bounds)).max.y;
					if (vertices[i].y < num7)
					{
						vertices[i].y = num7;
					}
				}
				if (!isFlatteningVerticesHorizontal)
				{
					float num8 = -45f;
					if ((Object)(object)lastPlayerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						num8 = -20f;
					}
					beerLiquidContainer.transform.localRotation = Quaternion.Euler(0f, num8, 0f);
				}
				isFlatteningVerticesHorizontal = true;
			}
			else if (isFlatteningVerticesHorizontal)
			{
				for (int j = 0; j < vertices.Length; j++)
				{
					vertices[j].y = originalVerticesOffsetH[j];
				}
				beerLiquidContainer.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
				isFlatteningVerticesHorizontal = false;
			}
			beerLiquidMesh.vertices = vertices;
			beerLiquidMesh.RecalculateNormals();
			beerLiquidMeshFilter.mesh = beerLiquidMesh;
		}

		private void IncreaseDrunknessHeavy()
		{
			lastPlayerHeldBy.drunknessInertia = Mathf.Clamp(lastPlayerHeldBy.drunknessInertia + Time.deltaTime / 40f * lastPlayerHeldBy.drunknessSpeed, 0.1f, 3f);
			lastPlayerHeldBy.increasingDrunknessThisFrame = true;
			CustomPlayerController component = ((Component)lastPlayerHeldBy).GetComponent<CustomPlayerController>();
			component.beerDrunkness = Mathf.Clamp(component.beerDrunkness + Time.deltaTime / 50f, 0f, 1f);
		}

		private void IncreaseDrunkessLight()
		{
			lastPlayerHeldBy.drunknessInertia = Mathf.Clamp(lastPlayerHeldBy.drunknessInertia + Time.deltaTime / 80f * lastPlayerHeldBy.drunknessSpeed, 0.1f, 1f);
			lastPlayerHeldBy.increasingDrunknessThisFrame = true;
			CustomPlayerController component = ((Component)lastPlayerHeldBy).GetComponent<CustomPlayerController>();
			component.beerDrunkness = Mathf.Clamp(component.beerDrunkness + Time.deltaTime / 120f, 0f, 1f);
		}

		public float GetPercentUsed()
		{
			return percentUsed;
		}

		public void SetBeerType(Material mat, bool isHeavy)
		{
			hasSetBeerType = false;
			beerLiquidMaterial = mat;
			isHeavyBeer = isHeavy;
		}

		private void UpdateBeerType()
		{
			MeshRenderer component = ((Component)beerLiquidContainer.transform.Find("BeerLiquid")).GetComponent<MeshRenderer>();
			((Renderer)component).material = beerLiquidMaterial;
		}

		public void TriggerBeerFill(Action onDoneFillCallback, Action onGrabItemCallback)
		{
			doneFillCallback = onDoneFillCallback;
			grabItemCallback = onGrabItemCallback;
			FlipBeer();
		}

		public void FlipBeer()
		{
			isFlipping = true;
			((GrabbableObject)this).customGrabTooltip = "Pouring...";
			beerMug.GetComponent<Animator>().SetTrigger("beerFlip");
		}

		public void StartFill()
		{
			isFlipping = false;
			isFilling = true;
			percentFilled = 0f;
			Object.Destroy((Object)(object)mugAnimator);
		}

		private void DoneFilling()
		{
			percentFilled = 1f;
			isFilling = false;
			((GrabbableObject)this).grabbable = true;
			doneFillCallback();
			doneFillCallback = null;
			((GrabbableObject)this).customGrabTooltip = null;
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			if (isActive)
			{
				SetActiveStatus(active: false);
			}
			isEquiped = false;
			particleSystem.Stop();
			particleSystem.Clear();
		}

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			isEquiped = true;
			particleSystem.Play();
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			if (grabItemCallback != null)
			{
				grabItemCallback();
				grabItemCallback = null;
			}
			GrabItemServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void GrabItemServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1003776000u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1003776000u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					GrabItemClientRpc();
				}
			}
		}

		[ClientRpc]
		private void GrabItemClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1323330482u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1323330482u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					grabItemCallback = null;
					lastPlayerHeldBy = ((GrabbableObject)this).playerHeldBy;
				}
			}
		}

		public override void OnHitGround()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).OnHitGround();
			if (isActive)
			{
				SetActiveStatus(active: false);
			}
			isEquiped = false;
			particleSystem.Play();
			beerMug.transform.SetLocalPositionAndRotation(groundPosition, groundRotation);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			SetActiveStatusServerRpc(buttonDown, NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)this));
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetActiveStatusServerRpc(bool active, NetworkBehaviourReference pipeRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_0103: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1614102246u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1614102246u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkBehaviour)this).IsServer)
				{
					SetActiveStatusClientRpc(active, pipeRef);
					SetPlayerVoiceMuffledClientRpc(active);
				}
			}
		}

		[ClientRpc]
		private void SetActiveStatusClientRpc(bool active, NetworkBehaviourReference pipeRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3865379800u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3865379800u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (percentUsed >= 1f && active)
				{
					Plugin.logger.LogDebug((object)"player cannot drink beer, already used up");
				}
				else
				{
					SetActiveStatus(active);
				}
			}
		}

		private void SetActiveStatus(bool active)
		{
			isActive = active;
			lastPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", isActive);
			if (isActive)
			{
				timeUntilDrinkSound = 0.2f;
			}
		}

		[ClientRpc]
		private void SetPlayerVoiceMuffledClientRpc(bool enableMuffle)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3341308629u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enableMuffle, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3341308629u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			if (enableMuffle)
			{
				lastPlayerHeldBy.voiceMuffledByEnemy = true;
				if ((Object)(object)lastPlayerHeldBy.currentVoiceChatIngameSettings != (Object)null)
				{
					OccludeAudio component = ((Component)lastPlayerHeldBy.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>();
					component.overridingLowPass = true;
					component.lowPassOverride = 600f;
				}
			}
			else
			{
				lastPlayerHeldBy.voiceMuffledByEnemy = false;
				if ((Object)(object)lastPlayerHeldBy.currentVoiceChatIngameSettings != (Object)null)
				{
					OccludeAudio component2 = ((Component)lastPlayerHeldBy.currentVoiceChatIngameSettings.voiceAudio).GetComponent<OccludeAudio>();
					component2.overridingLowPass = false;
				}
			}
		}

		[ClientRpc]
		private void FinishDrinkingClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4282623143u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4282623143u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					SetActiveStatus(active: false);
					beerLiquidContainer.active = false;
				}
			}
		}

		private void OnCollisionEnter(Collision collision)
		{
			CasinoBeer casinoBeer = default(CasinoBeer);
			if (((Component)collision.transform).TryGetComponent<CasinoBeer>(ref casinoBeer) && isEquiped)
			{
				audioSource.PlayOneShot(Plugin.Sounds[Constants.GLASS_CLINK_SOUNDS[2]]);
			}
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CasinoBeer()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1003776000u, new RpcReceiveHandler(__rpc_handler_1003776000));
			NetworkManager.__rpc_func_table.Add(1323330482u, new RpcReceiveHandler(__rpc_handler_1323330482));
			NetworkManager.__rpc_func_table.Add(1614102246u, new RpcReceiveHandler(__rpc_handler_1614102246));
			NetworkManager.__rpc_func_table.Add(3865379800u, new RpcReceiveHandler(__rpc_handler_3865379800));
			NetworkManager.__rpc_func_table.Add(3341308629u, new RpcReceiveHandler(__rpc_handler_3341308629));
			NetworkManager.__rpc_func_table.Add(4282623143u, new RpcReceiveHandler(__rpc_handler_4282623143));
		}

		private static void __rpc_handler_1003776000(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CasinoBeer)(object)target).GrabItemServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1323330482(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CasinoBeer)(object)target).GrabItemClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1614102246(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool active = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives));
				NetworkBehaviourReference pipeRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CasinoBeer)(object)target).SetActiveStatusServerRpc(active, pipeRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3865379800(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool active = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives));
				NetworkBehaviourReference pipeRef = default(NetworkBehaviourReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkBehaviourReference>(ref pipeRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CasinoBeer)(object)target).SetActiveStatusClientRpc(active, pipeRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3341308629(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool playerVoiceMuffledClientRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref playerVoiceMuffledClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CasinoBeer)(object)target).SetPlayerVoiceMuffledClientRpc(playerVoiceMuffledClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4282623143(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CasinoBeer)(object)target).FinishDrinkingClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CasinoBeer";
		}
	}
	internal class CigarBox : NetworkBehaviour
	{
		private int pipeCost = 75;

		private const float lidOpenRotation = -80f;

		private const float lidRotationSmoothTime = 0.2f;

		private Vector3 pipeSpawnOffset = new Vector3(-0.7f, -0.05f, 0f);

		private Vector3 pipeSpawnArea = new Vector3(0.3f, 0f, 0.2f);

		private Vector3 pipeSpawnRotation = new Vector3(0f, 20f, 0f);

		private Quaternion lidClosedRotation;

		private Quaternion lidOpenRotationQuaternion;

		private InteractTrigger buyPipeInteractTrigger;

		private GameObject boxLid;

		private Camera localPlayerCamera;

		private int layerMask = 512;

		private void Awake()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Expected O, but got Unknown
			boxLid = ((Component)((Component)this).transform.Find("Top")).gameObject;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)(object)localPlayerController != (Object)null)
			{
				localPlayerCamera = localPlayerController.gameplayCamera;
			}
			lidClosedRotation = boxLid.transform.localRotation;
			lidOpenRotationQuaternion = Quaternion.Euler(-80f, 0f, 0f);
			buyPipeInteractTrigger = ((Component)this).GetComponent<InteractTrigger>();
			InteractEvent val = new InteractEvent();
			((UnityEvent<PlayerControllerB>)(object)val).AddListener((UnityAction<PlayerControllerB>)BuyPipe);
			buyPipeInteractTrigger.onInteract = val;
		}

		private void Start()
		{
			SyncHostConfigs();
		}

		private void SyncHostConfigs()
		{
			pipeCost = Plugin.configFile.hostConfigInts[Constants.PRICE_LUCKY_PIPE];
			buyPipeInteractTrigger.hoverTip = $"Buy Lucky Pipe (■{pipeCost}) : [E]";
		}

		private void Update()
		{
			//IL_000c: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(((Component)localPlayerCamera).transform.position, ((Component)localPlayerCamera).transform.forward, ref val, 3f, layerMask) && (Object)(object)((RaycastHit)(ref val)).collider != (Object)null && (Object)(object)((Component)((RaycastHit)(ref val)).collider).gameObject == (Object)(object)((Component)this).gameObject)
			{
				boxLid.transform.localRotation = Quaternion.Slerp(boxLid.transform.localRotation, lidOpenRota