Decompiled source of Lead Hints v1.0.0

LeadHints.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using TMPro;
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("LeadHints")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyDescription("Displays the types of leads you'll receive in the 'Details' tab of job listings before accepting a side job.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+915ef15a11114c0740c1733cb19308f3c4f08738")]
[assembly: AssemblyProduct("LeadHints")]
[assembly: AssemblyTitle("LeadHints")]
[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 LeadHints
{
	[BepInPlugin("LeadHints", "LeadHints", "1.0.0")]
	public class LeadHintsPlugin : BasePlugin
	{
		[HarmonyPatch(typeof(ObjectivesContentController), "UpdateJobDetails")]
		public class ObjectivesContentController_UpdateJobDetails
		{
			public static bool Prefix(ObjectivesContentController __instance)
			{
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: 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_0099: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				if (__instance.job == null || !__instance.job.knowHandInLocation)
				{
					((TMP_Text)__instance.jobDetails).text = CalculateJobText(__instance.job);
					((TMP_Text)__instance.jobDetails).ForceMeshUpdate(false, false);
					__instance.pageRect.sizeDelta = new Vector2(__instance.pageRect.sizeDelta.x, Mathf.Max(((TMP_Text)__instance.jobDetails).GetPreferredValues().y + 32f, 466f));
					__instance.pageRect.anchoredPosition = new Vector2(0f, __instance.pageRect.sizeDelta.y * -0.5f);
					return false;
				}
				return true;
			}
		}

		public static ConfigEntry<bool> Enabled;

		public static ManualLogSource PluginLogger;

		public override void Load()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Expected O, but got Unknown
			PluginLogger = ((BasePlugin)this).Log;
			Enabled = ((BasePlugin)this).Config.Bind<bool>("General", "Enabled", true, "Is the mod enabled at all? (Game restart required)");
			if (Enabled.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>("LeadHints");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
				}
				pluginLogger.LogInfo(val);
				Harmony val2 = new Harmony("LeadHints");
				val2.PatchAll();
				ManualLogSource pluginLogger2 = PluginLogger;
				val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("LeadHints");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is patched!");
				}
				pluginLogger2.LogInfo(val);
			}
		}

		public static string ConvertDataKeyToName(DataKey lead, string prefix = "")
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Invalid comparison between Unknown and I4
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Invalid comparison between Unknown and I4
			string name = Enum.GetName<DataKey>(lead);
			name = name.Replace("random", "");
			name = Regex.Replace(name, "(\\B[A-Z](?!\\B[A-Z]))", " $1");
			name = char.ToUpper(name[0]) + name.Substring(1);
			if ((int)lead != 18)
			{
				if ((int)lead == 30)
				{
					name = "Height (Estimate)";
				}
			}
			else
			{
				name = "Shoe Size (Estimate)";
			}
			if (prefix != "" && name == "Name")
			{
				return prefix;
			}
			if (prefix != "")
			{
				return prefix + " " + name;
			}
			return name;
		}

		public static string CalculateJobText(SideJob job)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Expected I4, but got Unknown
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			SortedSet<string> sortedSet = new SortedSet<string>();
			Dictionary<string, SortedSet<string>> dictionary = new Dictionary<string, SortedSet<string>>();
			dictionary.Add("Paramour", new SortedSet<string>());
			dictionary.Add("Poster", new SortedSet<string>());
			dictionary.Add("Other", new SortedSet<string>());
			Enumerator<DataKey> enumerator = job.leadKeys.GetEnumerator();
			while (enumerator.MoveNext())
			{
				DataKey current = enumerator.Current;
				sortedSet.Add(ConvertDataKeyToName(current));
			}
			Enumerator<StartingLead> enumerator2 = job.preset.informationAcquisitionLeads.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				StartingLead current2 = enumerator2.Current;
				Enumerator<DataKey> enumerator3 = current2.keys.GetEnumerator();
				while (enumerator3.MoveNext())
				{
					DataKey current3 = enumerator3.Current;
					LeadEvidence leadEvidence = current2.leadEvidence;
					LeadEvidence val = leadEvidence;
					switch (val - 1)
					{
					case 1:
						sortedSet.Add(ConvertDataKeyToName(current3));
						break;
					case 4:
						sortedSet.Add(ConvertDataKeyToName(current3, "Home"));
						break;
					case 7:
						sortedSet.Add(ConvertDataKeyToName(current3, "Work"));
						break;
					case 10:
						sortedSet.Add(ConvertDataKeyToName(current3, "Home Building"));
						break;
					case 17:
						sortedSet.Add(ConvertDataKeyToName(current3, "Work Building"));
						break;
					case 2:
						sortedSet.Add(ConvertDataKeyToName(current3));
						break;
					case 11:
						dictionary["Paramour"].Add(ConvertDataKeyToName(current3, "Home Building"));
						break;
					case 5:
						dictionary["Paramour"].Add(ConvertDataKeyToName(current3, "Home"));
						break;
					case 8:
						dictionary["Paramour"].Add(ConvertDataKeyToName(current3, "Work"));
						break;
					case 18:
						dictionary["Paramour"].Add(ConvertDataKeyToName(current3, "Work Building"));
						break;
					case 0:
						dictionary["Poster"].Add(ConvertDataKeyToName(current3));
						break;
					default:
						dictionary["Other"].Add(ConvertDataKeyToName(current3));
						break;
					case 14:
					case 15:
						break;
					}
				}
			}
			string text = "\nLeads:\n";
			if (sortedSet.Count > 0)
			{
				text += "Purp details:\n";
			}
			foreach (string item in sortedSet)
			{
				text = text + "\t" + item + "\n";
			}
			foreach (string key in dictionary.Keys)
			{
				if (dictionary[key].Count == 0)
				{
					continue;
				}
				text = text + key + "\n";
				foreach (string item2 in dictionary[key])
				{
					text = text + "\t" + item2 + "\n";
				}
			}
			return text + "\n";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LeadHints";

		public const string PLUGIN_NAME = "LeadHints";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}