Decompiled source of CreepoCore v1.0.0

CreepoCore.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CreepoCore")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CreepoCore")]
[assembly: AssemblyTitle("CreepoCore")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 CreepoCore
{
	internal static class LateJoinFix
	{
		private static FieldRef<RunManager, bool> restarting;

		internal static void Apply(Harmony harmony)
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			try
			{
				if (Chainloader.PluginInfos.TryGetValue("zichen.latejoinnow", out var value))
				{
					MethodInfo methodInfo = ((object)value.Instance).GetType().Assembly.GetTypes().SelectMany((Type t) => t.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)).FirstOrDefault((MethodInfo m) => m.Name == "RunManagerChangeLevelPrefix");
					if (methodInfo == null)
					{
						Plugin.Log.LogWarning((object)"Late Join Now cleanup not found; no fix applied.");
						return;
					}
					restarting = AccessTools.FieldRefAccess<RunManager, bool>("restarting");
					harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(LateJoinFix), "OnlyOnRealChange", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.Log.LogInfo((object)"Late Join Now level-change fix ready.");
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Late Join Now fix failed: " + ex.Message));
			}
		}

		private static bool OnlyOnRealChange()
		{
			try
			{
				RunManager instance = RunManager.instance;
				if ((Object)(object)instance == (Object)null)
				{
					return true;
				}
				if (restarting.Invoke(instance))
				{
					return false;
				}
				return SemiFunc.MenuLevel() || SemiFunc.IsMasterClientOrSingleplayer();
			}
			catch
			{
				return true;
			}
		}
	}
	internal static class GoopFix
	{
		internal static void Apply(Harmony harmony)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			try
			{
				if (Chainloader.PluginInfos.ContainsKey("GoopSwagger.GoopUpgrades"))
				{
					MethodInfo methodInfo = AccessTools.Method(AccessTools.TypeByName("GoopUpgrades.ShieldUI"), "Update", (Type[])null, (Type[])null);
					if (methodInfo == null)
					{
						Plugin.Log.LogWarning((object)"Goop shield display not found; no fix applied.");
						return;
					}
					harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(GoopFix), "PlayerExists", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.Log.LogInfo((object)"Goop Upgrades shield display fix ready.");
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Goop Upgrades fix failed: " + ex.Message));
			}
		}

		private static bool PlayerExists()
		{
			return (Object)(object)PlayerAvatar.instance != (Object)null;
		}
	}
	internal static class VoodooFix
	{
		private const float Near = 2f;

		private const float Far = 14f;

		private static readonly string[] Walking = new string[3] { "footstepLeftSound", "footstepRightSound", "voodooMoveSound" };

		private static readonly Dictionary<Sound, Component> steps = new Dictionary<Sound, Component>();

		internal static void Apply(Harmony harmony)
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			try
			{
				if (Chainloader.PluginInfos.ContainsKey("WesleysEnemies"))
				{
					MethodInfo methodInfo = AccessTools.Method(AccessTools.TypeByName("WesleysEnemies.AI.Voodoo"), "Awake", (Type[])null, (Type[])null);
					MethodInfo methodInfo2 = AccessTools.Method(typeof(Sound), "Play", new Type[5]
					{
						typeof(Vector3),
						typeof(float),
						typeof(float),
						typeof(float),
						typeof(float)
					}, (Type[])null);
					if (methodInfo == null || methodInfo2 == null)
					{
						Plugin.Log.LogWarning((object)"Voodoo not found; no fix applied.");
						return;
					}
					harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(VoodooFix), "Found", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(VoodooFix), "Played", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
					Plugin.Log.LogInfo((object)"Voodoo footstep range fix ready.");
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Voodoo fix failed: " + ex.Message));
			}
		}

		private static void Found(Component __instance)
		{
			try
			{
				object value = Traverse.Create((object)__instance).Field("VoodooAnim").GetValue();
				Component val = (Component)((value is Component) ? value : null);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				foreach (Sound item in (from p in steps
					where (Object)(object)p.Value == (Object)null
					select p.Key).ToList())
				{
					steps.Remove(item);
				}
				GameObject val2 = (((Object)(object)AudioManager.instance != (Object)null) ? AudioManager.instance.AudioDefault : null);
				AudioSource val3 = (((Object)(object)val2 != (Object)null) ? val2.GetComponent<AudioSource>() : null);
				float falloffMultiplier = (((Object)(object)val3 != (Object)null && val3.maxDistance > 14f) ? (14f / val3.maxDistance) : 1f);
				string[] walking = Walking;
				foreach (string text in walking)
				{
					object value2 = Traverse.Create((object)val).Field(text).GetValue();
					Sound val4 = (Sound)((value2 is Sound) ? value2 : null);
					if (val4 != null)
					{
						val4.FalloffMultiplier = falloffMultiplier;
						steps[val4] = val;
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Voodoo fix failed: " + ex.Message));
			}
		}

		private static void Played(Sound __instance, AudioSource __result)
		{
			try
			{
				if (!((Object)(object)__result == (Object)null) && steps.ContainsKey(__instance))
				{
					__result.rolloffMode = (AudioRolloffMode)1;
					__result.minDistance = 2f;
				}
			}
			catch
			{
			}
		}
	}
	internal static class SettingsLock
	{
		internal static void Apply(Harmony harmony)
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Expected O, but got Unknown
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			try
			{
				if (!Chainloader.PluginInfos.ContainsKey("nickklmao.repoconfig"))
				{
					return;
				}
				Type type = AccessTools.TypeByName("REPOConfig.ConfigMenu");
				MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "CreateModMenu", (Type[])null, (Type[])null));
				if (methodInfo == null)
				{
					Plugin.Log.LogWarning((object)"Mod settings menu not found; it stays unlocked.");
					return;
				}
				harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(SettingsLock), "BlockOpen", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				int num = 0;
				Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Public | BindingFlags.NonPublic);
				for (int i = 0; i < nestedTypes.Length; i++)
				{
					MethodInfo[] methods = nestedTypes[i].GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
					foreach (MethodInfo methodInfo2 in methods)
					{
						ParameterInfo[] parameters = methodInfo2.GetParameters();
						if (methodInfo2.Name.Contains("<Initialize>") && !(methodInfo2.ReturnType != typeof(void)) && parameters.Length == 1 && !(parameters[0].ParameterType != typeof(Transform)))
						{
							harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(SettingsLock), "HideButton", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
							num++;
						}
					}
				}
				Plugin.Log.LogInfo((object)$"Mod settings lock ready ({num} buttons).");
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Mod settings lock failed: " + ex.Message));
			}
		}

		private static bool HideButton()
		{
			return !Game.InMultiplayer();
		}

		private static bool BlockOpen()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!Game.InMultiplayer())
			{
				return true;
			}
			try
			{
				MenuManager instance = MenuManager.instance;
				if (instance != null)
				{
					instance.PagePopUp("Locked", new Color(1f, 0.55f, 0f), "Mod settings can't be changed during a multiplayer game.", "OK", true);
				}
			}
			catch
			{
			}
			return false;
		}
	}
	internal static class DevMode
	{
		private static bool looked;

		private static ConfigEntry<bool> dev;

		private static ConfigEntry<bool> vanilla;

		private static bool devWasOn;

		private static bool vanillaWasOn;

		internal static void Tick()
		{
			if (!looked)
			{
				looked = true;
				Type type = AccessTools.TypeByName("REPOLib.ConfigManager");
				dev = type?.GetProperty("DeveloperMode", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null) as ConfigEntry<bool>;
				vanilla = type?.GetProperty("VanillaDeveloperMode", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(null) as ConfigEntry<bool>;
			}
			if (Game.InMultiplayer())
			{
				if (dev != null && dev.Value)
				{
					devWasOn = true;
					SetQuiet(dev, value: false);
				}
				if (vanilla != null && vanilla.Value)
				{
					vanillaWasOn = true;
					SetQuiet(vanilla, value: false);
				}
			}
			else
			{
				if (devWasOn)
				{
					devWasOn = false;
					SetQuiet(dev, value: true);
				}
				if (vanillaWasOn)
				{
					vanillaWasOn = false;
					SetQuiet(vanilla, value: true);
				}
			}
		}

		private static void SetQuiet(ConfigEntry<bool> entry, bool value)
		{
			ConfigFile configFile = ((ConfigEntryBase)entry).ConfigFile;
			bool saveOnConfigSet = configFile.SaveOnConfigSet;
			configFile.SaveOnConfigSet = false;
			try
			{
				entry.Value = value;
			}
			finally
			{
				configFile.SaveOnConfigSet = saveOnConfigSet;
			}
		}
	}
	internal static class ModCheck
	{
		private const string ModsKey = "creepoMods";

		private const string CheckKey = "creepoCheck";

		private static string mine;

		private static HashSet<string> mineSet;

		private static float nextPublish;

		private static readonly Dictionary<int, float> firstSeen = new Dictionary<int, float>();

		private static readonly Dictionary<int, float> refused = new Dictionary<int, float>();

		private static readonly HashSet<int> banned = new HashSet<int>();

		private static string pendingReason;

		private static float menuTime;

		internal static void Tick()
		{
			if (!PhotonNetwork.InRoom)
			{
				firstSeen.Clear();
				refused.Clear();
				banned.Clear();
				nextPublish = 0f;
				ShowPending();
				return;
			}
			menuTime = 0f;
			if (mine == null)
			{
				mineSet = new HashSet<string>(Chainloader.PluginInfos.Keys);
				mine = string.Join(",", mineSet.OrderBy<string, string>((string g) => g, StringComparer.Ordinal));
			}
			Publish();
			if (PhotonNetwork.IsMasterClient)
			{
				HostCheck();
			}
			else
			{
				ClientCheck();
			}
		}

		private static void Publish()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Expected O, but got Unknown
			//IL_00b5: Expected O, but got Unknown
			Player localPlayer = PhotonNetwork.LocalPlayer;
			bool flag = PhotonNetwork.IsMasterClient && Plugin.CheckMods.Value;
			if (localPlayer.CustomProperties[(object)"creepoMods"] as string == mine)
			{
				object obj = localPlayer.CustomProperties[(object)"creepoCheck"];
				bool flag2 = default(bool);
				int num;
				if (obj is bool)
				{
					flag2 = (bool)obj;
					num = 1;
				}
				else
				{
					num = 0;
				}
				if (((uint)num & (flag2 ? 1u : 0u)) == (flag ? 1u : 0u))
				{
					return;
				}
			}
			if (!(Time.unscaledTime < nextPublish))
			{
				nextPublish = Time.unscaledTime + 5f;
				Hashtable val = new Hashtable();
				((Dictionary<object, object>)val).Add((object)"creepoMods", (object)mine);
				((Dictionary<object, object>)val).Add((object)"creepoCheck", (object)flag);
				localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
			}
		}

		private static void HostCheck()
		{
			if (!Plugin.CheckMods.Value)
			{
				return;
			}
			Player[] playerListOthers = PhotonNetwork.PlayerListOthers;
			foreach (Player val in playerListOthers)
			{
				float value2;
				if (refused.TryGetValue(val.ActorNumber, out var value))
				{
					if (Time.unscaledTime - value > 5f && banned.Add(val.ActorNumber) && (Object)(object)NetworkManager.instance != (Object)null)
					{
						NetworkManager.instance.BanPlayer(val);
					}
				}
				else if (val.CustomProperties[(object)"creepoMods"] is string text)
				{
					List<string> list = (from g in text.Split(',')
						where g.Length > 0 && !mineSet.Contains(g)
						select g).ToList();
					if (list.Count > 0)
					{
						Refuse(val, "runs mods you don't: " + string.Join(", ", list));
					}
				}
				else if (!firstSeen.TryGetValue(val.ActorNumber, out value2))
				{
					firstSeen[val.ActorNumber] = Time.unscaledTime;
				}
				else if (Time.unscaledTime - value2 > (float)Plugin.JoinGraceSeconds.Value)
				{
					Refuse(val, "did not report their mods (Creepo Core missing)");
				}
			}
		}

		private static void Refuse(Player p, string why)
		{
			//IL_0045: 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)
			refused[p.ActorNumber] = Time.unscaledTime;
			Plugin.Log.LogWarning((object)("Refused " + p.NickName + ": " + why));
			try
			{
				SemiFunc.UIFocusText(p.NickName + " refused: mod list differs", Color.white, new Color(1f, 0.55f, 0f), 4f);
			}
			catch
			{
			}
			if ((Object)(object)NetworkManager.instance != (Object)null)
			{
				NetworkManager.instance.KickPlayer(p);
			}
		}

		private static void ClientCheck()
		{
			if (pendingReason != null)
			{
				return;
			}
			Player masterClient = PhotonNetwork.MasterClient;
			if (masterClient == null)
			{
				return;
			}
			object obj = masterClient.CustomProperties[(object)"creepoCheck"];
			if (obj is bool && (bool)obj && masterClient.CustomProperties[(object)"creepoMods"] is string text)
			{
				HashSet<string> hostSet = new HashSet<string>(text.Split(','));
				PluginInfo value;
				List<string> list = (from g in mineSet
					where !hostSet.Contains(g)
					select (!Chainloader.PluginInfos.TryGetValue(g, out value)) ? g : value.Metadata.Name).ToList();
				if (list.Count != 0)
				{
					pendingReason = "The host is not running:\n<b>" + string.Join(", ", list) + "</b>\nRemove " + ((list.Count == 1) ? "it" : "them") + " to join.";
					Plugin.Log.LogWarning((object)("Host will refuse this game. " + pendingReason.Replace("\n", " ")));
				}
			}
		}

		private static void ShowPending()
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			if (pendingReason == null)
			{
				return;
			}
			if ((Object)(object)RunManager.instance == (Object)null || (Object)(object)MenuManager.instance == (Object)null || !SemiFunc.IsMainMenu())
			{
				menuTime = 0f;
				return;
			}
			menuTime += 0.25f;
			if (menuTime < 2f)
			{
				return;
			}
			string text = pendingReason;
			pendingReason = null;
			try
			{
				MenuManager.instance.PagePopUp("Creepo Lock", new Color(1f, 0.55f, 0f), text, "OK", true);
			}
			catch
			{
			}
		}
	}
	internal static class MapChoice
	{
		private const string RoomKey = "creepoMaps";

		private static Type mapVote;

		private static Type optionType;

		private static FieldInfo optionsField;

		private static PropertyInfo levelProp;

		private static PropertyInfo buttonProp;

		private static PropertyInfo randomProp;

		private static MethodInfo lastPlayed;

		private static readonly List<object> shown = new List<object>();

		private static string hostList;

		private static string applied;

		internal static void Apply(Harmony harmony)
		{
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Expected O, but got Unknown
			try
			{
				if (Chainloader.PluginInfos.ContainsKey("Patrick.MapVote"))
				{
					mapVote = AccessTools.TypeByName("MapVote.MapVote");
					optionType = AccessTools.TypeByName("MapVote.VoteOptionButton");
					optionsField = AccessTools.Field(mapVote, "VoteOptionButtons");
					levelProp = AccessTools.Property(optionType, "Level");
					buttonProp = AccessTools.Property(optionType, "Button");
					randomProp = AccessTools.Property(optionType, "IsRandomButton");
					lastPlayed = AccessTools.Method(mapVote, "HasBeenLastPlayed", (Type[])null, (Type[])null);
					MethodInfo methodInfo = AccessTools.Method(mapVote, "CreateVotePopup", (Type[])null, (Type[])null);
					if (optionsField == null || levelProp == null || buttonProp == null || randomProp == null || methodInfo == null)
					{
						Plugin.Log.LogWarning((object)"Map Vote has changed; the short list is off.");
						mapVote = null;
					}
					else
					{
						harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(MapChoice), "AfterPopup", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
						Plugin.Log.LogInfo((object)"Map Vote short list ready.");
					}
				}
			}
			catch (Exception ex)
			{
				mapVote = null;
				Plugin.Log.LogWarning((object)("Map Vote short list failed: " + ex.Message));
			}
		}

		private static void AfterPopup()
		{
			try
			{
				shown.Clear();
				foreach (object item in (IEnumerable)optionsField.GetValue(null))
				{
					shown.Add(item);
				}
				applied = null;
				if (SemiFunc.IsMasterClientOrSingleplayer())
				{
					if (hostList == null || !hostList.StartsWith(Round() + "|"))
					{
						Pick();
					}
					Filter(hostList);
				}
				else
				{
					Filter(RoomList());
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Map Vote short list: " + ex.Message));
			}
		}

		internal static void Tick()
		{
			if (mapVote == null || (Object)(object)RunManager.instance == (Object)null)
			{
				return;
			}
			if (SemiFunc.IsMasterClientOrSingleplayer())
			{
				if (hostList != null && !hostList.StartsWith(Round() + "|"))
				{
					hostList = null;
					Share("");
				}
			}
			else
			{
				string text = RoomList();
				if (shown.Count > 0 && text + "@" + Round() != applied)
				{
					Filter(text);
				}
			}
		}

		private static string Round()
		{
			RunManager instance = RunManager.instance;
			return instance.levelsCompleted + ":" + (((Object)(object)instance.levelCurrent != (Object)null) ? ((Object)instance.levelCurrent).name : "");
		}

		private static void Pick()
		{
			List<string> list = (from l in RunManager.instance.levels
				where (Object)(object)l != (Object)null
				select ((Object)l).name).Distinct().ToList();
			List<string> list2 = list.Where((string n) => !(lastPlayed != null) || !(bool)lastPlayed.Invoke(null, new object[1] { n })).ToList();
			int value = Plugin.MapChoices.Value;
			List<string> list3 = ((list2.Count >= value) ? list2 : list);
			List<string> list4 = new List<string>();
			while (list4.Count < value && list3.Count > 0)
			{
				int index = Random.Range(0, list3.Count);
				list4.Add(list3[index]);
				list3.RemoveAt(index);
			}
			hostList = Round() + "|" + string.Join("|", list4);
			Share(hostList);
		}

		private static void Share(string value)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_002b: Expected O, but got Unknown
			if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient)
			{
				Room currentRoom = PhotonNetwork.CurrentRoom;
				Hashtable val = new Hashtable();
				((Dictionary<object, object>)val).Add((object)"creepoMaps", (object)value);
				currentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null);
			}
		}

		private static string RoomList()
		{
			if (!PhotonNetwork.InRoom)
			{
				return null;
			}
			return ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties[(object)"creepoMaps"] as string;
		}

		private static void Filter(string list)
		{
			applied = list + "@" + Round();
			HashSet<string> hashSet = null;
			if (!string.IsNullOrEmpty(list))
			{
				string[] array = list.Split('|');
				if (array[0] == Round() && array.Length > 1)
				{
					hashSet = new HashSet<string>(array.Skip(1));
				}
			}
			IList list2 = (IList)optionsField.GetValue(null);
			foreach (object item in shown)
			{
				bool flag = hashSet == null || (bool)randomProp.GetValue(item) || hashSet.Contains((string)levelProp.GetValue(item));
				SetVisible(buttonProp.GetValue(item), flag);
				if (!flag)
				{
					list2.Remove(item);
				}
			}
		}

		private static void SetVisible(object button, bool visible)
		{
			if (button == null)
			{
				return;
			}
			object obj = AccessTools.Property(button.GetType(), "repoScrollViewElement")?.GetValue(button);
			PropertyInfo propertyInfo = ((obj == null) ? null : AccessTools.Property(obj.GetType(), "visibility"));
			if (propertyInfo != null)
			{
				propertyInfo.SetValue(obj, visible);
				return;
			}
			Component val = (Component)((button is Component) ? button : null);
			if (val != null)
			{
				val.gameObject.SetActive(visible);
			}
		}
	}
	[BepInPlugin("cam.creepocore", "Creepo Core", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string Guid = "cam.creepocore";

		public const string Version = "1.0.0";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> CheckMods;

		internal static ConfigEntry<int> JoinGraceSeconds;

		internal static ConfigEntry<int> MapChoices;

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			//IL_00b7: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			CheckMods = ((BaseUnityPlugin)this).Config.Bind<bool>("Lock", "CheckMods", true, "Host only. Refuse players who run a mod the host is not running.");
			JoinGraceSeconds = ((BaseUnityPlugin)this).Config.Bind<int>("Lock", "JoinGraceSeconds", 30, new ConfigDescription("Host only. Seconds a joining player has to report their mods before being refused.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 120), Array.Empty<object>()));
			MapChoices = ((BaseUnityPlugin)this).Config.Bind<int>("Map Vote", "MapChoices", 3, new ConfigDescription("Host only. How many maps are offered in each vote.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 8), Array.Empty<object>()));
			Harmony val = new Harmony("cam.creepocore");
			SettingsLock.Apply(val);
			MapChoice.Apply(val);
			LateJoinFix.Apply(val);
			GoopFix.Apply(val);
			VoodooFix.Apply(val);
			GameObject val2 = new GameObject("CreepoCore")
			{
				hideFlags = (HideFlags)61
			};
			Object.DontDestroyOnLoad((Object)val2);
			val2.AddComponent<Ticker>();
			Log.LogInfo((object)"Creepo Core 1.0.0 loaded.");
		}
	}
	internal class Ticker : MonoBehaviour
	{
		private float next;

		private void Update()
		{
			if (Time.unscaledTime < next)
			{
				return;
			}
			next = Time.unscaledTime + 0.25f;
			try
			{
				DevMode.Tick();
				ModCheck.Tick();
				MapChoice.Tick();
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Tick failed: " + ex.Message));
			}
		}
	}
	internal static class Game
	{
		internal static bool InMultiplayer()
		{
			if (PhotonNetwork.InRoom)
			{
				return true;
			}
			if ((Object)(object)GameManager.instance != (Object)null)
			{
				return GameManager.instance.gameMode == 1;
			}
			return false;
		}
	}
}