Decompiled source of TobogangMod v0.1.0

BepInEx/plugins/SkreenZ.TobogangMod.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using SkreenZ.TobogangMod.NetcodePatcher;
using TMPro;
using TobogangMod.Model;
using TobogangMod.Patches;
using TobogangMod.Scripts;
using TobogangMod.Scripts.Items;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.UI;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SkreenZ.TobogangMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a7e78936dd72704e00632339ca09c6f8d1251486")]
[assembly: AssemblyProduct("TobogangMod")]
[assembly: AssemblyTitle("SkreenZ.TobogangMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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;
		}
	}
}
namespace TobogangMod
{
	[BepInPlugin("SkreenZ.TobogangMod", "TobogangMod", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
	public class TobogangMod : BaseUnityPlugin
	{
		public class TobogangItems
		{
			public static readonly string PURGE = "Purge";

			public static readonly string TA_GUEULE = "TaGueule";

			public static readonly string RP_JOEL = "RPJoel";

			public static readonly string FUNKY_BOULE = "FunkyBoule";

			public static readonly string BUTINGUE = "Butingue";

			public static readonly string NUKE = "Nuke";

			public static readonly string SWAP = "Swap";

			public static readonly string ANNIHILATION = "Annihilation";

			public static readonly string ARMAGEDDON = "Armageddon";

			public static readonly string FRENESIE = "Frenesie";
		}

		public static readonly ulong NULL_OBJECT = ulong.MaxValue;

		public static readonly string ASSETS_PATH = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TobogangMod");

		public static ContentLoader ContentLoader = null;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static UnlockablesList Unlockables = null;

		public static AudioClip DrumRollClip { get; private set; } = null;


		public static AudioClip PartyHornClip { get; private set; } = null;


		public static AudioClip ConfettiClip { get; private set; } = null;


		public static AudioClip SuccessClip { get; private set; } = null;


		public static AudioClip NukeAlarmClip { get; private set; } = null;


		public static AudioClip ShipTeleporterBeamClip { get; private set; } = null;


		public static AudioClip SunExplosionClip { get; private set; } = null;


		public static AudioClip DistantExplosionClip { get; private set; } = null;


		public static AudioClip ArmageddonSirenClip { get; private set; } = null;


		public static AudioClip InitialDIntro { get; private set; } = null;


		public static AudioClip InitialDLoop { get; private set; } = null;


		public static AudioClip RecycleClip { get; private set; } = null;


		public static GameObject ConfettiPrefab { get; private set; } = null;


		public static GameObject TobogganPrefab { get; private set; } = null;


		public static GameObject TrashPrefab { get; private set; } = null;


		public static TobogangMod Instance { get; private set; } = null;


		public static ManualLogSource Logger { get; private set; } = null;


		internal static Harmony? Harmony { get; set; }

		public static AssetBundle MainAssetBundle { get; private set; } = null;


		public static GameObject NetworkPrefab { get; private set; } = null;


		private void Awake()
		{
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Expected O, but got Unknown
			Instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(ASSETS_PATH, "tobogangasset"));
			NetworkPrefab = MainAssetBundle.LoadAsset<GameObject>("NetworkHandler");
			DrumRollClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/drum_roll.mp3");
			DrumRollClip.LoadAudioData();
			PartyHornClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/party_horn.mp3");
			PartyHornClip.LoadAudioData();
			ConfettiClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/confetti.mp3");
			ConfettiClip.LoadAudioData();
			SuccessClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/success.mp3");
			SuccessClip.LoadAudioData();
			NukeAlarmClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/nuke_alarm.mp3");
			NukeAlarmClip.LoadAudioData();
			ShipTeleporterBeamClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/ship_teleporter_beam.mp3");
			ShipTeleporterBeamClip.LoadAudioData();
			SunExplosionClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/sun_explosion.mp3");
			SunExplosionClip.LoadAudioData();
			DistantExplosionClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/distant_explosion.mp3");
			DistantExplosionClip.LoadAudioData();
			ArmageddonSirenClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/armageddon_siren.wav");
			ArmageddonSirenClip.LoadAudioData();
			InitialDIntro = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/intiald_intro.mp3");
			InitialDIntro.LoadAudioData();
			InitialDLoop = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/intiald_loop.wav");
			InitialDLoop.LoadAudioData();
			RecycleClip = MainAssetBundle.LoadAsset<AudioClip>("Assets/CustomAssets/Audio/recycle.wav");
			RecycleClip.LoadAudioData();
			Unlockables = MainAssetBundle.LoadAsset<UnlockablesList>("Assets/CustomAssets/TobogangUnlockables.asset");
			ConfettiPrefab = MainAssetBundle.LoadAsset<GameObject>("Assets/CustomAssets/ConfettiPrefab.prefab");
			ConfettiPrefab.AddComponent<AutoDespawnScript>();
			NetworkPrefabs.RegisterNetworkPrefab(ConfettiPrefab);
			TobogganPrefab = MainAssetBundle.LoadAsset<GameObject>("Assets/CustomPrefabs/TobogganPrefab.prefab");
			TobogganPrefab.AddComponent<TobogganScript>();
			NetworkPrefabs.RegisterNetworkPrefab(TobogganPrefab);
			TrashPrefab = MainAssetBundle.LoadAsset<GameObject>("Assets/CustomPrefabs/TrashPrefab.prefab");
			TrashPrefab.AddComponent<TrashScript>();
			NetworkPrefabs.RegisterNetworkPrefab(TrashPrefab);
			ContentLoader = new ContentLoader(((BaseUnityPlugin)Instance).Info, MainAssetBundle, (Action<CustomContent, GameObject>)delegate(CustomContent content, GameObject prefab)
			{
				Prefabs.Add(content.ID, prefab);
			});
			InitAll();
			CreateItems();
			Patch();
			NetcodePatcher();
			Logger.LogInfo((object)"SkreenZ.TobogangMod v1.0.0 has loaded !");
		}

		internal static void InitAll()
		{
			RandomSound.Init();
			CramptesManager.Init();
			CoinguesManager.Init();
			TVScriptPatch.Load();
		}

		internal static void Patch()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("SkreenZ.TobogangMod");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		private void CreateItems()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Expected O, but got Unknown
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Expected O, but got Unknown
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.TA_GUEULE, "Assets/CustomAssets/Items/TobogangTaGueule.asset", (Action<Item>)delegate(Item item)
			{
				TobogangTaGueule tobogangTaGueule = item.spawnPrefab.AddComponent<TobogangTaGueule>();
				((GrabbableObject)tobogangTaGueule).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.RP_JOEL, "Assets/CustomAssets/Items/TobogangRPJoel.asset", (Action<Item>)delegate(Item item)
			{
				TobogangRPJoel tobogangRPJoel = item.spawnPrefab.AddComponent<TobogangRPJoel>();
				((GrabbableObject)tobogangRPJoel).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.FUNKY_BOULE, "Assets/CustomAssets/Items/TobogangFunkyBoule.asset", (Action<Item>)delegate(Item item)
			{
				TobogangFunkyBoule tobogangFunkyBoule = item.spawnPrefab.AddComponent<TobogangFunkyBoule>();
				((GrabbableObject)tobogangFunkyBoule).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.NUKE, "Assets/CustomAssets/Items/TobogangNuke.asset", (Action<Item>)delegate(Item item)
			{
				TobogangNuke tobogangNuke = item.spawnPrefab.AddComponent<TobogangNuke>();
				((GrabbableObject)tobogangNuke).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.SWAP, "Assets/CustomAssets/Items/TobogangSwap.asset", (Action<Item>)delegate(Item item)
			{
				TobogangSwap tobogangSwap = item.spawnPrefab.AddComponent<TobogangSwap>();
				((GrabbableObject)tobogangSwap).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.ARMAGEDDON, "Assets/CustomAssets/Items/TobogangArmageddon.asset", (Action<Item>)delegate(Item item)
			{
				TobogangArmageddon tobogangArmageddon = item.spawnPrefab.AddComponent<TobogangArmageddon>();
				((GrabbableObject)tobogangArmageddon).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.ANNIHILATION, "Assets/CustomAssets/Items/TobogangAnnihilation.asset", (Action<Item>)delegate(Item item)
			{
				TobogangAnnihilation tobogangAnnihilation = item.spawnPrefab.AddComponent<TobogangAnnihilation>();
				((GrabbableObject)tobogangAnnihilation).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new CustomItem(TobogangItems.FRENESIE, "Assets/CustomAssets/Items/TobogangFrenesie.asset", (Action<Item>)delegate(Item item)
			{
				TobogangFrenesie tobogangFrenesie = item.spawnPrefab.AddComponent<TobogangFrenesie>();
				((GrabbableObject)tobogangFrenesie).itemProperties = item;
			}));
			ContentLoader.Register((CustomContent)new ScrapItem(TobogangItems.BUTINGUE, "Assets/CustomAssets/Items/TobogangButingue.asset", 10, (LevelTypes)(-1), (string[])null, (Action<Item>)delegate(Item item)
			{
				TobogangButingue tobogangButingue = item.spawnPrefab.AddComponent<TobogangButingue>();
				((GrabbableObject)tobogangButingue).itemProperties = item;
			}));
			Logger.LogInfo((object)"Registered items");
		}

		public static TobogangItem[] GetTobogangItems()
		{
			List<TobogangItem> list = new List<TobogangItem>();
			foreach (GameObject value in Prefabs.Values)
			{
				TobogangItem component = value.GetComponent<TobogangItem>();
				if ((Object)(object)component != (Object)null)
				{
					list.Add(component);
				}
			}
			return list.ToArray();
		}

		public static TobogangItem? GeTobogangItem(string id)
		{
			foreach (GameObject value in Prefabs.Values)
			{
				TobogangItem component = value.GetComponent<TobogangItem>();
				if ((Object)(object)component != (Object)null && component.TobogangItemId == id)
				{
					return component;
				}
			}
			return null;
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}

		public static NetworkObject? TryGet(ulong objectNetId)
		{
			if (objectNetId == NULL_OBJECT)
			{
				return null;
			}
			return NetworkManager.Singleton.SpawnManager.SpawnedObjects[objectNetId];
		}

		private static void NetcodePatcher()
		{
			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);
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SkreenZ.TobogangMod";

		public const string PLUGIN_NAME = "TobogangMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace TobogangMod.Scripts
{
	public class AudioSourcePlayerOld : MonoBehaviour
	{
		private AudioSource audioSource;

		private void Start()
		{
			audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
			audioSource.loop = false;
			audioSource.minDistance = 5f;
			audioSource.maxDistance = 50f;
			audioSource.spatialBlend = 1f;
		}

		public void Play(AudioClip audioClip)
		{
			if ((Object)(object)audioClip == (Object)null)
			{
				TobogangMod.Logger.LogError((object)"Tried to play an AudioSourcePlayer with a null AudioClip");
			}
			else
			{
				audioSource.PlayOneShot(audioClip);
			}
		}
	}
	public class AutoDespawnScript : NetworkBehaviour
	{
		public float DespawnTimeout = 5f;

		private void Start()
		{
			if (((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost)
			{
				((MonoBehaviour)this).StartCoroutine(WaitAndDespawn());
			}
		}

		private IEnumerator WaitAndDespawn()
		{
			yield return (object)new WaitForSeconds(DespawnTimeout);
			((Component)this).gameObject.GetComponent<NetworkObject>().Despawn(true);
		}

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

		protected internal override string __getTypeName()
		{
			return "AutoDespawnScript";
		}
	}
	public class AutoDestroy : MonoBehaviour
	{
		public float TimeToLive = 5f;

		private float _timeAlive;

		private void Update()
		{
			_timeAlive += Time.deltaTime;
			if (_timeAlive >= TimeToLive)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	public class CoinguesManager : NetworkBehaviour
	{
		private struct ClaimInfo
		{
			public bool ClaimedToday;

			public int Streak;
		}

		public struct BetInfo
		{
			public ulong PlayerNetId;

			public uint Amount;
		}

		public static readonly int CLAIM_VALUE = 10;

		public static readonly int DEATH_MALUS = 30;

		public static readonly int CRAMPTES_PROC_MALUS = 100;

		public static readonly float SCRAP_COINGUES_MULTIPLIER = 0.5f;

		public static readonly float CLAIM_TIME = 360f;

		private const float ARMAGEDDON_RANGE = 100f;

		private CoinguesStorage _coingues = new CoinguesStorage();

		private Dictionary<string, ClaimInfo> _playerClaims = new Dictionary<string, ClaimInfo>();

		private Dictionary<string, BetInfo> _playerBets = new Dictionary<string, BetInfo>();

		public Dictionary<string, int> PlayerProfits = new Dictionary<string, int>();

		public HashSet<ulong> DiscoPlayers = new HashSet<ulong>();

		private TextMeshProUGUI? _localPlayerCoinguesDisplay;

		private TextMeshProUGUI? _localPlayerCoinguesDisplayS;

		private GameObject _explosionPrefab;

		private GameObject _discoPrefab;

		private float _currentSunExplosionTime;

		private float _sunLerp;

		private AudioSource _alarmAudio;

		private static readonly AnimationCurve SUN_EXPLOSION_CURVE = new AnimationCurve((Keyframe[])(object)new Keyframe[3]
		{
			new Keyframe(0f, 0f),
			new Keyframe(0.8f, 0.008f),
			new Keyframe(1f, 1f)
		});

		public static CoinguesManager Instance { get; private set; }

		public static GameObject NetworkPrefab { get; private set; }

		public List<PlayerControllerB> MutedPlayers { get; private set; } = new List<PlayerControllerB>();


		public List<PlayerControllerB> DeafenedPlayers { get; private set; } = new List<PlayerControllerB>();


		public List<int> TobogangUnlockableIds { get; private set; } = new List<int>();


		public bool IsSunExploding { get; private set; }

		public float CurrentSunIntensity { get; private set; }

		public static void Init()
		{
			NetworkPrefab = NetworkPrefabs.CloneNetworkPrefab(TobogangMod.NetworkPrefab, "CoinguesManager");
			NetworkPrefab.AddComponent<CoinguesManager>();
		}

		private void Awake()
		{
			Instance = this;
		}

		private void Start()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_0361: Unknown result type (might be due to invalid IL or missing references)
			//IL_0366: Unknown result type (might be due to invalid IL or missing references)
			_explosionPrefab = Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab);
			_explosionPrefab.SetActive(false);
			_explosionPrefab.AddComponent<AutoDestroy>();
			_discoPrefab = Object.Instantiate<GameObject>(StartOfRound.Instance.unlockablesList.unlockables[27].prefabObject, Vector3.zero, Quaternion.identity);
			_discoPrefab.SetActive(false);
			Object.Destroy((Object)(object)_discoPrefab.GetComponent<AutoParentToShip>());
			Object.Destroy((Object)(object)_discoPrefab.GetComponent<NetworkObject>());
			AudioSource componentInChildren = _explosionPrefab.GetComponentInChildren<AudioSource>();
			componentInChildren.maxDistance = 50f;
			componentInChildren.spatialBlend = 1f;
			componentInChildren.rolloffMode = (AudioRolloffMode)1;
			FarSound farSound = ((Component)componentInChildren).gameObject.AddComponent<FarSound>();
			farSound.Clip = TobogangMod.DistantExplosionClip;
			Transform transform = ((Component)StartOfRound.Instance.middleOfShipNode).transform;
			GameObject val = Object.Instantiate<GameObject>(new GameObject("TobogangAlarm"), transform.position + Vector3.up * 10f, Quaternion.identity, transform);
			_alarmAudio = val.AddComponent<AudioSource>();
			_alarmAudio.spatialBlend = 1f;
			_alarmAudio.minDistance = 0f;
			foreach (UnlockableItem unlockable in TobogangMod.Unlockables.unlockables)
			{
				int count = StartOfRound.Instance.unlockablesList.unlockables.Count;
				PlaceableShipObject componentInChildren2 = unlockable.prefabObject.GetComponentInChildren<PlaceableShipObject>();
				componentInChildren2.unlockableID = count;
				componentInChildren2.placeObjectSFX = GameObject.Find("Terminal").GetComponentInChildren<Terminal>().placeableObject.placeObjectSFX;
				StartOfRound.Instance.unlockablesList.unlockables.Add(unlockable);
				TobogangUnlockableIds.Add(count);
			}
			if (((NetworkBehaviour)this).IsServer)
			{
				if (ES3.FileExists(GameNetworkManager.Instance.currentSaveFileName))
				{
					string text = ((BaseUnityPlugin)TobogangMod.Instance).Info.Metadata.Name + "_Coingues_";
					string text2 = ((BaseUnityPlugin)TobogangMod.Instance).Info.Metadata.Name + "_ClaimStreak_";
					string[] keys = ES3.GetKeys(GameNetworkManager.Instance.currentSaveFileName);
					foreach (string text3 in keys)
					{
						if (text3 != null && (text3.StartsWith(text) || text3.StartsWith(text2)))
						{
							if (text3.StartsWith(text))
							{
								_coingues[text3.Substring(text.Length)] = ES3.Load<int>(text3, GameNetworkManager.Instance.currentSaveFileName, 0);
							}
							else if (text3.StartsWith(text2))
							{
								int streak = ES3.Load<int>(text3, GameNetworkManager.Instance.currentSaveFileName, 0);
								_playerClaims[text3.Substring(text2.Length)] = new ClaimInfo
								{
									ClaimedToday = false,
									Streak = streak
								};
							}
						}
					}
					TobogangMod.Logger.LogDebug((object)$"Loaded coingues from save: {_coingues}");
				}
				GameObject val2 = Object.Instantiate<GameObject>(StartOfRound.Instance.unlockablesList.unlockables[TobogangUnlockableIds[0]].prefabObject, StartOfRound.Instance.elevatorTransform.position, Quaternion.identity);
				val2.GetComponent<NetworkObject>().Spawn(false);
			}
			else
			{
				SyncAllClientsServerRpc();
			}
		}

		private void Update()
		{
			if ((Object)(object)StartOfRound.Instance.localPlayerController == (Object)null)
			{
				return;
			}
			UpdateSunExplosion();
			if ((Object)(object)_localPlayerCoinguesDisplay == (Object)null || (Object)(object)_localPlayerCoinguesDisplayS == (Object)null)
			{
				if (!((Object)(object)PlayerControllerPatch.LocalPlayerCanvas != (Object)null))
				{
					return;
				}
				_localPlayerCoinguesDisplay = ((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find("CoinguesAmount")).gameObject.GetComponent<TextMeshProUGUI>();
				_localPlayerCoinguesDisplayS = ((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find("CoinguesAmountS")).gameObject.GetComponent<TextMeshProUGUI>();
			}
			int coingues = GetCoingues(StartOfRound.Instance.localPlayerController);
			((TMP_Text)_localPlayerCoinguesDisplay).text = $"{coingues} coingue";
			((Component)_localPlayerCoinguesDisplayS).gameObject.SetActive(coingues > 1);
		}

		private void UpdateSunExplosion()
		{
			if (IsSunExploding)
			{
				_currentSunExplosionTime = Mathf.Lerp(0f, 1f, _sunLerp);
				_sunLerp += 0.05f * Time.deltaTime;
				CurrentSunIntensity = SUN_EXPLOSION_CURVE.Evaluate(_currentSunExplosionTime) * TimeOfDayPatch.MAX_INTENSITY;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void SyncAllClientsServerRpc()
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(868135506u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 868135506u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			SyncAllClientsClientRpc(_coingues);
			string key;
			foreach (KeyValuePair<string, ClaimInfo> item in _playerClaims.ToDictionary<KeyValuePair<string, ClaimInfo>, string, ClaimInfo>((KeyValuePair<string, ClaimInfo> e) => e.Key, (KeyValuePair<string, ClaimInfo> e) => e.Value))
			{
				item.Deconstruct(out key, out var value);
				string playerId = key;
				ClaimInfo claimInfo = value;
				SetPlayerClaimClientRpc(playerId, claimInfo.ClaimedToday, claimInfo.Streak);
			}
			foreach (KeyValuePair<string, BetInfo> item2 in _playerBets.ToDictionary<KeyValuePair<string, BetInfo>, string, BetInfo>((KeyValuePair<string, BetInfo> e) => e.Key, (KeyValuePair<string, BetInfo> e) => e.Value))
			{
				item2.Deconstruct(out key, out var value2);
				string playerId2 = key;
				BetInfo betInfo = value2;
				SetPlayerBetClientRpc(playerId2, betInfo.PlayerNetId, betInfo.Amount);
			}
		}

		[ClientRpc]
		private void SyncAllClientsClientRpc(CoinguesStorage inCoingues)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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(737086338u, val, (RpcDelivery)0);
				bool flag = inCoingues != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe<CoinguesStorage>(ref inCoingues, default(ForNetworkSerializable));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 737086338u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				_coingues = inCoingues;
			}
		}

		[ClientRpc]
		private void SetPlayerClaimClientRpc(string playerId, bool claimedToday, int streak)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: 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(1512485847u, val, (RpcDelivery)0);
				bool flag = playerId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerId, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref claimedToday, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, streak);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1512485847u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				_playerClaims[playerId] = new ClaimInfo
				{
					ClaimedToday = claimedToday,
					Streak = streak
				};
			}
		}

		[ClientRpc]
		private void SetPlayerBetClientRpc(string playerId, ulong betPlayerNetId, uint amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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_00d4: 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(388981004u, val, (RpcDelivery)0);
				bool flag = playerId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(playerId, false);
				}
				BytePacker.WriteValueBitPacked(val2, betPlayerNetId);
				BytePacker.WriteValueBitPacked(val2, amount);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 388981004u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				_playerBets[playerId] = new BetInfo
				{
					PlayerNetId = betPlayerNetId,
					Amount = amount
				};
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ResetCoinguesServerRpc()
		{
			//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(1576525930u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1576525930u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ResetCoinguesClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ResetCoinguesClientRpc()
		{
			//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(1238209074u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1238209074u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					_coingues = new CoinguesStorage();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetPlayerBetServerRpc(NetworkObjectReference player, NetworkObjectReference targetPlayer, uint betAmount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: 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(1831417057u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref targetPlayer, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, betAmount);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1831417057u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref player)).TryGet(ref val3, (NetworkManager)null))
			{
				string playerId = GetPlayerId(((Component)val3).GetComponentInChildren<PlayerControllerB>());
				if (!_playerBets.ContainsKey(playerId) && GetCoingues(playerId) >= betAmount)
				{
					RemoveCoinguesServerRpc(player, (int)betAmount);
					SetPlayerBetClientRpc(playerId, ((NetworkObjectReference)(ref targetPlayer)).NetworkObjectId, betAmount);
				}
			}
		}

		[ServerRpc]
		public void FinishBetcoingueServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1747750497u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1747750497u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			string mostProfitablePlayer = null;
			int num = 0;
			foreach (var (text2, num3) in PlayerProfits)
			{
				if (num3 > num)
				{
					mostProfitablePlayer = text2;
					num = num3;
				}
			}
			((MonoBehaviour)this).StartCoroutine(WaitAndFinishBet(mostProfitablePlayer));
		}

		private IEnumerator WaitAndFinishBet(string? mostProfitablePlayer)
		{
			yield return (object)new WaitForSeconds(5f);
			FinishBetcoingueClientRpc(mostProfitablePlayer ?? "");
		}

		[ClientRpc]
		private void FinishBetcoingueClientRpc(string winningPlayerId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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(2140220416u, val, (RpcDelivery)0);
				bool flag = winningPlayerId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(winningPlayerId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2140220416u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				((MonoBehaviour)this).StartCoroutine(FinishBetcoingueCoroutine(winningPlayerId));
			}
		}

		private IEnumerator FinishBetcoingueCoroutine(string winningPlayerId)
		{
			PlayerControllerB winningPlayer = GetPlayer(winningPlayerId);
			Transform betcoingue = PlayerControllerPatch.LocalPlayerCanvas.transform.Find("BetcoingueResult");
			((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find("BetcoingueResult/NoBet")).gameObject.SetActive(false);
			TextMeshProUGUI playerNameText = ((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find("BetcoingueResult/Header/PlayerName")).gameObject.GetComponent<TextMeshProUGUI>();
			((Component)playerNameText).gameObject.SetActive(false);
			((TMP_Text)playerNameText).text = (((Object)(object)winningPlayer != (Object)null) ? winningPlayer.playerUsername : "Personne !");
			for (int j = 0; j < 10; j++)
			{
				((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find($"BetcoingueResult/Content/Player{j}")).gameObject.SetActive(false);
			}
			((Component)betcoingue).gameObject.SetActive(true);
			HUDManager.Instance.UIAudio.PlayOneShot(TobogangMod.DrumRollClip);
			yield return (object)new WaitForSeconds(TobogangMod.DrumRollClip.length);
			((Component)playerNameText).gameObject.SetActive(true);
			HUDManager.Instance.UIAudio.PlayOneShot(TobogangMod.PartyHornClip);
			yield return (object)new WaitForSeconds(1.5f);
			if (_playerBets.Count == 0)
			{
				((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find("BetcoingueResult/NoBet")).gameObject.SetActive(true);
			}
			for (int i = 0; i < _playerBets.Count && i < 10; i++)
			{
				PlayerControllerB player = GetPlayer(_playerBets.Keys.ToArray()[i]);
				((TMP_Text)((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find($"BetcoingueResult/Content/Player{i}/Name")).GetComponent<TextMeshProUGUI>()).text = player.playerUsername;
				BetInfo betInfo = _playerBets.Values.ToArray()[i];
				bool flag = (Object)(object)winningPlayer != (Object)null && betInfo.PlayerNetId == ((NetworkBehaviour)winningPlayer).NetworkObjectId;
				long num = (flag ? (betInfo.Amount * _playerBets.Count) : betInfo.Amount);
				((TMP_Text)((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find($"BetcoingueResult/Content/Player{i}/Amount")).GetComponent<TextMeshProUGUI>()).text = string.Format("{0}{1}", flag ? "+" : "-", num);
				((Component)PlayerControllerPatch.LocalPlayerCanvas.transform.Find($"BetcoingueResult/Content/Player{i}")).gameObject.SetActive(true);
				yield return (object)new WaitForSeconds(1.5f);
			}
			yield return (object)new WaitForSeconds(5f);
			((Component)betcoingue).gameObject.SetActive(false);
			if (!((NetworkBehaviour)this).IsServer)
			{
				yield break;
			}
			foreach (var (playerId, betInfo3) in _playerBets)
			{
				if (winningPlayerId != "")
				{
					ulong playerNetId = betInfo3.PlayerNetId;
					PlayerControllerB? player2 = GetPlayer(winningPlayerId);
					if (playerNetId == ((player2 != null) ? new ulong?(((NetworkBehaviour)player2).NetworkObjectId) : null))
					{
						CoinguesManager coinguesManager = this;
						PlayerControllerB? player3 = GetPlayer(playerId);
						coinguesManager.AddCoinguesServerRpc(NetworkObjectReference.op_Implicit((player3 != null) ? ((NetworkBehaviour)player3).NetworkObject : null), (int)betInfo3.Amount * _playerBets.Count);
					}
				}
			}
			ClearAllBetsClientRpc();
		}

		public BetInfo? GetPlayerBet(PlayerControllerB player)
		{
			string playerId = GetPlayerId(player);
			if (!_playerBets.TryGetValue(playerId, out var value))
			{
				return null;
			}
			return value;
		}

		[ServerRpc(RequireOwnership = false)]
		public void ClearAllBetsServerRpc()
		{
			//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(1949487861u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1949487861u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClearAllBetsClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ClearAllBetsClientRpc()
		{
			//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(566546028u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 566546028u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					_playerBets.Clear();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void GiveTobogangItemToPlayerServerRpc(string item, NetworkObjectReference player)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: 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(1967320365u, val, (RpcDelivery)0);
				bool flag = item != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(item, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1967320365u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref player)).TryGet(ref val3, (NetworkManager)null))
			{
				PlayerControllerB component = ((Component)val3).GetComponent<PlayerControllerB>();
				GameObject val4 = Object.Instantiate<GameObject>(((CustomItem)TobogangMod.ContentLoader.LoadedContent[item]).Item.spawnPrefab);
				val4.GetComponent<NetworkObject>().Spawn(false);
				GrabbableObject component2 = val4.GetComponent<GrabbableObject>();
				((MonoBehaviour)component2).StartCoroutine(WaitAndGiveItemToPlayer(component, component2));
			}
		}

		private IEnumerator WaitAndGiveItemToPlayer(PlayerControllerB player, GrabbableObject grabbable)
		{
			yield return (object)new WaitForEndOfFrame();
			bool flag = !grabbable.heldByPlayerOnServer;
			if (flag)
			{
				grabbable.heldByPlayerOnServer = true;
				((NetworkBehaviour)grabbable).NetworkObject.ChangeOwnership(player.actualClientId);
			}
			player.GrabObjectClientRpc(flag, NetworkObjectReference.op_Implicit(((NetworkBehaviour)grabbable).NetworkObject));
			SetGrabbableParentClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)grabbable).NetworkObject), NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject));
		}

		[ClientRpc]
		private void SetGrabbableParentClientRpc(NetworkObjectReference grabbableRef, NetworkObjectReference player)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4266182412u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref grabbableRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4266182412u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			NetworkObject val4 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref grabbableRef)).TryGet(ref val3, (NetworkManager)null) && ((NetworkObjectReference)(ref player)).TryGet(ref val4, (NetworkManager)null))
			{
				GrabbableObject componentInChildren = ((Component)val3).GetComponentInChildren<GrabbableObject>();
				componentInChildren.parentObject = ((Component)val4).GetComponentInChildren<PlayerControllerB>().localItemHolder;
				Collider[] componentsInChildren = ((Component)componentInChildren).gameObject.GetComponentsInChildren<Collider>();
				foreach (Collider val5 in componentsInChildren)
				{
					val5.enabled = false;
				}
			}
		}

		public static string GetPlayerId(PlayerControllerB player)
		{
			if (player.playerSteamId == 0L)
			{
				return player.playerUsername;
			}
			return player.playerSteamId.ToString();
		}

		public static PlayerControllerB? GetPlayer(string playerId)
		{
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.playerUsername == playerId || (ulong.TryParse(playerId, out var result) && result == val.playerSteamId))
				{
					return val;
				}
			}
			return null;
		}

		public int GetCoingues(PlayerControllerB player)
		{
			return GetCoingues(GetPlayerId(player));
		}

		public int GetCoingues(string playerId)
		{
			if (_coingues.ContainsKey(playerId))
			{
				return _coingues[playerId];
			}
			return 0;
		}

		public string[] GetRegisteredPlayers()
		{
			string[] array = new string[_coingues.Keys.Count];
			_coingues.Keys.CopyTo(array, 0);
			return array;
		}

		[ServerRpc(RequireOwnership = false)]
		public void AddCoinguesServerRpc(NetworkObjectReference player, int amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: 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(3562842266u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, amount);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3562842266u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref player)).TryGet(ref val3, (NetworkManager)null))
				{
					SetCoinguesClientRpc(player, GetCoingues(((Component)val3).gameObject.GetComponent<PlayerControllerB>()) + amount);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void RemoveCoinguesServerRpc(NetworkObjectReference player, int amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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(1956406280u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, amount);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1956406280u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					AddCoinguesServerRpc(player, -amount);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetCoinguesServerRpc(NetworkObjectReference player, int newCoingues)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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(1542832419u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, newCoingues);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1542832419u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetCoinguesClientRpc(player, newCoingues);
				}
			}
		}

		[ClientRpc]
		private void SetCoinguesClientRpc(NetworkObjectReference player, int newCoingues)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: 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(1206298429u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref player, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, newCoingues);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1206298429u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref player)).TryGet(ref val3, (NetworkManager)null))
			{
				PlayerControllerB component = ((Component)val3).gameObject.GetComponent<PlayerControllerB>();
				int num = _coingues[GetPlayerId(component)];
				newCoingues = Math.Max(newCoingues, 0);
				int num2 = newCoingues - num;
				_coingues[GetPlayerId(component)] = newCoingues;
				if ((Object)(object)component == (Object)(object)StartOfRound.Instance.localPlayerController && num2 != 0)
				{
					Transform transform = PlayerControllerPatch.LocalPlayerCanvas.gameObject.transform;
					Transform val4 = transform.Find("CoinguesText");
					GameObject val5 = Object.Instantiate<GameObject>(((Component)val4).gameObject, transform);
					val5.AddComponent<FadingText>();
					((TMP_Text)val5.GetComponent<TextMeshProUGUI>()).text = string.Format("{0}{1}", (num2 > 0) ? "+" : "", num2);
					((Graphic)val5.GetComponent<TextMeshProUGUI>()).color = ((num2 > 0) ? Color.green : Color.red);
					val5.SetActive(true);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void MutePlayerServerRpc(NetworkObjectReference targetPlayerRef, ulong sourcePlayerRef, bool isMuted)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			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(1676438684u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref targetPlayerRef, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, sourcePlayerRef);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMuted, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1676438684u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					MutePlayerClientRpc(targetPlayerRef, sourcePlayerRef, isMuted);
				}
			}
		}

		[ClientRpc]
		private void MutePlayerClientRpc(NetworkObjectReference targetPlayerRef, ulong sourcePlayerRef, bool isMuted)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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(4192194429u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref targetPlayerRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, sourcePlayerRef);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMuted, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4192194429u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref targetPlayerRef)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			PlayerControllerB component = ((Component)val3).gameObject.GetComponent<PlayerControllerB>();
			if (!((Object)(object)component == (Object)null) && (!isMuted || !MutedPlayers.Contains(component)))
			{
				if (isMuted)
				{
					TobogangMod.Logger.LogDebug((object)("Muted " + component.playerUsername));
					MutedPlayers.Add(component);
				}
				else
				{
					TobogangMod.Logger.LogDebug((object)("Unmuted " + component.playerUsername));
					MutedPlayers.Remove(component);
				}
				((Component)((Component)component.usernameCanvas).transform.Find(PlayerControllerPatch.MUTE_ICON)).gameObject.SetActive(isMuted);
				LayoutPlayerIcons(component);
				NetworkObject val4 = TobogangMod.TryGet(sourcePlayerRef);
				if (isMuted && (Object)(object)component == (Object)(object)StartOfRound.Instance.localPlayerController && (Object)(object)val4 != (Object)null)
				{
					HUDManager.Instance.DisplayGlobalNotification($"{((Component)val4).gameObject.GetComponent<PlayerControllerB>().playerUsername} a utilise Ta gueule pour te mute pendant {Math.Round(TobogangTaGueule.MUTE_DURATION)} secondes");
				}
				StartOfRound.Instance.UpdatePlayerVoiceEffects();
			}
		}

		public void ForcePlayerSprint(PlayerControllerB player)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				((MonoBehaviour)this).StartCoroutine(ForceSprintCoroutine(player));
			}
		}

		private IEnumerator ForceSprintCoroutine(PlayerControllerB player)
		{
			if (((NetworkBehaviour)this).IsServer)
			{
				PlaySoundClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject), isIntro: true);
				yield return (object)new WaitForSeconds(12.125f);
				PlaySoundClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject), isIntro: false);
				ForceSprintPlayerServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject), active: true);
				while (!StartOfRound.Instance.inShipPhase && player.isPlayerControlled && !player.isPlayerDead)
				{
					yield return (object)new WaitForEndOfFrame();
				}
				ForceSprintPlayerServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject), active: false);
				StopSoundClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player).NetworkObject));
			}
		}

		[ClientRpc]
		private void PlaySoundClientRpc(NetworkObjectReference playerRef, bool isIntro)
		{
			//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)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3359671104u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isIntro, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3359671104u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null))
				{
					RandomSound randomSound = RandomSound.Instances[val3.NetworkObjectId];
					randomSound.AudioSource.clip = (isIntro ? TobogangMod.InitialDIntro : TobogangMod.InitialDLoop);
					randomSound.AudioSource.loop = !isIntro;
					randomSound.AudioSource.Play();
				}
			}
		}

		[ClientRpc]
		private void StopSoundClientRpc(NetworkObjectReference playerRef)
		{
			//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)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(826760210u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 826760210u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null))
				{
					RandomSound randomSound = RandomSound.Instances[val3.NetworkObjectId];
					randomSound.AudioSource.Stop(false);
					randomSound.AudioSource.clip = null;
					randomSound.AudioSource.loop = false;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ForceSprintPlayerServerRpc(NetworkObjectReference playerRef, bool active)
		{
			//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_00f2: 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(2498804718u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2498804718u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ForceSprintPlayerClientRpc(playerRef, active);
				}
			}
		}

		[ClientRpc]
		public void ForceSprintPlayerClientRpc(NetworkObjectReference playerRef, bool active)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1845376260u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1845376260u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null))
			{
				PlayerControllerB componentInChildren = ((Component)val3).GetComponentInChildren<PlayerControllerB>();
				if ((Object)(object)componentInChildren == (Object)(object)StartOfRound.Instance.localPlayerController)
				{
					PlayerControllerPatch.LocalPlayerIsForcedToSprint = active;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DeafenPlayerServerRpc(NetworkObjectReference targetPlayerRef, ulong sourcePlayerRef, bool isDeaf)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			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(3463337202u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref targetPlayerRef, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, sourcePlayerRef);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isDeaf, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3463337202u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DeafenPlayerClientRpc(targetPlayerRef, sourcePlayerRef, isDeaf);
				}
			}
		}

		[ClientRpc]
		private void DeafenPlayerClientRpc(NetworkObjectReference targetPlayerRef, ulong sourcePlayerRef, bool isDeaf)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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(1108074325u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref targetPlayerRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, sourcePlayerRef);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isDeaf, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1108074325u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || !((NetworkObjectReference)(ref targetPlayerRef)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			PlayerControllerB component = ((Component)val3).gameObject.GetComponent<PlayerControllerB>();
			if (!((Object)(object)component == (Object)null) && (!isDeaf || !DeafenedPlayers.Contains(component)))
			{
				if (isDeaf)
				{
					TobogangMod.Logger.LogDebug((object)("Deafened " + component.playerUsername));
					DeafenedPlayers.Add(component);
				}
				else
				{
					TobogangMod.Logger.LogDebug((object)("Un-deafened " + component.playerUsername));
					DeafenedPlayers.Remove(component);
				}
				((Component)((Component)component.usernameCanvas).transform.Find(PlayerControllerPatch.DEAF_ICON)).gameObject.SetActive(isDeaf);
				LayoutPlayerIcons(component);
				NetworkObject val4 = TobogangMod.TryGet(sourcePlayerRef);
				if (isDeaf && (Object)(object)component == (Object)(object)StartOfRound.Instance.localPlayerController && (Object)(object)val4 != (Object)null)
				{
					HUDManager.Instance.DisplayGlobalNotification($"{((Component)val4).gameObject.GetComponent<PlayerControllerB>().playerUsername} a utilise RP Joel pour te rendre sourd pendant {Math.Round(TobogangRPJoel.DEAFEN_DURATION)} secondes");
				}
				StartOfRound.Instance.UpdatePlayerVoiceEffects();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ClaimServerRpc(NetworkObjectReference playerRef)
		{
			//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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: 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(1595957267u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1595957267u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null) && !(RoundManager.Instance.timeScript.currentDayTime < CLAIM_TIME))
			{
				PlayerControllerB componentInChildren = ((Component)val3).GetComponentInChildren<PlayerControllerB>();
				string playerId = GetPlayerId(componentInChildren);
				bool flag = _playerClaims.ContainsKey(playerId) && _playerClaims[playerId].ClaimedToday;
				ClaimClientRpc(playerRef);
				if (!flag)
				{
					AddCoinguesServerRpc(playerRef, CLAIM_VALUE + _playerClaims[playerId].Streak);
					return;
				}
				RemoveCoinguesServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)componentInChildren).NetworkObject), 1);
				CramptesManager.Instance.SetCramptesPlayerServerRpc(((NetworkBehaviour)componentInChildren).NetworkObjectId);
			}
		}

		[ClientRpc]
		private void ClaimClientRpc(NetworkObjectReference playerRef)
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2269151550u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2269151550u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null))
			{
				PlayerControllerB componentInChildren = ((Component)val3).GetComponentInChildren<PlayerControllerB>();
				string playerId = GetPlayerId(componentInChildren);
				if (!_playerClaims.ContainsKey(playerId))
				{
					_playerClaims[playerId] = new ClaimInfo
					{
						ClaimedToday = true,
						Streak = 0
					};
				}
				else
				{
					ClaimInfo value = _playerClaims[playerId];
					value.ClaimedToday = true;
					value.Streak++;
					_playerClaims[playerId] = value;
				}
			}
		}

		[ServerRpc]
		public void ResetClaimsServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2828550871u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2828550871u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ResetClaimsClientRpc();
			}
		}

		[ClientRpc]
		private void ResetClaimsClientRpc()
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3714431125u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3714431125u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			foreach (string item in _playerClaims.Keys.ToList())
			{
				ClaimInfo value = _playerClaims[item];
				if (!value.ClaimedToday)
				{
					value.Streak = -1;
				}
				value.ClaimedToday = false;
				_playerClaims[item] = value;
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SetClaimStreakServerRpc(NetworkObjectReference playerRef, int streak)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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(2148893323u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, streak);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2148893323u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					SetClaimStreakClientRpc(playerRef, streak);
				}
			}
		}

		[ClientRpc]
		private void SetClaimStreakClientRpc(NetworkObjectReference playerRef, int streak)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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(735857771u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, streak);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 735857771u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerRef)).TryGet(ref val3, (NetworkManager)null))
			{
				string playerId = GetPlayerId(((Component)val3).GetComponentInChildren<PlayerControllerB>());
				if (_playerClaims.ContainsKey(playerId))
				{
					ClaimInfo value = _playerClaims[playerId];
					value.Streak = streak;
					_playerClaims[playerId] = value;
				}
				else
				{
					_playerClaims[playerId] = new ClaimInfo
					{
						ClaimedToday = false,
						Streak = streak
					};
				}
			}
		}

		public bool HasClaimedToday(PlayerControllerB player)
		{
			return HasClaimedToday(GetPlayerId(player));
		}

		public bool HasClaimedToday(string playerId)
		{
			if (!_playerClaims.ContainsKey(playerId))
			{
				return false;
			}
			return _playerClaims[playerId].ClaimedToday;
		}

		public int GetClaimStreak(PlayerControllerB player)
		{
			return GetClaimStreak(GetPlayerId(player));
		}

		public int GetClaimStreak(string playerId)
		{
			if (!_playerClaims.ContainsKey(playerId))
			{
				return -1;
			}
			return _playerClaims[playerId].Streak;
		}

		private static void LayoutPlayerIcons(PlayerControllerB player)
		{
			//IL_003c: 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)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)((Component)player.usernameCanvas).transform.Find(PlayerControllerPatch.MUTE_ICON)).gameObject;
			GameObject gameObject2 = ((Component)((Component)player.usernameCanvas).transform.Find(PlayerControllerPatch.DEAF_ICON)).gameObject;
			Vector3 localPosition = ((Transform)gameObject.GetComponent<RectTransform>()).localPosition;
			Vector3 localPosition2 = ((Transform)gameObject2.GetComponent<RectTransform>()).localPosition;
			bool flag = gameObject.activeSelf && gameObject2.activeSelf;
			localPosition.x = (flag ? (-40f) : 0f);
			localPosition2.x = (flag ? 40f : 0f);
			((Transform)gameObject.GetComponent<RectTransform>()).localPosition = localPosition;
			((Transform)gameObject2.GetComponent<RectTransform>()).localPosition = localPosition2;
		}

		public GameObject? SpawnScrap(Item item, Vector3 location, bool falling = false)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkBehaviour)this).IsServer)
			{
				return null;
			}
			GameObject val = Object.Instantiate<GameObject>(item.spawnPrefab, location, Quaternion.Euler(item.restingRotation), RoundManager.Instance.spawnedScrapContainer);
			GrabbableObject component = val.GetComponent<GrabbableObject>();
			if (falling)
			{
				component.startFallingPosition = location;
				((M