using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Lamb.UI.FollowerInteractionWheel;
using Microsoft.CodeAnalysis;
using ShowFollowerJobTitles.Common.Extensions;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ShowFollowerJobTitles")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+f406bd717bd319b101b72c27b33999cebbbba38d")]
[assembly: AssemblyProduct("ShowFollowerJobTitles")]
[assembly: AssemblyTitle("ShowFollowerJobTitles")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 ShowFollowerJobTitles
{
[BepInPlugin("com.f4iTh.COTL.ShowFollowerJobTitles", "Show Follower Job Titles Continued", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource StaticLogger;
private readonly Harmony _harmony = new Harmony("com.f4iTh.COTL.ShowFollowerJobTitles");
private void Awake()
{
StaticLogger = ((BaseUnityPlugin)this).Logger;
}
private void OnEnable()
{
_harmony.PatchAll();
}
private void OnDisable()
{
_harmony.UnpatchSelf();
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ShowFollowerJobTitles";
public const string PLUGIN_NAME = "ShowFollowerJobTitles";
public const string PLUGIN_VERSION = "1.1.0";
}
}
namespace ShowFollowerJobTitles.Common.Patches
{
[HarmonyPatch]
public class FollowerInformationBoxPatches
{
private static MethodBase TargetMethod()
{
return typeof(FollowerInformationBox).GetMethod("ConfigureImpl", BindingFlags.Instance | BindingFlags.NonPublic);
}
[HarmonyPostfix]
public static void ConfigureImpl(FollowerInformationBox __instance)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_0065: 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)
if (!((Object)(object)__instance.FollowerRole == (Object)null) && !((FollowerSelectItem)__instance).FollowerInfo.OldAge && !((FollowerSelectItem)__instance).FollowerInfo.HasThought((Thought)146) && (int)((FollowerSelectItem)__instance).FollowerInfo.CursedState != 392)
{
FollowerBrain followBrain = __instance.followBrain;
string iconForRole = FontImageNamesExtensions.GetIconForRole((followBrain != null) ? followBrain.Info.FollowerRole : ((FollowerSelectItem)__instance).FollowerInfo.FollowerRole);
if (!string.IsNullOrWhiteSpace(iconForRole))
{
TextMeshProUGUI followerRole = __instance.FollowerRole;
((TMP_Text)followerRole).text = ((TMP_Text)followerRole).text + " | " + iconForRole;
}
}
}
}
[HarmonyPatch]
public class NotificationFollowerPatches
{
private static MethodBase TargetMethod()
{
return typeof(NotificationFollower).GetMethod("Localize", BindingFlags.Instance | BindingFlags.NonPublic);
}
[HarmonyPostfix]
public static void Localize(NotificationFollower __instance)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Invalid comparison between Unknown and I4
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
FieldInfo field = typeof(NotificationFollower).GetField("_description", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field2 = typeof(NotificationFollower).GetField("_followerInfo", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field3 = typeof(NotificationFollower).GetField("_type", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null || field2 == null || field3 == null)
{
return;
}
FollowerInfo val = (FollowerInfo)field2.GetValue(__instance);
TextMeshProUGUI val2 = (TextMeshProUGUI)field.GetValue(__instance);
NotificationType val3 = (NotificationType)field3.GetValue(__instance);
if ((int)val3 == 46 && !((Object)(object)val2 == (Object)null))
{
string iconForRole = FontImageNamesExtensions.GetIconForRole(val.FollowerRole);
if (!string.IsNullOrWhiteSpace(iconForRole))
{
((TMP_Text)val2).text = ((TMP_Text)val2).text + " (" + iconForRole + ")";
}
}
}
}
[HarmonyPatch]
public class UIFollowerNamePatches
{
private static MethodBase TargetMethod()
{
return typeof(UIFollowerName).GetMethod("SetText", BindingFlags.Instance | BindingFlags.NonPublic);
}
[HarmonyPostfix]
public static void SetText(UIFollowerName __instance)
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0072: 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_00c7: Invalid comparison between Unknown and I4
FieldInfo field = typeof(UIFollowerName).GetField("nameText", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field2 = typeof(UIFollowerName).GetField("follower", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null || field2 == null)
{
return;
}
TMP_Text val = (TMP_Text)field.GetValue(__instance);
Follower val2 = (Follower)field2.GetValue(__instance);
string iconForRole = FontImageNamesExtensions.GetIconForRole(val2.Brain.Info.FollowerRole);
int num = val.text.IndexOf(iconForRole, StringComparison.Ordinal);
if (val2.Brain.Info.OldAge || val2.Brain.HasThought((Thought)146) || (int)val2.Brain.Info.CursedState == 392)
{
if (num > 0)
{
val.text = val.text.Remove(num, iconForRole.Length - 1);
}
}
else if (!string.IsNullOrWhiteSpace(iconForRole) && num <= 0)
{
val.text = val.text + " (" + iconForRole + ")";
}
}
}
[HarmonyPatch]
public class UIFollowerWheelInteractionItemPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(UIFollowerWheelInteractionItem), "Configure", new Type[]
{
typeof(Follower),
typeof(CommandItem)
})]
public static void Configure(UIFollowerWheelInteractionItem __instance, ref Follower follower, ref CommandItem commandItem)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Invalid comparison between Unknown and I4
if (commandItem == null || !commandItem.Command.IsFollowerRoleCommand())
{
return;
}
FieldInfo field = typeof(UIFollowerWheelInteractionItem).GetField("_title", BindingFlags.Instance | BindingFlags.NonPublic);
FieldInfo field2 = typeof(UIFollowerWheelInteractionItem).GetField("_text", BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null || field2 == null)
{
return;
}
FollowerRole followerRole = commandItem.Command.FollowerCommandToRole();
int num = DataManager.Instance.Followers.Count((FollowerInfo followerInfo) => followerInfo.FollowerRole == followerRole);
string arg = (string)field.GetValue(__instance);
TextMeshProUGUI val = (TextMeshProUGUI)field2.GetValue(__instance);
if (followerRole == follower.Brain.Info.FollowerRole)
{
if (commandItem.IsAvailable(follower))
{
((TMP_Text)val).text = "<color=yellow>" + ((TMP_Text)val).text + "</color>";
}
field.SetValue(__instance, $"<color=yellow>{arg} ({num})</color>");
}
else if (!commandItem.IsAvailable(follower))
{
field.SetValue(__instance, string.Format("{0} ({1}{2})", arg, num, ((int)followerRole == 6) ? "" : " + 1"));
}
else
{
field.SetValue(__instance, $"{arg} ({num} + 1)");
}
}
}
}
namespace ShowFollowerJobTitles.Common.Extensions
{
public static class FollowerCommandsExtensions
{
public static bool IsFollowerRoleCommand(this FollowerCommands followerCommand)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Invalid comparison between Unknown and I4
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Invalid comparison between Unknown and I4
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Invalid comparison between Unknown and I4
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Invalid comparison between Unknown and I4
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Invalid comparison between Unknown and I4
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Invalid comparison between Unknown and I4
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Invalid comparison between Unknown and I4
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Invalid comparison between Unknown and I4
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Invalid comparison between Unknown and I4
if ((int)followerCommand <= 58)
{
if ((int)followerCommand <= 28)
{
if (followerCommand - 14 <= 1 || (int)followerCommand == 17 || followerCommand - 27 <= 1)
{
goto IL_0091;
}
}
else if ((int)followerCommand <= 42)
{
if ((int)followerCommand == 30 || (int)followerCommand == 42)
{
goto IL_0091;
}
}
else if ((int)followerCommand == 47 || (int)followerCommand == 58)
{
goto IL_0091;
}
}
else if ((int)followerCommand <= 113)
{
if ((int)followerCommand <= 81)
{
if ((int)followerCommand == 64 || (int)followerCommand == 81)
{
goto IL_0091;
}
}
else if ((int)followerCommand == 88 || (int)followerCommand == 113)
{
goto IL_0091;
}
}
else if ((int)followerCommand <= 124)
{
if (followerCommand - 116 <= 1 || (int)followerCommand == 124)
{
goto IL_0091;
}
}
else if ((int)followerCommand == 126 || (int)followerCommand == 175)
{
goto IL_0091;
}
return false;
IL_0091:
return true;
}
public static FollowerRole FollowerCommandToRole(this FollowerCommands followerCommand)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Invalid comparison between Unknown and I4
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Invalid comparison between Unknown and I4
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Invalid comparison between Unknown and I4
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected I4, but got Unknown
//IL_00f6: 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_00ba: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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
//IL_002a: 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_0043: Expected I4, but got Unknown
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Invalid comparison between Unknown and I4
//IL_007a: 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_0097: Expected I4, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Invalid comparison between Unknown and I4
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: 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_00be: Unknown result type (might be due to invalid IL or missing references)
if (1 == 0)
{
}
FollowerRole result;
if ((int)followerCommand <= 64)
{
if ((int)followerCommand <= 42)
{
switch (followerCommand - 14)
{
case 0:
goto IL_00b5;
case 3:
goto IL_00c1;
case 1:
goto IL_00c9;
case 2:
goto IL_0103;
}
switch (followerCommand - 27)
{
case 0:
goto IL_00b1;
case 1:
goto IL_00c5;
case 3:
goto IL_00cd;
case 2:
goto IL_0103;
}
if ((int)followerCommand != 42)
{
goto IL_0103;
}
result = (FollowerRole)4;
}
else if ((int)followerCommand != 47)
{
if ((int)followerCommand != 58)
{
if ((int)followerCommand != 64)
{
goto IL_0103;
}
result = (FollowerRole)10;
}
else
{
result = (FollowerRole)9;
}
}
else
{
result = (FollowerRole)3;
}
}
else if ((int)followerCommand <= 117)
{
if ((int)followerCommand != 81)
{
if ((int)followerCommand != 88)
{
switch (followerCommand - 113)
{
case 0:
break;
case 3:
goto IL_00ea;
case 4:
goto IL_00ef;
default:
goto IL_0103;
}
result = (FollowerRole)14;
}
else
{
result = (FollowerRole)13;
}
}
else
{
result = (FollowerRole)12;
}
}
else if ((int)followerCommand != 124)
{
if ((int)followerCommand != 126)
{
if ((int)followerCommand != 175)
{
goto IL_0103;
}
result = (FollowerRole)19;
}
else
{
result = (FollowerRole)18;
}
}
else
{
result = (FollowerRole)17;
}
goto IL_0107;
IL_00c9:
result = (FollowerRole)7;
goto IL_0107;
IL_00b5:
result = (FollowerRole)2;
goto IL_0107;
IL_0103:
result = (FollowerRole)1;
goto IL_0107;
IL_00ef:
result = (FollowerRole)16;
goto IL_0107;
IL_0107:
if (1 == 0)
{
}
return result;
IL_00ea:
result = (FollowerRole)15;
goto IL_0107;
IL_00cd:
result = (FollowerRole)8;
goto IL_0107;
IL_00c5:
result = (FollowerRole)6;
goto IL_0107;
IL_00b1:
result = (FollowerRole)0;
goto IL_0107;
IL_00c1:
result = (FollowerRole)5;
goto IL_0107;
}
public static FollowerCommands FollowerRoleToCommand(FollowerRole followerRole)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected I4, but got Unknown
//IL_005f: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//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_0073: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_009b: 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)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
if (1 == 0)
{
}
FollowerCommands result = (FollowerCommands)((int)followerRole switch
{
0 => 27,
2 => 14,
3 => 47,
4 => 42,
5 => 17,
6 => 28,
7 => 15,
8 => 30,
9 => 58,
10 => 64,
12 => 81,
13 => 88,
14 => 113,
15 => 116,
16 => 117,
17 => 124,
18 => 126,
19 => 175,
_ => 0,
});
if (1 == 0)
{
}
return result;
}
}
public static class FontImageNamesExtensions
{
public static string GetIconForRole(FollowerRole followerRole)
{
//IL_0001: 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)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
string text = FontImageNames.IconForRole(followerRole);
if (string.IsNullOrWhiteSpace(text))
{
try
{
text = FontImageNames.IconForCommand(FollowerCommandsExtensions.FollowerRoleToCommand(followerRole));
}
catch (ArgumentOutOfRangeException)
{
}
}
return text;
}
}
}