STFU.dll

Decompiled 4 days ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AIGraph;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GTFO.API;
using GTFO.API.Utilities;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using LevelGeneration;
using LevelGeneration.Core;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("STFU")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("STFU")]
[assembly: AssemblyTitle("STFU")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace STFU
{
	internal static class BoxColliderPseudofix
	{
		public static readonly Dictionary<BoxCollider, (Vector3, Vector3)> AffectedBoxColliders = new Dictionary<BoxCollider, (Vector3, Vector3)>();

		public const string NegativeScaleSize = "BoxColliders does not support negative size or scale.";

		private const string Warning = "Warning";

		public static void Setup()
		{
			LevelAPI.OnBuildDone += OnBuildDone;
			LevelAPI.OnEnterLevel += OnEnterLevel;
			LevelAPI.OnLevelCleanup += OnLevelCleanup;
		}

		private static void OnBuildDone()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			foreach (BoxCollider item in Object.FindObjectsOfType<BoxCollider>())
			{
				if ((Object)(object)item != (Object)null)
				{
					Transform transform = ((Component)item).transform;
					Vector3 lossyScale = transform.lossyScale;
					Vector3 size = item.size;
					bool flag = lossyScale.x < 0f || lossyScale.y < 0f || lossyScale.z < 0f;
					bool flag2 = size.x < 0f || size.y < 0f || size.z < 0f;
					if (flag || flag2)
					{
						AffectedBoxColliders[item] = (transform.localScale, size);
						STFULogger.LogAs("Warning", "BoxColliders does not support negative size or scale.", suppressLog: true);
						Vector3 localScale = transform.localScale;
						localScale.x *= Mathf.Sign(lossyScale.x);
						localScale.y *= Mathf.Sign(lossyScale.y);
						localScale.z *= Mathf.Sign(lossyScale.z);
						transform.localScale = localScale;
						item.size = new Vector3(Mathf.Abs(size.x), Mathf.Abs(size.y), Mathf.Abs(size.z));
					}
				}
			}
		}

		private static void OnEnterLevel()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			//IL_0033: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			foreach (KeyValuePair<BoxCollider, (Vector3, Vector3)> affectedBoxCollider in AffectedBoxColliders)
			{
				BoxCollider key = affectedBoxCollider.Key;
				var (localScale, size) = affectedBoxCollider.Value;
				((Component)key).transform.localScale = localScale;
				key.size = size;
			}
			if (!Configuration.LogBoxColliderResults || !AffectedBoxColliders.Any())
			{
				return;
			}
			STFULogger.LogWarning($"Found {AffectedBoxColliders.Count} BoxColliders with negative size or scale");
			if (Configuration.ShowAffectedBoxColliderNames)
			{
				STFULogger.LogDebug(AffectedBoxColliders.Keys.Select((BoxCollider box) => ((Object)box).name).Aggregate((string a, string b) => a + ", " + b));
			}
		}

		private static void OnLevelCleanup()
		{
			AffectedBoxColliders.Clear();
		}
	}
	[HarmonyPatch]
	internal static class CGWS_Wrapper
	{
		public const string PLUGIN_GUID = "com.Untilted.ConfigurableGlobalWaveSettings";

		private static readonly Type? SPtype;

		public const string SPmethod = "LogNextType";

		public static bool IsLoaded { get; private set; }

		static CGWS_Wrapper()
		{
			IsLoaded = false;
			if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("com.Untilted.ConfigurableGlobalWaveSettings", out var value))
			{
				try
				{
					Assembly assembly = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? throw new Exception("CGWS Assembly is missing!");
					Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(assembly);
					SPtype = typesFromAssembly.First((Type t) => t.Name == "SettingsPatches");
					IsLoaded = SPtype != null;
				}
				catch (Exception value2)
				{
					STFULogger.LogError($"Exception thrown while reading data from ConfigurableGlobalWaveSettings:\n{value2}");
					IsLoaded = false;
				}
			}
			STFULogger.LogDebug($"ConfigurableGlobalWaveSettings is loaded: {IsLoaded}");
		}

		[HarmonyPrepare]
		private static bool PreparePatch()
		{
			return IsLoaded;
		}

		[HarmonyTargetMethod]
		private static MethodBase GetTargetMethod()
		{
			STFULogger.LogDebug("Found CGWS patch method: LogNextType");
			return AccessTools.Method(SPtype, "LogNextType", (Type[])null, (Type[])null);
		}

		[HarmonyPrefix]
		private static bool Pre_LogNextType()
		{
			return !Configuration.SuppressAllCGWSLogs;
		}
	}
	internal static class Configuration
	{
		private static readonly ConfigFile Config;

		private static readonly ConfigEntry<bool> Config_SuppressAllMCP3Logs;

		private static readonly ConfigEntry<bool> Config_SuppressCGWSLogs;

		private static readonly ConfigEntry<bool> Config_LogGeoVolumeResults;

		private static readonly ConfigEntry<bool> Config_LogBoxColliderResults;

		private static readonly ConfigEntry<bool> Config_ShowAffectedBoxColliderNames;

		public static bool SuppressAllMCP3Logs => Config_SuppressAllMCP3Logs.Value;

		public static bool SuppressAllCGWSLogs => Config_SuppressCGWSLogs.Value;

		public static bool LogGeoVolumeResults => Config_LogGeoVolumeResults.Value;

		public static bool LogBoxColliderResults => Config_LogBoxColliderResults.Value;

		public static bool ShowAffectedBoxColliderNames => Config_ShowAffectedBoxColliderNames.Value;

		static Configuration()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "STFU.cfg"), true);
			string text = "General Settings";
			Config_SuppressAllMCP3Logs = Config.Bind<bool>(text, "Suppress All MyCoolPlugin3 Logs", false, "If enabled, don't allow any logs from MCP3. Otherwise, only print unique logs.");
			Config_SuppressCGWSLogs = Config.Bind<bool>(text, "Suppress ConfigurableGlobalWaveSettings Logs", true, "If enabled, don't allow any logs of EnemyType Heats and selected EnemyTypes from CGWS.");
			Config_LogGeoVolumeResults = Config.Bind<bool>(text, "Show Post-LG GeomorphVolume Results", true, "Show the total amount of \"borken cells\" error logs.");
			Config_LogBoxColliderResults = Config.Bind<bool>(text, "Show Post-LG BoxCollider Results", true, "Show the total amount of BoxColliders warning logs with a negative size or scale.");
			Config_ShowAffectedBoxColliderNames = Config.Bind<bool>(text, "Show Affected BoxCollider Names", false, "List the specific BoxColliders that have a negative size or scale.");
		}

		internal static void Init()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			LiveEditListener val = LiveEdit.CreateListener(Paths.ConfigPath, "STFU.cfg", false);
			val.FileChanged += new LiveEditEventHandler(OnFileChanged);
		}

		private static void OnFileChanged(LiveEditEventArgs e)
		{
			STFULogger.LogWarning("Config file changed: " + e.FullPath);
			Config.Reload();
		}
	}
	[BepInPlugin("Amor.STFU", "STFU", "1.2.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class EntryPoint : BasePlugin
	{
		public override void Load()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Configuration.Init();
			new Harmony("Amor.STFU").PatchAll();
			BoxColliderPseudofix.Setup();
			STFULogger.LogInfo("STFU is done loading!");
		}
	}
	[HarmonyPatch]
	internal static class MCP3_Wrapper
	{
		public const string PLUGIN_GUID = "com.MyName.MyGTFOPlugin";

		private static readonly Type? Ltype;

		private static readonly string[] Lmethods;

		public static bool IsLoaded { get; private set; }

		static MCP3_Wrapper()
		{
			IsLoaded = false;
			Lmethods = new string[3] { "Info", "Debug", "Error" };
			if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("com.MyName.MyGTFOPlugin", out var value))
			{
				try
				{
					Assembly assembly = ((value == null) ? null : value.Instance?.GetType()?.Assembly) ?? throw new Exception("MCP3 Assembly is missing!");
					Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(assembly);
					Ltype = typesFromAssembly.First((Type t) => t.Name == "L");
					IsLoaded = Ltype != null;
				}
				catch (Exception value2)
				{
					STFULogger.LogError($"Exception thrown while reading data from MyCoolPLugin3:\n{value2}");
					IsLoaded = false;
				}
			}
			STFULogger.LogDebug($"MyCoolPlugin3 is loaded: {IsLoaded}");
		}

		[HarmonyPrepare]
		private static bool PrepPatches()
		{
			return IsLoaded;
		}

		[HarmonyTargetMethods]
		private static IEnumerable<MethodBase> GetTargetMethods()
		{
			string[] lmethods = Lmethods;
			foreach (string name in lmethods)
			{
				yield return AccessTools.Method(Ltype, name, (Type[])null, (Type[])null);
				STFULogger.LogAs(name, "Found MCP3 patch method: " + name);
			}
		}

		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpile_Lspam(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod)
		{
			yield return new CodeInstruction(OpCodes.Ldstr, (object)__originalMethod.Name);
			yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
			yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(MCP3_Wrapper), "Intercept", new Type[2]
			{
				typeof(string),
				typeof(object)
			}, (Type[])null));
			yield return new CodeInstruction(OpCodes.Ret, (object)null);
		}

		public static void Intercept(string method, object data)
		{
			STFULogger.LogAs(method, data?.ToString() ?? string.Empty, Configuration.SuppressAllMCP3Logs);
		}
	}
	[HarmonyPatch(typeof(CellSoundEmitter), "OnParticleCollision")]
	internal static class Patch_ParticleCollision
	{
		[HarmonyPrefix]
		private static bool Cancel_Null_ps_Param(CellSoundEmitter __instance)
		{
			if ((Object)(object)__instance.m_particleSystem == (Object)null)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch]
	internal static class Patch_TryGetGeomorphVolume
	{
		public const string DimensionIsBorken = "ERROR: Dimension X is borken";

		public const string NoCellInGrid = "ERROR: Couldn't find cell in grid";

		public const string BorkenCell = "ERROR: Borken cell";

		private const string Error = "Error";

		public static bool IsNotInLevel { get; private set; }

		static Patch_TryGetGeomorphVolume()
		{
			IsNotInLevel = true;
			LevelAPI.OnEnterLevel += OnEnterLevel;
			LevelAPI.OnLevelCleanup += OnLevelCleanup;
		}

		private static void OnEnterLevel()
		{
			string[] array = new string[3] { "ERROR: Dimension X is borken", "ERROR: Couldn't find cell in grid", "ERROR: Borken cell" };
			foreach (string text in array)
			{
				if (Configuration.LogGeoVolumeResults && STFULogger.UniqueLogMap.TryGetValue(text, out var value))
				{
					STFULogger.LogWarning($"\"{text}\" message was logged {value} time(s)");
				}
			}
			IsNotInLevel = false;
		}

		private static void OnLevelCleanup()
		{
			IsNotInLevel = true;
		}

		[HarmonyTargetMethod]
		private static MethodBase TargetMethod()
		{
			return AccessTools.Method(typeof(AIG_GeomorphNodeVolume), "TryGetGeomorphVolume", (Type[])null, (Type[])null);
		}

		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpile_GeomorphVolume(IEnumerable<CodeInstruction> instructions)
		{
			MethodInfo helper = AccessTools.Method(typeof(Patch_TryGetGeomorphVolume), "TryGetGeomorphVolumeSilent", new Type[4]
			{
				typeof(int),
				typeof(eDimensionIndex),
				typeof(Vector3),
				typeof(AIG_GeomorphNodeVolume).MakeByRefType()
			}, (Type[])null);
			yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
			yield return new CodeInstruction(OpCodes.Ldarg_1, (object)null);
			yield return new CodeInstruction(OpCodes.Ldarg_2, (object)null);
			yield return new CodeInstruction(OpCodes.Ldarg_3, (object)null);
			yield return new CodeInstruction(OpCodes.Call, (object)helper);
			yield return new CodeInstruction(OpCodes.Ret, (object)null);
		}

		public static bool TryGetGeomorphVolumeSilent(int floorNR, eDimensionIndex dimensionIndex, Vector3 pos, out AIG_GeomorphNodeVolume resultingGeoVolume)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			resultingGeoVolume = null;
			LG_Floor currentFloor = Builder.CurrentFloor;
			if ((Object)(object)currentFloor == (Object)null)
			{
				Debug.LogError(Object.op_Implicit($"TryGetGeomorphVolume: No floor found! Dim: {dimensionIndex}. Doing this too early?"));
				return false;
			}
			Dimension val = default(Dimension);
			if (!currentFloor.GetDimension(dimensionIndex, ref val))
			{
				Debug.LogError(Object.op_Implicit($"TryGetGeomorphVolume: Tried to get dimension with index ({dimensionIndex}) but failed."));
				return false;
			}
			if (val.Grid == null || !TryGetCell(val.Grid, pos, out LG_Cell cell))
			{
				LogErrorAs("ERROR: Dimension X is borken", val.DimensionIndex, val.Grid, pos, null);
				if (val.Grid != null)
				{
					LogErrorAs("ERROR: Couldn't find cell in grid", val.DimensionIndex, val.Grid, pos, null);
				}
				return false;
			}
			LG_Tile grouping = ((CellBase<LG_Tile, LG_Cell>)(object)cell).m_grouping;
			if ((Object)(object)((grouping != null) ? grouping.m_geoRoot : null) == (Object)null)
			{
				LogErrorAs("ERROR: Borken cell", val.DimensionIndex, val.Grid, pos, cell);
				return false;
			}
			resultingGeoVolume = ((Il2CppObjectBase)((CellBase<LG_Tile, LG_Cell>)(object)cell).m_grouping.m_geoRoot.m_nodeVolume).TryCast<AIG_GeomorphNodeVolume>();
			return (Object)(object)resultingGeoVolume != (Object)null;
		}

		private static bool TryGetCell(LG_Grid grid, Vector3 pos, [MaybeNullWhen(false)] out LG_Cell cell)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_000f: 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)
			pos -= ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_gridPosition;
			int num = Mathf.RoundToInt((pos.x - ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_cellDimHalf) / ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_cellDim);
			int num2 = Mathf.RoundToInt((pos.z - ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_cellDimHalf) / ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_cellDim);
			if (num < 0 || num2 < 0 || num >= ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_sizeX || num2 >= ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).m_sizeZ)
			{
				cell = null;
				return false;
			}
			cell = ((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid).GetCell(num, num2);
			return true;
		}

		public static void LogErrorAs(string simpleStr, eDimensionIndex dim, LG_Grid? grid, Vector3 pos, LG_Cell? cell)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			if (IsNotInLevel)
			{
				STFULogger.LogAs("Error", simpleStr, IsNotInLevel);
				return;
			}
			string text;
			switch (simpleStr)
			{
			case "ERROR: Dimension X is borken":
				text = $"ERROR : Dimension {dim} is borken. grid: {grid}, cell: {cell}, DimIndexLookup: {dim}";
				break;
			case "ERROR: Couldn't find cell in grid":
				text = $"ERROR COULDN'T FIND CELL IN GRID : {dim}, gridPos: {((CellGridBase<LG_Grid, LG_Tile, LG_Cell>)(object)grid)?.m_gridPosition}, cellPos: {pos}";
				break;
			case "ERROR: Borken cell":
			{
				DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(82, 5);
				defaultInterpolatedStringHandler.AppendLiteral("ERROR : Borken cell (pos(");
				defaultInterpolatedStringHandler.AppendFormatted<Vector3>(pos);
				defaultInterpolatedStringHandler.AppendLiteral(") | cellpos(x:");
				defaultInterpolatedStringHandler.AppendFormatted(((CellBase<LG_Tile, LG_Cell>)(object)cell)?.x);
				defaultInterpolatedStringHandler.AppendLiteral(", z:");
				defaultInterpolatedStringHandler.AppendFormatted(((CellBase<LG_Tile, LG_Cell>)(object)cell)?.z);
				defaultInterpolatedStringHandler.AppendLiteral(")) grouping or root. grouping: ");
				object obj;
				if (cell == null)
				{
					obj = null;
				}
				else
				{
					LG_Tile grouping = ((CellBase<LG_Tile, LG_Cell>)(object)cell).m_grouping;
					obj = ((grouping != null) ? ((Object)grouping).ToString() : null);
				}
				if (obj == null)
				{
					obj = "<null>";
				}
				defaultInterpolatedStringHandler.AppendFormatted((string?)obj);
				defaultInterpolatedStringHandler.AppendLiteral(" | dim: ");
				defaultInterpolatedStringHandler.AppendFormatted<eDimensionIndex>(dim);
				text = defaultInterpolatedStringHandler.ToStringAndClear();
				break;
			}
			default:
				text = simpleStr;
				break;
			}
			Debug.LogError(Object.op_Implicit(text));
		}
	}
	internal static class STFULogger
	{
		private static readonly ManualLogSource MLS;

		public static ConcurrentDictionary<string, int> UniqueLogMap { get; internal set; }

		static STFULogger()
		{
			UniqueLogMap = new ConcurrentDictionary<string, int>();
			MLS = Logger.CreateLogSource("STFU");
			LevelAPI.OnBuildStart += Clear;
			LevelAPI.OnLevelCleanup += Clear;
		}

		private static void Clear()
		{
			UniqueLogMap.Clear();
		}

		public static void LogInfo(string str)
		{
			MLS.Log((LogLevel)8, (object)str);
		}

		public static void LogWarning(string str)
		{
			MLS.Log((LogLevel)4, (object)str);
		}

		public static void LogError(string str)
		{
			MLS.Log((LogLevel)2, (object)str);
		}

		public static void LogDebug(string str)
		{
			MLS.Log((LogLevel)32, (object)str);
		}

		public static void LogAs(string logLevel, string str, bool suppressLog = false)
		{
			string str2 = str;
			string logLevel2 = logLevel;
			UniqueLogMap.AddOrUpdate(str2, delegate
			{
				if (!string.IsNullOrEmpty(str2) && !suppressLog)
				{
					switch (logLevel2)
					{
					case "Info":
						LogInfo(str2);
						break;
					case "Debug":
						LogDebug(str2);
						break;
					case "Error":
						LogError(str2);
						break;
					case "Warning":
						LogWarning(str2);
						break;
					default:
						LogError("<null> " + str2);
						break;
					}
				}
				return 1;
			}, (string key, int cnt) => ++cnt);
		}
	}
}