Decompiled source of LycansNewRoles v0.43.0

plugins/LycansNewRoles/LycansNewRoles.dll

Decompiled a week 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.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")]
[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.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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Invalid comparison between Unknown and I4
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Invalid comparison between Unknown and I4
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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)
			try
			{
				if (!NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode))
				{
					return;
				}
				if ((int)GameManager.LocalGameState == 2 && (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 ((int)GameManager.LocalGameState != 2 || 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_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: 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 = Object.FindObjectsOfType<Loot>().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_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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);
					PlayerController player3 = PlayerRegistry.GetPlayer(player.Ref);
					PlayerController player4 = PlayerRegistry.GetPlayer(player2.Ref);
					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>
					{
						player3.PlayerData.Username,
						player4.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 const float EffectDurationStunned = 5f;

		public const float EffectDurationChasing = 1.25f;

		public const float EffectDurationSprinting = 5f;

		public const float EffectDurationReverting = 20f;

		public const float EffectDurationDisoriented = 3f;

		public const float EffectDurationInfected = 8f;

		public const float EffectDurationStealthing = 6f;

		public const float EffectDurationUndetected = 15f;

		public const float EffectDurationInnocent = 6f;

		public const float EffectDurationMurderer = 6f;

		public const float EffectDurationStarvationActive = 150f;

		public const float EffectDurationShouting = 7f;

		public const float EffectDurationBlind = 3.5f;

		public const float EffectDurationIllusion = 25f;

		public const float EffectDurationFear = 4f;

		public const float EffectDurationAntiMagic = 15f;

		public const float EffectDurationDisguised = 300f;

		public const float EffectDurationPoison = 300f;

		public const float EffectDurationVillageIdiotWarning = 5f;

		public const float EffectDurationVillageIdiotHunger = 10f;

		public const float EffectDurationCannibalFull = 75f;

		public const float EffectDurationParalyzed = 10f;

		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 = 10f;

		public const float AgentEliminationRange = 2.5f;

		public const int AntiMageTransformEffectRadius = 20;

		public const float AntiMageFeedMultiplier = 0.5f;

		public const float CannibalEatDuration = 3f;

		public const float NecromancerResurrectDuration = 3f;

		public const int ShapeshifterIllusionCastTime = 2;

		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 PossessorPossessionCastTime = 0.5f;

		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 = 65f;

		public const float SpySpyingRange = 10f;

		public const float SpySpyingDuration = 1f;

		public const int ScientistGoal = 10000;

		public const float ScientistAnalysisPowerAtMinDistance = 60f;

		public const float ScientistAnalysisPowerAtMaxDistance = 15f;

		public const float ScientistAnalysisMultiplierForTransform = 10f;

		public const float ScientistAnalysisMultiplierForKill = 10f;

		public const float ScientistAnalysisMultiplierIfWolfVisible = 5f;

		public const float ScientistAnalysisMultiplierIfWolfVisibleButWounded = 0.4f;

		public const float ScientistAnalysisRangePeriodic = 40f;

		public const float ScientistAnalysisRangeTransform = 40f;

		public const float ScientistAnalysisRangeKill = 30f;

		public const float TrackerWolfSpeedMultiplier = 0.9f;

		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 = 25f;

		public const float WarlockWolfCurseDormantMinimumDuration = 25f;

		public const float WarlockWolfCurseDormantMaximumDuration = 75f;

		public const float TraitorSabotageDelayMultiplier = 1.75f;

		public const float AlcoholicPotionHealWolf = 0.45f;

		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 GamblerSecondKillChance = 0.33f;

		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 = 0.8f;

		public const float SherifKillRange = 2.5f;

		public const float SherifWolfHealthAfterBeingShot = 0.4f;

		public const float SprinterSprintingAdditionalHunger = 4f;

		public const float StealtherWolfDetectionRadiusMultiplier = 0.65f;

		public const float VillageIdiotHungerMultiplier = 0.7f;

		public const float MidasEffectValueMultiplier = 4f;

		public const float VampireEffectRadius = 30f;

		public const float VampireEffectCurrentPercentage = 0.035f;

		public const float TinyMovementSpeed = 0.6f;

		public const float HauntedMinimumDelayServer = 3f;

		public const float HauntedMaximumDelayServer = 8f;

		public const float HauntedHealthGainPercentage = 0.25f;

		public const float HauntedHealthLossPercentage = 0.2f;

		public const float HauntedHealthDoorRadius = 40f;

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

		public const int NearsightedFogEndDistance = 10;

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

		public const float AssassinRange = 2.5f;

		public const float SabotageObjectRaycastRange = 7f;

		public const float PoisonEffectHealthDecrease = 0.3f;

		public const float PoisonMoveSpeedMultiplier = 0.85f;

		public const float EternalNightDurationMultiplier = 1.25f;

		public const float EternalNightWolfHungerMultiplier = 0.75f;

		public const float PortalSabotageStayActiveTime = 120f;

		public const float PortalSabotageReactivateTime = 5f;

		public const float PlayerRaycastRange = 10f;

		public const float TrapSetupTime = 1f;

		public const float TrapDisarmTime = 4f;

		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, 1250f },
			{ 30, 100f },
			{ 40, 85f },
			{ 50, 70f },
			{ 60, 60f },
			{ 70, 50f },
			{ 80, 40f },
			{ 90, 30f },
			{ 100, 20f }
		};

		public const int FogBonusEndDistanceForWolfForm = 25;

		public static int? GetCastTimeForSecondaryRole(PlayerCustom.PlayerSecondaryRole role)
		{
			if (role == PlayerCustom.PlayerSecondaryRole.BothTeleporter)
			{
				return 3;
			}
			return null;
		}

		public static int? GetCooldownForSecondaryRole(PlayerCustom.PlayerSecondaryRole role, int totalCycleTime)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			return role switch
			{
				PlayerCustom.PlayerSecondaryRole.BothAlcoholic => 60, 
				PlayerCustom.PlayerSecondaryRole.BothDetective => 8 * 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.BothPolitician => 10 * totalCycleTime, 
				PlayerCustom.PlayerSecondaryRole.BothAstral => 15, 
				PlayerCustom.PlayerSecondaryRole.BothSprinter => 90, 
				PlayerCustom.PlayerSecondaryRole.BothStealther => 120, 
				PlayerCustom.PlayerSecondaryRole.BothTeleporter => 120, 
				_ => null, 
			};
		}
	}
	[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_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: 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_01e6: 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 += 0.25f;
					}
					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(GameManager), "CheckForEndGame")]
	internal class CheckForEndgamePatch
	{
		private static bool Prefix(GameManager __instance)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_004c: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Invalid comparison between Unknown and I4
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Invalid comparison between Unknown and I4
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Invalid comparison between Unknown and I4
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Invalid comparison between Unknown and I4
			//IL_0310: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if (NetworkBool.op_Implicit(__instance.IsStarted) && !NetworkBool.op_Implicit(__instance.IsFinished))
				{
					PlayerCustom specificNewPrimaryRole = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.VillageIdiot);
					if ((Object)(object)specificNewPrimaryRole != (Object)null)
					{
						PlayerController player = PlayerRegistry.GetPlayer(specificNewPrimaryRole.Ref);
						if (NetworkBool.op_Implicit(player.IsDead) && NetworkBool.op_Implicit(specificNewPrimaryRole.KilledDuringVote))
						{
							GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, false);
							return false;
						}
					}
					PlayerCustom specificNewPrimaryRole2 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Cannibal);
					if ((Object)(object)specificNewPrimaryRole2 != (Object)null && specificNewPrimaryRole2.SoloRoleObjectiveCount >= PlayerCustom.CannibalTargetAmount)
					{
						GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, false);
						return false;
					}
					if ((int)GameManager.LocalGameState == 4 && PlayerRegistry.CountWhere((Predicate<PlayerController>)((PlayerController o) => !NetworkBool.op_Implicit(o.IsDead))) <= PlayerCustom.AgentMaxSurvivorsToWin)
					{
						IEnumerable<PlayerCustom> enumerable = PlayerCustomRegistry.Where((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Agent);
						if (enumerable.Any())
						{
							int num = 0;
							foreach (PlayerCustom item in enumerable)
							{
								PlayerController player2 = PlayerRegistry.GetPlayer(item.Ref);
								if (!NetworkBool.op_Implicit(player2.IsDead))
								{
									num++;
								}
							}
							if (num == 1)
							{
								GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, false);
								return false;
							}
						}
					}
					PlayerCustom specificNewPrimaryRole3 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Spy);
					if ((Object)(object)specificNewPrimaryRole3 != (Object)null && specificNewPrimaryRole3.SoloRoleObjectiveCount >= PlayerCustom.SpyTargetAmount)
					{
						GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, false);
						return false;
					}
					if ((int)GameManager.LocalGameState == 4)
					{
						PlayerCustom specificNewPrimaryRole4 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Scientist);
						if ((Object)(object)specificNewPrimaryRole4 != (Object)null && specificNewPrimaryRole4.SoloRoleObjectiveCount >= PlayerCustom.ScientistGoal)
						{
							PlayerController player3 = PlayerRegistry.GetPlayer(specificNewPrimaryRole4.Ref);
							if (!NetworkBool.op_Implicit(player3.IsDead))
							{
								GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, false);
								return false;
							}
						}
					}
					List<PlayerController> list = PlayerRegistry.Where((Predicate<PlayerController>)((PlayerController p) => !NetworkBool.op_Implicit(p.IsDead))).ToList();
					if (!NetworkBool.op_Implicit(__instance.BattleRoyale))
					{
						int num2 = list.Count((PlayerController p) => (int)p.Role == 1);
						int num3 = list.Count - num2;
						if ((int)GameManager.LocalGameState == 4)
						{
							foreach (PlayerController item2 in list)
							{
								PlayerCustom player4 = PlayerCustomRegistry.GetPlayer(item2.Ref);
								if (player4.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Traitor)
								{
									num3--;
								}
							}
						}
						if (num2 == 0)
						{
							GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, false);
							return false;
						}
						if (num3 == 0)
						{
							GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, true);
							return false;
						}
						if (num2 >= num3 && ((int)GameManager.State.Current == 4 || NetworkBool.op_Implicit(Plugin.CustomConfig.AmogusMode)))
						{
							GameManager.Rpc_EndGame(((SimulationBehaviour)__instance).Runner, true);
							return false;
						}
					}
					else if (list.Count <= 1)
					{
						GameManager.Rpc_EndGameBattleRoyale(((SimulationBehaviour)__instance).Runner);
					}
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("CheckForEndgamePatch: " + ex));
				StackTrace stackTrace = new StackTrace();
				Plugin.Logger.LogError((object)("StackTrace: " + stackTrace));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(GameManager), "Rpc_EndGame")]
	internal class EndgameChangesPatch
	{
		private unsafe static bool Prefix(NetworkRunner runner, bool wolfWin)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0272: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_031f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0445: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0480: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0596: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_053d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0542: Unknown result type (might be due to invalid IL or missing references)
			//IL_0508: Unknown result type (might be due to invalid IL or missing references)
			//IL_050a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_0574: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_05de: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0794: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_068d: Invalid comparison between Unknown and I4
			//IL_0673: Unknown result type (might be due to invalid IL or missing references)
			//IL_0675: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06af: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: 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 false;
					}
					if (runner.HasAnyActiveConnections())
					{
						int num = 8;
						num += 4;
						SimulationMessage* ptr = SimulationMessage.Allocate(runner.Simulation, num);
						byte* data = SimulationMessage.GetData(ptr);
						int num2 = RpcHeader.Write(RpcHeader.Create(NetworkBehaviourUtils.GetRpcStaticIndexOrThrow("System.Void GameManager::Rpc_EndGame(Fusion.NetworkRunner,System.Boolean)")), data);
						ReadWriteUtilsForWeaver.WriteBoolean((int*)(data + num2), wolfWin);
						num2 += 4;
						((SimulationMessage)ptr).Offset = num2 * 8;
						((SimulationMessage)ptr).SetStatic();
						runner.SendRpc(ptr);
					}
				}
				bool flag = false;
				PlayerCustom specificNewPrimaryRole = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.VillageIdiot);
				if ((Object)(object)specificNewPrimaryRole != (Object)null)
				{
					PlayerController player = PlayerRegistry.GetPlayer(specificNewPrimaryRole.Ref);
					if (NetworkBool.op_Implicit(player.IsDead) && NetworkBool.op_Implicit(specificNewPrimaryRole.KilledDuringVote))
					{
						flag = true;
					}
				}
				bool flag2 = false;
				PlayerCustom specificNewPrimaryRole2 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Cannibal);
				if ((Object)(object)specificNewPrimaryRole2 != (Object)null && specificNewPrimaryRole2.SoloRoleObjectiveCount >= PlayerCustom.CannibalTargetAmount)
				{
					flag2 = true;
				}
				PlayerRef val = PlayerRef.None;
				IEnumerable<PlayerCustom> enumerable = PlayerCustomRegistry.Where((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Agent);
				if (enumerable.Any() && PlayerRegistry.CountWhere((Predicate<PlayerController>)((PlayerController o) => !NetworkBool.op_Implicit(o.IsDead))) <= PlayerCustom.AgentMaxSurvivorsToWin)
				{
					foreach (PlayerCustom item in enumerable)
					{
						PlayerController player2 = PlayerRegistry.GetPlayer(item.Ref);
						if (!NetworkBool.op_Implicit(player2.IsDead))
						{
							val = ((!(val == PlayerRef.None)) ? PlayerRef.None : player2.Ref);
						}
					}
				}
				bool flag3 = false;
				PlayerCustom specificNewPrimaryRole3 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Spy);
				if ((Object)(object)specificNewPrimaryRole3 != (Object)null && specificNewPrimaryRole3.SoloRoleObjectiveCount >= PlayerCustom.SpyTargetAmount)
				{
					flag3 = true;
				}
				bool flag4 = false;
				PlayerCustom specificNewPrimaryRole4 = PlayerCustomRegistry.GetSpecificNewPrimaryRole(PlayerCustom.PlayerNewPrimaryRole.Scientist);
				if ((Object)(object)specificNewPrimaryRole4 != (Object)null && !NetworkBool.op_Implicit(PlayerRegistry.GetPlayer(specificNewPrimaryRole4.Ref).IsDead) && specificNewPrimaryRole4.SoloRoleObjectiveCount >= PlayerCustom.ScientistGoal)
				{
					flag4 = true;
				}
				if (runner.IsServer)
				{
					GameManager.Instance.IsFinished = 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)
						//IL_000f: 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_0033: Unknown result type (might be due to invalid IL or missing references)
						//IL_003f: Unknown result type (might be due to invalid IL or missing references)
						pObj.CanMove = NetworkBool.op_Implicit(false);
						PlayerCustom player11 = PlayerCustomRegistry.GetPlayer(pObj.Ref);
						if ((Object)(object)player11 != (Object)null)
						{
							player11.PrimaryRoleActionTimer = TickTimer.None;
							player11.PowerCooldownTimer = TickTimer.None;
							player11.TrapDisarmTimer = TickTimer.None;
						}
					});
					GameManager.State.Server_DelaySetState((EGameState)5, 3f);
				}
				if (runner.IsPlayer)
				{
					Color villagerColor = GameUI.VillagerColor;
					Color wolfColor = GameUI.WolfColor;
					PlayerCustom player3 = PlayerCustomRegistry.GetPlayer(PlayerController.Local.Ref);
					NetworkPlayerData playerData;
					string text;
					Color val2;
					string text2;
					if (flag)
					{
						PlayerController player4 = PlayerRegistry.GetPlayer(specificNewPrimaryRole.Ref);
						GameUI gameUI = GameManager.Instance.gameUI;
						playerData = player4.PlayerData;
						gameUI.UpdateWolvesRecap(((object)playerData.Username).ToString());
						text = "NALES_UI_VILLAGE_IDIOT_WIN";
						if (player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.VillageIdiot)
						{
							val2 = villagerColor;
							text2 = "VICTORY";
						}
						else
						{
							val2 = wolfColor;
							text2 = "DEFEAT";
						}
					}
					else if (flag2)
					{
						PlayerController player5 = PlayerRegistry.GetPlayer(specificNewPrimaryRole2.Ref);
						GameUI gameUI2 = GameManager.Instance.gameUI;
						playerData = player5.PlayerData;
						gameUI2.UpdateWolvesRecap(((object)playerData.Username).ToString());
						text = "NALES_UI_CANNIBAL_WIN";
						if (player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Cannibal)
						{
							val2 = villagerColor;
							text2 = "VICTORY";
						}
						else
						{
							val2 = wolfColor;
							text2 = "DEFEAT";
						}
					}
					else if (val != PlayerRef.None)
					{
						PlayerController player6 = PlayerRegistry.GetPlayer(val);
						GameUI gameUI3 = GameManager.Instance.gameUI;
						playerData = player6.PlayerData;
						gameUI3.UpdateWolvesRecap(((object)playerData.Username).ToString());
						text = "NALES_UI_AGENT_WIN";
						if ((Object)(object)PlayerController.Local == (Object)(object)player6)
						{
							val2 = villagerColor;
							text2 = "VICTORY";
						}
						else
						{
							val2 = wolfColor;
							text2 = "DEFEAT";
						}
					}
					else if (flag3)
					{
						PlayerController player7 = PlayerRegistry.GetPlayer(specificNewPrimaryRole3.Ref);
						GameUI gameUI4 = GameManager.Instance.gameUI;
						playerData = player7.PlayerData;
						gameUI4.UpdateWolvesRecap(((object)playerData.Username).ToString());
						text = "NALES_UI_SPY_WIN";
						if (player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Spy)
						{
							val2 = villagerColor;
							text2 = "VICTORY";
						}
						else
						{
							val2 = wolfColor;
							text2 = "DEFEAT";
						}
					}
					else if (flag4)
					{
						PlayerController player8 = PlayerRegistry.GetPlayer(specificNewPrimaryRole4.Ref);
						GameUI gameUI5 = GameManager.Instance.gameUI;
						playerData = player8.PlayerData;
						gameUI5.UpdateWolvesRecap(((object)playerData.Username).ToString());
						text = "NALES_UI_SCIENTIST_WIN";
						if (player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Scientist)
						{
							val2 = villagerColor;
							text2 = "VICTORY";
						}
						else
						{
							val2 = wolfColor;
							text2 = "DEFEAT";
						}
					}
					else
					{
						string text3 = UpdateRoleUtility.ListWolvesAsString(PlayerRef.None);
						PlayerCustom playerCustom = PlayerCustomRegistry.Where((PlayerCustom o) => o.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Traitor).FirstOrDefault();
						if ((Object)(object)playerCustom != (Object)null)
						{
							PlayerController player9 = PlayerRegistry.GetPlayer(playerCustom.Ref);
							string text4 = text3;
							NetworkString<_32> username = player9.PlayerData.Username;
							text3 = text4 + " + " + ((object)username).ToString();
						}
						GameManager.Instance.gameUI.UpdateWolvesRecap(text3);
						text = (wolfWin ? "UI_WOLVES_WIN" : "UI_VILLAGERS_WIN");
						if (player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.VillageIdiot || player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Cannibal || player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Agent || player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Spy || player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Scientist)
						{
							val2 = wolfColor;
							text2 = "DEFEAT";
						}
						else
						{
							bool flag5 = (int)PlayerController.Local.Role == 1 || player3.NewPrimaryRole == PlayerCustom.PlayerNewPrimaryRole.Traitor;
							if (wolfWin)
							{
								if (flag5)
								{
									val2 = villagerColor;
									text2 = "VICTORY";
								}
								else
								{
									val2 = wolfColor;
									text2 = "DEFEAT";
								}
							}
							else if (flag5)
							{
								val2 = wolfColor;
								text2 = "DEFEAT";
							}
							else
							{
								val2 = villagerColor;
								text2 = "VICTORY";
							}
						}
					}
					AudioManager.Play(text2, (MixerTarget)2, 0.5f, 1f);
					GameManager.Instance.gameUI.UpdateTransitionText(text, val2);
					GameManager.Instance.gameUI.ShowWolvesRecap(true);
					GameManager.Instance.gameUI.StartFade(true);
					Dictionary<PlayerRef, PlayerDisplay> value = Traverse.Create((object)GameManager.Instance.gameUI).Field<Dictionary<PlayerRef, PlayerDisplay>>("_playerDisplays").Value;
					foreach (KeyValuePair<PlayerRef, PlayerDisplay> item2 in value)
					{
						TextMeshProUGUI value2 = Traverse.Create((object)item2.Value).Field<TextMeshProUGUI>("username").Value;
						PlayerController player10 = PlayerRegistry.GetPlayer(item2.Key);
						if ((Object)(object)player10 != (Object)null)
						{
							playerData = player10.PlayerData;
							if (((NetworkPlayerData)(ref playerData)).IsValid)
							{
								playerData = player10.PlayerData;
								((TMP_Text)value2).text = ((object)playerData.Username).ToString();
								((Graphic)value2).color = new Color(255f, 255f, 255f, 0.6f);
							}
						}
					}
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("EndgameChangesPatch error: " + ex));
				return true;
			}
		}
	}
	public class ExtraSettings : MonoBehaviour
	{
		private static ExtraSettings _instance;

		public bool ReduceWolfRed;

		public bool CheckModInstall;

		public static ExtraSettings Instance
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject("ExtraSettings");
					val.AddComponent<ExtraSettings>();
					GameObject val2 = Object.Instantiate<GameObject>(val);
					_instance = val2.GetComponent<ExtraSettings>();
				}
				return _instance;
			}
		}

		private void Start()
		{
			ReduceWolfRed = PlayerPrefs.GetInt("EXTRA_SETTINGS_REDUCE_WOLF_RED") == 1;
			CheckModInstall = PlayerPrefs.GetInt("EXTRA_SETTINGS_CHECK_MOD_INSTALL") == 1;
		}

		public static void OnReduceWolfRedChanged(bool value)
		{
			PlayerPrefs.SetInt("EXTRA_SETTINGS_REDUCE_WOLF_RED", value ? 1 : 0);
			Instance.ReduceWolfRed = value;
		}

		public static void OnCheckModInstallChanged(bool value)
		{
			PlayerPrefs.SetInt("EXTRA_SETTINGS_CHECK_MOD_INSTALL", value ? 1 : 0);
			Instance.CheckModInstall = value;
		}
	}
	[HarmonyPatch(typeof(SettingsUI), "Start")]
	internal class ExtraSettingsPatch
	{
		private static void Postfix(SettingsUI __instance)
		{
			try
			{
				Toggle checkbox = GetCheckbox(__instance, "NALES_SETTING_REDUCE_WOLF_RED", "EXTRA_SETTINGS_REDUCE_WOLF_RED");
				((UnityEvent<bool>)(object)checkbox.onValueChanged).AddListener((UnityAction<bool>)ExtraSettings.OnReduceWolfRedChanged);
				Toggle checkbox2 = GetCheckbox(__instance, "NALES_SETTING_CHECK_MOD_INSTALL", "EXTRA_SETTINGS_CHECK_MOD_INSTALL");
				((UnityEvent<bool>)(object)checkbox2.onValueChanged).AddListener((UnityAction<bool>)ExtraSettings.OnCheckModInstallChanged);
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("ExtraSettingsPatch error: " + ex));
			}
		}

		private static Toggle GetCheckbox(SettingsUI settingsUI, string textKey, string playerPref)
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			Toggle value = Traverse.Create((object)settingsUI).Field<Toggle>("reverseYAxisToggle").Value;
			Transform parent = ((Component)value).transform.parent.parent.parent;
			Transform parent2 = ((Component)value).transform.parent.parent.parent.parent;
			Transform val = Object.Instantiate<Transform>(parent, parent2);
			LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText");
			((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(textKey));
			Toggle componentInChildren = ((Component)val).GetComponentInChildren<Toggle>();
			GameObject gameObject = ((Component)componentInChildren).gameObject;
			Object.DestroyImmediate((Object)(object)componentInChildren);
			componentInChildren = gameObject.AddComponent<Toggle>();
			componentInChildren.graphic = ((Component)((Component)componentInChildren).transform.Find("Background").Find("Checkmark")).GetComponent<Graphic>();
			componentInChildren.isOn = PlayerPrefs.GetInt(playerPref) == 1;
			return componentInChildren;
		}
	}
	[HarmonyPatch(typeof(LightingManager), "DisplayWolfLight")]
	internal class ExtraSettingsReduceWolfRedPatch
	{
		private static bool Prefix(bool active, LightingManager __instance)
		{
			try
			{
				ColorAdjustmentManager.UpdateColorAdjustment();
				return false;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("ExtraSettingsReduceWolfRedPatch error: " + ex));
				return true;
			}
		}
	}
	[HarmonyPatch(typeof(LightingManager), "UpdateLighting")]
	public class FogChangesPatch
	{
		public static float FogDensityDaytime = 0.015f;

		public static float FogEndDistanceDaytime { get; set; }

		public static float FogEndDistanceNight { get; set; }

		public static float FogDensityNight { get; set; }

		private static void Postfix(LightingManager __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				EGameState localGameState = GameManager.LocalGameState;
				EGameState val = localGameState;
				if (val - 2 > 2)
				{
					return;
				}
				PlayerCustom player = PlayerCustomRegistry.GetPlayer(PlayerController.Local.LocalCameraHandler.PovPlayer.Ref);
				if (Plugin.CustomConfig.NightFog == 0 && !NetworkBool.op_Implicit(player.Nearsighted))
				{
					return;
				}
				if (NetworkBool.op_Implicit(PlayerController.Local.LocalCameraHandler.PovPlayer.IsZooming))
				{
					RenderSettings.fogDensity = 0f;
					RenderSettings.fogEndDistance = 300f;
					return;
				}
				float num = 0f;
				float num2 = 300f;
				float value = Traverse.Create((object)__instance).Field<float>("_localTimeOfDay").Value;
				if (value >= 6f && value <= 17f)
				{
					num = FogDensityDaytime;
					num2 = FogEndDistanceDaytime;
				}
				else if (value <= 5f || value >= 18f)
				{
					num = FogDensityNight;
					num2 = FogEndDistanceNight;
				}
				else if (value > 5f && value < 6f)
				{
					num = Mathf.Lerp(FogDensityDaytime, FogDensityNight, 6f - value);
					num2 = Mathf.Lerp(FogEndDistanceDaytime, FogEndDistanceNight, 6f - value);
				}
				else if (value > 17f && value < 18f)
				{
					num = Mathf.Lerp(FogDensityNight, FogDensityDaytime, 18f - value);
					num2 = Mathf.Lerp(FogEndDistanceNight, FogEndDistanceDaytime, 18f - value);
				}
				if (NetworkBool.op_Implicit(PlayerController.Local.LocalCameraHandler.PovPlayer.IsWolf))
				{
					num2 += 25f;
				}
				else if (NetworkBool.op_Implicit(PlayerController.Local.LocalCameraHandler.PovPlayer.PlayerEffectManager.NightVision))
				{
					num2 += 60f;
					num /= 2f;
				}
				if (NetworkBool.op_Implicit(player.Nearsighted))
				{
					num2 = 10f;
					num = 1f;
					RenderSettings.fogColor = BalancingValues.NearsightedFogColor;
				}
				RenderSettings.fogDensity = num;
				RenderSettings.fogEndDistance = num2;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("FogChangesPatch error: " + ex));
			}
		}
	}
	[NetworkBehaviourWeaved(7)]
	public class GameConfig : NetworkBehaviour
	{
		public enum ConfigTypeEnum
		{
			Base,
			Mod,
			Potions
		}

		public static Dictionary<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown> NewPrimaryRolesConfig = new Dictionary<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown>();

		public static Dictionary<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown> SecondaryRolesConfig = new Dictionary<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown>();

		public static Dictionary<string, Toggle> PotionsConfig = new Dictionary<string, Toggle>();

		public Dictionary<PlayerCustom.PlayerNewPrimaryRole, float> NewPrimaryRoleChance = new Dictionary<PlayerCustom.PlayerNewPrimaryRole, float>();

		public Dictionary<PlayerCustom.PlayerSecondaryRole, int> SecondaryRoleNumbers = new Dictionary<PlayerCustom.PlayerSecondaryRole, int>();

		public Dictionary<string, bool> PotionsAvailability = new Dictionary<string, bool>();

		public static Toggle TrapsModifiedToggle;

		public static Toggle AnonymousVotesToggle;

		public static Toggle AmogusModeToggle;

		public static Toggle SabotagesAvailableToggle;

		public static Toggle DropItemsAvailableToggle;

		public static TMP_Dropdown NightFogDropdown;

		public static Button ButtonConfigBaseGame;

		public static Button ButtonConfigMod;

		public static GameObject GameSettingsObject;

		public static GameObject SoloRoleWarningObject;

		[Networked]
		[NetworkedWeaved(0, 1)]
		public unsafe NetworkBool TrapsModified
		{
			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 GameConfig.TrapsModified. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)(*base.Ptr);
			}
			private 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 GameConfig.TrapsModified. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr, value);
			}
		}

		[Networked]
		[NetworkedWeaved(1, 1)]
		public unsafe NetworkBool AnonymousVotes
		{
			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 GameConfig.AnonymousVotes. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)base.Ptr[1];
			}
			private 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 GameConfig.AnonymousVotes. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr + 1, value);
			}
		}

		[Networked]
		[NetworkedWeaved(2, 1)]
		public unsafe NetworkBool AmogusMode
		{
			get
			{
				//IL_0026: 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)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing GameConfig.AmogusMode. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)base.Ptr[2];
			}
			private set
			{
				//IL_0026: 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)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing GameConfig.AmogusMode. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr + 2, value);
			}
		}

		[Networked]
		[NetworkedWeaved(3, 1)]
		public unsafe NetworkBool SabotagesAvailable
		{
			get
			{
				//IL_0026: 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)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing GameConfig.SabotagesAvailable. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)base.Ptr[3];
			}
			private set
			{
				//IL_0026: 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)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing GameConfig.SabotagesAvailable. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr + 3, value);
			}
		}

		[Networked]
		[NetworkedWeaved(4, 1)]
		public unsafe NetworkBool DropItemsAvailable
		{
			get
			{
				//IL_0026: 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)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing GameConfig.DropItemsAvailable. Networked properties can only be accessed when Spawned() has been called.");
				}
				return (NetworkBool)base.Ptr[4];
			}
			private set
			{
				//IL_0026: 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)
				if (base.Ptr == null)
				{
					throw new InvalidOperationException("Error when accessing GameConfig.DropItemsAvailable. Networked properties can only be accessed when Spawned() has been called.");
				}
				Unsafe.Write(base.Ptr + 4, value);
			}
		}

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

		private void Start()
		{
			FillTrapsModifiedToggle();
			FillAnonymousVotesToggle();
			FillAmogusModeToggle();
			FillSabotagesAvailableToggle();
			FillDropItemsAvailableToggle();
		}

		public override void Spawned()
		{
			if (((SimulationBehaviour)this).Runner.IsClient)
			{
				Plugin.NetworkObject = ((Component)this).GetComponent<NetworkObject>();
			}
			try
			{
				foreach (KeyValuePair<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown> item in NewPrimaryRolesConfig)
				{
					NewPrimaryRoleChance[item.Key] = float.Parse(item.Value.options[item.Value.value].text.Replace("%", "")) / 100f;
				}
				foreach (KeyValuePair<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown> item2 in SecondaryRolesConfig)
				{
					SecondaryRoleNumbers[item2.Key] = int.Parse(item2.Value.options[item2.Value.value].text);
				}
				NightFog = int.Parse(NightFogDropdown.options[NightFogDropdown.value].text.Replace("%", ""));
				foreach (KeyValuePair<string, Toggle> item3 in PotionsConfig)
				{
					PotionsAvailability[item3.Key] = item3.Value.isOn;
				}
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("GameConfigSetGameSettingsPatch error: " + ex));
			}
		}

		public override void Despawned(NetworkRunner runner, bool hasState)
		{
		}

		public static void CreateAndAttachNewPrimaryRoleConfigDropdown(GameSettingsUI gameSettingsUI, PlayerCustom.PlayerNewPrimaryRole role, string key)
		{
			TMP_Dropdown dropdownForPrimaryRole = GetDropdownForPrimaryRole(gameSettingsUI, role, key);
			NewPrimaryRolesConfig[role] = dropdownForPrimaryRole;
			FillNewPrimaryRoleDropdown(dropdownForPrimaryRole, role);
		}

		public static void CreateAndAttachSecondaryRoleConfigDropdown(GameSettingsUI gameSettingsUI, PlayerCustom.PlayerSecondaryRole role, string key)
		{
			TMP_Dropdown dropdownForSecondaryRole = GetDropdownForSecondaryRole(gameSettingsUI, key);
			SecondaryRolesConfig[role] = dropdownForSecondaryRole;
			FillSecondaryRoleDropdown(dropdownForSecondaryRole, role);
		}

		public static Toggle CreateAndAttachConfigToggle(GameSettingsUI gameSettingsUI, string key, ConfigTypeEnum type, Color textColor)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			return GetToggle(gameSettingsUI, key, type, textColor);
		}

		public static TMP_Dropdown CreateAndAttachConfigDropdown(GameSettingsUI gameSettingsUI, string key)
		{
			return GetDropdown(gameSettingsUI, key);
		}

		public static void FillNewPrimaryRoleDropdown(TMP_Dropdown dropdown, PlayerCustom.PlayerNewPrimaryRole role)
		{
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_NALES_ROLE_" + role))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + role, GetPrimaryRoleDefaultIndex(role));
			}
			((UnityEventBase)dropdown.onValueChanged).RemoveAllListeners();
			((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int index)
			{
				Plugin.CustomConfig.NewPrimaryRoleChance[role] = float.Parse(dropdown.options[index].text.Replace("%", "")) / 100f;
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + role, index);
			});
			if (PlayerPrefs.HasKey("GAME_SETTINGS_NALES_ROLE_" + role))
			{
				int @int = PlayerPrefs.GetInt("GAME_SETTINGS_NALES_ROLE_" + role);
				if (@int < dropdown.options.Count)
				{
					dropdown.SetValueWithoutNotify(@int);
				}
			}
		}

		public static void FillSecondaryRoleDropdown(TMP_Dropdown dropdown, PlayerCustom.PlayerSecondaryRole role)
		{
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_NALES_ROLE_" + role))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + role, 1);
			}
			((UnityEventBase)dropdown.onValueChanged).RemoveAllListeners();
			((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int index)
			{
				Plugin.CustomConfig.SecondaryRoleNumbers[role] = int.Parse(dropdown.options[index].text);
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + role, index);
			});
			if (PlayerPrefs.HasKey("GAME_SETTINGS_NALES_ROLE_" + role))
			{
				int @int = PlayerPrefs.GetInt("GAME_SETTINGS_NALES_ROLE_" + role);
				if (@int < dropdown.options.Count)
				{
					dropdown.SetValueWithoutNotify(@int);
				}
			}
		}

		public void FillTrapsModifiedToggle()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_TRAPS_MODIFIED"))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_TRAPS_MODIFIED", 1);
			}
			if (PlayerPrefs.HasKey("GAME_SETTINGS_TRAPS_MODIFIED") && PlayerPrefs.GetInt("GAME_SETTINGS_TRAPS_MODIFIED") == 1)
			{
				TrapsModified = NetworkBool.op_Implicit(true);
				TrapsModifiedToggle.SetIsOnWithoutNotify(true);
			}
		}

		public static void UpdateTrapsModified(bool value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Plugin.CustomConfig.TrapsModified = NetworkBool.op_Implicit(value);
			PlayerPrefs.SetInt("GAME_SETTINGS_TRAPS_MODIFIED", value ? 1 : 0);
		}

		public void UpdateTrapsModifiedSetting(bool value)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (((SimulationBehaviour)this).Runner.IsServer && (int)GameManager.State.Current == 1)
			{
				TrapsModified = NetworkBool.op_Implicit(value);
			}
		}

		public void FillAnonymousVotesToggle()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_ANONYMOUS_VOTES"))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_ANONYMOUS_VOTES", 0);
			}
			if (PlayerPrefs.HasKey("GAME_SETTINGS_ANONYMOUS_VOTES") && PlayerPrefs.GetInt("GAME_SETTINGS_ANONYMOUS_VOTES") == 1)
			{
				AnonymousVotes = NetworkBool.op_Implicit(true);
				AnonymousVotesToggle.SetIsOnWithoutNotify(true);
			}
		}

		public static void UpdateAnonymousVotes(bool value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Plugin.CustomConfig.AnonymousVotes = NetworkBool.op_Implicit(value);
			PlayerPrefs.SetInt("GAME_SETTINGS_ANONYMOUS_VOTES", value ? 1 : 0);
		}

		public void UpdateAnonymousVotesSetting(bool value)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (((SimulationBehaviour)this).Runner.IsServer && (int)GameManager.State.Current == 1)
			{
				AnonymousVotes = NetworkBool.op_Implicit(value);
			}
		}

		public void FillAmogusModeToggle()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_AMOGUS_MODE"))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_AMOGUS_MODE", 0);
			}
			if (PlayerPrefs.HasKey("GAME_SETTINGS_AMOGUS_MODE") && PlayerPrefs.GetInt("GAME_SETTINGS_AMOGUS_MODE") == 1)
			{
				AmogusMode = NetworkBool.op_Implicit(true);
				AmogusModeToggle.SetIsOnWithoutNotify(true);
			}
		}

		public static void UpdateAmogusMode(bool value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Plugin.CustomConfig.AmogusMode = NetworkBool.op_Implicit(value);
			PlayerPrefs.SetInt("GAME_SETTINGS_AMOGUS_MODE", value ? 1 : 0);
		}

		public void UpdateAmogusModeSetting(bool value)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (((SimulationBehaviour)this).Runner.IsServer && (int)GameManager.State.Current == 1)
			{
				AmogusMode = NetworkBool.op_Implicit(value);
			}
		}

		public void FillSabotagesAvailableToggle()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_SABOTAGES_AVAILABLE"))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_SABOTAGES_AVAILABLE", 1);
			}
			if (PlayerPrefs.HasKey("GAME_SETTINGS_SABOTAGES_AVAILABLE") && PlayerPrefs.GetInt("GAME_SETTINGS_SABOTAGES_AVAILABLE") == 1)
			{
				SabotagesAvailable = NetworkBool.op_Implicit(true);
				SabotagesAvailableToggle.SetIsOnWithoutNotify(true);
			}
		}

		public static void UpdateSabotagesAvailable(bool value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Plugin.CustomConfig.SabotagesAvailable = NetworkBool.op_Implicit(value);
			PlayerPrefs.SetInt("GAME_SETTINGS_SABOTAGES_AVAILABLE", value ? 1 : 0);
		}

		public void UpdateSabotagesAvailableSetting(bool value)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (((SimulationBehaviour)this).Runner.IsServer && (int)GameManager.State.Current == 1)
			{
				SabotagesAvailable = NetworkBool.op_Implicit(value);
			}
		}

		public void FillDropItemsAvailableToggle()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_DROP_ITEMS_AVAILABLE"))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_DROP_ITEMS_AVAILABLE", 1);
			}
			if (PlayerPrefs.HasKey("GAME_SETTINGS_DROP_ITEMS_AVAILABLE") && PlayerPrefs.GetInt("GAME_SETTINGS_DROP_ITEMS_AVAILABLE") == 1)
			{
				DropItemsAvailable = NetworkBool.op_Implicit(true);
				DropItemsAvailableToggle.SetIsOnWithoutNotify(true);
			}
		}

		public static void UpdateDropItemsAvailable(bool value)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			Plugin.CustomConfig.DropItemsAvailable = NetworkBool.op_Implicit(value);
			PlayerPrefs.SetInt("GAME_SETTINGS_DROP_ITEMS_AVAILABLE", value ? 1 : 0);
		}

		public void UpdateDropItemsAvailableSetting(bool value)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (((SimulationBehaviour)this).Runner.IsServer && (int)GameManager.State.Current == 1)
			{
				DropItemsAvailable = NetworkBool.op_Implicit(value);
			}
		}

		public static void FillNightFogDropdown(TMP_Dropdown dropdown)
		{
			if (!PlayerPrefs.HasKey("GAME_SETTINGS_NIGHT_FOG"))
			{
				PlayerPrefs.SetInt("GAME_SETTINGS_NIGHT_FOG", 5);
			}
			((UnityEventBase)dropdown.onValueChanged).RemoveAllListeners();
			((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)delegate(int index)
			{
				Plugin.CustomConfig.NightFog = int.Parse(dropdown.options[index].text.Replace("%", ""));
				PlayerPrefs.SetInt("GAME_SETTINGS_NIGHT_FOG", index);
			});
			if (PlayerPrefs.HasKey("GAME_SETTINGS_NIGHT_FOG"))
			{
				int @int = PlayerPrefs.GetInt("GAME_SETTINGS_NIGHT_FOG");
				if (@int < dropdown.options.Count)
				{
					dropdown.SetValueWithoutNotify(@int);
				}
			}
		}

		public static void FillPotionToggle(Toggle potionToggle, Effect effect)
		{
			string playerPref = "GAME_SETTINGS_NALES_POTION_" + effect.GetTranslateKey();
			if (!PlayerPrefs.HasKey(playerPref))
			{
				PlayerPrefs.SetInt(playerPref, 1);
			}
			((UnityEventBase)potionToggle.onValueChanged).RemoveAllListeners();
			((UnityEvent<bool>)(object)potionToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool value)
			{
				Plugin.CustomConfig.PotionsAvailability[effect.GetTranslateKey()] = value;
				PlayerPrefs.SetInt(playerPref, value ? 1 : 0);
			});
			if (PlayerPrefs.HasKey(playerPref) && PlayerPrefs.GetInt(playerPref) == 1)
			{
				PotionsConfig[effect.GetTranslateKey()].SetIsOnWithoutNotify(true);
			}
		}

		public void ResetToDefault()
		{
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<PlayerCustom.PlayerNewPrimaryRole, TMP_Dropdown> item in NewPrimaryRolesConfig)
			{
				item.Value.value = GetPrimaryRoleDefaultIndex(item.Key);
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + item.Key, GetPrimaryRoleDefaultIndex(item.Key));
			}
			foreach (KeyValuePair<PlayerCustom.PlayerSecondaryRole, TMP_Dropdown> item2 in SecondaryRolesConfig)
			{
				item2.Value.value = 1;
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_ROLE_" + item2.Key, 1);
			}
			TrapsModifiedToggle.SetIsOnWithoutNotify(true);
			PlayerPrefs.SetInt("GAME_SETTINGS_TRAPS_MODIFIED", 1);
			TrapsModified = NetworkBool.op_Implicit(true);
			AnonymousVotesToggle.SetIsOnWithoutNotify(false);
			PlayerPrefs.SetInt("GAME_SETTINGS_ANONYMOUS_VOTES", 0);
			AnonymousVotes = NetworkBool.op_Implicit(false);
			AmogusModeToggle.SetIsOnWithoutNotify(false);
			PlayerPrefs.SetInt("GAME_SETTINGS_AMOGUS_MODE", 0);
			AmogusMode = NetworkBool.op_Implicit(false);
			SabotagesAvailableToggle.SetIsOnWithoutNotify(true);
			PlayerPrefs.SetInt("GAME_SETTINGS_SABOTAGES_AVAILABLE", 1);
			SabotagesAvailable = NetworkBool.op_Implicit(true);
			DropItemsAvailableToggle.SetIsOnWithoutNotify(true);
			PlayerPrefs.SetInt("GAME_SETTINGS_DROP_ITEMS_AVAILABLE", 1);
			DropItemsAvailable = NetworkBool.op_Implicit(true);
			NightFogDropdown.value = 5;
			PlayerPrefs.SetInt("GAME_SETTINGS_NIGHT_FOG", 5);
			foreach (KeyValuePair<string, Toggle> item3 in PotionsConfig)
			{
				item3.Value.isOn = true;
				PlayerPrefs.SetInt("GAME_SETTINGS_NALES_POTION_" + item3.Key, 1);
			}
		}

		private static TMP_Dropdown GetDropdownForPrimaryRole(GameSettingsUI gameSettingsUI, PlayerCustom.PlayerNewPrimaryRole role, string key)
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			TMP_Dropdown value = Traverse.Create((object)gameSettingsUI).Field<TMP_Dropdown>("alchemistsCountDropdown").Value;
			Transform parent = ((Component)value).transform.parent.parent.parent;
			Transform parent2 = ((Component)value).transform.parent.parent.parent.parent;
			Transform val = Object.Instantiate<Transform>(parent, parent2);
			((Component)val).gameObject.AddComponent<NewConfigComponent>();
			LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText");
			val2.StringReference.Arguments = new List<object> { TranslationManager.Instance.GetTranslation(key) };
			string text = "";
			switch (role)
			{
			case PlayerCustom.PlayerNewPrimaryRole.VillageIdiot:
			case PlayerCustom.PlayerNewPrimaryRole.Cannibal:
			case PlayerCustom.PlayerNewPrimaryRole.Agent:
			case PlayerCustom.PlayerNewPrimaryRole.Spy:
			case PlayerCustom.PlayerNewPrimaryRole.Scientist:
				text = "NALES_CONFIG_ROLE_TYPE_MAIN_SOLO";
				break;
			case PlayerCustom.PlayerNewPrimaryRole.Traitor:
				text = "NALES_CONFIG_ROLE_TYPE_TRAITOR";
				break;
			case PlayerCustom.PlayerNewPrimaryRole.Necromancer:
			case PlayerCustom.PlayerNewPrimaryRole.Shapeshifter:
			case PlayerCustom.PlayerNewPrimaryRole.Deceiver:
			case PlayerCustom.PlayerNewPrimaryRole.AntiMage:
			case PlayerCustom.PlayerNewPrimaryRole.Tracker:
			case PlayerCustom.PlayerNewPrimaryRole.Enraged:
			case PlayerCustom.PlayerNewPrimaryRole.Warlock:
			case PlayerCustom.PlayerNewPrimaryRole.Possessor:
				text = "NALES_CONFIG_ROLE_TYPE_MAIN_WOLF";
				break;
			}
			((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(text));
			TMP_Dropdown componentInChildren = ((Component)val).GetComponentInChildren<TMP_Dropdown>();
			componentInChildren.ClearOptions();
			List<string> list = new List<string>();
			for (int i = 0; i <= 100; i += 10)
			{
				list.Add(i + "%");
			}
			componentInChildren.AddOptions(list);
			return componentInChildren;
		}

		private static TMP_Dropdown GetDropdownForSecondaryRole(GameSettingsUI gameSettingsUI, string key)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			TMP_Dropdown value = Traverse.Create((object)gameSettingsUI).Field<TMP_Dropdown>("alchemistsCountDropdown").Value;
			Transform parent = ((Component)value).transform.parent.parent.parent;
			Transform parent2 = ((Component)value).transform.parent.parent.parent.parent;
			Transform val = Object.Instantiate<Transform>(parent, parent2);
			((Component)val).gameObject.AddComponent<NewConfigComponent>();
			LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText");
			val2.StringReference.Arguments = new List<object> { TranslationManager.Instance.GetTranslation(key) };
			((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit("NALES_CONFIG_ROLE_TYPE_SECONDARY"));
			return ((Component)val).GetComponentInChildren<TMP_Dropdown>();
		}

		private static Toggle GetToggle(GameSettingsUI gameSettingsUI, string key, ConfigTypeEnum type, Color textColor)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			Toggle value = Traverse.Create((object)gameSettingsUI).Field<Toggle>("showAllyToggle").Value;
			Transform parent = ((Component)value).transform.parent.parent.parent;
			Transform parent2 = ((Component)value).transform.parent.parent.parent.parent;
			Transform val = Object.Instantiate<Transform>(parent, parent2);
			switch (type)
			{
			case ConfigTypeEnum.Mod:
				((Component)val).gameObject.AddComponent<NewConfigComponent>();
				break;
			case ConfigTypeEnum.Potions:
				((Component)val).gameObject.AddComponent<PotionConfigComponent>();
				break;
			}
			LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText");
			((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(key));
			((Graphic)((Component)val).GetComponentInChildren<TextMeshProUGUI>()).color = textColor;
			Toggle componentInChildren = ((Component)val).GetComponentInChildren<Toggle>();
			GameObject gameObject = ((Component)componentInChildren).gameObject;
			Object.DestroyImmediate((Object)(object)componentInChildren);
			componentInChildren = gameObject.AddComponent<Toggle>();
			componentInChildren.graphic = ((Component)((Component)componentInChildren).transform.Find("Background").Find("Checkmark")).GetComponent<Graphic>();
			return componentInChildren;
		}

		private static TMP_Dropdown GetDropdown(GameSettingsUI gameSettingsUI, string key)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			TMP_Dropdown value = Traverse.Create((object)gameSettingsUI).Field<TMP_Dropdown>("alchemistsCountDropdown").Value;
			Transform parent = ((Component)value).transform.parent.parent.parent;
			Transform parent2 = ((Component)value).transform.parent.parent.parent.parent;
			Transform val = Object.Instantiate<Transform>(parent, parent2);
			((Component)val).gameObject.AddComponent<NewConfigComponent>();
			LocalizeStringEvent val2 = ((Component)val).GetComponentsInChildren<LocalizeStringEvent>().First((LocalizeStringEvent o) => ((Object)o).name == "SettingNameText");
			val2.StringReference.Arguments = new List<object> { TranslationManager.Instance.GetTranslation(key) };
			((LocalizedReference)val2.StringReference).SetReference(TableReference.op_Implicit("UI Text"), TableEntryReference.op_Implicit(key));
			TMP_Dropdown componentInChildren = ((Component)val).GetComponentInChildren<TMP_Dropdown>();
			componentInChildren.ClearOptions();
			List<string> list = new List<string>();
			for (int i = 0; i <= 100; i += 10)
			{
				list.Add(i + "%");
			}
			componentInChildren.AddOptions(list);
			return componentInChildren;
		}

		public static void OnClickConfigBase()
		{
			ToggleConfigType(ConfigTypeEnum.Base);
		}

		public static void OnClickConfigMod()
		{
			ToggleConfigType(ConfigTypeEnum.Mod);
		}

		public static void OnClickConfigPotions()
		{
			ToggleConfigType(ConfigTypeEnum.Potions);
		}

		private static void ToggleConfigType(ConfigTypeEnum configType)
		{
			try
			{
				Toggle[] componentsInChildren = GameSettingsObject.GetComponentsInChildren<Toggle>(true);
				TMP_Dropdown[] componentsInChildren2 = GameSettingsObject.GetComponentsInChildren<TMP_Dropdown>(true);
				List<GameObject> list = new List<GameObject>();
				Toggle[] array = componentsInChildren;
				foreach (Toggle val in array)
				{
					if (((Object)((Component)val).gameObject).name != "Item")
					{
						Transform parent = ((Component)val).transform.parent.parent.parent;
						list.Add(((Component)parent).gameObject);
					}
				}
				TMP_Dropdown[] array2 = componentsInChildren2;
				foreach (TMP_Dropdown val2 in array2)
				{
					Transform parent2 = ((Component)val2).transform.parent.parent.parent;
					list.Add(((Component)parent2).gameObject);
				}
				NewConfigComponent newConfigComponent = default(NewConfigComponent);
				PotionConfigComponent potionConfigComponent = default(PotionConfigComponent);
				foreach (GameObject item in list)
				{
					if (item.TryGetComponent<NewConfigComponent>(ref newConfigComponent))
					{
						item.SetActive(configType == ConfigTypeEnum.Mod);
					}
					else if (item.TryGetComponent<PotionConfigComponent>(ref potionConfigComponent))
					{
						item.SetActive(configType == ConfigTypeEnum.Potions);
					}
					else
					{
						item.SetActive(configType == ConfigTypeEnum.Base);
					}
				}
				SoloRoleWarningObject.SetActive(configType == ConfigTypeEnum.Mod);
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError((object)("ToggleConfigType error: " + ex));
			}
		}

		public static int GetPrimaryRoleDefaultIndex(PlayerCustom.PlayerNewPrimaryRole role)
		{
			return role switch
			{
				PlayerCustom.PlayerNewPrimaryRole.VillageIdiot => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Cannibal => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Agent => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Spy => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Scientist => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Traitor => 0, 
				PlayerCustom.PlayerNewPrimaryRole.Necromancer => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Shapeshifter => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Possessor => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Deceiver => 10, 
				PlayerCustom.PlayerNewPrimaryRole.AntiMage => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Tracker => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Enraged => 10, 
				PlayerCustom.PlayerNewPrimaryRole.Warlock => 10, 
				_ => 0, 
			};
		}
	}
	[HarmonyPatch(typeof(GameSettingsUI), "Start")]
	internal class GameConfigAddNewSettingsPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction<bool> <0>__UpdateTrapsModified;

			public static UnityAction<bool> <1>__UpdateAnonymousVotes;

			public static UnityAction<bool> <2>__UpdateAmogusMode;

			public static UnityAction<bool> <3>__UpdateSabotagesAvailable;

			public static UnityAction<bool> <4>__UpdateDropItemsAvailable;

			public static UnityAction <5>__OnClickConfigBase;

			public static UnityAction <6>__OnClickConfigMod;

			public static UnityAction <7>__OnClickConfigPotions;
		}

		private static void Postfix(GameSettingsUI __instance)
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_0399: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Expected I4, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04db: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0554: Unknown result type (might be due to invalid IL or missing references)
			//IL_0566: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0519: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0524: Expected O, but got Unknown
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Expected O, but got Unknown
			//IL_0643: Unknown