Decompiled source of LycansNewRoles v0.117.0

plugins/LycansNewRoles/LycansNewRoles.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using DynamicSmokeSystem;
using Fusion;
using Fusion.Sockets;
using HarmonyLib;
using HarmonyLib.Tools;
using Helpers.Collections;
using LycansNewRoles.NewEffects;
using LycansNewRoles.NewItems;
using LycansNewRoles.NewMaps;
using LycansNewRoles.NewPrimaryRoles;
using LycansNewRoles.Sabotages;
using Managers;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.Localization;
using UnityEngine.Localization.Components;
using UnityEngine.Localization.Settings;
using UnityEngine.Localization.Tables;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
using UnityEngine.Scripting;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LycansNewRoles")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+88a69ab3cbfb868d0da2073fc6a398b25050d76d")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("LycansNewRoles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LycansNewRoles
{
	[HarmonyPatch(typeof(LightingManager), "FixedUpdateNetwork")]
	internal class AmogusModeNoCyclePatch
	{
		private static bool Prefix(LightingManager __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode))
				{
					return false;
				}
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("AmogusModeNoCyclePatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerController), "Interact")]
	internal class AmogusModeInteractPatch
	{
		private static void Postfix(bool isPrimary, PlayerController __instance)
		{
			//IL_0007: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Invalid comparison between Unknown and I4
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode))
				{
					return;
				}
				if (LycansUtility.GameActuallyInPlay && (Object)(object)__instance.targetObject != (Object)null && !NetworkBool.op_Implicit(GameManager.LightingManager.IsNight))
				{
					PlayerController componentInParent = __instance.targetObject.GetComponentInParent<PlayerController>();
					PlayerCustom player = PlayerCustomRegistry.GetPlayer(PlayerController.Local.Ref);
					if ((Object)(object)componentInParent != (Object)null && NetworkBool.op_Implicit(componentInParent.IsDead))
					{
						AmogusManager.Rpc_Report(((SimulationBehaviour)__instance).Runner, __instance.Index, componentInParent.Index);
					}
				}
				if (!LycansUtility.GameActuallyInPlay || NetworkBool.op_Implicit(GameManager.LightingManager.IsNight) || !((Object)(object)__instance.targetObject != (Object)null) || (int)__instance.Role != 1)
				{
					return;
				}
				PlayerController componentInParent2 = __instance.targetObject.GetComponentInParent<PlayerController>();
				PlayerCustom player2 = PlayerCustomRegistry.GetPlayer(PlayerController.Local.Ref);
				if ((Object)(object)componentInParent2 != (Object)null && (int)componentInParent2.Role != 1 && !NetworkBool.op_Implicit(componentInParent2.IsDead))
				{
					TickTimer amogusModeKillCooldown = player2.AmogusModeKillCooldown;
					if (!((TickTimer)(ref amogusModeKillCooldown)).IsRunning)
					{
						componentInParent2.Rpc_Kill(__instance.Ref);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("AmogusModeInteractPatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerController), "Rpc_Kill")]
	internal class AmogusModeKillSilentPatch
	{
		private unsafe static bool Prefix(PlayerRef killer, PlayerController __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: 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_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode))
				{
					return true;
				}
				if (NetworkBehaviourUtils.InvokeRpc)
				{
					NetworkBehaviourUtils.InvokeRpc = false;
				}
				else
				{
					NetworkRunner runner = ((SimulationBehaviour)__instance).Runner;
					if ((Object)(object)runner == (Object)null)
					{
						throw new ArgumentNullException("runner");
					}
					if ((int)runner.Stage == 4)
					{
						return false;
					}
					if (runner.HasAnyActiveConnections())
					{
						int num = 8;
						num += 4;
						SimulationMessage* ptr = SimulationMessage.Allocate(((SimulationBehaviour)__instance).Runner.Simulation, num);
						byte* data = SimulationMessage.GetData(ptr);
						int num2 = RpcHeader.Write(RpcHeader.Create(((SimulationBehaviour)__instance).Object.Id, ((NetworkBehaviour)__instance).ObjectIndex, 12), data);
						Unsafe.Write(data + num2, killer);
						num2 += 4;
						((SimulationMessage)ptr).Offset = num2 * 8;
						((SimulationBehaviour)__instance).Runner.SendRpc(ptr);
					}
				}
				if (((SimulationBehaviour)__instance).HasStateAuthority)
				{
					if (!((PlayerRef)(ref killer)).IsNone)
					{
						PlayerController player = PlayerRegistry.GetPlayer(killer);
						PlayerCustom player2 = PlayerCustomRegistry.GetPlayer(killer);
						TickTimer amogusModeKillCooldown = player2.AmogusModeKillCooldown;
						if (((TickTimer)(ref amogusModeKillCooldown)).IsRunning)
						{
							return false;
						}
						player2.AmogusModeKillCooldown = TickTimer.CreateFromSeconds(((SimulationBehaviour)__instance).Runner, 30f);
						__instance.Killer = killer;
					}
					__instance.IsDead = NetworkBool.op_Implicit(true);
					GameManager.Instance.CheckForEndGame();
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("AmogusModeKillSilentPatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(GameState), "Spawned")]
	internal class AmogusModeStateMachinePatch
	{
		private static void Postfix(GameState __instance)
		{
			try
			{
				StateMachine<EGameState> value = Traverse.Create((object)__instance).Field<StateMachine<EGameState>>("StateMachine").Value;
				GameState gameState = __instance;
				StateHooks<EGameState> obj = value[(EGameState)2];
				obj.onEnter = (Action<EGameState>)Delegate.Combine(obj.onEnter, (Action<EGameState>)delegate(EGameState state)
				{
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0024: Unknown result type (might be due to invalid IL or missing references)
					//IL_0026: Invalid comparison between Unknown and I4
					if (NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode) && ((SimulationBehaviour)gameState).Runner.IsServer && (int)state != 5)
					{
						PlayerRegistry.ForEach((Action<PlayerController>)delegate(PlayerController player)
						{
							//IL_000b: Unknown result type (might be due to invalid IL or missing references)
							//IL_001e: Unknown result type (might be due to invalid IL or missing references)
							//IL_002a: Unknown result type (might be due to invalid IL or missing references)
							//IL_0055: Unknown result type (might be due to invalid IL or missing references)
							//IL_003e: Unknown result type (might be due to invalid IL or missing references)
							//IL_0062: Unknown result type (might be due to invalid IL or missing references)
							//IL_0068: Invalid comparison between Unknown and I4
							//IL_0073: Unknown result type (might be due to invalid IL or missing references)
							//IL_0091: Unknown result type (might be due to invalid IL or missing references)
							if ((Object)(object)player != (Object)null && NetworkBool.op_Implicit(player.IsDead))
							{
								PlayerCustom player2 = PlayerCustomRegistry.GetPlayer(player.Ref);
								if (!NetworkBool.op_Implicit(player2.Disappeared))
								{
									player2.Disappeared = NetworkBool.op_Implicit(true);
								}
							}
							if ((Object)(object)player != (Object)null && !NetworkBool.op_Implicit(player.IsDead) && (int)player.Role == 1)
							{
								PlayerCustom player3 = PlayerCustomRegistry.GetPlayer(player.Ref);
								player3.AmogusModeKillCooldown = TickTimer.CreateFromSeconds(((SimulationBehaviour)gameState).Runner, 15f);
							}
						});
					}
				});
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("AmogusModeStateMachinePatch error: " + ex));
			}
		}
	}
	[NetworkBehaviourWeaved(20)]
	public class AmogusManager : NetworkBehaviour
	{
		public static AmogusManager Instance { get; private set; }

		[Networked]
		[NetworkedWeaved(0, 1)]
		public unsafe TickTimer NextLootTimer
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing AmogusManager.NextLootTimer. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (TickTimer)(*base.Ptr);
			}
			set
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing AmogusManager.NextLootTimer. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr, value);
			}
		}

		public override void Spawned()
		{
			((NetworkBehaviour)this).Spawned();
			Instance = this;
		}

		public override void Despawned(NetworkRunner runner, bool hasState)
		{
			((NetworkBehaviour)this).Despawned(runner, hasState);
			Instance = null;
		}

		public override void FixedUpdateNetwork()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Invalid comparison between Unknown and I4
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode) || !((SimulationBehaviour)this).Runner.IsServer || (int)GameManager.LocalGameState != 2)
				{
					return;
				}
				TickTimer nextLootTimer = NextLootTimer;
				if (((TickTimer)(ref nextLootTimer)).Expired(((SimulationBehaviour)this).Runner))
				{
					List<Loot> source = (from o in Object.FindObjectsOfType<Loot>()
						where o.GetMapID() == GameManager.Instance.MapID
						select o).ToList();
					for (int i = 0; i < 5; i++)
					{
						List<Loot> list = source.Where((Loot o) => !NetworkBool.op_Implicit(o.Available)).ToList();
						if (list.Any())
						{
							Loot val = CollectionsUtil.Grab<Loot>(list, 1).First();
							val.Available = NetworkBool.op_Implicit(true);
						}
					}
					NextLootTimer = TickTimer.None;
				}
				nextLootTimer = NextLootTimer;
				if (!((TickTimer)(ref nextLootTimer)).IsRunning)
				{
					int num = PlayerRegistry.CountWhere((Predicate<PlayerController>)((PlayerController o) => !NetworkBool.op_Implicit(o.IsDead)));
					float num2 = 60f / (float)num;
					NextLootTimer = TickTimer.CreateFromSeconds(((SimulationBehaviour)this).Runner, num2);
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("AmogusManager FixedUpdateNetwork error: " + ex));
			}
		}

		[Rpc]
		public unsafe static void Rpc_Report(NetworkRunner runner, int playerIndex, int targetPlayerIndex)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (NetworkBehaviourUtils.InvokeRpc)
				{
					NetworkBehaviourUtils.InvokeRpc = false;
				}
				else
				{
					if ((Object)(object)runner == (Object)null)
					{
						throw new ArgumentNullException("runner");
					}
					if ((int)runner.Stage == 4)
					{
						return;
					}
					if (runner.HasAnyActiveConnections())
					{
						int num = 24;
						SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num);
						byte* data = SimulationMessage.GetData(ptr);
						int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void LycansNewRoles.AmogusManager::Rpc_Report(Fusion.NetworkRunner,System.Int32,System.Int32)")), data);
						*(int*)(data + num2) = playerIndex;
						num2 += 4;
						*(int*)(data + num2) = targetPlayerIndex;
						num2 += 4;
						((SimulationMessage)ptr).Offset = num2 * 8;
						((SimulationMessage)ptr).SetStatic();
						runner.SendRpc(ptr);
					}
				}
				if (runner.IsServer)
				{
					GameManager.LightingManager.IsNight = NetworkBool.op_Implicit(true);
					PlayerRegistry.ForEach((Action<PlayerController>)delegate(PlayerController pObj)
					{
						//IL_0003: Unknown result type (might be due to invalid IL or missing references)
						pObj.CanMove = NetworkBool.op_Implicit(false);
					});
					GameManager.State.Server_DelaySetState((EGameState)3, 3f);
				}
				if (runner.IsPlayer)
				{
					AudioManager.Play("BELL", (MixerTarget)2, 1f, 1f);
					PlayerCustom player = PlayerCustomRegistry.GetPlayer(playerIndex);
					PlayerCustom player2 = PlayerCustomRegistry.GetPlayer(targetPlayerIndex);
					TextMeshProUGUI value = Traverse.Create((object)GameManager.Instance.gameUI).Field<TextMeshProUGUI>("transitionText").Value;
					LocalizeStringEvent value2 = Traverse.Create((object)GameManager.Instance.gameUI).Field<LocalizeStringEvent>("transition").Value;
					((Graphic)value).color = Color.white;
					value2.StringReference.Arguments = new List<object>
					{
						player.PlayerController.PlayerData.Username,
						player2.PlayerController.PlayerData.Username
					};
					((LocalizedReference)value2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit("NALES_AMOGUS_MODE_REPORT_TEXT"));
					value2.RefreshString();
					GameManager.Instance.gameUI.StartFade(true);
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("Rpc_Report error: " + ex));
			}
		}

		[NetworkRpcStaticWeavedInvoker("System.Void LycansNewRoles.AmogusManager::Rpc_Report(Fusion.NetworkRunner,System.Int32,System.Int32)")]
		[Preserve]
		protected unsafe static void Rpc_Report_0040Invoker(NetworkRunner runner, SimulationMessage* message)
		{
			byte* data = SimulationMessage.GetData(message);
			int num = (RpcHeader.ReadSize(data) + 3) & -4;
			int playerIndex = *(int*)(data + num);
			num += 4;
			int targetPlayerIndex = *(int*)(data + num);
			num += 4;
			NetworkBehaviourUtils.InvokeRpc = true;
			Rpc_Report(runner, playerIndex, targetPlayerIndex);
		}
	}
	public static class BalancingValues
	{
		public struct ModifiedEffectData
		{
			public int MagicianCooldownSeconds;

			public float? DurationOnTransformedWolf;

			public ModifiedEffectData(int magicianCooldownSeconds, float? durationOnTransformedWolf)
			{
				MagicianCooldownSeconds = magicianCooldownSeconds;
				DurationOnTransformedWolf = durationOnTransformedWolf;
			}
		}

		public const float EffectDurationStunned = 5f;

		public const float EffectDurationChasing = 2.5f;

		public const float EffectDurationSprinting = 5f;

		public const float EffectDurationReverting = 20f;

		public const float EffectDurationDisoriented = 3f;

		public const float EffectDurationInfected = 8f;

		public const float EffectDurationStealthing = 7f;

		public const float EffectDurationUndetected = 15f;

		public const float EffectDurationStarvationActive = 150f;

		public const float EffectDurationShouting = 7f;

		public const float EffectDurationBlind = 3.5f;

		public const float EffectDurationIllusion = 25f;

		public const float EffectDurationDisguised = 300f;

		public const float EffectDurationDiseased = 300f;

		public const float EffectDurationBomb = 20f;

		public const float EffectDurationPanic = 3f;

		public const float EffectDurationFleeing = 4f;

		public const float EffectDurationVillageIdiotWarning = 5f;

		public const float EffectDurationVillageIdiotHunger = 10f;

		public const float EffectDurationCannibalFull = 55f;

		public const float EffectDurationDowned = 10f;

		public const float EffectDurationWounded = 45f;

		public const float EffectDurationPoisoned = 45f;

		public const float EffectDurationPhasing = 3f;

		public const float EffectDurationDying = 45f;

		public const float EffectDurationAngel = 25f;

		public const float EffectDurationPoaching = 6f;

		public const float EffectDurationShapeshifting = 6f;

		public const float EffectDurationPotionDeaf = 75f;

		public const float EffectDurationPotionMidas = 50f;

		public const float EffectDurationPotionVampire = 45f;

		public const float EffectDurationPotionTiny = 35f;

		public const float EffectDurationPotionHaunted = 70f;

		public const float EffectDurationPotionNearsighted = 60f;

		public const float EffectDurationPotionAssassin = 20f;

		public const float EffectDurationPotionStinking = 60f;

		public const float EffectDurationPotionMute = 60f;

		public const float EffectDurationPotionClairvoyance = 55f;

		public const float AgentEliminationRange = 2.5f;

		public const float CannibalEatDuration = 4f;

		public const float NecromancerResurrectDuration = 3f;

		public const int ShapeshifterIllusionCastTime = 1;

		public const float DeceiverScaryEffectDistance = 40f;

		public const float DeceiverIllusionDelayInitialMinSeconds = 2f;

		public const float DeceiverIllusionDelayInitialMaxSeconds = 10f;

		public const float DeceiverIllusionDelayBetweenMinSeconds = 15f;

		public const float DeceiverIllusionDelayBetweenMaxSeconds = 30f;

		public const float DeceiverIllusionDurationMinSeconds = 6f;

		public const float DeceiverIllusionDurationMaxSeconds = 15f;

		public const float DeceiverTrickRange = 10f;

		public const float VillageIdiotCheckInterval = 5f;

		public const float VillageIdiotMaximumPlayerDistance = 13f;

		public const float VillageIdiotMaximumWolfDistance = 40f;

		public const float VillageIdiotMinimumLastCheckDistance = 14f;

		public const float VillageIdiotNewTimerAfterLoot = 10f;

		public const int VillageIdiotFailedChecksForWarning = 4;

		public const int VillageIdiotFailedChecksForHunger = 6;

		public const float VillageIdiotAdditionalHungerWithEffect = 2.5f;

		public const float SpyMinimumDistanceForBestTarget = 50f;

		public const float SpySpyingRange = 10f;

		public const float SpyCooldownAfterSpyingSeconds = 30f;

		public const float ScientistAnalysisPowerAtMinDistance = 70f;

		public const float ScientistAnalysisPowerAtMaxDistance = 20f;

		public const float ScientistAnalysisMultiplierIfCursed = 0.25f;

		public const float ScientistAnalysisMultiplierForTransform = 8f;

		public const float ScientistAnalysisMultiplierForKill = 8f;

		public const float ScientistAnalysisMultiplierIfWolfVisible = 4f;

		public const float ScientistAnalysisMultiplierIfWolfVisibleButWounded = 0.4f;

		public const float ScientistAnalysisMultiplierIfScientistCrouched = 0.8f;

		public const float ScientistAnalysisMultiplierIfScientistInvisible = 0.4f;

		public const float ScientistAnalysisMultiplierIfScientistFast = 0.3f;

		public const float ScientistAnalysisRangePeriodic = 40f;

		public const float ScientistAnalysisRangeTransform = 40f;

		public const float ScientistAnalysisRangeKill = 30f;

		public const float BeastMarkRange = 4f;

		public const float BeastTransformationTime = 8f;

		public const float BeastKillRange = 3f;

		public const float BeastHealthLossPercentagePerSecond = 0.01f;

		public const float BeastTrapHealthLossPercentagePerSecond = 0.02f;

		public const float BeastHealthGainPercentagePerKill = 0.15f;

		public const float BeastMovementSpeed = 0.15f;

		public const float BeastNegativeEffectsDurationPercentage = 0.5f;

		public const float BeastHealthLossPercentageOnShot = 0.1f;

		public const float BeastHealthLossPercentageOnBomb = 0.25f;

		public const float BeastTrapDurationSeconds = 5f;

		public const int BeastDamageBonusOnDoors = 50;

		public const int BeastActiveFogEndDistance = 65;

		public static Color BeastActiveFogColor = new Color(1f, 0f, 0f, 1f);

		public const float BeastVoiceRange = 80f;

		public const float TrackerWolfSpeedMultiplier = 0.75f;

		public const float EnragedWolfSpeedMultiplier = 1.2f;

		public const float EnragedWolfTransformDelayMultiplier = 0.7f;

		public const float EnragedWolfHungerMultiplier = 1.5f;

		public const float WarlockWolfCurseRange = 10f;

		public const float WarlockWolfCurseDormantMinimumDelay = 1f;

		public const float WarlockWolfCurseDormantMaximumDelay = 20f;

		public const float WarlockWolfCurseDormantMinimumDuration = 25f;

		public const float WarlockWolfCurseDormantMaximumDuration = 50f;

		public const float SaboteurTrapHeldItemRange = 2.5f;

		public const float SaboteurPoisonHealthDecrease = 1f;

		public const int SaboteurPoisonFogEndDistance = 25;

		public static Color SaboteurPoisonFogColor = new Color(0f, 0.5f, 0f, 1f);

		public const float SaboteurTrappedGadgetHealthLossPercentage = 0.2f;

		public const float SaboteurWoundedMoveSpeedMultiplier = 0.65f;

		public const float SaboteurItemLightIntensityNotHeld = 3f;

		public const float SaboteurItemLightIntensityHeld = 0.5f;

		public const float SaboteurItemLightRangeNotHeld = 2f;

		public const float SaboteurItemLightRangeHeld = 0.15f;

		public const float TraitorSabotageDelayMultiplier = 1.35f;

		public const float BomberCreateBombRange = 2.5f;

		public const float BomberGiveBombRange = 2.5f;

		public const float BomberBombStartMinimumDelay = 10f;

		public const float BomberBombStartMaximumDelay = 20f;

		public const float BomberBombTickingSoundRange = 20f;

		public const float BomberBombExplosionSoundRange = 40f;

		public const float PoacherMarkSoundRange = 30f;

		public const float PoachingMovementSpeed = 1.8f;

		public const float AlcoholicPotionHealWolf = 0.45f;

		public const float AlcoholicPotionHealBeast = 0.2f;

		public const float SprinterSprintingMoveSpeedMultiplier = 1.75f;

		public const float SprinterChasingMoveSpeedMultiplier = 1.5f;

		public const float DetectiveInspectRange = 2.5f;

		public const float EngineerTrappedDuration = 4f;

		public const float EngineerTrapDisarmTime = 1f;

		public const int EngineerDoorBashBonusDamageWolf = 40;

		public const int EngineerDoorBashBonusDamageNonWolf = 20;

		public const int EngineerSmokeRadius = 250;

		public const int InfectedWolfRadius = 30;

		public const float GamblerSwitchRange = 5f;

		public const float HowlerShoutingVoiceRange = 80f;

		public const float HowlerShoutingDisorientedRange = 25f;

		public const float MetabolicWolfStarvationRange = 10f;

		public const float MetabolicVillagerFeedMultiplier = 1.75f;

		public const float MetabolicStarvationAdditionalHunger = 1f;

		public const float PoliticianDenyVoteRange = 10f;

		public const float AstralDefaultRange = 10f;

		public const float AstralKillRange = 4f;

		public const float AstralSabotageRange = 7f;

		public const float AstralPowerHeight = 10f;

		public const float AstralPowerAdditionalHunger = 1.5f;

		public const float SherifKillRange = 2.5f;

		public const float SherifWolfHealthAfterBeingShot = 0.4f;

		public const float SprinterSprintingAdditionalHunger = 4f;

		public const float RangerWolfFootstepsDuration = 90f;

		public const float RangerVillagerFootstepsDuration = 25f;

		public const float RangerSearchRadius = 30f;

		public const float RangerWolfOnMinimapRadius = 30f;

		public const float ScavengerHumanFormHealPercentage = 0.15f;

		public const float ScavengerWolfFormHealPercentage = 0.5f;

		public const float MagicianCastRange = 7f;

		public const float MagicianMinimumCooldownAfterNewSpell = 10f;

		public static Dictionary<int, int> DetectiveVillagerSuspicionPonderation = new Dictionary<int, int>
		{
			{ 0, 1 },
			{ 1, 4 },
			{ 2, 6 },
			{ 3, 4 },
			{ 4, 3 },
			{ 5, 2 }
		};

		public static Dictionary<int, int> DetectiveWolfSuspicionPonderation = new Dictionary<int, int>
		{
			{ 1, 2 },
			{ 2, 3 },
			{ 3, 5 },
			{ 4, 6 },
			{ 5, 4 }
		};

		public static Dictionary<int, int> DetectiveTraitorSuspicionPonderation = new Dictionary<int, int>
		{
			{ 1, 2 },
			{ 2, 3 },
			{ 3, 5 },
			{ 4, 6 },
			{ 5, 4 }
		};

		public static Dictionary<int, int> DetectiveSoloSuspicionPonderation = new Dictionary<int, int>
		{
			{ 1, 2 },
			{ 2, 3 },
			{ 3, 5 },
			{ 4, 6 },
			{ 5, 4 }
		};

		public const float PeasantRadiusForItem = 30f;

		public const float PeasantChanceForItem = 1f;

		public const float GuardWarningRange = 25f;

		public const float GuardTakeRifleDuration = 3f;

		public const float ExorcistMarkRange = 7f;

		public const float ExorcistMarkHungerMultiplier = 1.5f;

		public const int ExorcistFogEndDistance = 25;

		public static Color ExorcistFogColor = new Color(0.5f, 0.5f, 0f, 1f);

		public const float ExorcistBlindDuration = 3f;

		public const float ForensicsAnalyzeDuration = 3f;

		public const float AvengerAttackRange = 2.5f;

		public const float AvengerAttackDownedDuration = 8f;

		public const float SurvivalistSaveCastTime = 4f;

		public const float SurvivalistHungerPercentageWhenDowned = 0.295f;

		public const float SurvivalistAlertRange = 40f;

		public const float SurvivalistHeartbeatRange = 15f;

		public const float PriestProtectRange = 2.5f;

		public const float PriestProtectionDownedDuration = 4f;

		public const float PriestProtectionFleeingDuration = 5f;

		public const float AngelHealPercentage = 0.5f;

		public const float VillageIdiotHungerMultiplier = 0.7f;

		public const float MidasEffectValueMultiplier = 4f;

		public const float VampireEffectCurrentPercentage = 0.03f;

		public const float TinyMovementSpeed = 0.6f;

		public const float HauntedMinimumDelayServer = 3f;

		public const float HauntedMaximumDelayServer = 6f;

		public const float HauntedHealthGainPercentage = 0.3f;

		public const float HauntedHealthLossPercentage = 0.2f;

		public const float HauntedDoorRadius = 40f;

		public const float HauntedLanternFlickerRadius = 30f;

		public const float HauntedLanternFlickerDuration = 10f;

		public static Dictionary<HauntedEffect.HauntedPossibleEffect, int> HauntedChanceByEffect = new Dictionary<HauntedEffect.HauntedPossibleEffect, int>
		{
			{
				HauntedEffect.HauntedPossibleEffect.HealthGain,
				2
			},
			{
				HauntedEffect.HauntedPossibleEffect.HealthLoss,
				2
			},
			{
				HauntedEffect.HauntedPossibleEffect.OpenDoors,
				3
			},
			{
				HauntedEffect.HauntedPossibleEffect.CloseDoors,
				3
			},
			{
				HauntedEffect.HauntedPossibleEffect.Teleport,
				2
			},
			{
				HauntedEffect.HauntedPossibleEffect.GainItem,
				2
			},
			{
				HauntedEffect.HauntedPossibleEffect.RandomNegativeEffect,
				3
			},
			{
				HauntedEffect.HauntedPossibleEffect.Sound,
				2
			},
			{
				HauntedEffect.HauntedPossibleEffect.FlickerLanterns,
				2
			}
		};

		public const int NearsightedFogEndDistance = 12;

		public static Color NearsightedFogColor = new Color(0f, 0f, 0.1f, 1f);

		public const float AssassinRange = 2.5f;

		public const float DisorientedMovementSpeed = 0.5f;

		public const float StunnedMovementSpeed = 0.5f;

		public const float StinkingEffectRadiusOnNonWolf = 4f;

		public const float StinkingEffectRadiusOnWolf = 10f;

		public const float NauseatedMovementSpeed = 0.8f;

		public const int NauseatedFogEndDistance = 30;

		public static Color NauseatedFogColor = new Color(0f, 0.5f, 0f, 1f);

		public const float SacrificeWolfHungerMultiplier = 0.75f;

		public const float SacrificeMovementSpeed = 1.15f;

		public const float SacrificeTransformDelayMultiplier = 0.6f;

		public const float PhasingMovementSpeedHumanForm = 1.5f;

		public const float PhasingMovementSpeedWolfForm = 1.25f;

		public const float BombMovementSpeed = 1.15f;

		public const float FleeingMovementSpeed = 1.5f;

		public const float PanicMovementSpeed = 0.65f;

		public const float LoverVillagerHungerRateBase = 0.125f;

		public const float LoverVillagerHungerRatePerLivingPlayer = 0.0125f;

		public const float LoverVillagerHealPercentageOnWolfKill = 0.45f;

		public const float MagicScrollDurationMultiplier = 0.6f;

		public const float SabotageObjectRaycastRange = 7f;

		public const float DiseaseEffectHealthDecrease = 0.3f;

		public const float DiseaseMoveSpeedMultiplier = 0.85f;

		public const float EmpoweredWolfHungerMultiplier = 0.75f;

		public const float EmpoweredMovementSpeed = 1.1f;

		public const float PortalSabotageStayActiveTime = 120f;

		public const float PortalSabotageReactivateTime = 5f;

		public const float CursedNightFogEndDistanceMultiplier = 0.65f;

		public const float CursedNightDefaultCurseCooldown = 100f;

		public const float PlayerRaycastRange = 10f;

		public const float PlayerRaycastRangeWhenInvisible = 2.5f;

		public const float TrapSetupTime = 1f;

		public const float TrapDisarmTime = 2.5f;

		public const float TrapDisarmTimeInWolfForm = 5f;

		public const float MaxSpeedBase = 1.5f;

		public const float AmogusModeKillRange = 5f;

		public const float AmogusModeKillCooldown = 30f;

		public const float AmogusModeReportRange = 10f;

		public const int AmogusBaseLootsSpawn = 5;

		public const int AmogusBaseIntervalBetweenLoots = 60;

		public static Dictionary<int, float> FogEndDistanceDaytimeByFogConfigPercentage = new Dictionary<int, float>
		{
			{ 0, 300f },
			{ 10, 300f },
			{ 20, 300f },
			{ 30, 300f },
			{ 40, 300f },
			{ 50, 300f },
			{ 60, 300f },
			{ 70, 300f },
			{ 80, 300f },
			{ 90, 300f },
			{ 100, 300f }
		};

		public static Dictionary<int, float> FogEndDistanceNightByFogConfigPercentage = new Dictionary<int, float>
		{
			{ 0, 300f },
			{ 10, 150f },
			{ 20, 125f },
			{ 30, 100f },
			{ 40, 80f },
			{ 50, 65f },
			{ 60, 55f },
			{ 70, 45f },
			{ 80, 35f },
			{ 90, 26f },
			{ 100, 18f }
		};

		public const int FogBonusEndDistanceForWolfForm = 25;

		public static int BeastMarkCooldown => Mathf.RoundToInt(45f - (float)PlayerRegistry.Count * 2f);

		public static List<int> GetSuspiciousnessBag(Dictionary<int, int> dictionary)
		{
			List<int> list = new List<int>();
			foreach (KeyValuePair<int, int> item in dictionary)
			{
				for (int i = 0; i < item.Value; i++)
				{
					list.Add(item.Key);
				}
			}
			return list;
		}

		public static int GetVillagerJobChancePonderation(PlayerCustom.PlayerPrimaryRolePower power)
		{
			return power switch
			{
				PlayerCustom.PlayerPrimaryRolePower.Peasant => 3, 
				PlayerCustom.PlayerPrimaryRolePower.Repairer => 2, 
				PlayerCustom.PlayerPrimaryRolePower.Guard => 2, 
				PlayerCustom.PlayerPrimaryRolePower.Exorcist => 3, 
				PlayerCustom.PlayerPrimaryRolePower.Forensics => 2, 
				PlayerCustom.PlayerPrimaryRolePower.Avenger => 2, 
				PlayerCustom.PlayerPrimaryRolePower.Barkeep => 3, 
				PlayerCustom.PlayerPrimaryRolePower.Survivalist => 3, 
				PlayerCustom.PlayerPrimaryRolePower.Priest => 3, 
				PlayerCustom.PlayerPrimaryRolePower.Angel => 3, 
				_ => 0, 
			};
		}

		public static int AvengerMaxSurvivorsToKill(int totalPlayers)
		{
			switch (totalPlayers)
			{
			case 1:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
				return 3;
			case 8:
			case 9:
				return 4;
			case 10:
			case 11:
				return 5;
			case 12:
			case 13:
				return 6;
			case 14:
			case 15:
				return 7;
			default:
				return 4;
			}
		}

		public static int? GetCastTimeForSecondaryRole(PlayerCustom.PlayerSecondaryRole role)
		{
			return role switch
			{
				PlayerCustom.PlayerSecondaryRole.BothTeleporter => 3, 
				PlayerCustom.PlayerSecondaryRole.BothRanger => 3, 
				PlayerCustom.PlayerSecondaryRole.BothScavenger => 3, 
				_ => null, 
			};
		}

		public static int? GetCooldownForPrimaryRolePower(PlayerCustom.PlayerPrimaryRolePower role, int totalCycleTime)
		{
			return role switch
			{
				PlayerCustom.PlayerPrimaryRolePower.Saboteur => 30, 
				PlayerCustom.PlayerPrimaryRolePower.Warlock => 5 * totalCycleTime, 
				PlayerCustom.PlayerPrimaryRolePower.Deceiver => 5 * totalCycleTime, 
				PlayerCustom.PlayerPrimaryRolePower.Tracker => 15, 
				PlayerCustom.PlayerPrimaryRolePower.Forensics => 5 * totalCycleTime, 
				_ => null, 
			};
		}

		public static PowerMaterialsInfo? GetRequiredMaterialsForPrimaryRolePower(PlayerCustom.PlayerPrimaryRolePower power)
		{
			return power switch
			{
				PlayerCustom.PlayerPrimaryRolePower.Bomber => new PowerMaterialsInfo(100, 0f, 0f), 
				PlayerCustom.PlayerPrimaryRolePower.Exorcist => new PowerMaterialsInfo(75, 0.756f, 0f), 
				PlayerCustom.PlayerPrimaryRolePower.Priest => new PowerMaterialsInfo(125, 0.756f, 1f), 
				_ => null, 
			};
		}

		public static int? GetCooldownForSecondaryRole(PlayerCustom.PlayerSecondaryRole role, int totalCycleTime)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			return role switch
			{
				PlayerCustom.PlayerSecondaryRole.BothAlcoholic => 60, 
				PlayerCustom.PlayerSecondaryRole.BothDetective => Mathf.RoundToInt(3.5f * (float)totalCycleTime), 
				PlayerCustom.PlayerSecondaryRole.BothEngineer => NetworkBool.op_Implicit(Plugin.CustomConfig.DropItemsAvailable) ? 90 : 60, 
				PlayerCustom.PlayerSecondaryRole.BothGambler => 120, 
				PlayerCustom.PlayerSecondaryRole.BothHowler => 120, 
				PlayerCustom.PlayerSecondaryRole.BothIllusionist => 120, 
				PlayerCustom.PlayerSecondaryRole.BothInfected => 120, 
				PlayerCustom.PlayerSecondaryRole.BothMetabolic => 8 * totalCycleTime, 
				PlayerCustom.PlayerSecondaryRole.BothAstral => 15, 
				PlayerCustom.PlayerSecondaryRole.BothSprinter => 90, 
				PlayerCustom.PlayerSecondaryRole.BothStealther => 120, 
				PlayerCustom.PlayerSecondaryRole.BothTeleporter => 90, 
				PlayerCustom.PlayerSecondaryRole.BothScavenger => 30, 
				_ => null, 
			};
		}

		public static ModifiedEffectData GetModifiedEffectData(Effect effect)
		{
			if (effect is AuditionEffect)
			{
				return new ModifiedEffectData(45, null);
			}
			if (effect is InvisibilityEffect)
			{
				return new ModifiedEffectData(120, 15f);
			}
			if (effect is NightVision)
			{
				return new ModifiedEffectData(45, null);
			}
			if (effect is SatiatedEffect)
			{
				return new ModifiedEffectData(60, 20f);
			}
			if (effect is SpeedEffect)
			{
				return new ModifiedEffectData(120, 20f);
			}
			if (effect is MidasEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			if (effect is AssassinEffect)
			{
				return new ModifiedEffectData(120, 0f);
			}
			if (effect is StinkingEffect)
			{
				return new ModifiedEffectData(75, null);
			}
			if (effect is ClairvoyanceEffect)
			{
				return new ModifiedEffectData(80, 20f);
			}
			if (effect is GiantEffect)
			{
				return new ModifiedEffectData(90, 10f);
			}
			if (effect is TeleportationEffect)
			{
				return new ModifiedEffectData(75, 10f);
			}
			if (effect is VampireEffect)
			{
				return new ModifiedEffectData(75, 30f);
			}
			if (effect is TinyEffect)
			{
				return new ModifiedEffectData(120, 15f);
			}
			if (effect is HauntedEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			if (effect is FlatulenceEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			if (effect is GlowingEffect)
			{
				return new ModifiedEffectData(60, 0f);
			}
			if (effect is ParanoiaEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			if (effect is DeafnessEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			if (effect is NearsightedEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			if (effect is MuteEffect)
			{
				return new ModifiedEffectData(60, null);
			}
			return new ModifiedEffectData(60, null);
		}

		public static int CannibalTargetAmount(int totalPlayers)
		{
			if (totalPlayers <= 5)
			{
				return 2;
			}
			if (totalPlayers <= 8)
			{
				return 3;
			}
			if (totalPlayers <= 11)
			{
				return 4;
			}
			if (totalPlayers <= 13)
			{
				return 5;
			}
			if (totalPlayers <= 15)
			{
				return 6;
			}
			return 1;
		}

		public static int AgentMaxSurvivorsToWin(int totalPlayers)
		{
			switch (totalPlayers)
			{
			case 1:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
				return 2;
			case 8:
			case 9:
			case 10:
			case 11:
			case 12:
				return 3;
			case 13:
			case 14:
			case 15:
				return 4;
			default:
				return 4;
			}
		}

		public static int SpyTargetAmount(int totalPlayers)
		{
			switch (totalPlayers)
			{
			case 1:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
				return 5;
			case 7:
			case 8:
			case 9:
				return 6;
			case 10:
			case 11:
				return 7;
			case 12:
			case 13:
				return 8;
			case 14:
			case 15:
				return 9;
			default:
				return 9;
			}
		}

		public static int BeastTargetAmount(int survivingPlayers)
		{
			return Mathf.CeilToInt((float)survivingPlayers * 0.6f);
		}

		public static int ScientistGoal(int totalPlayers)
		{
			return PlayerRegistry.Count * 500;
		}

		public static bool IsValidEffectForScroll(Effect effect)
		{
			return effect is InvisibilityEffect || effect is NightVision || effect is SatiatedEffect || effect is SpeedEffect || effect is ClairvoyanceEffect || effect is GiantEffect || effect is TeleportationEffect || effect is VampireEffect || effect is HauntedEffect || effect is FlatulenceEffect || effect is ParanoiaEffect || effect is DeafnessEffect || effect is NearsightedEffect || effect is MuteEffect;
		}

		public static float DraftModeChanceToRemoveSoloRole(PlayerCustom.PlayerNewPrimaryRole soloRole)
		{
			return soloRole switch
			{
				PlayerCustom.PlayerNewPrimaryRole.VillageIdiot => 0f, 
				PlayerCustom.PlayerNewPrimaryRole.Cannibal => 0f, 
				PlayerCustom.PlayerNewPrimaryRole.Agent => 0f, 
				PlayerCustom.PlayerNewPrimaryRole.Spy => 0f, 
				PlayerCustom.PlayerNewPrimaryRole.Scientist => 0f, 
				PlayerCustom.PlayerNewPrimaryRole.Lover => 0.2f, 
				PlayerCustom.PlayerNewPrimaryRole.Beast => 0.4f, 
				_ => 0f, 
			};
		}

		public static float WolfScareEffectRadiusMultiplierByMap(int mapId)
		{
			return mapId switch
			{
				1 => 1f, 
				2 => 0.65f, 
				_ => 1f, 
			};
		}

		public static float NightFogEndDistanceMultiplierByMap(int mapId)
		{
			return mapId switch
			{
				1 => 1f, 
				2 => 0.7f, 
				_ => 1f, 
			};
		}

		public static float VampireEffectRadiusByMap(int mapId)
		{
			return mapId switch
			{
				1 => 25f, 
				2 => 12.5f, 
				_ => 25f, 
			};
		}

		public static float BeastHeartbeatMaximumRange(int mapId)
		{
			return mapId switch
			{
				1 => 20f, 
				2 => 15f, 
				_ => 20f, 
			};
		}
	}
	public class PowerMaterialsInfo
	{
		public int RequiredMaterials;

		public float StartingMaterialsPercentage;

		public float BonusMultiplierAtFullHealth;

		public PowerMaterialsInfo(int requiredMaterials, float startingMaterialsPercentage, float bonusMultiplierAtFullHealth)
		{
			RequiredMaterials = requiredMaterials;
			StartingMaterialsPercentage = startingMaterialsPercentage;
			BonusMultiplierAtFullHealth = bonusMultiplierAtFullHealth;
		}
	}
	[NetworkBehaviourWeaved(20)]
	public class BeastManager : NetworkBehaviour
	{
		private float DelayToNextHeartbeat;

		private const float DelaySoundSlow = 2.1f;

		private const float DelaySoundMid = 1.42f;

		private const float DelaySoundFast = 0.9f;

		[Networked(OnChanged = "BeastActiveChanged")]
		[NetworkedWeaved(0, 1)]
		public unsafe NetworkBool BeastActive
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.BeastActive. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)(*base.Ptr);
			}
			set
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.BeastActive. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr, value);
			}
		}

		[Networked(OnChanged = "BeastKillsChanged")]
		[NetworkedWeaved(1, 1)]
		public unsafe int BeastKills
		{
			get
			{
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.BeastKills. Networked properties can only be accessed when Spawned() has been called.");
				}
				return base.Ptr[1];
			}
			set
			{
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.BeastKills. Networked properties can only be accessed when Spawned() has been called.");
				}
				base.Ptr[1] = value;
			}
		}

		[Networked]
		[NetworkedWeaved(2, 1)]
		public unsafe int BeastKillsObjective
		{
			get
			{
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.BeastKillsObjective. Networked properties can only be accessed when Spawned() has been called.");
				}
				return base.Ptr[2];
			}
			set
			{
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.BeastKillsObjective. Networked properties can only be accessed when Spawned() has been called.");
				}
				base.Ptr[2] = value;
			}
		}

		public static BeastManager Instance { get; private set; }

		public void Reset()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			BeastActive = NetworkBool.op_Implicit(false);
			BeastKills = 0;
			BeastKillsObjective = 0;
		}

		public override void Spawned()
		{
			((NetworkBehaviour)this).Spawned();
			Instance = this;
		}

		public override void Despawned(NetworkRunner runner, bool hasState)
		{
			((NetworkBehaviour)this).Despawned(runner, hasState);
			Instance = null;
		}

		private void Update()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: 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)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkBool.op_Implicit(BeastActive))
			{
				return;
			}
			if (DelayToNextHeartbeat <= 0f)
			{
				float num = BalancingValues.BeastHeartbeatMaximumRange(GameManager.Instance.MapID);
				float num2 = num * 0.7f;
				float num3 = num * 0.4f;
				PlayerCustom povPlayerCustom = PlayerCustomRegistry.GetPlayer(PlayerController.Local.LocalCameraHandler.PovPlayer.Ref);
				if (povPlayerCustom.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Beast)
				{
					List<PlayerController> list = PlayerRegistry.Where((Predicate<PlayerController>)((PlayerController o) => o.Ref != povPlayerCustom.Ref && !NetworkBool.op_Implicit(o.IsDead))).ToList();
					PlayerController val = null;
					float? num4 = null;
					foreach (PlayerController item in list)
					{
						float num5 = Vector3.Distance(((Component)povPlayerCustom.PlayerController).transform.position, ((Component)item).transform.position);
						if (!num4.HasValue || num5 < num4.Value)
						{
							val = item;
							num4 = num5;
						}
					}
					if ((Object)(object)val != (Object)null && num4.Value <= num)
					{
						string text;
						float delayToNextHeartbeat;
						if (num4.Value > num2)
						{
							text = "BeastHeartBeatSlow";
							delayToNextHeartbeat = 2f;
						}
						else if (num4.Value > num3)
						{
							text = "BeastHeartBeatMid";
							delayToNextHeartbeat = 1.337f;
						}
						else
						{
							text = "BeastHeartBeatFast";
							delayToNextHeartbeat = 0.841f;
						}
						AudioManager.PlayAndFollow(text, ((Component)val).transform, (MixerTarget)2, num, 0.8f);
						DelayToNextHeartbeat = delayToNextHeartbeat;
					}
					else
					{
						DelayToNextHeartbeat = 0.5f;
					}
					return;
				}
				PlayerCustom specificNewPrimaryRole = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Beast);
				float num6 = Vector3.Distance(((Component)povPlayerCustom.PlayerController).transform.position, ((Component)specificNewPrimaryRole.PlayerController).transform.position);
				if (num6 <= num)
				{
					string text2;
					float delayToNextHeartbeat2;
					if (num6 > num2)
					{
						text2 = "BeastHeartBeatSlow";
						delayToNextHeartbeat2 = 2f;
					}
					else if (num6 > num3)
					{
						text2 = "BeastHeartBeatMid";
						delayToNextHeartbeat2 = 1.337f;
					}
					else
					{
						text2 = "BeastHeartBeatFast";
						delayToNextHeartbeat2 = 0.841f;
					}
					AudioManager.Play(text2, (MixerTarget)2, 0.5f, 1f);
					DelayToNextHeartbeat = delayToNextHeartbeat2;
				}
				else
				{
					DelayToNextHeartbeat = 0.5f;
				}
			}
			else
			{
				DelayToNextHeartbeat -= Time.deltaTime;
			}
		}

		public void ActivateBeast()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			BeastActive = NetworkBool.op_Implicit(true);
		}

		[Preserve]
		public static void BeastActiveChanged(Changed<BeastManager> changed)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				BeastManager behaviour = changed.Behaviour;
				if (NetworkBool.op_Implicit(behaviour.BeastActive))
				{
					int num = BalancingValues.BeastTargetAmount(PlayerRegistry.CountWhere((Predicate<PlayerController>)((PlayerController o) => !NetworkBool.op_Implicit(o.IsDead))) - 1);
					PlayerCustom specificNewPrimaryRole = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Beast);
					if (((SimulationBehaviour)behaviour).Runner.IsServer)
					{
						behaviour.BeastKillsObjective = num;
						specificNewPrimaryRole.PlayerController.Hunger = GameManager.Instance.MaxHunger;
						Traverse.Create((object)specificNewPrimaryRole.PlayerController).Property("WolfDelay", (object[])null).SetValue((object)TickTimer.CreateFromSeconds(((SimulationBehaviour)behaviour).Runner, 8f));
						specificNewPrimaryRole.PlayerController.TransformedNight = NetworkBool.op_Implicit(true);
						specificNewPrimaryRole.PlayerController.IsWolf = NetworkBool.op_Implicit(true);
						specificNewPrimaryRole.PlayerController.MovementAction = 0;
						specificNewPrimaryRole.PlayerController.CanMoveAnimation = NetworkBool.op_Implicit(false);
						specificNewPrimaryRole.PlayerController.IsZooming = NetworkBool.op_Implicit(false);
						GameManager.Rpc_BroadcastFollowSound(((SimulationBehaviour)behaviour).Runner, NetworkString<_16>.op_Implicit("BeastAwakening"), ((Component)specificNewPrimaryRole.PlayerController).transform.position, 50f, 0.8f);
					}
					Traverse.Create((object)specificNewPrimaryRole.PlayerController).Field<ParticleSystem>("smokeParticleSystem").Value.Play();
					PlayerCustom player = PlayerCustomRegistry.GetPlayer(PlayerController.Local.LocalCameraHandler.PovPlayer.Ref);
					if (player.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Beast)
					{
						UIManager.ShowRedCenterMessage("NALES_UI_BEAST_UNLEASHED_BEAST", 0.5f, 5f, new List<object> { num });
					}
					else
					{
						UIManager.ShowRedCenterMessage("NALES_UI_BEAST_UNLEASHED_OTHERS", 0.5f, 4f);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("ColorIndexChanged error: " + ex));
			}
		}

		[Preserve]
		public static void BeastKillsChanged(Changed<BeastManager> changed)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				BeastManager behaviour = changed.Behaviour;
				if (NetworkBool.op_Implicit(behaviour.BeastActive) && ((SimulationBehaviour)behaviour).Runner.IsServer && behaviour.BeastKills >= behaviour.BeastKillsObjective)
				{
					PlayerCustom.Rpc_End_Game(((SimulationBehaviour)behaviour).Runner, PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Beast).Index);
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("ColorIndexChanged error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(GameState), "Spawned")]
	internal class GameStateActivateBeastPatch
	{
		private static void Postfix(GameState __instance)
		{
			try
			{
				StateMachine<EGameState> value = Traverse.Create((object)__instance).Field<StateMachine<EGameState>>("StateMachine").Value;
				GameState gameState = __instance;
				StateHooks<EGameState> obj = value[(EGameState)3];
				obj.onExit = (Action<EGameState>)Delegate.Combine(obj.onExit, (Action<EGameState>)delegate
				{
					//IL_0018: Unknown result type (might be due to invalid IL or missing references)
					//IL_0057: Unknown result type (might be due to invalid IL or missing references)
					if (((SimulationBehaviour)gameState).Runner.IsServer && NetworkBool.op_Implicit(GameManager.LightingManager.IsNight))
					{
						PlayerCustom beastCustom = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Beast);
						if (Object.op_Implicit((Object)(object)beastCustom) && !NetworkBool.op_Implicit(beastCustom.PlayerController.IsDead) && PlayerCustomRegistry.AllPlayers.All((PlayerCustom o) => o.Ref == beastCustom.Ref || NetworkBool.op_Implicit(o.PlayerController.IsDead) || NetworkBool.op_Implicit(o.BeastMark)))
						{
							BeastManager.Instance.ActivateBeast();
						}
					}
				});
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("GameStateActivateBeastPatch: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(LightingManager), "FixedUpdateNetwork")]
	internal class BeastNoCyclePatch
	{
		private static bool Prefix(LightingManager __instance)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (NetworkBool.op_Implicit(BeastManager.Instance.BeastActive) || NetworkBool.op_Implicit(DraftManager.Instance.Active))
				{
					return false;
				}
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("BeastNoCyclePatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(Effect), "Init")]
	internal class BeastReducedNegativeEffectsDurationPatch
	{
		private static bool Prefix(PlayerRef targetPlayer, Effect __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerController player = PlayerRegistry.GetPlayer(targetPlayer);
				PlayerCustom.ApplyEffectToPlayer(player, __instance, ((SimulationBehaviour)__instance).Runner);
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("BeastReducedNegativeEffectsDurationPatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(NetworkRunnerHandler), "StartSession")]
	internal class StartSessionPatch
	{
		private static void Prefix(ref int playerCount)
		{
			try
			{
				playerCount = 15;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("CreateGamePatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerRegistry), "GetAvailable")]
	internal class PlayerRegistryPatch
	{
		private static bool Prefix(PlayerRegistry __instance, ref bool __result, out byte index)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				NetworkDictionary<PlayerRef, PlayerController> value = Traverse.Create((object)__instance).Property<NetworkDictionary<PlayerRef, PlayerController>>("ObjectByRef", (object[])null).Value;
				if (value.Count == 0)
				{
					index = 0;
					__result = true;
					return false;
				}
				if (value.Count == 15)
				{
					index = 0;
					__result = false;
					return false;
				}
				byte[] array = ((IEnumerable<KeyValuePair<PlayerRef, PlayerController>>)(object)value).OrderBy(delegate(KeyValuePair<PlayerRef, PlayerController> kvp)
				{
					KeyValuePair<PlayerRef, PlayerController> keyValuePair2 = kvp;
					return keyValuePair2.Value.Index;
				}).Select(delegate(KeyValuePair<PlayerRef, PlayerController> kvp)
				{
					KeyValuePair<PlayerRef, PlayerController> keyValuePair = kvp;
					return keyValuePair.Value.Index;
				}).ToArray();
				for (int i = 0; i < array.Length - 1; i++)
				{
					if (array[i + 1] > array[i] + 1)
					{
						index = (byte)(array[i] + 1);
						__result = true;
						return false;
					}
				}
				index = (byte)(array[^1] + 1);
				__result = true;
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("PlayerRegistryPatch error: " + ex));
				index = 0;
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(GameUI), "UpdatePlayerCount")]
	internal class UpdatePlayerCountPatch
	{
		private static bool Prefix(int count, GameUI __instance)
		{
			try
			{
				((TMP_Text)Traverse.Create((object)__instance).Field<TextMeshProUGUI>("playerCount").Value).text = count + "/15";
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("UpdatePlayerCountPatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(ColorManager), "Awake")]
	internal class ColorManagerPatch
	{
		private static void Postfix(ColorManager __instance)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				List<Texture> list = Traverse.Create((object)__instance).Field<Texture[]>("villagerTextures").Value.ToList();
				List<Color> list2 = Traverse.Create((object)__instance).Field<Color[]>("colors").Value.ToList();
				list.Add(list[0]);
				list.Add(list[1]);
				list.Add(list[2]);
				list2.Add(list2[0]);
				list2.Add(list2[1]);
				list2.Add(list2[2]);
				Traverse.Create((object)__instance).Field("villagerTextures").SetValue((object)list.ToArray());
				Traverse.Create((object)__instance).Field("colors").SetValue((object)list2.ToArray());
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("ColorManagerPatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(GameManager), "GetSpawnPosition")]
	internal class SpawnPositionPatch
	{
		private static bool Prefix(PlayerController playerController, GameManager __instance, ref Vector3 __result)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				float num = 24f;
				float num2 = (float)(int)playerController.Index * num;
				Vector3 val = Quaternion.Euler(0f, num2, 0f) * Vector3.forward * Traverse.Create((object)__instance).Field<float>("radius").Value;
				__result = Traverse.Create((object)__instance).Field<Transform[]>("mapSpawns").Value[__instance.MapID - 1].position + val;
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("SpawnPositionPatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(LocalCameraHandler), "UpdateAnchorOffset")]
	internal class TinyEffectLocalCameraHandlerPatch
	{
		private static void Postfix(LocalCameraHandler __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((int)GameManager.LocalGameState == 0 || !((Object)(object)__instance.PovPlayer != (Object)null) || NetworkBool.op_Implicit(__instance.PovPlayer.IsDead))
				{
					return;
				}
				PlayerCustom player = PlayerCustomRegistry.GetPlayer(__instance.PovPlayer.Ref);
				Traverse<bool> val = Traverse.Create((object)__instance).Field<bool>("_giant");
				if (val.Value != NetworkBool.op_Implicit(player.Tiny) || (player.SecondaryRole == PlayerCustom.PlayerSecondaryRole.BothAstral && val.Value != NetworkBool.op_Implicit(player.SecondaryRolePowerActive)))
				{
					Transform value = Traverse.Create((object)__instance).Field<Transform>("localCameraAnchorPoint").Value;
					int value2 = Traverse.Create((object)__instance).Field<int>("_movementStatus").Value;
					Traverse<bool> val2 = Traverse.Create((object)__instance).Field<bool>("_isWolf");
					float value3 = Traverse.Create((object)__instance).Field<float>("_baseCameraOffset").Value;
					int movementAction = __instance.PovPlayer.MovementAction;
					bool flag = NetworkBool.op_Implicit(__instance.PovPlayer.IsWolf);
					bool flag2 = NetworkBool.op_Implicit(__instance.PovPlayer.PlayerEffectManager.Giant);
					bool flag3 = NetworkBool.op_Implicit(player.Tiny);
					bool flag4 = player.SecondaryRole == PlayerCustom.PlayerSecondaryRole.BothAstral && NetworkBool.op_Implicit(player.SecondaryRolePowerActive);
					float num = ((movementAction == 1) ? (value3 - 0.5f) : value3);
					if (flag)
					{
						num = ((!flag3) ? (num + 0.25f) : ((movementAction == 1) ? 0.35f : 0.5f));
					}
					else if (flag2)
					{
						num = ((movementAction == 1) ? 7.2f : 10.2f);
					}
					else if (flag3)
					{
						num = ((movementAction == 1) ? 0.09f : 0.12f);
					}
					else if (flag4)
					{
						num = 10f;
					}
					Vector3 localPosition = value.localPosition;
					((Vector3)(ref localPosition))..ctor(localPosition.x, num, localPosition.z);
					value.localPosition = localPosition;
					value2 = movementAction;
					val2.Value = flag;
					val.Value = flag2 || flag3 || flag4;
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("TinyEffectLocalCameraHandlerPatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerController), "UpdateCameraAnchorOffset")]
	internal class CameraAnchorPatch
	{
		private static void Postfix(PlayerController __instance)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: 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_00b8: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerCustom player = PlayerCustomRegistry.GetPlayer(__instance.Ref);
				if (player.SecondaryRole == PlayerCustom.PlayerSecondaryRole.BothAstral && NetworkBool.op_Implicit(player.SecondaryRolePowerActive))
				{
					float num = 10f;
					Transform value = Traverse.Create((object)__instance).Field<Transform>("cameraAnchorPoint").Value;
					Vector3 localPosition = value.localPosition;
					((Vector3)(ref localPosition))..ctor(localPosition.x, num, localPosition.z);
					value.localPosition = localPosition;
				}
				else if (NetworkBool.op_Implicit(player.Tiny))
				{
					float num2 = ((__instance.MovementAction == 1) ? 0.09f : 0.12f);
					Transform value2 = Traverse.Create((object)__instance).Field<Transform>("cameraAnchorPoint").Value;
					Vector3 localPosition2 = value2.localPosition;
					((Vector3)(ref localPosition2))..ctor(localPosition2.x, num2, localPosition2.z);
					value2.localPosition = localPosition2;
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("CameraAnchorPatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(LocalCameraHandler), "LateUpdate")]
	internal class LocalCameraHandlerLateUpdatePatch
	{
		private static bool Prefix(LocalCameraHandler __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (!((Behaviour)__instance.LocalCamera).enabled)
				{
					return false;
				}
				if (NetworkBool.op_Implicit(PlayerCustom.Local.Dying) || NetworkBool.op_Implicit(PlayerCustom.Local.Downed))
				{
					return false;
				}
				if (UIManager.GenericChoicePanel.Active)
				{
					return false;
				}
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("LocalCameraHandlerLateUpdatePatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(LocalCameraHandler), "SwitchPov")]
	internal class LocalCameraHandlerSwitchPoVPatch
	{
		private static void Postfix(LocalCameraHandler __instance)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerCustom player = PlayerCustomRegistry.GetPlayer(__instance.PovPlayer.Ref);
				if (!((Object)(object)player != (Object)null))
				{
					return;
				}
				player.UpdateAngelLightOnWolves();
				foreach (PlayerCustom allPlayer in PlayerCustomRegistry.AllPlayers)
				{
					allPlayer.UpdateVisibility();
					allPlayer.UpdatePoacherMarkVisibility();
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("LocalCameraHandlerSwitchPoVPatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerController), "OnPlayerDataChanged")]
	internal class OnPlayerDataChangedColorPatch
	{
		private static void Postfix(Changed<PlayerController> changed)
		{
			//IL_005f: 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)
			try
			{
				PlayerController behaviour = changed.Behaviour;
				if (((SimulationBehaviour)behaviour).HasInputAuthority)
				{
					if (PlayerPrefs.HasKey("FavoriteColor"))
					{
						PlayerCustom.Rpc_Change_Color(((SimulationBehaviour)behaviour).Runner, behaviour.Index, PlayerPrefs.GetInt("FavoriteColor"));
					}
					else
					{
						PlayerCustom.Rpc_Change_Color(((SimulationBehaviour)behaviour).Runner, behaviour.Index, behaviour.Index);
					}
				}
				PlayerCustom player = PlayerCustomRegistry.GetPlayer(behaviour.Ref);
				if ((Object)(object)player != (Object)null)
				{
					player.UpdateColor();
				}
				if (((SimulationBehaviour)behaviour).Runner.IsServer)
				{
					UIManager.ModInstallationPanel.AddOrUpdatePlayer(behaviour.Ref);
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("OnPlayerDataChangedColorPatch error: " + ex));
			}
		}
	}
	[HarmonyPatch(typeof(PlayerEffectsManager), "GlowingChanged")]
	internal class GlowingChangedColorPatch
	{
		private static bool Prefix(Changed<PlayerEffectsManager> changed)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				PlayerEffectsManager behaviour = changed.Behaviour;
				PlayerController value = Traverse.Create((object)behaviour).Field<PlayerController>("_playerController").Value;
				PlayerCustom player = PlayerCustomRegistry.GetPlayer(value.Ref);
				SkinnedMeshRenderer value2 = Traverse.Create((object)value.PlayerEffectManager).Field<SkinnedMeshRenderer>("skinnedMeshRenderer").Value;
				Light value3 = Traverse.Create((object)value.PlayerEffectManager).Field<Light>("glowingLight").Value;
				if (NetworkBool.op_Implicit(behaviour.Glowing))
				{
					Color color = ColorManager.GetColor(player.ColorIndex);
					((Renderer)value2).material.SetColor(Shader.PropertyToID("_EmissionColor"), color * 3f);
					((Renderer)value2).material.EnableKeyword("_EMISSION");
					value3.color = color;
					((Behaviour)value3).enabled = true;
					return false;
				}
				((Renderer)value2).material.DisableKeyword("_EMISSION");
				((Behaviour)value3).enabled = false;
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("GlowingChangedColorPatch error: " + ex));
				return true;
			}
		}
	}
	public static class ColorPicker
	{
		public const int ColorsLength = 12;

		public const string FavoriteColorPlayerPref = "FavoriteColor";

		public static void NextColor()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			PlayerCustom player = PlayerCustomRegistry.GetPlayer(PlayerController.Local.Ref);
			if (player.ColorIndex >= 11)
			{
				PlayerCustom.Rpc_Change_Color(((SimulationBehaviour)player).Runner, player.Index, 0);
			}
			else
			{
				PlayerCustom.Rpc_Change_Color(((SimulationBehaviour)player).Runner, player.Index, player.ColorIndex + 1);
			}
		}

		public static void PreviousColor()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			PlayerCustom player = PlayerCustomRegistry.GetPlayer(PlayerController.Local.Ref);
			if (player.ColorIndex == 0)
			{
				PlayerCustom.Rpc_Change_Color(((SimulationBehaviour)player).Runner, player.Index, 11);
			}
			else
			{
				PlayerCustom.Rpc_Change_Color(((SimulationBehaviour)player).Runner, player.Index, player.ColorIndex - 1);
			}
		}
	}
	[NetworkBehaviourWeaved(20)]
	public class DraftManager : NetworkBehaviour
	{
		public enum DraftPlayerMainRole
		{
			Villager,
			Wolf,
			Solo,
			Traitor,
			Hunter,
			Alchemist
		}

		public const float TimeToChooseRolesSeconds = 20f;

		public List<PlayerCustom> Players = new List<PlayerCustom>();

		private int _remainingWolfPowersCount;

		private int _remainingSecondaryRolesCount;

		private List<DraftPlayerMainRole> _remainingMainRoles = new List<DraftPlayerMainRole>();

		private List<PlayerCustom.PlayerNewPrimaryRole> _remainingSoloRoles = new List<PlayerCustom.PlayerNewPrimaryRole>();

		private List<PlayerCustom.PlayerPrimaryRolePower> _remainingVillagerJobs = new List<PlayerCustom.PlayerPrimaryRolePower>();

		private List<PlayerCustom.PlayerPrimaryRolePower> _remainingWolfPowers = new List<PlayerCustom.PlayerPrimaryRolePower>();

		private List<PlayerCustom.PlayerSecondaryRole> _remainingSecondaryRoles = new List<PlayerCustom.PlayerSecondaryRole>();

		private List<int> _offeredSoloRoleOrPowerIndexes = new List<int>();

		private List<int> _offeredSecondaryRoleIndexes = new List<int>();

		public int CurrentPlayerPosition;

		public int MainRoleIndex;

		public int SelectedSoloRoleOrPowerIndex;

		public int SelectedSecondaryRoleIndex;

		[Networked(OnChanged = "ActiveChanged")]
		[NetworkedWeaved(0, 1)]
		public unsafe NetworkBool Active
		{
			get
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.Active. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)(*base.Ptr);
			}
			set
			{
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.Active. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr, value);
			}
		}

		[Networked]
		[NetworkedWeaved(1, 1)]
		public unsafe TickTimer CurrentPlayerTimer
		{
			get
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.CurrentPlayerTimer. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (TickTimer)base.Ptr[1];
			}
			set
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing PlayerCustom.CurrentPlayerTimer. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr + 1, value);
			}
		}

		public static DraftManager Instance { get; private set; }

		public PlayerCustom CurrentPlayer => Players[CurrentPlayerPosition - 1];

		public void Init()
		{
			Players.Clear();
			_remainingMainRoles.Clear();
			_remainingSoloRoles.Clear();
			_remainingVillagerJobs.Clear();
			_remainingWolfPowers.Clear();
			_remainingSecondaryRoles.Clear();
			_offeredSoloRoleOrPowerIndexes.Clear();
			_offeredSecondaryRoleIndexes.Clear();
			_remainingWolfPowersCount = Plugin.CustomConfig.WolfPowersCount;
			_remainingSecondaryRolesCount = Plugin.CustomConfig.SecondaryRolesCount;
			Players = PlayerCustomRegistry.AllPlayers.ToList();
			Players.Shuffle();
			foreach (PlayerCustom player in Players)
			{
				player.DraftPosition = Players.IndexOf(player) + 1;
				player.PlayerController.Role = (PlayerRole)0;
			}
			CurrentPlayerPosition = 0;
			_remainingSoloRoles = (from o in Plugin.CustomConfig.SoloRoleActive
				where o.Key != 0 && o.Key != PlayerCustom.PlayerNewPrimaryRole.Traitor && o.Value
				select o.Key).ToList();
			if (GameManager.Instance.WolvesCount < 2)
			{
				_remainingSoloRoles.Remove(PlayerCustom.PlayerNewPrimaryRole.Lover);
			}
			List<PlayerCustom.PlayerNewPrimaryRole> list = new List<PlayerCustom.PlayerNewPrimaryRole>();
			foreach (PlayerCustom.PlayerNewPrimaryRole remainingSoloRole in _remainingSoloRoles)
			{
				if (Random.value < BalancingValues.DraftModeChanceToRemoveSoloRole(remainingSoloRole))
				{
					list.Add(remainingSoloRole);
				}
			}
			foreach (PlayerCustom.PlayerNewPrimaryRole item in list)
			{
				_remainingSoloRoles.Remove(item);
			}
			_remainingWolfPowers = (from o in Plugin.CustomConfig.PrimaryRolePowerActive
				where o.Value && !PlayerCustom.IsPrimaryRolePowerForVillagers(o.Key) && !PlayerCustom.IsPrimaryRolePowerDisabled(o.Key)
				select o.Key).ToList();
			List<PlayerCustom.PlayerPrimaryRolePower> list2 = (from o in Plugin.CustomConfig.PrimaryRolePowerActive
				where o.Value && PlayerCustom.IsPrimaryRolePowerForVillagers(o.Key) && !PlayerCustom.IsPrimaryRolePowerDisabled(o.Key)
				select o.Key).ToList();
			_remainingVillagerJobs = new List<PlayerCustom.PlayerPrimaryRolePower>();
			foreach (PlayerCustom.PlayerPrimaryRolePower item2 in list2)
			{
				if (PlayerCustom.IsPrimaryRolePowerAvailable(item2))
				{
					int villagerJobChancePonderation = BalancingValues.GetVillagerJobChancePonderation(item2);
					for (int i = 0; i < villagerJobChancePonderation; i++)
					{
						_remainingVillagerJobs.Add(item2);
					}
				}
			}
			_remainingSecondaryRoles = (from o in Plugin.CustomConfig.SecondaryRoleActive
				where o.Value && o.Key != PlayerCustom.PlayerSecondaryRole.BothTelepath
				select o.Key).ToList();
			for (int j = 0; j < GameManager.Instance.WolvesCount; j++)
			{
				_remainingMainRoles.Add(DraftPlayerMainRole.Wolf);
			}
			for (int k = 0; k < GameManager.Instance.HuntersCount; k++)
			{
				_remainingMainRoles.Add(DraftPlayerMainRole.Hunter);
			}
			for (int l = 0; l < GameManager.Instance.AlchemistsCount; l++)
			{
				_remainingMainRoles.Add(DraftPlayerMainRole.Alchemist);
			}
			for (int m = 0; m < Plugin.CustomConfig.TraitorsCount; m++)
			{
				_remainingMainRoles.Add(DraftPlayerMainRole.Traitor);
			}
			for (int n = 0; n < Math.Min(Plugin.CustomConfig.SoloRolesCount, _remainingSoloRoles.Count); n++)
			{
				_remainingMainRoles.Add(DraftPlayerMainRole.Solo);
			}
			for (int num = _remainingMainRoles.Count; num < PlayerRegistry.Count; num++)
			{
				_remainingMainRoles.Add(DraftPlayerMainRole.Villager);
			}
			LogRemainingMainRoles(_remainingMainRoles);
			if (_remainingMainRoles.Any((DraftPlayerMainRole o) => o == DraftPlayerMainRole.Solo) && _remainingMainRoles.Any((DraftPlayerMainRole o) => o == DraftPlayerMainRole.Villager) && _remainingMainRoles.Any((DraftPlayerMainRole o) => o == DraftPlayerMainRole.Wolf))
			{
				bool flag = false;
				while (!flag)
				{
					LycansUtility.DebugLog("Shuffle main roles...");
					_remainingMainRoles.Shuffle();
					int num2 = _remainingMainRoles.LastIndexOf(DraftPlayerMainRole.Solo);
					List<DraftPlayerMainRole> list3 = _remainingMainRoles.Skip(num2 + 1).ToList();
					LogRemainingMainRoles(list3);
					if (list3.Any((DraftPlayerMainRole o) => o == DraftPlayerMainRole.Villager) && list3.Any((DraftPlayerMainRole o) => o == DraftPlayerMainRole.Wolf))
					{
						flag = true;
					}
				}
			}
			else
			{
				_remainingMainRoles.Shuffle();
			}
			LycansUtility.DebugLog("Main roles are now valid");
			LogRemainingMainRoles(_remainingMainRoles);
			NextPlayer();
		}

		private void LogRemainingMainRoles(List<DraftPlayerMainRole> mainRoles)
		{
			LycansUtility.DebugLog("----- Showing remaining roles -----");
			foreach (DraftPlayerMainRole mainRole in mainRoles)
			{
				LycansUtility.DebugLog(mainRole.ToString());
			}
			LycansUtility.DebugLog("----- End showing roles ------");
		}

		private void NextPlayer()
		{
			//IL_0ba7: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_062c: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_0823: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
			_offeredSoloRoleOrPowerIndexes.Clear();
			_offeredSecondaryRoleIndexes.Clear();
			CurrentPlayerPosition++;
			if (PlayerCustomRegistry.Any((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Lover))
			{
				_remainingSoloRoles.RemoveAll((PlayerCustom.PlayerNewPrimaryRole o) => o == PlayerCustom.PlayerNewPrimaryRole.Agent);
			}
			if (PlayerCustomRegistry.Any((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Agent))
			{
				_remainingSoloRoles.RemoveAll((PlayerCustom.PlayerNewPrimaryRole o) => o == PlayerCustom.PlayerNewPrimaryRole.Lover);
			}
			DraftPlayerMainRole mainRole = _remainingMainRoles.First();
			if (PlayerCustomRegistry.CountWhere((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Agent) == 1 && mainRole == DraftPlayerMainRole.Villager)
			{
				mainRole = DraftPlayerMainRole.Solo;
				_offeredSoloRoleOrPowerIndexes.Add(3);
				List<PlayerCustom.PlayerSecondaryRole> list = _remainingSecondaryRoles.Where((PlayerCustom.PlayerSecondaryRole o) => PlayerCustom.GetAvailableSecondaryRoles((PlayerRole)0, PlayerCustom.PlayerNewPrimaryRole.Agent, PlayerCustom.PlayerPrimaryRolePower.None).Contains(o)).ToList();
				if (list.Any())
				{
					list = CollectionsUtil.Grab<PlayerCustom.PlayerSecondaryRole>(list, Math.Min(3, list.Count)).ToList();
					if (list.Count >= 1)
					{
						_offeredSecondaryRoleIndexes.Add((int)list[0]);
					}
					if (list.Count >= 2)
					{
						_offeredSecondaryRoleIndexes.Add((int)list[1]);
					}
					if (list.Count >= 3)
					{
						_offeredSecondaryRoleIndexes.Add((int)list[2]);
					}
				}
				_remainingMainRoles.Remove(DraftPlayerMainRole.Villager);
			}
			else if (PlayerCustomRegistry.CountWhere((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Lover) == 1 && mainRole == DraftPlayerMainRole.Wolf)
			{
				mainRole = DraftPlayerMainRole.Solo;
				_offeredSoloRoleOrPowerIndexes.Add(6);
				_remainingMainRoles.Remove(DraftPlayerMainRole.Wolf);
			}
			else
			{
				switch (mainRole)
				{
				case DraftPlayerMainRole.Villager:
				{
					if (_remainingVillagerJobs.Count <= 0 || !(Random.value * 100f < (float)Plugin.CustomConfig.VillagerPowersChance))
					{
						break;
					}
					List<PlayerCustom.PlayerPrimaryRolePower> list4 = new List<PlayerCustom.PlayerPrimaryRolePower>();
					list4.AddRange(_remainingVillagerJobs);
					PlayerCustom.PlayerPrimaryRolePower firstJob = CollectionsUtil.Grab<PlayerCustom.PlayerPrimaryRolePower>(list4, 1).First();
					_offeredSoloRoleOrPowerIndexes.Add((int)firstJob);
					list4.RemoveAll((PlayerCustom.PlayerPrimaryRolePower o) => o == firstJob);
					if (list4.Count > 0)
					{
						PlayerCustom.PlayerPrimaryRolePower secondJob = CollectionsUtil.Grab<PlayerCustom.PlayerPrimaryRolePower>(list4, 1).First();
						_offeredSoloRoleOrPowerIndexes.Add((int)secondJob);
						list4.RemoveAll((PlayerCustom.PlayerPrimaryRolePower o) => o == secondJob);
						if (list4.Count > 0)
						{
							PlayerCustom.PlayerPrimaryRolePower item = CollectionsUtil.Grab<PlayerCustom.PlayerPrimaryRolePower>(list4, 1).First();
							_offeredSoloRoleOrPowerIndexes.Add((int)item);
						}
					}
					break;
				}
				case DraftPlayerMainRole.Wolf:
				case DraftPlayerMainRole.Traitor:
					if (_remainingWolfPowersCount > 0)
					{
						List<PlayerCustom.PlayerPrimaryRolePower> list3 = _remainingWolfPowers.Where((PlayerCustom.PlayerPrimaryRolePower o) => mainRole == DraftPlayerMainRole.Wolf || PlayerCustom.IsWolfPowerAvailableForTraitor(o)).ToList();
						if (list3.Any())
						{
							list3 = CollectionsUtil.Grab<PlayerCustom.PlayerPrimaryRolePower>(list3, Math.Min(3, list3.Count)).ToList();
						}
						if (list3.Count >= 1)
						{
							_offeredSoloRoleOrPowerIndexes.Add((int)list3[0]);
						}
						if (list3.Count >= 2)
						{
							_offeredSoloRoleOrPowerIndexes.Add((int)list3[1]);
						}
						if (list3.Count >= 3)
						{
							_offeredSoloRoleOrPowerIndexes.Add((int)list3[2]);
						}
					}
					break;
				case DraftPlayerMainRole.Solo:
					if (_remainingSoloRoles.Any())
					{
						List<PlayerCustom.PlayerNewPrimaryRole> list2 = CollectionsUtil.Grab<PlayerCustom.PlayerNewPrimaryRole>(_remainingSoloRoles, Math.Min(3, _remainingSoloRoles.Count)).ToList();
						if (list2.Count >= 1)
						{
							_offeredSoloRoleOrPowerIndexes.Add((int)list2[0]);
						}
						if (list2.Count >= 2)
						{
							_offeredSoloRoleOrPowerIndexes.Add((int)list2[1]);
						}
						if (list2.Count >= 3)
						{
							_offeredSoloRoleOrPowerIndexes.Add((int)list2[2]);
						}
					}
					break;
				}
				if (_remainingSecondaryRolesCount > 0)
				{
					PlayerRole basePrimaryRole;
					List<PlayerCustom.PlayerSecondaryRole> secondaryRoles;
					switch (mainRole)
					{
					case DraftPlayerMainRole.Villager:
						basePrimaryRole = (PlayerRole)0;
						secondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, PlayerCustom.PlayerPrimaryRolePower.None);
						break;
					case DraftPlayerMainRole.Wolf:
						basePrimaryRole = (PlayerRole)1;
						secondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, PlayerCustom.PlayerPrimaryRolePower.None);
						break;
					case DraftPlayerMainRole.Traitor:
						basePrimaryRole = (PlayerRole)0;
						secondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.Traitor, PlayerCustom.PlayerPrimaryRolePower.None);
						secondaryRoles.RemoveAll((PlayerCustom.PlayerSecondaryRole o) => PlayerCustom.IsSecondaryRoleDisabledForTraitor(o));
						break;
					case DraftPlayerMainRole.Hunter:
						basePrimaryRole = (PlayerRole)2;
						secondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, PlayerCustom.PlayerPrimaryRolePower.None);
						break;
					case DraftPlayerMainRole.Alchemist:
						basePrimaryRole = (PlayerRole)3;
						secondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, PlayerCustom.PlayerPrimaryRolePower.None);
						break;
					case DraftPlayerMainRole.Solo:
						basePrimaryRole = (PlayerRole)0;
						secondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, PlayerCustom.PlayerPrimaryRolePower.None);
						break;
					default:
						throw new ArgumentOutOfRangeException();
					}
					if (_offeredSoloRoleOrPowerIndexes.Count > 0)
					{
						DraftPlayerMainRole draftPlayerMainRole = mainRole;
						DraftPlayerMainRole draftPlayerMainRole2 = draftPlayerMainRole;
						if (draftPlayerMainRole2 == DraftPlayerMainRole.Solo)
						{
							List<PlayerCustom.PlayerNewPrimaryRole> list5 = new List<PlayerCustom.PlayerNewPrimaryRole>();
							if (_offeredSoloRoleOrPowerIndexes.Count >= 1)
							{
								list5.Add((PlayerCustom.PlayerNewPrimaryRole)_offeredSoloRoleOrPowerIndexes[0]);
							}
							if (_offeredSoloRoleOrPowerIndexes.Count >= 2)
							{
								list5.Add((PlayerCustom.PlayerNewPrimaryRole)_offeredSoloRoleOrPowerIndexes[1]);
							}
							if (_offeredSoloRoleOrPowerIndexes.Count >= 3)
							{
								list5.Add((PlayerCustom.PlayerNewPrimaryRole)_offeredSoloRoleOrPowerIndexes[2]);
							}
							List<PlayerCustom.PlayerSecondaryRole> secondaryRolesAvailableForAtLeastOneSoloRoles = new List<PlayerCustom.PlayerSecondaryRole>();
							foreach (PlayerCustom.PlayerNewPrimaryRole item2 in list5)
							{
								secondaryRolesAvailableForAtLeastOneSoloRoles.AddRange(PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, item2, PlayerCustom.PlayerPrimaryRolePower.None));
							}
							secondaryRoles.RemoveAll((PlayerCustom.PlayerSecondaryRole o) => !secondaryRolesAvailableForAtLeastOneSoloRoles.Contains(o));
						}
						else
						{
							List<PlayerCustom.PlayerPrimaryRolePower> list6 = new List<PlayerCustom.PlayerPrimaryRolePower>();
							if (_offeredSoloRoleOrPowerIndexes.Count >= 1)
							{
								list6.Add((PlayerCustom.PlayerPrimaryRolePower)_offeredSoloRoleOrPowerIndexes[0]);
							}
							if (_offeredSoloRoleOrPowerIndexes.Count >= 2)
							{
								list6.Add((PlayerCustom.PlayerPrimaryRolePower)_offeredSoloRoleOrPowerIndexes[1]);
							}
							if (_offeredSoloRoleOrPowerIndexes.Count >= 3)
							{
								list6.Add((PlayerCustom.PlayerPrimaryRolePower)_offeredSoloRoleOrPowerIndexes[2]);
							}
							List<PlayerCustom.PlayerSecondaryRole> secondaryRolesAvailableForAtLeastOnePower = new List<PlayerCustom.PlayerSecondaryRole>();
							foreach (PlayerCustom.PlayerPrimaryRolePower item3 in list6)
							{
								secondaryRolesAvailableForAtLeastOnePower.AddRange(PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, item3));
							}
							secondaryRoles.RemoveAll((PlayerCustom.PlayerSecondaryRole o) => !secondaryRolesAvailableForAtLeastOnePower.Contains(o));
						}
					}
					secondaryRoles = _remainingSecondaryRoles.Where((PlayerCustom.PlayerSecondaryRole o) => secondaryRoles.Contains(o)).ToList();
					if (secondaryRoles.Any())
					{
						for (int i = 0; i < 10; i++)
						{
							bool flag = true;
							_offeredSecondaryRoleIndexes.Clear();
							secondaryRoles = CollectionsUtil.Grab<PlayerCustom.PlayerSecondaryRole>(secondaryRoles, Math.Min(3, secondaryRoles.Count)).ToList();
							if (secondaryRoles.Count >= 1)
							{
								_offeredSecondaryRoleIndexes.Add((int)secondaryRoles[0]);
							}
							if (secondaryRoles.Count >= 2)
							{
								_offeredSecondaryRoleIndexes.Add((int)secondaryRoles[1]);
							}
							if (secondaryRoles.Count >= 3)
							{
								_offeredSecondaryRoleIndexes.Add((int)secondaryRoles[2]);
							}
							DraftPlayerMainRole draftPlayerMainRole3 = mainRole;
							DraftPlayerMainRole draftPlayerMainRole4 = draftPlayerMainRole3;
							if (draftPlayerMainRole4 == DraftPlayerMainRole.Solo)
							{
								List<PlayerCustom.PlayerNewPrimaryRole> list7 = new List<PlayerCustom.PlayerNewPrimaryRole>();
								if (_offeredSoloRoleOrPowerIndexes.Count >= 1)
								{
									list7.Add((PlayerCustom.PlayerNewPrimaryRole)_offeredSoloRoleOrPowerIndexes[0]);
								}
								if (_offeredSoloRoleOrPowerIndexes.Count >= 2)
								{
									list7.Add((PlayerCustom.PlayerNewPrimaryRole)_offeredSoloRoleOrPowerIndexes[1]);
								}
								if (_offeredSoloRoleOrPowerIndexes.Count >= 3)
								{
									list7.Add((PlayerCustom.PlayerNewPrimaryRole)_offeredSoloRoleOrPowerIndexes[2]);
								}
								foreach (PlayerCustom.PlayerNewPrimaryRole item4 in list7)
								{
									List<PlayerCustom.PlayerSecondaryRole> availableSecondaryRoles = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, item4, PlayerCustom.PlayerPrimaryRolePower.None);
									if (!availableSecondaryRoles.Intersect(secondaryRoles).Any())
									{
										flag = false;
										break;
									}
								}
							}
							else
							{
								List<PlayerCustom.PlayerPrimaryRolePower> list8 = new List<PlayerCustom.PlayerPrimaryRolePower>();
								if (_offeredSoloRoleOrPowerIndexes.Count >= 1)
								{
									list8.Add((PlayerCustom.PlayerPrimaryRolePower)_offeredSoloRoleOrPowerIndexes[0]);
								}
								if (_offeredSoloRoleOrPowerIndexes.Count >= 2)
								{
									list8.Add((PlayerCustom.PlayerPrimaryRolePower)_offeredSoloRoleOrPowerIndexes[1]);
								}
								if (_offeredSoloRoleOrPowerIndexes.Count >= 3)
								{
									list8.Add((PlayerCustom.PlayerPrimaryRolePower)_offeredSoloRoleOrPowerIndexes[2]);
								}
								foreach (PlayerCustom.PlayerPrimaryRolePower item5 in list8)
								{
									List<PlayerCustom.PlayerSecondaryRole> availableSecondaryRoles2 = PlayerCustom.GetAvailableSecondaryRoles(basePrimaryRole, PlayerCustom.PlayerNewPrimaryRole.None, item5);
									if (!availableSecondaryRoles2.Intersect(secondaryRoles).Any())
									{
										flag = false;
										break;
									}
								}
							}
							if (flag)
							{
								break;
							}
						}
					}
				}
				_remainingMainRoles.Remove(mainRole);
			}
			CurrentPlayerTimer = TickTimer.CreateFromSeconds(((SimulationBehaviour)this).Runner, 20f);
			Rpc_New_Player(((SimulationBehaviour)this).Runner, CurrentPlayerPosition, CurrentPlayer.Index, (int)mainRole, (_offeredSoloRoleOrPowerIndexes.Count >= 1) ? _offeredSoloRoleOrPowerIndexes[0] : (-1), (_offeredSoloRoleOrPowerIndexes.Count >= 2) ? _offeredSoloRoleOrPowerIndexes[1] : (-1), (_offeredSoloRoleOrPowerIndexes.Count >= 3) ? _offeredSoloRoleOrPowerIndexes[2] : (-1), (_offeredSecondaryRoleIndexes.Count >= 1) ? _offeredSecondaryRoleIndexes[0] : (-1), (_offeredSecondaryRoleIndexes.Count >= 2) ? _offeredSecondaryRoleIndexes[1] : (-1), (_offeredSecondaryRoleIndexes.Count >= 3) ? _offeredSecondaryRoleIndexes[2] : (-1));
		}

		public override void Spawned()
		{
			((NetworkBehaviour)this).Spawned();
			Instance = this;
		}

		public override void Despawned(NetworkRunner runner, bool hasState)
		{
			((NetworkBehaviour)this).Despawned(runner, hasState);
			Instance = null;
		}

		public override void FixedUpdateNetwork()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkBool.op_Implicit(Active))
			{
				return;
			}
			TickTimer currentPlayerTimer;
			if (((SimulationBehaviour)this).Runner.IsServer)
			{
				currentPlayerTimer = CurrentPlayerTimer;
				if (((TickTimer)(ref currentPlayerTimer)).Expired(((SimulationBehaviour)this).Runner))
				{
					TimerExpired();
				}
			}
			if (((SimulationBehaviour)this).Runner.IsServer && PlayerRef.op_Implicit(CurrentPlayer.Ref) >= 1000)
			{
				currentPlayerTimer = CurrentPlayerTimer;
				if (((TickTimer)(ref currentPlayerTimer)).RemainingTime(((SimulationBehaviour)this).Runner) <= 19f)
				{
					TimerExpired();
				}
			}
		}

		private void TimerExpired()
		{
			FinishChoice();
		}

		public void FinishChoice()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_042a: Unknown result type (might be due to invalid IL or missing references)
			CurrentPlayerTimer = TickTimer.None;
			PlayerCustom currentPlayer = CurrentPlayer;
			DraftPlayerMainRole mainRoleIndex = (DraftPlayerMainRole)MainRoleIndex;
			switch (mainRoleIndex)
			{
			case DraftPlayerMainRole.Villager:
				currentPlayer.PlayerController.Role = (PlayerRole)0;
				break;
			case DraftPlayerMainRole.Hunter:
				currentPlayer.PlayerController.Role = (PlayerRole)2;
				break;
			case DraftPlayerMainRole.Alchemist:
				currentPlayer.PlayerController.Role = (PlayerRole)3;
				break;
			case DraftPlayerMainRole.Wolf:
				currentPlayer.PlayerController.Role = (PlayerRole)1;
				break;
			case DraftPlayerMainRole.Traitor:
				currentPlayer.PlayerController.Role = (PlayerRole)0;
				currentPlayer.GiveNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Traitor);
				break;
			case DraftPlayerMainRole.Solo:
				currentPlayer.PlayerController.Role = (PlayerRole)0;
				break;
			}
			DraftPlayerMainRole draftPlayerMainRole = mainRoleIndex;
			DraftPlayerMainRole draftPlayerMainRole2 = draftPlayerMainRole;
			if (draftPlayerMainRole2 == DraftPlayerMainRole.Solo)
			{
				if (SelectedSoloRoleOrPowerIndex != -1)
				{
					PlayerCustom.PlayerNewPrimaryRole selectedSoloRoleOrPowerIndex = (PlayerCustom.PlayerNewPrimaryRole)SelectedSoloRoleOrPowerIndex;
					_remainingSoloRoles.Remove(selectedSoloRoleOrPowerIndex);
					currentPlayer.GiveNewPrimaryRole(selectedSoloRoleOrPowerIndex);
				}
				else
				{
					int num = CollectionsUtil.Grab<int>(_offeredSoloRoleOrPowerIndexes, 1).First();
					PlayerCustom.PlayerNewPrimaryRole playerNewPrimaryRole = (PlayerCustom.PlayerNewPrimaryRole)num;
					_remainingSoloRoles.Remove(playerNewPrimaryRole);
					currentPlayer.GiveNewPrimaryRole(playerNewPrimaryRole);
				}
			}
			else if (_offeredSoloRoleOrPowerIndexes.Any())
			{
				if (SelectedSoloRoleOrPowerIndex != -1)
				{
					PlayerCustom.PlayerPrimaryRolePower selectedSoloRoleOrPowerIndex2 = (PlayerCustom.PlayerPrimaryRolePower)SelectedSoloRoleOrPowerIndex;
					_remainingVillagerJobs.Remove(selectedSoloRoleOrPowerIndex2);
					_remainingWolfPowers.Remove(selectedSoloRoleOrPowerIndex2);
					currentPlayer.GivePrimaryRolePower(selectedSoloRoleOrPowerIndex2);
				}
				else
				{
					int num2 = CollectionsUtil.Grab<int>(_offeredSoloRoleOrPowerIndexes, 1).First();
					PlayerCustom.PlayerPrimaryRolePower playerPrimaryRolePower = (PlayerCustom.PlayerPrimaryRolePower)num2;
					_remainingVillagerJobs.Remove(playerPrimaryRolePower);
					_remainingWolfPowers.Remove(playerPrimaryRolePower);
					currentPlayer.GivePrimaryRolePower(playerPrimaryRolePower);
				}
				if (mainRoleIndex == DraftPlayerMainRole.Wolf || mainRoleIndex == DraftPlayerMainRole.Traitor)
				{
					_remainingWolfPowersCount--;
				}
			}
			else if (currentPlayer.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.None)
			{
				currentPlayer.GiveNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.None);
			}
			if (currentPlayer.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Lover)
			{
				currentPlayer.GiveSecondaryRole(PlayerCustom.PlayerSecondaryRole.BothTelepath);
			}
			else if (_offeredSecondaryRoleIndexes.Any())
			{
				if (SelectedSecondaryRoleIndex != -1)
				{
					PlayerCustom.PlayerSecondaryRole selectedSecondaryRoleIndex = (PlayerC