Decompiled source of CommunityCaseLoader v0.2.2

CommunityCaseLoader.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AssetBundleLoader;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UniverseLib;

[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("CommunityCaseLoader")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("An example mod that works on both IL2CPP and Mono game branches")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+aca643ad969699af0165bd3c8c0ba85e253e8e01")]
[assembly: AssemblyProduct("CommunityCaseLoader")]
[assembly: AssemblyTitle("CommunityCaseLoader")]
[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 CommunityCaseLoader
{
	[BepInPlugin("CommunityCaseLoader", "CommunityCaseLoader", "1.0.0")]
	public class CommunityCaseLoaderPlugin : BasePlugin
	{
		public static ManualLogSource PluginLogger;

		public static string DEBUG_LoadSpecificMurder;

		public static bool DEBUG_ShowMurderDebugMessages;

		public static bool DEBUG_EnableMODebugging;

		public static string DEBUG_LoadSpecificSideJob;

		public static bool DEBUG_ShowSideJobDebugMessages;

		public static bool DEBUG_ShowSideJobSpawnLocation;

		public static bool DEBUG_ListAllLoadedObjects;

		public override void Load()
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Expected O, but got Unknown
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			PluginLogger = ((BasePlugin)this).Log;
			DEBUG_ListAllLoadedObjects = ((BasePlugin)this).Config.Bind<bool>("Debug", "List all loaded objects", false, (ConfigDescription)null).Value;
			DEBUG_LoadSpecificMurder = ((BasePlugin)this).Config.Bind<string>("Debug", "Force specific MurderMO", "", (ConfigDescription)null).Value;
			DEBUG_ShowMurderDebugMessages = ((BasePlugin)this).Config.Bind<bool>("Debug", "Show murder debug messages", false, (ConfigDescription)null).Value;
			DEBUG_EnableMODebugging = ((BasePlugin)this).Config.Bind<bool>("MurderMO Debugging", "List spawned murder objects and highlight them", false, (ConfigDescription)null).Value;
			DEBUG_LoadSpecificSideJob = ((BasePlugin)this).Config.Bind<string>("SideJob Debugging", "Force specific JobPreset", "", "Only one will spawn at a time in this mode for debugging purposes").Value;
			DEBUG_ShowSideJobDebugMessages = ((BasePlugin)this).Config.Bind<bool>("SideJob Debugging", "Show SideJob debug messages", false, (ConfigDescription)null).Value;
			DEBUG_ShowSideJobSpawnLocation = ((BasePlugin)this).Config.Bind<bool>("SideJob Debugging", "Log where the SideJob spawned", false, "Gives an easy way to find the forced SideJob without spoiling it").Value;
			ManualLogSource pluginLogger = PluginLogger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CommunityCaseLoader");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			pluginLogger.LogInfo(val);
			Harmony val2 = new Harmony("CommunityCaseLoader");
			val2.PatchAll();
			ManualLogSource pluginLogger2 = PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("CommunityCaseLoader");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
			}
			pluginLogger2.LogInfo(val);
			BundleLoader.loadObjectDelegates.Add(new LoadObjects(LoadObjectsCallback));
		}

		public List<ScriptableObject> LoadObjectsCallback(List<ScriptableObject> loadedScriptableObjects)
		{
			List<ScriptableObject> result = new List<ScriptableObject>();
			List<object> list = new List<object>();
			List<DirectoryInfo> list2 = (from dirPath in Directory.GetDirectories(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), ".."), "*", SearchOption.AllDirectories)
				select new DirectoryInfo(dirPath) into dir
				where File.Exists(Path.Combine(dir.FullName, "murdermanifest.sodso.json"))
				select dir).ToList();
			foreach (DirectoryInfo item in list2)
			{
				dynamic val = NewtonsoftExtensions.NewtonsoftJson.JToken_Parse(File.ReadAllText(Path.Combine(item.FullName, "murdermanifest.sodso.json")));
				val["moName"] = item.Name;
				val["folderPath"] = item.FullName;
				dynamic loadBefore = val.Value<string>("loadBefore");
				if (loadBefore == null && loadBefore == "")
				{
					list.Add(val);
					continue;
				}
				dynamic val2 = list.Where((dynamic previousManifest) => previousManifest.Value<string>("moName") == loadBefore).FirstOrDefault();
				if (val2 != null)
				{
					list.Insert(list.IndexOf(val2), val);
				}
				else
				{
					list.Add(val);
				}
			}
			foreach (dynamic item2 in list)
			{
				LoadManifest(item2, ref result);
			}
			return result;
		}

		private static void LoadManifest(dynamic manifest, ref List<ScriptableObject> objectsToLoad)
		{
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_0706: Unknown result type (might be due to invalid IL or missing references)
			//IL_070d: Expected O, but got Unknown
			//IL_06d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_057d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0584: Expected O, but got Unknown
			dynamic val = manifest.Value<string>("moName");
			dynamic val2 = manifest.Value<string>("folderPath");
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3;
			if (manifest.Value<bool>("enabled"))
			{
				ManualLogSource pluginLogger = PluginLogger;
				val3 = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Loading MurderMO: ");
					val3.AppendFormatted(val);
				}
				pluginLogger.LogInfo(val3);
				List<string> list = new List<string>();
				foreach (dynamic item2 in manifest["fileOrder"])
				{
					string path = Path.Combine(val2, item2.ToString().Replace("REF:", "") + ".sodso.json");
					if (File.Exists(path))
					{
						string item = File.ReadAllText(path);
						list.Add(item);
						continue;
					}
					ManualLogSource pluginLogger2 = PluginLogger;
					BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to load file: ");
						val4.AppendFormatted(item2);
						((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" (File not found)");
					}
					pluginLogger2.LogError(val4);
				}
				{
					foreach (string item3 in list)
					{
						ScriptableObject val5 = JsonLoader.LoadFileToGame(item3);
						objectsToLoad.Add(val5);
						if (ReflectionExtensions.GetActualType((object)val5) == typeof(JobPreset))
						{
							JobPreset val6 = ReflectionExtensions.TryCast<JobPreset>((object)val5);
							Enumerator<StartingSpawnItem> enumerator3 = val6.spawnItems.GetEnumerator();
							while (enumerator3.MoveNext())
							{
								StartingSpawnItem current3 = enumerator3.Current;
								if (current3.vmailThread != "")
								{
									Toolbox_Start.vmailTreeMap[current3.vmailThread] = new JobPresetAndTag
									{
										JobPreset = val6,
										JobTag = current3.itemTag
									};
								}
							}
						}
						if (DEBUG_ListAllLoadedObjects)
						{
							ManualLogSource pluginLogger3 = PluginLogger;
							val3 = new BepInExInfoLogInterpolatedStringHandler(16, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Loading Object: ");
								((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)val5).name);
							}
							pluginLogger3.LogInfo(val3);
						}
					}
					return;
				}
			}
			ManualLogSource pluginLogger4 = PluginLogger;
			val3 = new BepInExInfoLogInterpolatedStringHandler(33, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Not Loading MurderMO: ");
				val3.AppendFormatted(val);
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (Disabled)");
			}
			pluginLogger4.LogInfo(val3);
		}
	}
	[HarmonyPatch(typeof(Toolbox), "Start")]
	public class Toolbox_Start
	{
		public static Dictionary<string, JobPresetAndTag> vmailTreeMap = new Dictionary<string, JobPresetAndTag>();

		public static Dictionary<int, int> sideJobThreadIDMap = new Dictionary<int, int>();

		public static void Postfix()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected O, but got Unknown
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Expected O, but got Unknown
			bool flag2 = default(bool);
			if (CommunityCaseLoaderPlugin.DEBUG_LoadSpecificMurder != "")
			{
				bool flag = false;
				ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(18, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Forcing MurderMO: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(CommunityCaseLoaderPlugin.DEBUG_LoadSpecificMurder);
				}
				pluginLogger.LogWarning(val);
				for (int num = Toolbox.Instance.allMurderMOs.Count - 1; num >= 0; num--)
				{
					if (((Object)Toolbox.Instance.allMurderMOs[num]).name != CommunityCaseLoaderPlugin.DEBUG_LoadSpecificMurder)
					{
						Toolbox.Instance.allMurderMOs[num].disabled = true;
					}
					else
					{
						flag = true;
					}
				}
				if (!flag)
				{
					ManualLogSource pluginLogger2 = CommunityCaseLoaderPlugin.PluginLogger;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(20, 1, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("MurderMO not found: ");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(CommunityCaseLoaderPlugin.DEBUG_LoadSpecificMurder);
					}
					pluginLogger2.LogError(val2);
					ManualLogSource pluginLogger3 = CommunityCaseLoaderPlugin.PluginLogger;
					BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Loaded MurderMOs:");
					}
					pluginLogger3.LogInfo(val3);
					for (int num2 = Toolbox.Instance.allMurderMOs.Count - 1; num2 >= 0; num2--)
					{
						ManualLogSource pluginLogger4 = CommunityCaseLoaderPlugin.PluginLogger;
						val3 = new BepInExInfoLogInterpolatedStringHandler(1, 1, ref flag2);
						if (flag2)
						{
							((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("\t");
							((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)Toolbox.Instance.allMurderMOs[num2]).name);
						}
						pluginLogger4.LogInfo(val3);
					}
				}
			}
			if (CommunityCaseLoaderPlugin.DEBUG_LoadSpecificSideJob != "")
			{
				ManualLogSource pluginLogger5 = CommunityCaseLoaderPlugin.PluginLogger;
				BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(17, 1, ref flag2);
				if (flag2)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Forcing SideJob: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(CommunityCaseLoaderPlugin.DEBUG_LoadSpecificSideJob);
				}
				pluginLogger5.LogWarning(val);
				for (int num3 = SideJobController.Instance.jobTracking.Count - 1; num3 >= 0; num3--)
				{
					if (SideJobController.Instance.jobTracking[num3].name != CommunityCaseLoaderPlugin.DEBUG_LoadSpecificSideJob)
					{
						SideJobController.Instance.jobTracking.RemoveAt(num3);
					}
					else
					{
						SideJobController.Instance.jobTracking[num3].preset.disabled = false;
						SideJobController.Instance.jobTracking[num3].preset.maxJobs = 1;
						SideJobController.Instance.jobTracking[num3].preset.immediatePostCountThreshold = 100;
					}
				}
			}
			else
			{
				CommunityCaseLoaderPlugin.DEBUG_ShowSideJobDebugMessages = false;
				CommunityCaseLoaderPlugin.DEBUG_ShowSideJobSpawnLocation = false;
			}
		}
	}
	[HarmonyPatch]
	public class Toolbox_NewVmailThread
	{
		[HarmonyTargetMethod]
		internal static MethodBase CalculateMethod()
		{
			return (from mi in typeof(Toolbox).GetMethods()
				where mi.Name == "NewVmailThread" && mi.GetParameters().Length == 10
				select mi).First();
		}

		public static void Postfix(MessageThreadSave __result, Human from, ref Human to1, ref Human to2, ref Human to3, ref List<Human> cc, string treeID, float timeStamp, int progress = 999)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Expected O, but got Unknown
			if (!Toolbox_Start.vmailTreeMap.ContainsKey(treeID))
			{
				return;
			}
			Enumerator<int, SideJob> enumerator = SideJobController.Instance.allJobsDictionary.GetEnumerator();
			bool flag = default(bool);
			while (enumerator.MoveNext())
			{
				KeyValuePair<int, SideJob> current = enumerator.Current;
				if (current.Value.purpID != from.humanID || !(current.Value.presetStr == ((SoCustomComparison)Toolbox_Start.vmailTreeMap[treeID].JobPreset).presetName))
				{
					continue;
				}
				Toolbox_Start.sideJobThreadIDMap[current.value.jobID] = __result.threadID;
				if (CommunityCaseLoaderPlugin.DEBUG_ShowSideJobDebugMessages)
				{
					ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Mapped jobID ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(current.value.jobID);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to threadID ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(__result.threadID);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" on creation");
					}
					pluginLogger.LogInfo(val);
				}
				break;
			}
		}
	}
	[HarmonyPatch(typeof(SaveStateController), "LoadSaveState")]
	public class SaveStateController_LoadSaveState
	{
		public static void Postfix(SaveStateController __instance)
		{
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Expected O, but got Unknown
			Enumerator<int, MessageThreadSave> enumerator = GameplayController.Instance.messageThreads.GetEnumerator();
			bool flag = default(bool);
			while (enumerator.MoveNext())
			{
				KeyValuePair<int, MessageThreadSave> current = enumerator.Current;
				if (!Toolbox_Start.vmailTreeMap.ContainsKey(current.Value.treeID))
				{
					continue;
				}
				int num = current.Value.senders[0];
				Enumerator<int, SideJob> enumerator2 = SideJobController.Instance.allJobsDictionary.Values.GetEnumerator();
				while (enumerator2.MoveNext())
				{
					SideJob current2 = enumerator2.Current;
					if (!(((SoCustomComparison)Toolbox_Start.vmailTreeMap[current.Value.treeID].JobPreset).presetName == ((SoCustomComparison)current2.preset).presetName) || current2.purpID != num)
					{
						continue;
					}
					Toolbox_Start.sideJobThreadIDMap[current2.jobID] = current.Value.threadID;
					if (CommunityCaseLoaderPlugin.DEBUG_ShowSideJobDebugMessages)
					{
						ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Mapped jobID ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(current2.jobID);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to threadID ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(current.Value.threadID);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" on load");
						}
						pluginLogger.LogInfo(val);
					}
				}
				break;
			}
		}
	}
	[HarmonyPatch(typeof(ResolveQuestion), "UpdateCorrect")]
	public class CaseResolveQuestion_UpdateCorrect
	{
		public static bool Prefix(ResolveQuestion __instance, Case forCase, ref bool __result)
		{
			//IL_009d: 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)
			if (((forCase != null) ? forCase.job : null) != null && Toolbox_Start.sideJobThreadIDMap.ContainsKey(forCase.job.jobID))
			{
				string inputtedEvidence = __instance.inputtedEvidence;
				Enumerator<CaseElement> enumerator = forCase.caseElements.GetEnumerator();
				while (enumerator.MoveNext())
				{
					CaseElement current = enumerator.Current;
					if (current.id == inputtedEvidence)
					{
						EvidencePrintedVmail val = ((Il2CppObjectBase)current.pinnedController.evidence).TryCast<EvidencePrintedVmail>();
						if (val != null && Toolbox_Start.vmailTreeMap.ContainsKey(val.thread.treeID) && __instance.tag == Toolbox_Start.vmailTreeMap[val.thread.treeID].JobTag)
						{
							__instance.isCorrect = val.thread.threadID == Toolbox_Start.sideJobThreadIDMap[forCase.job.jobID];
							__result = __instance.isCorrect;
							return false;
						}
						break;
					}
				}
			}
			return true;
		}
	}
	public class JobPresetAndTag
	{
		public JobPreset JobPreset;

		public JobTag JobTag;
	}
	[HarmonyPatch(typeof(MurderController), "PickNewVictim")]
	public class MurderController_PickNewVictim
	{
		public static void Postfix()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Expected O, but got Unknown
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			if (!CommunityCaseLoaderPlugin.DEBUG_ShowMurderDebugMessages)
			{
				return;
			}
			ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MurderMO: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((SoCustomComparison)MurderController.Instance.chosenMO).presetName);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			pluginLogger.LogInfo(val);
			ManualLogSource pluginLogger2 = CommunityCaseLoaderPlugin.PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(29, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Murderer: ");
				BepInExInfoLogInterpolatedStringHandler obj = val;
				Human currentMurderer = MurderController.Instance.currentMurderer;
				((BepInExLogInterpolatedStringHandler)obj).AppendFormatted<string>((currentMurderer != null) ? ((Object)currentMurderer).name : null);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (Works: ");
				BepInExInfoLogInterpolatedStringHandler obj2 = val;
				Occupation job = MurderController.Instance.currentMurderer.job;
				object obj3;
				if (job == null)
				{
					obj3 = null;
				}
				else
				{
					Company employer = job.employer;
					obj3 = ((employer != null) ? employer.name : null);
				}
				((BepInExLogInterpolatedStringHandler)obj2).AppendFormatted<string>((string)obj3);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Lives: ");
				BepInExInfoLogInterpolatedStringHandler obj4 = val;
				Human currentMurderer2 = MurderController.Instance.currentMurderer;
				((BepInExLogInterpolatedStringHandler)obj4).AppendFormatted<string>((currentMurderer2 != null) ? ((Object)currentMurderer2.home).name : null);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			pluginLogger2.LogInfo(val);
			ManualLogSource pluginLogger3 = CommunityCaseLoaderPlugin.PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(28, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Victim: ");
				BepInExInfoLogInterpolatedStringHandler obj5 = val;
				Human currentVictim = MurderController.Instance.currentVictim;
				((BepInExLogInterpolatedStringHandler)obj5).AppendFormatted<string>((currentVictim != null) ? ((Object)currentVictim).name : null);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (Works: ");
				BepInExInfoLogInterpolatedStringHandler obj6 = val;
				Human currentVictim2 = MurderController.Instance.currentVictim;
				object obj7;
				if (currentVictim2 == null)
				{
					obj7 = null;
				}
				else
				{
					Occupation job2 = currentVictim2.job;
					if (job2 == null)
					{
						obj7 = null;
					}
					else
					{
						Company employer2 = job2.employer;
						obj7 = ((employer2 != null) ? employer2.name : null);
					}
				}
				((BepInExLogInterpolatedStringHandler)obj6).AppendFormatted<string>((string)obj7);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Lives: ");
				BepInExInfoLogInterpolatedStringHandler obj8 = val;
				Human currentVictim3 = MurderController.Instance.currentVictim;
				((BepInExLogInterpolatedStringHandler)obj8).AppendFormatted<string>((currentVictim3 != null) ? ((Object)currentVictim3.home).name : null);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("))");
			}
			pluginLogger3.LogInfo(val);
		}
	}
	[HarmonyPatch(typeof(MurderController), "SpawnItem")]
	public class MurderController_SpawnItem
	{
		public static List<Interactable> murderInteractables = new List<Interactable>();

		public static void Postfix(MurderController __instance, Interactable __result)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			if (CommunityCaseLoaderPlugin.DEBUG_EnableMODebugging)
			{
				ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MurderMO (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance.chosenMO).name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") Spawning Item: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__result.preset).name);
				}
				pluginLogger.LogInfo(val);
				murderInteractables.Add(__result);
			}
		}
	}
	[HarmonyPatch(typeof(Murder), "PlaceCallingCard")]
	public class MurderController_PlaceCallingCard
	{
		private const int HIGHLIGHTED_LAYER = 30;

		public static void Postfix(Murder __instance)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			if (CommunityCaseLoaderPlugin.DEBUG_EnableMODebugging)
			{
				ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(35, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("MurderMO (");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance.preset).name);
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") Spawning Calling Card: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance.callingCard.preset).name);
				}
				pluginLogger.LogInfo(val);
				MurderController_SpawnItem.murderInteractables.Add(__instance.callingCard);
				__instance.callingCard.spawnedObject.layer = 30;
			}
		}
	}
	[HarmonyPatch(typeof(Interactable), "LoadInteractableToWorld")]
	public class Interactable_LoadInteractableToWorld
	{
		private const int HIGHLIGHTED_LAYER = 30;

		public static void Prefix(Interactable __instance, ref bool forceSpawnImmediate)
		{
			if (MurderController_SpawnItem.murderInteractables.Contains(__instance))
			{
				forceSpawnImmediate = true;
			}
		}

		public static void Postfix(Interactable __instance)
		{
			if (MurderController_SpawnItem.murderInteractables.Contains(__instance))
			{
				__instance.spawnedObject.layer = 30;
			}
		}
	}
	[HarmonyPatch(typeof(SideJob), "PostJob")]
	public class SideJob_PostJob
	{
		public static void Postfix(SideJob __instance)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if (CommunityCaseLoaderPlugin.DEBUG_ShowSideJobDebugMessages || CommunityCaseLoaderPlugin.DEBUG_ShowSideJobSpawnLocation)
			{
				ManualLogSource pluginLogger = CommunityCaseLoaderPlugin.PluginLogger;
				val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SideJob: Posted at ");
					BepInExInfoLogInterpolatedStringHandler obj = val;
					object obj2;
					if (__instance == null)
					{
						obj2 = null;
					}
					else
					{
						Interactable post = __instance.post;
						if (post == null)
						{
							obj2 = null;
						}
						else
						{
							NewNode node = post.node;
							if (node == null)
							{
								obj2 = null;
							}
							else
							{
								NewGameLocation gameLocation = node.gameLocation;
								obj2 = ((gameLocation != null) ? ((Object)gameLocation).name : null);
							}
						}
					}
					((BepInExLogInterpolatedStringHandler)obj).AppendFormatted<string>((string)obj2);
				}
				pluginLogger.LogInfo(val);
			}
			if (!CommunityCaseLoaderPlugin.DEBUG_ShowSideJobDebugMessages)
			{
				return;
			}
			ManualLogSource pluginLogger2 = CommunityCaseLoaderPlugin.PluginLogger;
			val = new BepInExInfoLogInterpolatedStringHandler(34, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SideJob: Posted about ");
				BepInExInfoLogInterpolatedStringHandler obj3 = val;
				object obj4;
				if (__instance == null)
				{
					obj4 = null;
				}
				else
				{
					Human purp = __instance.purp;
					obj4 = ((purp != null) ? ((Object)purp).name : null);
				}
				((BepInExLogInterpolatedStringHandler)obj3).AppendFormatted<string>((string)obj4);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (Works at ");
				BepInExInfoLogInterpolatedStringHandler obj5 = val;
				object obj6;
				if (__instance == null)
				{
					obj6 = null;
				}
				else
				{
					Human purp2 = __instance.purp;
					if (purp2 == null)
					{
						obj6 = null;
					}
					else
					{
						Occupation job = purp2.job;
						if (job == null)
						{
							obj6 = null;
						}
						else
						{
							Company employer = job.employer;
							obj6 = ((employer != null) ? employer.name : null);
						}
					}
				}
				((BepInExLogInterpolatedStringHandler)obj5).AppendFormatted<string>((string)obj6);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")");
			}
			pluginLogger2.LogInfo(val);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CommunityCaseLoader";

		public const string PLUGIN_NAME = "CommunityCaseLoader";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}