Decompiled source of Room Tool v1.0.0

RoomTool.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;
using MonoMod.Cil;
using SGUI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RoomTool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("N/A")]
[assembly: AssemblyProduct("RoomTool")]
[assembly: AssemblyCopyright("Copyright © N/A 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("85ce4615-de89-492f-b9fe-788c0983bb70")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace RoomTool
{
	public static class BlacklistManager
	{
		public static readonly HashSet<string> Blacklist = new HashSet<string>();

		public const string BlacklistFileName = "RoomBlacklist.txt";

		public static string BlacklistFilePath;

		public static void Init()
		{
			BlacklistFilePath = Path.Combine(Paths.ConfigPath, "RoomBlacklist.txt");
			LoadBlacklist();
		}

		public static void LoadBlacklist()
		{
			Blacklist.Clear();
			if (File.Exists(BlacklistFilePath))
			{
				string[] array = File.ReadAllLines(BlacklistFilePath);
				foreach (string item in array)
				{
					Blacklist.Add(item);
				}
			}
		}

		public static bool AddToBlacklist(string elem)
		{
			if (!Blacklist.Add(elem))
			{
				return false;
			}
			WriteBlacklist();
			return true;
		}

		public static bool RemoveFromBlacklist(string elem)
		{
			if (!Blacklist.Remove(elem))
			{
				return false;
			}
			WriteBlacklist();
			return true;
		}

		public static bool ClearBlacklist()
		{
			if (Blacklist.Count <= 0)
			{
				return false;
			}
			Blacklist.Clear();
			WriteBlacklist();
			return true;
		}

		public static void WriteBlacklist()
		{
			string directoryName = Path.GetDirectoryName(BlacklistFilePath);
			if (!Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
			string blacklistFilePath = BlacklistFilePath;
			HashSet<string> blacklist = Blacklist;
			int num = 0;
			string[] array = new string[blacklist.Count];
			foreach (string item in blacklist)
			{
				array[num] = item;
				num++;
			}
			File.WriteAllLines(blacklistFilePath, array);
		}
	}
	public static class ILTools
	{
		public static bool JumpToNext(this ILCursor crs, Func<Instruction, bool> match, int times = 1)
		{
			for (int i = 0; i < times; i++)
			{
				if (!crs.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { match }))
				{
					return false;
				}
			}
			return true;
		}

		public static bool JumpBeforeNext(this ILCursor crs, Func<Instruction, bool> match, int times = 1)
		{
			for (int i = 0; i < times; i++)
			{
				if (!crs.TryGotoNext((MoveType)((i != times - 1) ? 2 : 0), new Func<Instruction, bool>[1] { match }))
				{
					return false;
				}
			}
			return true;
		}

		public static IEnumerable MatchAfter(this ILCursor crs, Func<Instruction, bool> match)
		{
			Instruction curr = crs.Next;
			crs.Index = 0;
			while (crs.JumpToNext(match))
			{
				yield return null;
			}
			crs.Next = curr;
		}

		public static IEnumerable MatchBefore(this ILCursor crs, Func<Instruction, bool> match)
		{
			Instruction curr = crs.Next;
			crs.Index = 0;
			while (crs.JumpBeforeNext(match))
			{
				Instruction c = crs.Next;
				yield return null;
				crs.Goto(c, (MoveType)2, false);
			}
			crs.Next = curr;
		}

		public static VariableDefinition DeclareLocal<T>(this ILContext ctx)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected O, but got Unknown
			VariableDefinition val = new VariableDefinition(ctx.Import(typeof(T)));
			ctx.Body.Variables.Add(val);
			return val;
		}

		public static VariableDefinition DeclareLocal<T>(this ILCursor crs)
		{
			return crs.Context.DeclareLocal<T>();
		}

		public static bool TryGotoArg(this ILCursor crs, Instruction targetInstr, int argIndex, int instance = 0)
		{
			if (argIndex < 0)
			{
				return false;
			}
			if (instance < 0)
			{
				return false;
			}
			if (targetInstr == null)
			{
				return false;
			}
			List<Instruction> argumentInstructions = targetInstr.GetArgumentInstructions(crs.Context, argIndex);
			if (instance >= argumentInstructions.Count)
			{
				return false;
			}
			crs.Goto(argumentInstructions[instance], (MoveType)2, false);
			return true;
		}

		public static bool TryGotoArg(this ILCursor crs, int argIndex, int instance = 0)
		{
			return crs.TryGotoArg(crs.Next, argIndex, instance);
		}

		public static IEnumerable MatchArg(this ILCursor crs, Instruction targetInstr, int argIndex)
		{
			if (argIndex < 0 || targetInstr == null)
			{
				yield break;
			}
			Instruction curr = crs.Next;
			List<Instruction> argumentInstrs = targetInstr.GetArgumentInstructions(crs.Context, argIndex);
			foreach (Instruction arg in argumentInstrs)
			{
				crs.Goto(arg, (MoveType)2, false);
				yield return null;
			}
			crs.Next = curr;
		}

		public static IEnumerable MatchArg(this ILCursor crs, int argIndex)
		{
			return crs.MatchArg(crs.Next, argIndex);
		}

		private static List<Instruction> GetArgumentInstructions(this Instruction instruction, ILContext context, int argumentIndex)
		{
			int num = instruction.InputCount();
			int num2 = num - argumentIndex - 1;
			if (num2 < 0)
			{
				Debug.Log((object)$"Argument index {argumentIndex} is higher than the highest argument index ({num - 1})");
				return new List<Instruction>();
			}
			List<Instruction> list = instruction.PossiblePreviousInstructions(context);
			List<Instruction> list2 = new List<Instruction>();
			foreach (Instruction item in list)
			{
				BacktrackToArg(item, context, num2, list2);
			}
			list2.Sort((Instruction a, Instruction b) => context.IndexOf(a).CompareTo(context.IndexOf(b)));
			return list2;
		}

		private static void BacktrackToArg(Instruction current, ILContext ctx, int remainingMoves, List<Instruction> foundArgs)
		{
			if (remainingMoves <= 0 && current.OutputCount() > 0)
			{
				if (remainingMoves == 0)
				{
					foundArgs.Add(current);
				}
				return;
			}
			remainingMoves -= current.StackDelta();
			List<Instruction> list = current.PossiblePreviousInstructions(ctx);
			foreach (Instruction item in list)
			{
				BacktrackToArg(item, ctx, remainingMoves, foundArgs);
			}
		}

		public static int InputCount(this Instruction instr)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Expected I4, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Invalid comparison between Unknown and I4
			if (instr == null)
			{
				return 0;
			}
			OpCode opCode = instr.OpCode;
			if ((int)((OpCode)(ref opCode)).FlowControl == 2)
			{
				IMethodSignature val = (IMethodSignature)instr.Operand;
				int num = 0;
				if ((int)((OpCode)(ref opCode)).Code != 114 && val.HasThis && !val.ExplicitThis)
				{
					num++;
				}
				if (val.HasParameters)
				{
					num += val.Parameters.Count;
				}
				if ((int)((OpCode)(ref opCode)).Code == 40)
				{
					num++;
				}
				return num;
			}
			StackBehaviour stackBehaviourPop = ((OpCode)(ref opCode)).StackBehaviourPop;
			if (1 == 0)
			{
			}
			int result;
			switch (stackBehaviourPop - 1)
			{
			case 0:
			case 2:
			case 9:
				result = 1;
				break;
			case 1:
			case 3:
			case 4:
			case 5:
			case 7:
			case 8:
			case 10:
			case 11:
				result = 2;
				break;
			case 6:
			case 12:
			case 13:
			case 14:
			case 15:
			case 16:
				result = 3;
				break;
			default:
				result = 0;
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static int OutputCount(this Instruction instr)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected I4, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Invalid comparison between Unknown and I4
			if (instr == null)
			{
				return 0;
			}
			OpCode opCode = instr.OpCode;
			if ((int)((OpCode)(ref opCode)).FlowControl == 2)
			{
				IMethodSignature val = (IMethodSignature)instr.Operand;
				int num = 0;
				if ((int)((OpCode)(ref opCode)).Code == 114 || (int)val.ReturnType.MetadataType != 1)
				{
					num++;
				}
				return num;
			}
			StackBehaviour stackBehaviourPush = ((OpCode)(ref opCode)).StackBehaviourPush;
			if (1 == 0)
			{
			}
			int result;
			switch (stackBehaviourPush - 20)
			{
			case 0:
			case 2:
			case 3:
			case 4:
			case 5:
			case 6:
				result = 1;
				break;
			case 1:
				result = 2;
				break;
			default:
				result = 0;
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static int StackDelta(this Instruction instr)
		{
			return instr.OutputCount() - instr.InputCount();
		}

		public static List<Instruction> PossiblePreviousInstructions(this Instruction instr, ILContext ctx)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			List<Instruction> list = new List<Instruction>();
			Enumerator<Instruction> enumerator = ctx.Instrs.GetEnumerator();
			try
			{
				while (enumerator.MoveNext())
				{
					Instruction current = enumerator.Current;
					if (Array.IndexOf(current.PossibleNextInstructions(), instr) >= 0)
					{
						list.Add(current);
					}
				}
			}
			finally
			{
				((IDisposable)enumerator).Dispose();
			}
			return list;
		}

		public static Instruction[] PossibleNextInstructions(this Instruction instr)
		{
			//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_000b: 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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected I4, but got Unknown
			OpCode opCode = instr.OpCode;
			FlowControl flowControl = ((OpCode)(ref opCode)).FlowControl;
			if (1 == 0)
			{
			}
			Instruction[] result;
			switch ((int)flowControl)
			{
			case 2:
			case 5:
				result = (Instruction[])(object)new Instruction[1] { instr.Next };
				break;
			case 0:
			{
				Instruction branchTarget2 = instr.GetBranchTarget();
				result = (Instruction[])(object)((branchTarget2 == null) ? new Instruction[0] : new Instruction[1] { branchTarget2 });
				break;
			}
			case 3:
			{
				Instruction branchTarget = instr.GetBranchTarget();
				result = (Instruction[])(object)((branchTarget == null) ? new Instruction[1] { instr.Next } : new Instruction[2] { instr.Next, branchTarget });
				break;
			}
			default:
				result = (Instruction[])(object)new Instruction[0];
				break;
			}
			if (1 == 0)
			{
			}
			return result;
		}

		public static Instruction GetBranchTarget(this Instruction branch)
		{
			object operand = branch.Operand;
			Instruction val = (Instruction)((operand is Instruction) ? operand : null);
			if (val != null)
			{
				return val;
			}
			object operand2 = branch.Operand;
			return ((ILLabel)(((operand2 is ILLabel) ? operand2 : null)?)).Target;
		}

		public static string InstructionToString(this Instruction c)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//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: Invalid comparison between Unknown and I4
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Invalid comparison between Unknown and I4
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				return ((object)c).ToString();
			}
			catch
			{
				try
				{
					OpCode opCode = c.OpCode;
					OperandType operandType = ((OpCode)(ref opCode)).OperandType;
					if (((int)operandType == 0 || (int)operandType == 15) ? true : false)
					{
						object operand = c.Operand;
						ILLabel val = (ILLabel)((operand is ILLabel) ? operand : null);
						if (val != null)
						{
							object arg = c.Offset;
							opCode = c.OpCode;
							return $"IL_{arg:x4}: {((OpCode)(ref opCode)).Name} IL_{val.Target.Offset:x4}";
						}
					}
					opCode = c.OpCode;
					if ((int)((OpCode)(ref opCode)).OperandType == 10 && c.Operand is IEnumerable<ILLabel> source)
					{
						object arg2 = c.Offset;
						opCode = c.OpCode;
						return string.Format("IL_{0:x4}: {1} {2}", arg2, ((OpCode)(ref opCode)).Name, string.Join(", ", source.Select((ILLabel x) => x.Target.Offset.ToString("x4")).ToArray()));
					}
				}
				catch
				{
				}
			}
			return "This shouldn't be happening";
		}

		public static T EnumeratorGetField<T>(this object obj, string name)
		{
			return (T)obj.GetType().EnumeratorField(name).GetValue(obj);
		}

		public static FieldInfo EnumeratorField(this MethodBase method, string name)
		{
			return method.DeclaringType.EnumeratorField(name);
		}

		public static FieldInfo EnumeratorField(this Type tp, string name)
		{
			return tp.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).First((FieldInfo x) => (object)x != null && x.Name != null && (x.Name.Contains("<" + name + ">") || x.Name == name));
		}
	}
	[HarmonyPatch]
	public static class Patches
	{
		public static MethodInfo fbs_fbl_rl = AccessTools.Method(typeof(Patches), "FixBossSelection_FixBossesList_ReplaceList", (Type[])null, (Type[])null);

		[HarmonyPatch(typeof(PrototypeDungeonRoom), "CheckPrerequisites")]
		[HarmonyPostfix]
		public static void InvalidateBlacklistedRoom_Postfix(PrototypeDungeonRoom __instance, ref bool __result)
		{
			if (__result && !((Object)(object)__instance == (Object)null) && BlacklistManager.Blacklist.Contains(((Object)__instance).name))
			{
				__result = false;
			}
		}

		[HarmonyPatch(typeof(IndividualBossFloorEntry), "GlobalPrereqsValid")]
		[HarmonyPostfix]
		public static void FixBossSelection_InvalidateBlacklistedBoss_Postfix(IndividualBossFloorEntry __instance, ref bool __result)
		{
			if (!__result || __instance == null || (Object)(object)__instance.TargetRoomTable == (Object)null || __instance.TargetRoomTable.includedRooms == null || __instance.TargetRoomTable.includedRooms.elements == null || __instance.TargetRoomTable.includedRooms.elements.Count <= 0)
			{
				return;
			}
			List<WeightedRoom> elements = __instance.TargetRoomTable.includedRooms.elements;
			foreach (WeightedRoom item in elements)
			{
				if (item == null || (Object)(object)item.room == (Object)null || !BlacklistManager.Blacklist.Contains(((Object)item.room).name))
				{
					return;
				}
			}
			__result = false;
		}

		[HarmonyPatch(typeof(OverrideBossFloorEntry), "GlobalPrereqsValid")]
		[HarmonyPostfix]
		public static void FixBossSelection_InvalidateBlacklistedOverrideBoss_Postfix(OverrideBossFloorEntry __instance, ref bool __result)
		{
			if (!__result || __instance == null || (Object)(object)__instance.TargetRoomTable == (Object)null || __instance.TargetRoomTable.includedRooms == null || __instance.TargetRoomTable.includedRooms.elements == null || __instance.TargetRoomTable.includedRooms.elements.Count <= 0)
			{
				return;
			}
			List<WeightedRoom> elements = __instance.TargetRoomTable.includedRooms.elements;
			foreach (WeightedRoom item in elements)
			{
				if (item == null || (Object)(object)item.room == (Object)null || !BlacklistManager.Blacklist.Contains(((Object)item.room).name))
				{
					return;
				}
			}
			__result = false;
		}

		[HarmonyPatch(typeof(BossFloorEntry), "SelectBoss")]
		[HarmonyILManipulator]
		public static void FixBossSelection_FixBossesList_Transpiler(ILContext ctx)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(ctx);
			if (val.JumpToNext((Instruction x) => ILPatternMatchingExt.MatchLdfld<BossFloorEntry>(x, "Bosses"), 8))
			{
				val.Emit(OpCodes.Ldloc_0);
				val.Emit(OpCodes.Call, (MethodBase)fbs_fbl_rl);
			}
		}

		public static List<IndividualBossFloorEntry> FixBossSelection_FixBossesList_ReplaceList(List<IndividualBossFloorEntry> _, List<IndividualBossFloorEntry> list)
		{
			return list;
		}
	}
	[BepInPlugin("spapi.etg.roomtool", "Room Tool", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string GUID = "spapi.etg.roomtool";

		public const string NAME = "Room Tool";

		public const string VERSION = "1.0.0";

		public void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			BlacklistManager.Init();
			new Harmony("spapi.etg.roomtool").PatchAll();
			ETGModConsole.Commands.AddGroup("roomtool");
			ConsoleCommandGroup group = ETGModConsole.Commands.GetGroup("roomtool");
			group.AddUnit("roomname", (Action<string[]>)LogRoomName);
			group.AddGroup("blacklist");
			ConsoleCommandGroup group2 = group.GetGroup("blacklist");
			group2.AddUnit("addcurrent", (Action<string[]>)BlacklistCurrent);
			group2.AddUnit("addbyname", (Action<string[]>)BlacklistByName);
			group2.AddUnit("remove", (Action<string[]>)UnblacklistRoom);
			group2.AddUnit("clear", (Action<string[]>)UnblacklistAll);
			group2.AddUnit("list", (Action<string[]>)LogBlacklist);
			ETGModConsole.CommandDescriptions["roomtool roomname"] = "Logs the name of the current room to the console.";
			ETGModConsole.CommandDescriptions["roomtool blacklist addcurrent"] = "Blacklists the current room.";
			ETGModConsole.CommandDescriptions["roomtool blacklist addbyname"] = "Blacklist a room with a given name.";
			ETGModConsole.CommandDescriptions["roomtool blacklist remove"] = "Unblacklists a room with a given name.";
			ETGModConsole.CommandDescriptions["roomtool blacklist clear"] = "Clears the room blacklist.";
			ETGModConsole.CommandDescriptions["roomtool blacklist list"] = "Logs the names of all blacklisted rooms to the console.";
		}

		public static void LogRoomName(string[] args)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (!GameManager.HasInstance || (Object)(object)GameManager.Instance.PrimaryPlayer == (Object)null)
			{
				((SElement)ETGModConsole.Log((object)"No active player.", false)).Foreground = Color.red;
			}
			else if (GameManager.Instance.PrimaryPlayer.CurrentRoom == null)
			{
				((SElement)ETGModConsole.Log((object)"The player is not currently in a room.", false)).Foreground = Color.red;
			}
			else
			{
				ETGModConsole.Log((object)GameManager.Instance.PrimaryPlayer.CurrentRoom.GetRoomName(), false);
			}
		}

		public static void BlacklistCurrent(string[] args)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			if (!GameManager.HasInstance || (Object)(object)GameManager.Instance.PrimaryPlayer == (Object)null)
			{
				((SElement)ETGModConsole.Log((object)"No active player.", false)).Foreground = Color.red;
				return;
			}
			if (GameManager.Instance.PrimaryPlayer.CurrentRoom == null)
			{
				((SElement)ETGModConsole.Log((object)"The player is not currently in a room.", false)).Foreground = Color.red;
				return;
			}
			string roomName = GameManager.Instance.PrimaryPlayer.CurrentRoom.GetRoomName();
			if (BlacklistManager.AddToBlacklist(roomName))
			{
				((SElement)ETGModConsole.Log((object)("Current room \"" + roomName + "\" successfully blacklisted."), false)).Foreground = Color.green;
			}
			else
			{
				((SElement)ETGModConsole.Log((object)("Current room \"" + roomName + "\" is already blacklisted."), false)).Foreground = Color.yellow;
			}
		}

		public static void BlacklistByName(string[] args)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			if (args.Length != 0)
			{
				text = args[0];
			}
			if (BlacklistManager.AddToBlacklist(text))
			{
				((SElement)ETGModConsole.Log((object)("Room \"" + text + "\" successfully blacklisted."), false)).Foreground = Color.green;
			}
			else
			{
				((SElement)ETGModConsole.Log((object)("Room \"" + text + "\" is already blacklisted."), false)).Foreground = Color.yellow;
			}
		}

		public static void UnblacklistRoom(string[] args)
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			string text = "";
			if (args.Length != 0)
			{
				text = args[0];
			}
			if (BlacklistManager.RemoveFromBlacklist(text))
			{
				((SElement)ETGModConsole.Log((object)("Room \"" + text + "\" successfully removed from the blacklist."), false)).Foreground = Color.green;
			}
			else
			{
				((SElement)ETGModConsole.Log((object)("Room \"" + text + "\" is not in the blacklist."), false)).Foreground = Color.yellow;
			}
		}

		public static void UnblacklistAll(string[] args)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (BlacklistManager.ClearBlacklist())
			{
				((SElement)ETGModConsole.Log((object)"Blacklist successfully cleared.", false)).Foreground = Color.green;
			}
			else
			{
				((SElement)ETGModConsole.Log((object)"The room blacklist is empty.", false)).Foreground = Color.yellow;
			}
		}

		public static void LogBlacklist(string[] args)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			if (BlacklistManager.Blacklist.Count <= 0)
			{
				((SElement)ETGModConsole.Log((object)"The room blacklist is empty.", false)).Foreground = Color.yellow;
				return;
			}
			ETGModConsole.Log((object)"Current room blacklist:", false);
			foreach (string item in BlacklistManager.Blacklist)
			{
				ETGModConsole.Log((object)item, false);
			}
		}
	}
}