Decompiled source of Parlays Pack v1.0.0

patchers/ParlaysPack/ParlayCompatibilityPatcher.dll

Decompiled a day 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.Security.Cryptography;
using BepInEx;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Mono.Collections.Generic;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
public static class Patcher
{
	private static ManualLogSource log;

	public static IEnumerable<string> TargetDLLs => new string[0];

	public static void Patch(AssemblyDefinition ignored)
	{
	}

	public static void Initialize()
	{
		Apply(Path.GetDirectoryName(typeof(Patcher).Assembly.Location), Paths.PluginPath);
	}

	public static void Apply(string own, string plugins)
	{
		//IL_014c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Expected O, but got Unknown
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Expected O, but got Unknown
		log = Logger.CreateLogSource("Parlay Compatibility Installer");
		string[] array = File.ReadAllLines(Path.Combine(own, "compatibility-rules.tsv"));
		foreach (string text in array)
		{
			if (string.IsNullOrWhiteSpace(text) || text.StartsWith("#"))
			{
				continue;
			}
			string[] array2 = text.Split('\t');
			if (array2.Length != 4)
			{
				throw new InvalidDataException("Invalid compatibility rule");
			}
			string[] files = Directory.GetFiles(plugins, array2[1], SearchOption.AllDirectories);
			string[] array3 = files;
			foreach (string text2 in array3)
			{
				string text3;
				using (SHA256 sHA = SHA256.Create())
				{
					using FileStream inputStream = File.OpenRead(text2);
					text3 = BitConverter.ToString(sHA.ComputeHash(inputStream)).Replace("-", "");
				}
				string path = text2 + ".parlay-patch-source";
				if (File.Exists(path) && File.ReadAllText(path).Trim() == text3)
				{
					continue;
				}
				if (text3 != array2[2])
				{
					log.LogWarning((object)("Unreviewed " + array2[1] + "; compatibility change skipped. Recheck its official update."));
					continue;
				}
				DefaultAssemblyResolver val = new DefaultAssemblyResolver();
				((BaseAssemblyResolver)val).AddSearchDirectory(Paths.ManagedPath);
				((BaseAssemblyResolver)val).AddSearchDirectory(Paths.BepInExRootPath + "/core");
				string[] directories = Directory.GetDirectories(plugins, "*", SearchOption.AllDirectories);
				foreach (string text4 in directories)
				{
					((BaseAssemblyResolver)val).AddSearchDirectory(text4);
				}
				AssemblyDefinition val2 = AssemblyDefinition.ReadAssembly(text2, new ReaderParameters
				{
					AssemblyResolver = (IAssemblyResolver)(object)val,
					InMemory = true
				});
				try
				{
					Transform(val2, array2[0]);
					string text5 = text2 + ".parlay-new";
					val2.Write(text5);
					if (!File.Exists(text2 + ".parlay-original"))
					{
						File.Copy(text2, text2 + ".parlay-original");
					}
					File.Copy(text5, text2, overwrite: true);
					File.Delete(text5);
				}
				finally
				{
					((IDisposable)val2)?.Dispose();
				}
				using (SHA256 sHA2 = SHA256.Create())
				{
					using FileStream inputStream2 = File.OpenRead(text2);
					File.WriteAllText(path, BitConverter.ToString(sHA2.ComputeHash(inputStream2)).Replace("-", ""));
				}
				log.LogInfo((object)("Applied reviewed compatibility change: " + array2[0] + " to " + array2[1]));
			}
		}
	}

	private static IEnumerable<MethodDefinition> Methods(ModuleDefinition m)
	{
		return m.GetTypes().SelectMany((TypeDefinition t) => (IEnumerable<MethodDefinition>)t.Methods);
	}

	private static MethodReference Method(TypeReference t, string name, TypeReference ret, params TypeReference[] args)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		MethodReference val = new MethodReference(name, ret, t);
		foreach (TypeReference val2 in args)
		{
			val.Parameters.Add(new ParameterDefinition(val2));
		}
		return val;
	}

	public static void Transform(AssemblyDefinition a, string rule)
	{
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0082: Invalid comparison between Unknown and I4
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: 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_00a9: 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_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0a9b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aa2: Expected O, but got Unknown
		//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab6: Expected O, but got Unknown
		//IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0aca: Expected O, but got Unknown
		//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ade: Expected O, but got Unknown
		//IL_0bea: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bf6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c04: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c0b: Expected O, but got Unknown
		//IL_0c2f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c3e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c4b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c5a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c69: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c78: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c87: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c96: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ca5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cb4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cc6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cd5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ce4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0cf3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d02: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d11: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d23: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d49: Unknown result type (might be due to invalid IL or missing references)
		//IL_0d60: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e9: Expected O, but got Unknown
		//IL_0404: Unknown result type (might be due to invalid IL or missing references)
		//IL_040b: Expected O, but got Unknown
		//IL_0414: Unknown result type (might be due to invalid IL or missing references)
		//IL_043a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0756: Unknown result type (might be due to invalid IL or missing references)
		//IL_075b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0611: Unknown result type (might be due to invalid IL or missing references)
		//IL_0633: Unknown result type (might be due to invalid IL or missing references)
		//IL_0919: Unknown result type (might be due to invalid IL or missing references)
		//IL_0929: Unknown result type (might be due to invalid IL or missing references)
		//IL_0945: Unknown result type (might be due to invalid IL or missing references)
		//IL_0954: Unknown result type (might be due to invalid IL or missing references)
		//IL_0961: Unknown result type (might be due to invalid IL or missing references)
		//IL_096e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		ModuleDefinition mainModule = a.MainModule;
		int num = 0;
		foreach (MethodDefinition item in from x in Methods(mainModule)
			where x.HasBody
			select x)
		{
			Enumerator<Instruction> enumerator2 = item.Body.Instructions.GetEnumerator();
			try
			{
				while (enumerator2.MoveNext())
				{
					Instruction current2 = enumerator2.Current;
					OpCode opCode = current2.OpCode;
					if ((int)((OpCode)(ref opCode)).OperandType != 15)
					{
						continue;
					}
					opCode = current2.OpCode;
					string name = ((OpCode)(ref opCode)).Name;
					opCode = current2.OpCode;
					string longName = name.Substring(0, ((OpCode)(ref opCode)).Name.Length - 2);
					current2.OpCode = (OpCode)typeof(OpCodes).GetFields().Single(delegate(FieldInfo f)
					{
						//IL_001e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0023: Unknown result type (might be due to invalid IL or missing references)
						int result;
						if (f.FieldType == typeof(OpCode))
						{
							OpCode val29 = (OpCode)f.GetValue(null);
							result = ((((OpCode)(ref val29)).Name == longName) ? 1 : 0);
						}
						else
						{
							result = 0;
						}
						return (byte)result != 0;
					}).GetValue(null);
				}
			}
			finally
			{
				((IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose();
			}
		}
		switch (rule)
		{
		case "operator-invisibility":
			foreach (MethodDefinition item2 in from m in Methods(mainModule)
				where m.HasBody
				select m)
			{
				Enumerator<Instruction> enumerator9 = item2.Body.Instructions.GetEnumerator();
				try
				{
					while (enumerator9.MoveNext())
					{
						Instruction current9 = enumerator9.Current;
						object operand5 = current9.Operand;
						FieldReference val22 = (FieldReference)((operand5 is FieldReference) ? operand5 : null);
						if (val22 != null && !(((MemberReference)((MemberReference)val22).DeclaringType).FullName != "RoR2.CharacterModel") && !(((MemberReference)val22).Name != "invisibilityCount"))
						{
							bool flag = current9.OpCode == OpCodes.Stfld;
							if (!flag && current9.OpCode != OpCodes.Ldfld)
							{
								throw new InvalidDataException("Unexpected invisibility opcode");
							}
							MethodReference val23 = Method(((MemberReference)val22).DeclaringType, flag ? "set_invisibilityCount" : "get_invisibilityCount", flag ? mainModule.TypeSystem.Void : val22.FieldType, (TypeReference[])(object)((!flag) ? new TypeReference[0] : new TypeReference[1] { val22.FieldType }));
							val23.HasThis = true;
							current9.OpCode = OpCodes.Callvirt;
							current9.Operand = val23;
							num++;
						}
					}
				}
				finally
				{
					((IDisposable)enumerator9/*cast due to .constrained prefix*/).Dispose();
				}
			}
			Require(num == 5, rule);
			break;
		case "command-icons":
			foreach (MethodDefinition item3 in from m in Methods(mainModule)
				where m.HasBody
				select m)
			{
				Collection<Instruction> instructions = item3.Body.Instructions;
				for (int num2 = 0; num2 < instructions.Count - 1; num2++)
				{
					object operand = instructions[num2].Operand;
					FieldReference val14 = (FieldReference)((operand is FieldReference) ? operand : null);
					object operand2 = instructions[num2 + 1].Operand;
					MethodReference val15 = (MethodReference)((operand2 is MethodReference) ? operand2 : null);
					if (val14 != null && !(((MemberReference)((MemberReference)val14).DeclaringType).FullName != "RoR2.PickupDef") && !(((MemberReference)val14).Name != "iconSprite") && val15 != null && !(((MemberReference)val15).Name != "set_sprite"))
					{
						AssemblyNameReference val16 = new AssemblyNameReference("QueueIconSupport", new Version(0, 0, 0, 0));
						mainModule.AssemblyReferences.Add(val16);
						TypeReference t3 = new TypeReference("", "QueueIconSupport", mainModule, (IMetadataScope)(object)val16);
						instructions[num2].OpCode = OpCodes.Nop;
						instructions[num2].Operand = null;
						instructions[num2 + 1].OpCode = OpCodes.Call;
						instructions[num2 + 1].Operand = Method(t3, "SetPickupIcon", mainModule.TypeSystem.Void, ((MemberReference)val15).DeclaringType, ((MemberReference)val14).DeclaringType);
						num++;
					}
				}
			}
			Require(num == 1, rule);
			break;
		case "beam-prefab":
			foreach (MethodDefinition item4 in from m in Methods(mainModule)
				where m.HasBody
				select m)
			{
				Instruction[] array = item4.Body.Instructions.ToArray();
				foreach (Instruction val17 in array)
				{
					object operand3 = val17.Operand;
					MethodReference val18 = (MethodReference)((operand3 is MethodReference) ? operand3 : null);
					if (val18 != null && !(((MemberReference)((MemberReference)val18).DeclaringType).FullName != "R2API.PrefabAPI") && !(((MemberReference)val18).Name != "InstantiateClone") && val18.Parameters.Count == 2)
					{
						MethodReference val19 = Method(((MemberReference)val18).DeclaringType, ((MemberReference)val18).Name, val18.ReturnType, ((IEnumerable<ParameterDefinition>)val18.Parameters).Select((ParameterDefinition p) => ((ParameterReference)p).ParameterType).Concat((IEnumerable<TypeReference>)(object)new TypeReference[1] { mainModule.TypeSystem.Boolean }).ToArray());
						val17.OpCode = OpCodes.Ldc_I4_0;
						val17.Operand = null;
						item4.Body.GetILProcessor().InsertAfter(val17, Instruction.Create(OpCodes.Call, val19));
						num++;
					}
				}
			}
			Require(num == 1, rule);
			break;
		case "fast-delay-name":
			foreach (TypeDefinition item5 in from val29 in mainModule.GetTypes()
				where ((MemberReference)val29).FullName == "BalancedFasterInteractables.Plugin/PurchaseDelay"
				select val29)
			{
				MethodDefinition val20 = ((IEnumerable<MethodDefinition>)item5.Methods).Single((MethodDefinition m) => ((MemberReference)m).Name == "Update" && ((MethodReference)m).Parameters.Count == 1 && ((MemberReference)((ParameterReference)((MethodReference)m).Parameters[0]).ParameterType).FullName == "System.Single");
				foreach (MethodDefinition item6 in from m in Methods(mainModule)
					where m.HasBody
					select m)
				{
					Enumerator<Instruction> enumerator7 = item6.Body.Instructions.GetEnumerator();
					try
					{
						while (enumerator7.MoveNext())
						{
							Instruction current7 = enumerator7.Current;
							object operand4 = current7.Operand;
							MethodReference val21 = (MethodReference)((operand4 is MethodReference) ? operand4 : null);
							if (val21 != null && ((MemberReference)((MemberReference)val21).DeclaringType).FullName == ((MemberReference)item5).FullName && ((MemberReference)val21).Name == "Update" && val21.Parameters.Count == 1)
							{
								((MemberReference)val21).Name = "ApplyDelayScale";
							}
						}
					}
					finally
					{
						((IDisposable)enumerator7/*cast due to .constrained prefix*/).Dispose();
					}
				}
				((MemberReference)val20).Name = "ApplyDelayScale";
				num++;
			}
			Require(num == 1, rule);
			break;
		case "music-scene":
			foreach (MethodDefinition item7 in from m in Methods(mainModule)
				where m.HasBody
				select m)
			{
				Instruction[] array2 = item7.Body.Instructions.ToArray();
				foreach (Instruction val24 in array2)
				{
					object operand6 = val24.Operand;
					MethodReference val25 = (MethodReference)((operand6 is MethodReference) ? operand6 : null);
					if (val25 != null && !(((MemberReference)((MemberReference)val25).DeclaringType).FullName != "RoR2.SceneDef") && !(((MemberReference)val25).Name != "get_sceneDefIndex"))
					{
						ILProcessor iLProcessor2 = item7.Body.GetILProcessor();
						Instruction next = val24.Next;
						Instruction val26 = Instruction.Create(OpCodes.Callvirt, val25);
						val24.OpCode = OpCodes.Dup;
						val24.Operand = null;
						Instruction[] array3 = (Instruction[])(object)new Instruction[5]
						{
							Instruction.Create(OpCodes.Brtrue, val26),
							Instruction.Create(OpCodes.Pop),
							Instruction.Create(OpCodes.Ldc_I4_M1),
							Instruction.Create(OpCodes.Br, next),
							val26
						};
						Instruction val27 = val24;
						Instruction[] array4 = array3;
						foreach (Instruction val28 in array4)
						{
							iLProcessor2.InsertAfter(val27, val28);
							val27 = val28;
						}
						num++;
					}
				}
			}
			Require(num == 1, rule);
			break;
		case "quality-temp":
		{
			TypeDefinition type = mainModule.GetType("ItemQualities.Equipments.PassiveHealing/<>c");
			MethodDefinition val = ((IEnumerable<MethodDefinition>)type.Methods).Single((MethodDefinition x) => ((MemberReference)x).Name == "<Surprise_DropTempItemServer>b__9_3");
			Require(val.Body.Instructions.Count == 4, rule);
			AssemblyNameReference val2 = ((IEnumerable<AssemblyNameReference>)mainModule.AssemblyReferences).Single((AssemblyNameReference x) => x.Name == "Mono.Cecil");
			TypeReference t = new TypeReference("Mono.Cecil.Cil", "Instruction", mainModule, (IMetadataScope)(object)val2);
			TypeReference val3 = new TypeReference("Mono.Cecil", "MethodReference", mainModule, (IMetadataScope)(object)val2);
			TypeReference t2 = new TypeReference("Mono.Cecil", "MemberReference", mainModule, (IMetadataScope)(object)val2);
			TypeReference val4 = new TypeReference("Mono.Cecil", "TypeReference", mainModule, (IMetadataScope)(object)val2);
			MethodReference val5 = Method(t, "get_Operand", mainModule.TypeSystem.Object);
			val5.HasThis = true;
			MethodReference val6 = Method(t2, "get_Name", mainModule.TypeSystem.String);
			val6.HasThis = true;
			MethodReference val7 = Method(t2, "get_DeclaringType", val4);
			val7.HasThis = true;
			MethodReference val8 = Method(val4, "get_FullName", mainModule.TypeSystem.String);
			val8.HasThis = true;
			MethodReference val9 = Method(mainModule.TypeSystem.String, "op_Equality", mainModule.TypeSystem.Boolean, mainModule.TypeSystem.String, mainModule.TypeSystem.String);
			ILProcessor iLProcessor = val.Body.GetILProcessor();
			Instruction val10 = ((IEnumerable<Instruction>)val.Body.Instructions).Last();
			val.Body.Instructions.Remove(val10);
			Instruction val11 = Instruction.Create(OpCodes.Ldc_I4_1);
			Instruction val12 = Instruction.Create(OpCodes.Ldc_I4_0);
			VariableDefinition val13 = new VariableDefinition(val3);
			val.Body.Variables.Add(val13);
			val.Body.InitLocals = true;
			iLProcessor.Emit(OpCodes.Brtrue, val11);
			iLProcessor.Emit(OpCodes.Ldarg_1);
			iLProcessor.Emit(OpCodes.Callvirt, val5);
			iLProcessor.Emit(OpCodes.Isinst, val3);
			iLProcessor.Emit(OpCodes.Stloc, val13);
			iLProcessor.Emit(OpCodes.Ldloc, val13);
			iLProcessor.Emit(OpCodes.Brfalse, val12);
			iLProcessor.Emit(OpCodes.Ldloc, val13);
			iLProcessor.Emit(OpCodes.Callvirt, val6);
			iLProcessor.Emit(OpCodes.Ldstr, "SpawnJunkDrop");
			iLProcessor.Emit(OpCodes.Call, val9);
			iLProcessor.Emit(OpCodes.Brfalse, val12);
			iLProcessor.Emit(OpCodes.Ldloc, val13);
			iLProcessor.Emit(OpCodes.Callvirt, val7);
			iLProcessor.Emit(OpCodes.Callvirt, val8);
			iLProcessor.Emit(OpCodes.Ldstr, "JunkDroneRandomItems");
			iLProcessor.Emit(OpCodes.Call, val9);
			iLProcessor.Emit(OpCodes.Ret);
			iLProcessor.Append(val12);
			iLProcessor.Emit(OpCodes.Ret);
			iLProcessor.Append(val11);
			iLProcessor.Emit(OpCodes.Ret);
			break;
		}
		default:
			throw new InvalidDataException("Unknown compatibility rule " + rule);
		}
	}

	private static void Require(bool ok, string rule)
	{
		if (!ok)
		{
			throw new InvalidDataException("Unexpected official method layout: " + rule);
		}
	}
}

plugins/ParlaysPack/TempItemFix/JunkDroneRandomItems.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using EntityStates.Drone.DroneJunk;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using R2API.Utils;
using RoR2;
using RoR2.Artifacts;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("LocalMods.JunkDroneRandomItems", "Temp Item Fix (Host Only)", "1.1.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class JunkDroneRandomItems : BaseUnityPlugin
{
	public const string Guid = "LocalMods.JunkDroneRandomItems";

	[ThreadStatic]
	private static int junkDropDepth;

	private static readonly MethodInfo spawn = typeof(PickupDropletController).GetMethod("CreatePickupDroplet", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[3]
	{
		typeof(UniquePickup),
		typeof(Vector3),
		typeof(Vector3)
	}, null);

	private static readonly MethodInfo commandEnabled = typeof(CommandArtifactManager).GetProperty("IsCommandArtifactEnabled", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetGetMethod(nonPublic: true);

	private static readonly MethodInfo spawnInfo = typeof(PickupDropletController).GetMethod("CreatePickupDroplet", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[3]
	{
		typeof(CreatePickupInfo),
		typeof(Vector3),
		typeof(Vector3)
	}, null);

	private Harmony harmony;

	private void Awake()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Expected O, but got Unknown
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0108: Expected O, but got Unknown
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Expected O, but got Unknown
		harmony = new Harmony("LocalMods.JunkDroneRandomItems");
		try
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(Surprise), "DropTempItemServer", new Type[1] { typeof(Vector3) }, (Type[])null);
			MethodInfo method = typeof(PickupDropletController).GetMethod("CreatePickupDroplet", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[3]
			{
				typeof(CreatePickupInfo),
				typeof(Vector3),
				typeof(Vector3)
			}, null);
			if (methodInfo == null || method == null || spawn == null || commandEnabled == null)
			{
				throw new MissingMethodException("Required native junk drone drop API not found.");
			}
			harmony.Patch((MethodBase)method, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(JunkDroneRandomItems), "FilterDropletCommand", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(JunkDroneRandomItems), "ScopeJunkDrop", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Ready: host junk drone items stay random under Command. Client-only sessions use native behavior.");
			try
			{
				MethodInfo methodInfo2 = AccessTools.Method(typeof(PickupDistributorBehavior), "Drop", Type.EmptyTypes, (Type[])null);
				if (methodInfo2 == null || spawnInfo == null)
				{
					throw new MissingMethodException("Dispenser drop API not found.");
				}
				harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(JunkDroneRandomItems), "ScopeDispenserDrop", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Ready: host temporary item dispensers give their displayed item under Command. Permanent-item dispensers remain unchanged.");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Dispenser fix unavailable; junk drone fix retained. " + ex));
			}
		}
		catch (Exception ex2)
		{
			harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogError((object)("Not enabled: incompatible drop hook. Native behavior restored. " + ex2));
		}
	}

	private void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
	}

	public static bool UseCommand(bool enabled, bool isServer, int depth)
	{
		return enabled && (!isServer || depth <= 0);
	}

	public static bool CommandForThisDroplet()
	{
		return UseCommand(CommandArtifactManager.IsCommandArtifactEnabled, NetworkServer.active, junkDropDepth);
	}

	public static void SpawnJunkDrop(UniquePickup pickup, Vector3 position, Vector3 velocity)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: 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)
		if (!NetworkServer.active)
		{
			return;
		}
		junkDropDepth++;
		try
		{
			PickupDropletController.CreatePickupDroplet(pickup, position, velocity);
		}
		finally
		{
			junkDropDepth--;
		}
	}

	public static IEnumerable<CodeInstruction> ScopeJunkDrop(IEnumerable<CodeInstruction> input)
	{
		return ReplaceOne(input, spawn, typeof(JunkDroneRandomItems).GetMethod("SpawnJunkDrop"));
	}

	public static bool IsTemporaryDispenserDrop(bool isServer, float decayValue)
	{
		return isServer && decayValue > 0f;
	}

	public static void SpawnDispenserDrop(CreatePickupInfo info, Vector3 position, Vector3 velocity)
	{
		//IL_0012: 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)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			return;
		}
		bool flag = IsTemporaryDispenserDrop(isServer: true, ((CreatePickupInfo)(ref info)).pickup.decayValue);
		if (flag)
		{
			junkDropDepth++;
		}
		try
		{
			PickupDropletController.CreatePickupDroplet(info, position, velocity);
		}
		finally
		{
			if (flag)
			{
				junkDropDepth--;
			}
		}
	}

	public static IEnumerable<CodeInstruction> ScopeDispenserDrop(IEnumerable<CodeInstruction> input)
	{
		return ReplaceOne(input, spawnInfo, typeof(JunkDroneRandomItems).GetMethod("SpawnDispenserDrop"));
	}

	public static IEnumerable<CodeInstruction> FilterDropletCommand(IEnumerable<CodeInstruction> input)
	{
		return ReplaceOne(input, commandEnabled, typeof(JunkDroneRandomItems).GetMethod("CommandForThisDroplet"));
	}

	private static IEnumerable<CodeInstruction> ReplaceOne(IEnumerable<CodeInstruction> input, MethodInfo original, MethodInfo replacement)
	{
		List<CodeInstruction> list = input.Select((Func<CodeInstruction, CodeInstruction>)((CodeInstruction i) => new CodeInstruction(i))).ToList();
		List<CodeInstruction> list2 = list.Where((CodeInstruction i) => i.opcode == OpCodes.Call && object.Equals(i.operand, original)).ToList();
		if (original == null || replacement == null || list2.Count != 1)
		{
			throw new InvalidOperationException("Expected exactly one native call; refusing an unrecognized game/mod layout.");
		}
		list2[0].operand = replacement;
		return list;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-CommandQueueIcons/QueueIconSupport.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.ContentManagement;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.CommandQueueIcons", "Command Queue Icon Compatibility", "1.0.0")]
public class QueueIconSupport : BaseUnityPlugin
{
	public static void SetPickupIcon(Image image, PickupDef pickup)
	{
		if (Object.op_Implicit((Object)(object)image) && pickup != null)
		{
			QueueIconLoader queueIconLoader = ((Component)image).gameObject.GetComponent<QueueIconLoader>();
			if (!Object.op_Implicit((Object)(object)queueIconLoader))
			{
				queueIconLoader = ((Component)image).gameObject.AddComponent<QueueIconLoader>();
			}
			queueIconLoader.Set(image, pickup);
		}
	}
}
public class QueueIconLoader : MonoBehaviour
{
	private AssetOrDirectReference<Sprite> reference;

	private int generation;

	public void Set(Image image, PickupDef pickup)
	{
		int current = ++generation;
		((Behaviour)image).enabled = false;
		reference = pickup.GetIconAODR(true, (Action<Sprite>)delegate(Sprite sprite)
		{
			if (Object.op_Implicit((Object)(object)image) && current == generation)
			{
				image.sprite = sprite;
				((Behaviour)image).enabled = Object.op_Implicit((Object)(object)sprite);
			}
		}, (Action<Sprite>)delegate
		{
			if (Object.op_Implicit((Object)(object)image) && current == generation)
			{
				((Behaviour)image).enabled = false;
			}
		});
		reference.SetUnloadType((AsyncReferenceHandleUnloadType)3);
	}

	private void OnDestroy()
	{
		generation++;
		reference = null;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-CommandQueueSelectionGuard/CommandQueueSelectionGuard.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
public static class ExactQueueChoice
{
	public static int Resolve(int wanted, int[] ids, bool[] available)
	{
		if (wanted < 0 || ids == null || available == null || ids.Length != available.Length)
		{
			return -1;
		}
		int num = -1;
		for (int i = 0; i < ids.Length; i++)
		{
			if (ids[i] == wanted)
			{
				if (num >= 0)
				{
					return -1;
				}
				num = i;
			}
		}
		return (num >= 0 && available[num]) ? num : (-1);
	}
}
[BepInPlugin("ClientSideRepairs.CommandQueueSelectionGuard", "Command Queue Exact Item Guard", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class CommandQueueSelectionGuard : BaseUnityPlugin
{
	private sealed class Request
	{
		public PickupPickerController picker;

		public PickupIndex wanted;

		public bool reached;
	}

	private static CommandQueueSelectionGuard instance;

	private static Func<IEnumerable<(ItemTier, PickupIndex)>> heads;

	private static Func<ItemTier, PickupIndex> peek;

	private static Func<ItemTier, PickupIndex> pop;

	private static FieldInfo prefab;

	private static bool audited;

	private static bool validCatalog;

	[ThreadStatic]
	private static Request active;

	private readonly HashSet<PickupPickerController> pending = new HashSet<PickupPickerController>();

	private void Awake()
	{
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Expected O, but got Unknown
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Expected O, but got Unknown
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Expected O, but got Unknown
		instance = this;
		Type type = AccessTools.TypeByName("CommandQueue.QueueManager");
		heads = (Func<IEnumerable<(ItemTier, PickupIndex)>>)Delegate.CreateDelegate(typeof(Func<IEnumerable<(ItemTier, PickupIndex)>>), AccessTools.Method(type, "PeekAll", (Type[])null, (Type[])null));
		peek = (Func<ItemTier, PickupIndex>)Delegate.CreateDelegate(typeof(Func<ItemTier, PickupIndex>), AccessTools.Method(type, "Peek", (Type[])null, (Type[])null));
		pop = (Func<ItemTier, PickupIndex>)Delegate.CreateDelegate(typeof(Func<ItemTier, PickupIndex>), AccessTools.Method(type, "Pop", (Type[])null, (Type[])null));
		prefab = AccessTools.Field(AccessTools.TypeByName("CommandQueue.CommandQueue"), "commandUIPrefab");
		Harmony val = new Harmony("ClientSideRepairs.CommandQueueSelectionGuard");
		val.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("CommandQueue.CommandQueue"), "HandleCommandDisplayBegin", (Type[])null, (Type[])null), new HarmonyMethod(typeof(CommandQueueSelectionGuard), "BeforeQueue", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LookingGlass.CommandItemCount.CommandItemCountClass"), "SubmitChoice", (Type[])null, (Type[])null), new HarmonyMethod(typeof(CommandQueueSelectionGuard), "BeforeRemap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(typeof(PickupPickerController), "SubmitChoice", new Type[1] { typeof(int) }, (Type[])null), new HarmonyMethod(typeof(CommandQueueSelectionGuard), "BeforeNativeSubmit", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Exact-item queue guard installed. Queued choices bypass display-only sorting; every submission is revalidated. Catalog audit waits for catalogs.");
	}

	private unsafe void Update()
	{
		//IL_003e: 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)
		//IL_0047: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007b: 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_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: 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_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_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: 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_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		if (audited || !((ResourceAvailability)(ref PickupCatalog.availability)).available || !((ResourceAvailability)(ref ItemCatalog.availability)).available)
		{
			return;
		}
		audited = true;
		validCatalog = true;
		int num = 0;
		int num2 = 0;
		GenericStaticEnumerable<ItemIndex, AllItemsEnumerator> allItems = ItemCatalog.allItems;
		AllItemsEnumerator enumerator = allItems.GetEnumerator();
		try
		{
			while (((AllItemsEnumerator)(ref enumerator)).MoveNext())
			{
				ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current;
				ItemDef itemDef = ItemCatalog.GetItemDef(current);
				if (!Object.op_Implicit((Object)(object)itemDef))
				{
					continue;
				}
				PickupIndex val = PickupCatalog.FindPickupIndex(current);
				if (!(val == PickupIndex.none))
				{
					PickupDef pickupDef = PickupCatalog.GetPickupDef(val);
					if (pickupDef == null || pickupDef.itemIndex != current)
					{
						validCatalog = false;
					}
					num++;
				}
			}
		}
		finally
		{
			((IDisposable)(*(AllItemsEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose();
		}
		GenericStaticEnumerable<EquipmentIndex, AllEquipmentEnumerator> allEquipment = EquipmentCatalog.allEquipment;
		AllEquipmentEnumerator enumerator2 = allEquipment.GetEnumerator();
		try
		{
			while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext())
			{
				EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current;
				EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current2);
				if (!Object.op_Implicit((Object)(object)equipmentDef))
				{
					continue;
				}
				PickupIndex val2 = PickupCatalog.FindPickupIndex(current2);
				if (!(val2 == PickupIndex.none))
				{
					PickupDef pickupDef2 = PickupCatalog.GetPickupDef(val2);
					if (pickupDef2 == null || pickupDef2.equipmentIndex != current2)
					{
						validCatalog = false;
					}
					num2++;
				}
			}
		}
		finally
		{
			((IDisposable)(*(AllEquipmentEnumerator*)(&enumerator2))/*cast due to .constrained prefix*/).Dispose();
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Full pickup catalog identity audit: " + num + " items, " + num2 + " equipment; valid=" + validCatalog + ". No hard-coded item IDs."));
		if (!validCatalog)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"Catalog identities disagree; queued auto-picks disabled. Use manual menus.");
		}
	}

	private static int Resolve(PickupPickerController picker, PickupIndex wanted)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)picker) || picker.options == null || PickupCatalog.GetPickupDef(wanted) == null)
		{
			return -1;
		}
		return ExactQueueChoice.Resolve(wanted.value, picker.options.Select((Option o) => o.pickup.pickupIndex.value).ToArray(), picker.options.Select((Option o) => o.available).ToArray());
	}

	private static void Manual(object[] args)
	{
		((Delegate)args[0]).DynamicInvoke(args.Skip(1).ToArray());
	}

	private static bool BeforeQueue(object[] __args)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Expected O, but got Unknown
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		//IL_0080: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
		PickupPickerController val = (PickupPickerController)__args[1];
		if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val.panelPrefab != (Object)(GameObject)prefab.GetValue(null))
		{
			return true;
		}
		if (!audited || !validCatalog)
		{
			Manual(__args);
			return false;
		}
		foreach (var item in heads())
		{
			if (Resolve(val, item.Item2) >= 0)
			{
				if (instance.pending.Add(val))
				{
					((MonoBehaviour)instance).StartCoroutine(instance.PickLater((object[])__args.Clone(), item.Item1, item.Item2));
				}
				return false;
			}
		}
		Manual(__args);
		return false;
	}

	private IEnumerator PickLater(object[] args, ItemTier tier, PickupIndex wanted)
	{
		//IL_0015: 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_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		PickupPickerController picker = (PickupPickerController)args[1];
		yield return null;
		pending.Remove(picker);
		if (!Object.op_Implicit((Object)(object)picker))
		{
			yield break;
		}
		int choice = Resolve(picker, wanted);
		if (choice < 0 || peek(tier) != wanted)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Queued item unavailable or queue changed; opening manual menu without consuming the queue.");
			Manual(args);
			yield break;
		}
		Request request = (active = new Request
		{
			picker = picker,
			wanted = wanted
		});
		try
		{
			picker.SubmitChoice(choice);
		}
		finally
		{
			active = null;
		}
		if (request.reached)
		{
			if (peek(tier) == wanted)
			{
				pop(tier);
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Verified queued choice: " + PickupCatalog.GetPickupDef(wanted).internalName + "; native option " + choice + "."));
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Auto-pick blocked before native submission; queue retained.");
			if (Object.op_Implicit((Object)(object)picker))
			{
				Manual(args);
			}
		}
	}

	private static bool BeforeRemap(object[] __args)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (active == null || (Object)(PickupPickerController)__args[1] != (Object)(object)active.picker)
		{
			return true;
		}
		int num = (int)__args[2];
		if (Resolve(active.picker, active.wanted) != num)
		{
			return false;
		}
		((Action<PickupPickerController, int>)__args[0])(active.picker, num);
		return false;
	}

	private static bool BeforeNativeSubmit(PickupPickerController __instance, int __0)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		if (active == null || (Object)(object)__instance != (Object)(object)active.picker)
		{
			return true;
		}
		if (Resolve(__instance, active.wanted) != __0)
		{
			((BaseUnityPlugin)instance).Logger.LogError((object)"Refused wrong queued choice. Queue retained; no selection submitted.");
			return false;
		}
		active.reached = true;
		return true;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-EmptySkinGuard/EmptySkinGuard.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.EmptySkinGuard", "Empty Model Skin Compatibility", "1.0.0")]
public class EmptySkinGuard : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ModelSkinController), "ApplySkinAsync")]
	private class Patch
	{
		[HarmonyPrefix]
		private static bool Before(ModelSkinController __instance, ref IEnumerator __result)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.skins != null && __instance.skins.Length != 0)
			{
				return true;
			}
			CharacterBody componentInParent = ((Component)__instance).GetComponentInParent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)componentInParent) && ((ResourceAvailability)(ref SkinCatalog.availability)).available)
			{
				SkinDef[] bodySkinDefs = SkinCatalog.GetBodySkinDefs(componentInParent.bodyIndex);
				if (bodySkinDefs != null && bodySkinDefs.Length != 0)
				{
					__instance.skins = bodySkinDefs;
					Log.LogInfo((object)("Restored catalog skins for " + ((Object)componentInParent).name));
					return true;
				}
			}
			Log.LogWarning((object)("Skipped skin loading on model with no skin definitions: " + ((Object)__instance).name));
			__result = Empty();
			return false;
		}
	}

	internal static ManualLogSource Log;

	private void Awake()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		new Harmony("ClientSideRepairs.EmptySkinGuard").PatchAll(typeof(EmptySkinGuard).Assembly);
	}

	private static IEnumerator Empty()
	{
		yield break;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-LegacyMusicSupport/R2API.dll

Decompiled a day ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using R2API;
using R2API.ContentManagement;
using R2API.MiscHelpers;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.ScriptableObjects;
using R2API.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("R2API")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("5.0.5.0")]
[assembly: AssemblyInformationalVersion("5.0.5")]
[assembly: AssemblyProduct("R2API")]
[assembly: AssemblyTitle("R2API")]
[assembly: AssemblyVersion("5.0.5.0")]
[assembly: TypeForwardedTo(typeof(ArtifactCodeAPI))]
[assembly: TypeForwardedTo(typeof(ContentAddition))]
[assembly: TypeForwardedTo(typeof(ManagedReadOnlyContentPack))]
[assembly: TypeForwardedTo(typeof(ManagedSerializableContentPack))]
[assembly: TypeForwardedTo(typeof(R2APIContentManager))]
[assembly: TypeForwardedTo(typeof(CustomElite))]
[assembly: TypeForwardedTo(typeof(CustomEquipment))]
[assembly: TypeForwardedTo(typeof(CustomItem))]
[assembly: TypeForwardedTo(typeof(DamageAPI))]
[assembly: TypeForwardedTo(typeof(DeployableAPI))]
[assembly: TypeForwardedTo(typeof(DifficultyAPI))]
[assembly: TypeForwardedTo(typeof(DirectorAPI))]
[assembly: TypeForwardedTo(typeof(DotAPI))]
[assembly: TypeForwardedTo(typeof(EliteAPI))]
[assembly: TypeForwardedTo(typeof(IModdedUnlockableDataProvider))]
[assembly: TypeForwardedTo(typeof(ItemAPI))]
[assembly: TypeForwardedTo(typeof(ItemDisplayRuleDict))]
[assembly: TypeForwardedTo(typeof(LanguageAPI))]
[assembly: TypeForwardedTo(typeof(LoadoutAPI))]
[assembly: TypeForwardedTo(typeof(LobbyConfigAPI))]
[assembly: TypeForwardedTo(typeof(KeyValuePairExtensions))]
[assembly: TypeForwardedTo(typeof(Modifier<>))]
[assembly: TypeForwardedTo(typeof(ModdedUnlockable))]
[assembly: TypeForwardedTo(typeof(INetCommand))]
[assembly: TypeForwardedTo(typeof(INetMessage))]
[assembly: TypeForwardedTo(typeof(INetRequest<, >))]
[assembly: TypeForwardedTo(typeof(INetRequestReply<, >))]
[assembly: TypeForwardedTo(typeof(ISerializableObject))]
[assembly: TypeForwardedTo(typeof(ISerializer<>))]
[assembly: TypeForwardedTo(typeof(NetCommandExtensions))]
[assembly: TypeForwardedTo(typeof(NetMessageExtensions))]
[assembly: TypeForwardedTo(typeof(NetRequestExtensions))]
[assembly: TypeForwardedTo(typeof(SerializableObjectExtensions))]
[assembly: TypeForwardedTo(typeof(SerializerExtensions))]
[assembly: TypeForwardedTo(typeof(NetworkDestination))]
[assembly: TypeForwardedTo(typeof(NetworkingAPI))]
[assembly: TypeForwardedTo(typeof(NetworkingHelpers))]
[assembly: TypeForwardedTo(typeof(Notification))]
[assembly: TypeForwardedTo(typeof(OrbAPI))]
[assembly: TypeForwardedTo(typeof(PrefabAPI))]
[assembly: TypeForwardedTo(typeof(R2API))]
[assembly: TypeForwardedTo(typeof(RecalculateStatsAPI))]
[assembly: TypeForwardedTo(typeof(SceneAssetAPI))]
[assembly: TypeForwardedTo(typeof(ArtifactCode))]
[assembly: TypeForwardedTo(typeof(R2APISerializableContentPack))]
[assembly: TypeForwardedTo(typeof(SerializableColorCatalogEntry))]
[assembly: TypeForwardedTo(typeof(SerializableDamageColor))]
[assembly: TypeForwardedTo(typeof(SerializableDifficultyDef))]
[assembly: TypeForwardedTo(typeof(SoundAPI))]
[assembly: TypeForwardedTo(typeof(TempVisualEffectAPI))]
[assembly: TypeForwardedTo(typeof(UnlockableAPI))]
[assembly: TypeForwardedTo(typeof(CecilUtil))]
[assembly: TypeForwardedTo(typeof(ChatMessage))]
[assembly: TypeForwardedTo(typeof(CommandHelper))]
[assembly: TypeForwardedTo(typeof(CompatibilityLevel))]
[assembly: TypeForwardedTo(typeof(DirectMessage))]
[assembly: TypeForwardedTo(typeof(EmbeddedResources))]
[assembly: TypeForwardedTo(typeof(EnumerableExtensions))]
[assembly: TypeForwardedTo(typeof(ManualLogSourceExtension))]
[assembly: TypeForwardedTo(typeof(NetworkCompatibility))]
[assembly: TypeForwardedTo(typeof(R2APISubmoduleDependency))]
[assembly: TypeForwardedTo(typeof(Reflection))]
[assembly: TypeForwardedTo(typeof(VersionStrictness))]

plugins/ParlaysPack/Repairs/ClientSideRepairs-MiniMapDlcSupport/MiniMapDlcSupport.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MiniMapLibrary;
using MiniMapLibrary.Scanner;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.MiniMapDlcSupport", "Mini Map Ping Icons", "1.3.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MiniMapDlcSupport : BaseUnityPlugin
{
	private sealed class PingMapIcon
	{
		public Image Image;

		public Sprite Sprite;

		public float RefreshAt;

		public bool Eligible;
	}

	private class RepairMarker : ITrackedObject
	{
		private readonly ITrackedObject backing;

		private readonly Sprite fallback;

		public GameObject gameObject
		{
			get
			{
				return backing.gameObject;
			}
			set
			{
				backing.gameObject = value;
			}
		}

		public RectTransform MinimapTransform
		{
			get
			{
				return backing.MinimapTransform;
			}
			set
			{
				backing.MinimapTransform = value;
			}
		}

		public InteractableKind InteractableType
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return backing.InteractableType;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				backing.InteractableType = value;
			}
		}

		public bool DynamicObject
		{
			get
			{
				return backing.DynamicObject;
			}
			set
			{
				backing.DynamicObject = value;
			}
		}

		public bool Active => backing.Active;

		public RepairMarker(ITrackedObject b, Sprite s)
		{
			backing = b;
			fallback = s;
		}

		public void Destroy()
		{
			backing.Destroy();
		}

		public void CheckActive()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			backing.CheckActive();
			Image val = (Object.op_Implicit((Object)(object)MinimapTransform) ? ((Component)MinimapTransform).GetComponent<Image>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				PingInfoProvider val2 = (Object.op_Implicit((Object)(object)gameObject) ? gameObject.GetComponent<PingInfoProvider>() : null);
				val.sprite = ((Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)val2.pingIconOverride)) ? val2.pingIconOverride : fallback);
				((Graphic)val).color = Settings.GetColor((InteractableKind)16, Active);
				((Behaviour)val).enabled = Active;
			}
		}
	}

	private class UniqueMarker : ITrackedObject
	{
		private readonly ITrackedObject backing;

		private readonly Sprite sprite;

		private readonly string symbol;

		public GameObject gameObject
		{
			get
			{
				return backing.gameObject;
			}
			set
			{
				backing.gameObject = value;
			}
		}

		public RectTransform MinimapTransform
		{
			get
			{
				return backing.MinimapTransform;
			}
			set
			{
				backing.MinimapTransform = value;
			}
		}

		public InteractableKind InteractableType
		{
			get
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				return backing.InteractableType;
			}
			set
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				backing.InteractableType = value;
			}
		}

		public bool DynamicObject
		{
			get
			{
				return backing.DynamicObject;
			}
			set
			{
				backing.DynamicObject = value;
			}
		}

		public bool Active => backing.Active;

		public UniqueMarker(ITrackedObject b, string key, Sprite s)
		{
			backing = b;
			sprite = s;
			symbol = InteractableIconArt.SymbolFor(key);
		}

		public void Destroy()
		{
			backing.Destroy();
		}

		public void CheckActive()
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			backing.CheckActive();
			Image val = (Object.op_Implicit((Object)(object)MinimapTransform) ? ((Component)MinimapTransform).GetComponent<Image>() : null);
			if (Object.op_Implicit((Object)(object)val))
			{
				val.sprite = sprite;
				Color color = Settings.GetColor(InteractableType, Active);
				if (!Active)
				{
					color.a = Math.Min(color.a, 0.25f);
				}
				((Graphic)val).color = color;
				MinimapTransform.sizeDelta = new Vector2(markerSize.Value, markerSize.Value);
			}
		}
	}

	private static ConfigEntry<bool> stationEnabled;

	private static ConfigEntry<bool> fallbackEnabled;

	private static ConfigEntry<bool> uniqueEnabled;

	private static ConfigEntry<float> markerSize;

	private static float nextScan;

	private static float nextRepairScan;

	private static readonly Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>();

	private static readonly Dictionary<GameObject, PingMapIcon> pingMapIcons = new Dictionary<GameObject, PingMapIcon>();

	private static Func<GameObject, Sprite> getPingIcon;

	private static float nextIconCacheClear;

	private static readonly FieldInfo stationBusy = AccessTools.Field(typeof(DroneCombinerController), "_isBusy");

	private static readonly HashSet<string> ignored = new HashSet<string> { "GenericPickupController", "PickupPickerController", "TieredPickupPickerController", "DummyPingableInteraction", "ProxyInteraction", "VehicleSeat", "GatewayProjectileController" };

	private void Awake()
	{
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Expected O, but got Unknown
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Expected O, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Expected O, but got Unknown
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Expected O, but got Unknown
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c8: Expected O, but got Unknown
		stationEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Icons", "Drone station", true, "Show drone combining/upgrade station markers.");
		fallbackEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Icons", "Missing interactable markers", true, "Track world interactables omitted by the original scanners.");
		uniqueEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Icons", "Custom missing icons", true, "Add vanilla-style icons only for missing or mystery markers. Existing icons remain unchanged.");
		markerSize = ((BaseUnityPlugin)this).Config.Bind<float>("Icons", "Missing icon size", 9f, new ConfigDescription("Size of added missing-interactable markers; existing markers keep their original size.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(6f, 24f), Array.Empty<object>()));
		((BaseUnityPlugin)this).Config.Bind<float>("Icons", "Drone station size", 9f, "Legacy station-size setting retained for compatibility.");
		Harmony val = new Harmony("ClientSideRepairs.MiniMapDlcSupport");
		Type type = AccessTools.TypeByName("MiniMapMod.MiniMapPlugin");
		val.Patch((MethodBase)AccessTools.Method(type, "ScanStaticTypes", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MiniMapDlcSupport), "UpdateMarkers", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(type, "Reset", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MiniMapDlcSupport), "ResetScan", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(type, "ScanScene", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MiniMapDlcSupport), "RefreshRepairDrones", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		getPingIcon = (Func<GameObject, Sprite>)Delegate.CreateDelegate(typeof(Func<GameObject, Sprite>), AccessTools.Method(typeof(PingIndicator), "GetInteractableIcon", new Type[1] { typeof(GameObject) }, (Type[])null));
		val.Patch((MethodBase)AccessTools.Method(type, "UpdateIconPositions", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(MiniMapDlcSupport), "ApplyPingMapIcons", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Minimap world-object icons follow native and modded ping icons; repairable drone markers retained.");
	}

	private static void ResetScan()
	{
		nextScan = (nextRepairScan = (nextIconCacheClear = 0f));
		pingMapIcons.Clear();
	}

	private static void ApplyPingMapIcons(List<ITrackedObject> ___TrackedObjects, bool ___Enable)
	{
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		if (!___Enable || getPingIcon == null)
		{
			return;
		}
		float unscaledTime = Time.unscaledTime;
		if (unscaledTime >= nextIconCacheClear)
		{
			pingMapIcons.Clear();
			nextIconCacheClear = unscaledTime + 10f;
		}
		foreach (ITrackedObject ___TrackedObject in ___TrackedObjects)
		{
			GameObject gameObject = ___TrackedObject.gameObject;
			if (!Object.op_Implicit((Object)(object)gameObject) || !Object.op_Implicit((Object)(object)___TrackedObject.MinimapTransform))
			{
				continue;
			}
			if (!pingMapIcons.TryGetValue(gameObject, out var value))
			{
				string kind = ((object)___TrackedObject.InteractableType/*cast due to .constrained prefix*/).ToString();
				value = new PingMapIcon
				{
					Eligible = MiniMapIconPolicy.ShouldMatchPing(kind, (Object)(object)gameObject.GetComponentInParent<CharacterBody>() != (Object)null, IsRepairPoint(gameObject.GetComponent<PurchaseInteraction>()))
				};
				pingMapIcons.Add(gameObject, value);
			}
			if (!value.Eligible)
			{
				continue;
			}
			if (!Object.op_Implicit((Object)(object)value.Image) || (Object)(object)((Component)value.Image).transform != (Object)(object)___TrackedObject.MinimapTransform)
			{
				value.Image = ((Component)___TrackedObject.MinimapTransform).GetComponent<Image>();
			}
			if (Object.op_Implicit((Object)(object)value.Image))
			{
				if (unscaledTime >= value.RefreshAt)
				{
					value.Sprite = getPingIcon(gameObject);
					value.RefreshAt = unscaledTime + 0.5f;
				}
				if (Object.op_Implicit((Object)(object)value.Sprite))
				{
					value.Image.sprite = value.Sprite;
				}
			}
		}
	}

	private static bool IsRepairPoint(PurchaseInteraction p)
	{
		return Object.op_Implicit((Object)(object)p) && MiniMapIconPolicy.IsRepairDrone(((Object)((Component)p).gameObject).name, p.contextToken, (Object)(object)((Component)p).GetComponent<SummonMasterBehavior>() != (Object)null, (Object)(object)((Component)p).GetComponent<DronePurchaseRepair>() != (Object)null);
	}

	private static void RefreshRepairDrones(List<ITrackedObject> ___TrackedObjects, Range3D ___TrackedDimensions, bool ___Enable, ISpriteManager ___SpriteManager)
	{
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		if (!___Enable || !fallbackEnabled.Value)
		{
			return;
		}
		InteractibleSetting setting = Settings.GetSetting((InteractableKind)16);
		if (setting.Config == null || !setting.Config.Enabled.Value)
		{
			return;
		}
		Dictionary<GameObject, RepairMarker> dictionary = new Dictionary<GameObject, RepairMarker>();
		foreach (ITrackedObject ___TrackedObject in ___TrackedObjects)
		{
			if (___TrackedObject is RepairMarker && Object.op_Implicit((Object)(object)___TrackedObject.gameObject))
			{
				dictionary[___TrackedObject.gameObject] = (RepairMarker)(object)___TrackedObject;
			}
		}
		for (int num = ___TrackedObjects.Count - 1; num >= 0; num--)
		{
			ITrackedObject val = ___TrackedObjects[num];
			if (!(val is RepairMarker) && Object.op_Implicit((Object)(object)val.gameObject) && dictionary.ContainsKey(val.gameObject))
			{
				val.Destroy();
				___TrackedObjects.RemoveAt(num);
			}
		}
		if (Time.unscaledTime < nextRepairScan)
		{
			return;
		}
		nextRepairScan = Time.unscaledTime + 2f;
		PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>();
		foreach (PurchaseInteraction val2 in array)
		{
			if (!IsRepairPoint(val2) || !((Behaviour)val2).isActiveAndEnabled || !val2.available)
			{
				continue;
			}
			GameObject gameObject = ((Component)val2).gameObject;
			if (dictionary.ContainsKey(gameObject))
			{
				continue;
			}
			RectTransform val3 = null;
			for (int num2 = ___TrackedObjects.Count - 1; num2 >= 0; num2--)
			{
				ITrackedObject val4 = ___TrackedObjects[num2];
				if (!((Object)(object)val4.gameObject != (Object)(object)gameObject))
				{
					if (!Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val4.MinimapTransform))
					{
						val3 = val4.MinimapTransform;
					}
					else
					{
						val4.Destroy();
					}
					___TrackedObjects.RemoveAt(num2);
				}
			}
			TrackedObject<PurchaseInteraction> b = new TrackedObject<PurchaseInteraction>((InteractableKind)16, gameObject, val3)
			{
				BackingObject = val2,
				DynamicObject = false,
				ActiveChecker = (PurchaseInteraction p) => Object.op_Implicit((Object)(object)p) && ((Behaviour)p).isActiveAndEnabled && p.available
			};
			RepairMarker repairMarker = new RepairMarker((ITrackedObject)(object)b, ___SpriteManager.GetSprite((InteractableKind)16));
			___TrackedObjects.Add((ITrackedObject)(object)repairMarker);
			dictionary[gameObject] = repairMarker;
			___TrackedDimensions.CheckValue(gameObject.transform.position);
		}
	}

	private static void UpdateMarkers(List<ITrackedObject> ___TrackedObjects, Range3D ___TrackedDimensions, bool ___Enable)
	{
		//IL_0492: Unknown result type (might be due to invalid IL or missing references)
		//IL_049c: Invalid comparison between Unknown and I4
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Invalid comparison between Unknown and I4
		//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Invalid comparison between Unknown and I4
		//IL_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c6: Invalid comparison between Unknown and I4
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_0195: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		if (!___Enable || Time.unscaledTime < nextScan)
		{
			return;
		}
		nextScan = Time.unscaledTime + 5f;
		HashSet<GameObject> hashSet = new HashSet<GameObject>();
		foreach (ITrackedObject ___TrackedObject in ___TrackedObjects)
		{
			if (Object.op_Implicit((Object)(object)___TrackedObject.gameObject))
			{
				hashSet.Add(CanonicalObject(___TrackedObject.gameObject));
			}
		}
		if (fallbackEnabled.Value)
		{
			MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>();
			foreach (MonoBehaviour val in array)
			{
				if (!Object.op_Implicit((Object)(object)val) || !(val is IInteractable) || ignored.Contains(((object)val).GetType().Name))
				{
					continue;
				}
				GameObject val2 = CanonicalObject(((Component)val).gameObject);
				if (!Object.op_Implicit((Object)(object)val2) || Object.op_Implicit((Object)(object)val2.GetComponentInParent<CharacterBody>()) || hashSet.Contains(val2))
				{
					continue;
				}
				string text = KeyFor(val2);
				if (!stationEnabled.Value && InteractableIconArt.SymbolFor(text) == "DroneCombine")
				{
					continue;
				}
				InteractableKind val3 = MiniMapIconPolicy.FallbackKind(text, ((Object)val2).name);
				InteractibleSetting setting = Settings.GetSetting(val3);
				if (setting.Config != null && setting.Config.Enabled.Value)
				{
					TrackedObject<MonoBehaviour> val4 = new TrackedObject<MonoBehaviour>(val3, val2, (RectTransform)null);
					val4.BackingObject = val;
					val4.ActiveChecker = IsAvailable;
					val4.DynamicObject = false;
					TrackedObject<MonoBehaviour> val5 = val4;
					ITrackedObject item;
					if (!uniqueEnabled.Value)
					{
						ITrackedObject val6 = (ITrackedObject)(object)val5;
						item = val6;
					}
					else
					{
						ITrackedObject val6 = (ITrackedObject)(object)new UniqueMarker((ITrackedObject)(object)val5, text, SpriteFor(text));
						item = val6;
					}
					___TrackedObjects.Add(item);
					___TrackedDimensions.CheckValue(val2.transform.position);
					hashSet.Add(val2);
				}
			}
		}
		if (fallbackEnabled.Value)
		{
			PingInfoProvider[] array2 = Object.FindObjectsOfType<PingInfoProvider>();
			foreach (PingInfoProvider val7 in array2)
			{
				GameObject val8 = CanonicalObject(((Component)val7).gameObject);
				if (!((Behaviour)val7).isActiveAndEnabled || hashSet.Contains(val8) || val8.layer == 5 || Object.op_Implicit((Object)(object)val8.GetComponentInParent<CharacterBody>()) || Object.op_Implicit((Object)(object)val8.GetComponentInParent<Canvas>()) || Object.op_Implicit((Object)(object)val8.GetComponent<GenericPickupController>()) || Object.op_Implicit((Object)(object)val8.GetComponent<PickupPickerController>()) || !Object.op_Implicit((Object)(object)val8.GetComponentInChildren<Collider>()))
				{
					continue;
				}
				bool flag = false;
				Transform parent = val8.transform.parent;
				while (Object.op_Implicit((Object)(object)parent))
				{
					if (hashSet.Contains(((Component)parent).gameObject))
					{
						flag = true;
						break;
					}
					parent = parent.parent;
				}
				if (flag)
				{
					continue;
				}
				InteractableKind val9 = MiniMapIconPolicy.FallbackKind(KeyFor(val8), ((Object)val8).name);
				InteractibleSetting setting2 = Settings.GetSetting(val9);
				if (setting2.Config != null && setting2.Config.Enabled.Value && (stationEnabled.Value || !MiniMapIconPolicy.IsDroneStation(((Object)val8).name, "")))
				{
					TrackedObject<PingInfoProvider> item2 = new TrackedObject<PingInfoProvider>(val9, val8, (RectTransform)null)
					{
						BackingObject = val7,
						DynamicObject = false,
						ActiveChecker = (PingInfoProvider p) => Object.op_Implicit((Object)(object)p) && ((Behaviour)p).isActiveAndEnabled && ProviderAvailable(p)
					};
					___TrackedObjects.Add((ITrackedObject)(object)item2);
					hashSet.Add(val8);
					___TrackedDimensions.CheckValue(val8.transform.position);
				}
			}
		}
		if (!uniqueEnabled.Value)
		{
			return;
		}
		for (int num = 0; num < ___TrackedObjects.Count; num++)
		{
			ITrackedObject val10 = ___TrackedObjects[num];
			if (!(val10 is UniqueMarker) && !(val10 is RepairMarker) && !val10.DynamicObject && Object.op_Implicit((Object)(object)val10.gameObject) && !Object.op_Implicit((Object)(object)val10.gameObject.GetComponentInParent<CharacterBody>()) && (int)val10.InteractableType != 65536 && (int)val10.InteractableType != 32768 && (int)val10.InteractableType != 16384 && (int)val10.InteractableType != 524288)
			{
				InteractibleSetting setting3 = Settings.GetSetting(val10.InteractableType);
				string path = ((setting3.Config == null) ? null : setting3.Config.IconPath.Value);
				bool missingStation = Object.op_Implicit((Object)(object)val10.gameObject.GetComponentInParent<DroneScrapperController>()) || Object.op_Implicit((Object)(object)val10.gameObject.GetComponentInParent<DroneCombinerController>());
				if (MiniMapIconPolicy.ShouldReplaceExisting(path, missingStation))
				{
					string key = KeyFor(val10.gameObject);
					___TrackedObjects[num] = (ITrackedObject)(object)new UniqueMarker(val10, key, SpriteFor(key));
				}
			}
		}
	}

	private static bool IsAvailable(MonoBehaviour c)
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Invalid comparison between Unknown and I4
		if (!Object.op_Implicit((Object)(object)c) || !((Behaviour)c).isActiveAndEnabled)
		{
			return false;
		}
		PurchaseInteraction val = (PurchaseInteraction)(object)((c is PurchaseInteraction) ? c : null);
		if (Object.op_Implicit((Object)(object)val))
		{
			return val.available;
		}
		GenericInteraction val2 = (GenericInteraction)(object)((c is GenericInteraction) ? c : null);
		if (Object.op_Implicit((Object)(object)val2))
		{
			return (int)val2.interactability == 2;
		}
		DroneScrapperPickerController val3 = (DroneScrapperPickerController)(object)((c is DroneScrapperPickerController) ? c : null);
		if (Object.op_Implicit((Object)(object)val3))
		{
			return val3.available;
		}
		if (c is DroneCombinerController && stationBusy != null)
		{
			return !(bool)stationBusy.GetValue(c);
		}
		return true;
	}

	private static bool ProviderAvailable(PingInfoProvider provider)
	{
		PurchaseInteraction component = ((Component)provider).GetComponent<PurchaseInteraction>();
		if (Object.op_Implicit((Object)(object)component))
		{
			return component.available;
		}
		GenericInteraction component2 = ((Component)provider).GetComponent<GenericInteraction>();
		if (Object.op_Implicit((Object)(object)component2))
		{
			return IsAvailable((MonoBehaviour)(object)component2);
		}
		return true;
	}

	private static string KeyFor(GameObject obj)
	{
		obj = CanonicalObject(obj);
		PurchaseInteraction component = obj.GetComponent<PurchaseInteraction>();
		GenericInteraction component2 = obj.GetComponent<GenericInteraction>();
		string text = (Object.op_Implicit((Object)(object)component) ? component.contextToken : (Object.op_Implicit((Object)(object)component2) ? component2.contextToken : ""));
		if (Object.op_Implicit((Object)(object)obj.GetComponentInParent<DroneScrapperController>()))
		{
			text = "DRONE_SCRAPPER_CONTEXT";
		}
		else if (Object.op_Implicit((Object)(object)obj.GetComponentInParent<DroneCombinerController>()))
		{
			text = "DRONE_COMBINER_CONTEXT";
		}
		return (((Object)obj).name.Replace("(Clone)", "").Trim() + "|" + text).ToUpperInvariant();
	}

	private static GameObject CanonicalObject(GameObject obj)
	{
		if (!Object.op_Implicit((Object)(object)obj))
		{
			return obj;
		}
		DroneScrapperController componentInParent = obj.GetComponentInParent<DroneScrapperController>();
		if (Object.op_Implicit((Object)(object)componentInParent))
		{
			return ((Component)componentInParent).gameObject;
		}
		DroneCombinerController componentInParent2 = obj.GetComponentInParent<DroneCombinerController>();
		if (Object.op_Implicit((Object)(object)componentInParent2))
		{
			return ((Component)componentInParent2).gameObject;
		}
		return obj;
	}

	private static Sprite SpriteFor(string key)
	{
		//IL_005f: 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_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Expected O, but got Unknown
		//IL_00b6: 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)
		if (sprites.TryGetValue(key, out var value))
		{
			return value;
		}
		int[] array = InteractableIconArt.Render(key);
		Color32[] array2 = (Color32[])(object)new Color32[array.Length];
		for (int i = 0; i < array.Length; i++)
		{
			array2[(63 - i / 64) * 64 + i % 64] = new Color32((byte)(array[i] >> 16), (byte)(array[i] >> 8), (byte)array[i], (byte)(array[i] >> 24));
		}
		Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false);
		val.SetPixels32(array2);
		val.Apply(false, true);
		((Texture)val).filterMode = (FilterMode)1;
		value = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f));
		sprites.Add(key, value);
		return value;
	}
}
public static class MiniMapIconPolicy
{
	public static bool ShouldMatchPing(string kind, bool hasBody, bool isRepairPoint)
	{
		if (hasBody && !isRepairPoint)
		{
			return false;
		}
		return kind != "Player" && kind != "Minion" && kind != "Neutral" && kind != "EnemyMonster" && kind != "EnemyLunar" && kind != "EnemyVoid";
	}

	public static bool IsRepairDrone(string name, string token, bool hasSummon, bool hasRepair)
	{
		string text = (name ?? "").ToUpperInvariant();
		string text2 = (token ?? "").ToUpperInvariant();
		return (hasSummon || hasRepair) && text.Contains("BROKEN") && (text.Contains("DRONE") || text.Contains("TURRET")) && (text2.Contains("DRONE") || text2.Contains("TURRET"));
	}

	public static bool ShouldReplaceExisting(string path, bool missingStation)
	{
		return missingStation || string.IsNullOrEmpty(path) || path.IndexOf("texMysteryIcon", StringComparison.OrdinalIgnoreCase) >= 0;
	}

	public static bool IsDroneStation(string name, string token)
	{
		string text = InteractableIconArt.SymbolFor(name + "|" + token);
		return text == "DroneCombine" || text == "DroneUpgrade";
	}

	public static InteractableKind FallbackKind(string token, string name)
	{
		//IL_0033: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		string text = (token + " " + name).ToUpperInvariant();
		if (text.Contains("SHRINE") || text.Contains("HALCYON"))
		{
			return (InteractableKind)4;
		}
		if (text.Contains("CHEST") || text.Contains("LOCKBOX"))
		{
			return (InteractableKind)1;
		}
		if (text.Contains("DRONE"))
		{
			return (InteractableKind)16;
		}
		return (InteractableKind)2;
	}
}
public static class InteractableIconArt
{
	private class Canvas
	{
		private readonly bool[] mask = new bool[4096];

		public void Point(int x, int y)
		{
			if (x >= 0 && x < 64 && y >= 0 && y < 64)
			{
				mask[y * 64 + x] = true;
			}
		}

		public void Line(int x, int y, int xx, int yy, int width = 3)
		{
			int num = Math.Max(Math.Abs(xx - x), Math.Abs(yy - y));
			for (int i = 0; i <= num; i++)
			{
				int num2 = ((num == 0) ? x : (x + (xx - x) * i / num));
				int num3 = ((num == 0) ? y : (y + (yy - y) * i / num));
				for (int j = -width / 2; j <= width / 2; j++)
				{
					for (int k = -width / 2; k <= width / 2; k++)
					{
						Point(num2 + j, num3 + k);
					}
				}
			}
		}

		public void Rect(int x, int y, int xx, int yy)
		{
			Line(x, y, xx, y);
			Line(xx, y, xx, yy);
			Line(xx, yy, x, yy);
			Line(x, yy, x, y);
		}

		public void Circle(int x, int y, int r)
		{
			for (int i = 0; i < 360; i++)
			{
				double num = (double)i * Math.PI / 180.0;
				Line(x + (int)(Math.Cos(num) * (double)r), y + (int)(Math.Sin(num) * (double)r), x + (int)(Math.Cos(num) * (double)r), y + (int)(Math.Sin(num) * (double)r));
			}
		}

		public void Dot(int x, int y)
		{
			for (int i = -2; i <= 2; i++)
			{
				for (int j = -2; j <= 2; j++)
				{
					Point(x + i, y + j);
				}
			}
		}

		public void Diamond(int x, int y, int r)
		{
			Line(x, y - r, x + r, y);
			Line(x + r, y, x, y + r);
			Line(x, y + r, x - r, y);
			Line(x - r, y, x, y - r);
		}

		public void Star(int x, int y, int r)
		{
			for (int i = 0; i < 5; i++)
			{
				double num = (double)(i * 72 - 90) * Math.PI / 180.0;
				double num2 = (double)((i + 2) * 72 - 90) * Math.PI / 180.0;
				Line(x + (int)(Math.Cos(num) * (double)r), y + (int)(Math.Sin(num) * (double)r), x + (int)(Math.Cos(num2) * (double)r), y + (int)(Math.Sin(num2) * (double)r));
			}
		}

		public int[] Finish()
		{
			int[] array = new int[4096];
			for (int i = 0; i < 64; i++)
			{
				for (int j = 0; j < 64; j++)
				{
					if (!mask[i * 64 + j])
					{
						continue;
					}
					for (int k = -1; k <= 1; k++)
					{
						for (int l = -1; l <= 1; l++)
						{
							int num = j + k;
							int num2 = i + l;
							if (num >= 0 && num < 64 && num2 >= 0 && num2 < 64)
							{
								array[num2 * 64 + num] = -16777216;
							}
						}
					}
				}
			}
			for (int m = 0; m < 4096; m++)
			{
				if (mask[m])
				{
					array[m] = -1;
				}
			}
			return array;
		}
	}

	public static string SymbolFor(string value)
	{
		string text = (value ?? "").Replace("_", "").ToUpperInvariant();
		if (text.Contains("DRONE") && (text.Contains("SCRAP") || text.Contains("RECYCL")))
		{
			return "DroneScrap";
		}
		if (text.Contains("DRONE") && text.Contains("COMBIN"))
		{
			return "DroneCombine";
		}
		if (text.Contains("DRONE") && text.Contains("UPGRAD"))
		{
			return "DroneUpgrade";
		}
		if (text.Contains("DRONE") && (text.Contains("VENDOR") || text.Contains("SHOP")))
		{
			return "DroneVendor";
		}
		if (text.Contains("DRONE"))
		{
			return "Drone";
		}
		if (text.Contains("SCRAPP"))
		{
			return "Scrapper";
		}
		if (text.Contains("DUPLICATOR") || text.Contains("PRINTER"))
		{
			return "Printer";
		}
		if (text.Contains("HOLLOW"))
		{
			return "HollowChest";
		}
		if (text.Contains("TIMEDCHEST") || text.Contains("TIMECHEST"))
		{
			return "TimedChest";
		}
		if (text.Contains("VOIDCHEST") || text.Contains("VOIDCRADLE") || text.Contains("VOIDLOCKBOX"))
		{
			return "VoidChest";
		}
		if (text.Contains("LUNARCHEST") || text.Contains("LUNARPOD"))
		{
			return "LunarPod";
		}
		if (text.Contains("GOLDCHEST") || text.Contains("LEGENDARYCHEST"))
		{
			return "LegendaryChest";
		}
		if (text.Contains("STEALTH"))
		{
			return "StealthChest";
		}
		if (text.Contains("CHEST2") || text.Contains("LARGECHEST"))
		{
			return "LargeChest";
		}
		if (text.Contains("ROULETTE") || text.Contains("OPTIONCHEST"))
		{
			return "ChoiceChest";
		}
		if (text.Contains("EQUIPMENTBARREL"))
		{
			return "EquipmentBarrel";
		}
		if (text.Contains("CHEST") || text.Contains("LOCKBOX"))
		{
			return "Chest";
		}
		if (text.Contains("TRIPLESHOP") || text.Contains("MULTISHOP"))
		{
			return "MultiShop";
		}
		if (text.Contains("TERMINAL") || text.Contains("SHOP"))
		{
			return "Shop";
		}
		if (text.Contains("BARREL"))
		{
			return "Barrel";
		}
		if (text.Contains("NEWT") || text.Contains("LUNARSTATUE"))
		{
			return "Newt";
		}
		if (text.Contains("HALCYON"))
		{
			return "Halcyon";
		}
		if (text.Contains("SHRINE"))
		{
			if (text.Contains("BLOOD"))
			{
				return "Blood";
			}
			if (text.Contains("CHANCE"))
			{
				return "Chance";
			}
			if (text.Contains("COMBAT"))
			{
				return "Combat";
			}
			if (text.Contains("HEAL"))
			{
				return "Healing";
			}
			if (text.Contains("BOSS"))
			{
				return "Mountain";
			}
			if (text.Contains("RESTACK") || text.Contains("ORDER"))
			{
				return "Order";
			}
			if (text.Contains("CLEANSE"))
			{
				return "Cleanse";
			}
			if (text.Contains("REBIRTH"))
			{
				return "Rebirth";
			}
			if (text.Contains("DREAD"))
			{
				return "Dread";
			}
			if (text.Contains("DEATH"))
			{
				return "Death";
			}
			if (text.Contains("CURSE"))
			{
				return "Curse";
			}
			if (text.Contains("CATASTROPHE"))
			{
				return "Catastrophe";
			}
			if (text.Contains("COLOSSUS"))
			{
				return "Colossus";
			}
			return "Shrine";
		}
		if (text.Contains("TELEPORTER"))
		{
			return "Teleporter";
		}
		if (text.Contains("PORTAL"))
		{
			return "Portal";
		}
		if (text.Contains("FAN"))
		{
			return "Fan";
		}
		if (text.Contains("GEODE"))
		{
			return "Geode";
		}
		if (text.Contains("ZIPRAIL"))
		{
			return "Rail";
		}
		if (text.Contains("WAKE"))
		{
			return "Wake";
		}
		if (text.Contains("GONG"))
		{
			return "Gong";
		}
		if (text.Contains("PEDESTAL") || text.Contains("PILLAR"))
		{
			return "Pedestal";
		}
		return "Unknown";
	}

	public static int[] Render(string key)
	{
		Canvas canvas = new Canvas();
		string text = SymbolFor(key);
		if (text.StartsWith("Drone"))
		{
			canvas.Rect(23, 22, 41, 38);
			canvas.Line(8, 25, 23, 30);
			canvas.Line(41, 30, 56, 25);
			canvas.Line(9, 18, 9, 33);
			canvas.Line(55, 18, 55, 33);
			canvas.Line(26, 43, 38, 43);
			switch (text)
			{
			case "DroneScrap":
				canvas.Line(21, 15, 44, 45, 5);
				canvas.Line(44, 15, 21, 45, 5);
				canvas.Rect(22, 48, 42, 51);
				break;
			case "DroneCombine":
				canvas.Line(32, 5, 32, 20);
				canvas.Line(25, 12, 39, 12);
				break;
			case "DroneUpgrade":
				canvas.Line(32, 5, 32, 20);
				canvas.Line(23, 13, 32, 4);
				canvas.Line(32, 4, 41, 13);
				break;
			case "DroneVendor":
				canvas.Rect(25, 6, 39, 16);
				canvas.Line(32, 3, 32, 19);
				break;
			}
		}
		else
		{
			switch (text)
			{
			case "Scrapper":
				canvas.Line(18, 39, 32, 12);
				canvas.Line(32, 12, 48, 39);
				canvas.Line(48, 39, 18, 39);
				canvas.Line(15, 32, 18, 39);
				canvas.Line(18, 39, 27, 41);
				break;
			case "Printer":
				canvas.Rect(12, 9, 51, 24);
				canvas.Line(25, 25, 32, 33);
				canvas.Line(39, 25, 32, 33);
				canvas.Rect(23, 36, 41, 47);
				break;
			case "HollowChest":
				canvas.Rect(13, 29, 51, 47);
				canvas.Rect(26, 18, 38, 29);
				canvas.Line(28, 14, 32, 5);
				canvas.Line(32, 5, 37, 14);
				canvas.Line(28, 14, 37, 14);
				break;
			case "TimedChest":
				canvas.Rect(10, 28, 54, 48);
				canvas.Circle(32, 17, 12);
				canvas.Line(32, 9, 32, 17);
				canvas.Line(32, 17, 39, 20);
				break;
			case "VoidChest":
				canvas.Diamond(32, 27, 22);
				canvas.Line(18, 16, 45, 40);
				canvas.Line(45, 16, 18, 40);
				break;
			case "LunarPod":
				canvas.Circle(32, 27, 21);
				canvas.Line(37, 7, 24, 17);
				canvas.Line(24, 17, 24, 37);
				canvas.Line(24, 37, 37, 47);
				break;
			case "LegendaryChest":
				canvas.Rect(9, 18, 55, 46);
				canvas.Star(32, 23, 15);
				break;
			case "StealthChest":
				canvas.Line(10, 16, 24, 16);
				canvas.Line(40, 16, 54, 16);
				canvas.Line(10, 16, 10, 43);
				canvas.Line(54, 16, 54, 43);
				canvas.Line(10, 43, 54, 43);
				canvas.Line(20, 35, 44, 22);
				break;
			case "LargeChest":
				canvas.Rect(8, 14, 55, 45);
				canvas.Rect(17, 6, 47, 14);
				canvas.Line(9, 27, 55, 27);
				canvas.Rect(28, 23, 36, 33);
				break;
			case "ChoiceChest":
				canvas.Rect(6, 21, 22, 43);
				canvas.Rect(24, 11, 40, 43);
				canvas.Rect(42, 21, 58, 43);
				break;
			case "Chest":
				canvas.Rect(12, 16, 52, 44);
				canvas.Line(13, 26, 51, 26);
				canvas.Rect(28, 22, 36, 32);
				break;
			case "EquipmentBarrel":
				canvas.Rect(20, 8, 44, 47);
				canvas.Line(21, 19, 43, 19);
				canvas.Line(37, 23, 28, 32);
				canvas.Line(28, 32, 37, 32);
				canvas.Line(37, 32, 28, 43);
				break;
			case "Barrel":
				canvas.Circle(32, 27, 20);
				canvas.Line(31, 12, 31, 43);
				canvas.Line(23, 19, 40, 19);
				canvas.Line(23, 34, 40, 34);
				break;
			case "MultiShop":
				canvas.Rect(5, 16, 20, 44);
				canvas.Rect(24, 16, 39, 44);
				canvas.Rect(43, 16, 58, 44);
				break;
			case "Shop":
				canvas.Rect(12, 13, 52, 44);
				canvas.Line(12, 23, 52, 23);
				canvas.Rect(22, 27, 42, 40);
				break;
			case "Blood":
				canvas.Line(32, 6, 16, 29);
				canvas.Line(32, 6, 48, 29);
				canvas.Circle(32, 32, 16);
				break;
			case "Chance":
				canvas.Rect(13, 10, 51, 47);
				canvas.Dot(23, 20);
				canvas.Dot(41, 20);
				canvas.Dot(32, 29);
				canvas.Dot(23, 38);
				canvas.Dot(41, 38);
				break;
			case "Combat":
				canvas.Line(13, 9, 51, 46);
				canvas.Line(51, 9, 13, 46);
				canvas.Line(9, 34, 26, 48);
				canvas.Line(39, 48, 55, 33);
				break;
			case "Healing":
				canvas.Line(32, 10, 12, 35);
				canvas.Line(12, 35, 52, 35);
				canvas.Line(52, 35, 32, 10);
				canvas.Line(32, 35, 32, 48);
				break;
			case "Mountain":
				canvas.Line(7, 45, 27, 11);
				canvas.Line(27, 11, 48, 45);
				canvas.Line(7, 45, 57, 45);
				canvas.Line(37, 27, 46, 17);
				canvas.Line(46, 17, 57, 45);
				break;
			case "Order":
				canvas.Circle(32, 27, 19);
				canvas.Line(45, 10, 47, 22);
				canvas.Line(47, 22, 35, 18);
				break;
			case "Cleanse":
				canvas.Line(14, 32, 34, 10);
				canvas.Line(34, 10, 52, 26);
				canvas.Line(52, 26, 33, 47);
				canvas.Line(33, 47, 14, 32);
				canvas.Line(23, 23, 42, 40);
				break;
			case "Rebirth":
				canvas.Circle(32, 17, 11);
				canvas.Line(32, 28, 32, 49);
				canvas.Line(18, 35, 46, 35);
				break;
			case "Dread":
				canvas.Line(7, 28, 32, 12);
				canvas.Line(32, 12, 57, 28);
				canvas.Line(57, 28, 32, 44);
				canvas.Line(32, 44, 7, 28);
				canvas.Circle(32, 28, 9);
				break;
			case "Death":
				canvas.Circle(32, 23, 18);
				canvas.Dot(24, 23);
				canvas.Dot(40, 23);
				canvas.Rect(24, 36, 40, 46);
				canvas.Line(32, 36, 32, 46);
				break;
			case "Curse":
				canvas.Circle(25, 20, 13);
				canvas.Circle(39, 35, 13);
				canvas.Line(23, 22, 41, 34);
				break;
			case "Catastrophe":
				canvas.Line(18, 8, 35, 8);
				canvas.Line(35, 8, 25, 24);
				canvas.Line(25, 24, 46, 24);
				canvas.Line(46, 24, 20, 48);
				break;
			default:
				if (!(text == "Geode"))
				{
					switch (text)
					{
					case "Colossus":
						canvas.Rect(13, 27, 51, 47);
						canvas.Line(16, 27, 16, 12);
						canvas.Line(48, 27, 48, 12);
						canvas.Line(16, 12, 48, 12);
						break;
					case "Newt":
						canvas.Circle(32, 31, 12);
						canvas.Line(20, 25, 9, 9);
						canvas.Line(9, 9, 9, 28);
						canvas.Line(44, 25, 55, 9);
						canvas.Line(55, 9, 55, 28);
						break;
					case "Teleporter":
						canvas.Line(8, 46, 56, 46);
						canvas.Line(13, 45, 23, 12);
						canvas.Line(23, 12, 41, 12);
						canvas.Line(41, 12, 51, 45);
						canvas.Circle(32, 31, 11);
						break;
					case "Portal":
						canvas.Circle(32, 27, 21);
						canvas.Circle(32, 27, 12);
						break;
					case "Fan":
						canvas.Circle(32, 27, 21);
						canvas.Line(32, 27, 32, 7);
						canvas.Line(32, 27, 14, 38);
						canvas.Line(32, 27, 50, 38);
						break;
					case "Rail":
					{
						canvas.Line(18, 7, 18, 48);
						canvas.Line(46, 7, 46, 48);
						for (int i = 12; i < 49; i += 10)
						{
							canvas.Line(18, i, 46, i);
						}
						break;
					}
					case "Wake":
						canvas.Line(8, 39, 56, 39);
						canvas.Line(16, 39, 21, 48);
						canvas.Line(21, 48, 47, 48);
						canvas.Line(47, 48, 56, 39);
						canvas.Line(32, 36, 32, 8);
						canvas.Line(32, 8, 48, 29);
						canvas.Line(48, 29, 32, 29);
						break;
					case "Gong":
						canvas.Circle(32, 23, 17);
						canvas.Line(9, 48, 55, 48);
						canvas.Line(14, 38, 14, 48);
						canvas.Line(50, 38, 50, 48);
						break;
					case "Pedestal":
						canvas.Rect(18, 20, 46, 47);
						canvas.Line(11, 20, 53, 20);
						canvas.Circle(32, 10, 7);
						break;
					default:
						canvas.Diamond(32, 27, 22);
						canvas.Circle(32, 27, 8);
						break;
					}
					break;
				}
				goto case "Halcyon";
			case "Halcyon":
				canvas.Diamond(32, 27, 22);
				canvas.Line(32, 5, 32, 49);
				if (text == "Geode")
				{
					canvas.Circle(32, 27, 9);
				}
				break;
			}
		}
		if (text == "Unknown")
		{
			byte[] array;
			using (SHA256 sHA = SHA256.Create())
			{
				array = sHA.ComputeHash(Encoding.UTF8.GetBytes(key ?? ""));
			}
			for (int j = 0; j < 8; j++)
			{
				if ((array[j / 8] & (1 << j % 8)) != 0)
				{
					double num = (double)j * Math.PI / 4.0;
					canvas.Line(32, 27, 32 + (int)(Math.Cos(num) * 17.0), 27 + (int)(Math.Sin(num) * 17.0), 2);
				}
			}
		}
		return canvas.Finish();
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-ModOptionsBridge/ModOptionsBridge.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using RiskOfOptions;
using RiskOfOptions.Options;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.ModOptionsBridge", "Client Side Settings Support", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ModOptionsBridge : BaseUnityPlugin
{
	private IEnumerator Start()
	{
		yield return null;
		yield return null;
		HashSet<string> existing = new HashSet<string>();
		FieldInfo field = typeof(ModSettingsManager).GetField("OptionCollection", BindingFlags.Static | BindingFlags.NonPublic);
		IEnumerable collections = ((field == null) ? null : (field.GetValue(null) as IEnumerable));
		if (collections == null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Settings collection unavailable; no duplicate pages will be added.");
			yield break;
		}
		foreach (object collection in collections)
		{
			PropertyInfo guid = collection.GetType().GetProperty("ModGuid");
			if (guid != null)
			{
				existing.Add((string)guid.GetValue(collection, null));
			}
		}
		foreach (PluginInfo info in Chainloader.PluginInfos.Values)
		{
			if ((Object)(object)info.Instance == (Object)null || (Object)(object)info.Instance == (Object)(object)this || existing.Contains(info.Metadata.GUID) || info.Metadata.GUID.StartsWith("com.bepis.r2api") || info.Metadata.GUID.IndexOf("BepInEx", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				continue;
			}
			int added = 0;
			foreach (ConfigDefinition definition in info.Instance.Config.Keys)
			{
				ConfigEntryBase entry = info.Instance.Config[definition];
				try
				{
					BaseOption option = MakeOption(entry, info.Metadata.GUID);
					if (option != null)
					{
						ModSettingsManager.AddOption(option, info.Metadata.GUID, info.Metadata.Name);
						added++;
					}
				}
				catch (Exception ex)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Skipped option " + info.Metadata.Name + "/" + definition.Key + ": " + ex.Message));
				}
			}
			if (added > 0)
			{
				existing.Add(info.Metadata.GUID);
				ModSettingsManager.SetModDescription("Existing mod settings exposed by Client Side Settings Support. Restart Risk of Rain 2 after changing these settings.", info.Metadata.GUID, info.Metadata.Name);
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Added settings page: " + info.Metadata.Name + " (" + added + " options)"));
			}
		}
	}

	private BaseOption MakeOption(ConfigEntryBase entry, string guid)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Expected O, but got Unknown
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Expected O, but got Unknown
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Expected O, but got Unknown
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Expected O, but got Unknown
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Expected O, but got Unknown
		if (entry is ConfigEntry<bool>)
		{
			return (BaseOption)new CheckBoxOption((ConfigEntry<bool>)(object)entry, true);
		}
		if (entry is ConfigEntry<int>)
		{
			return (BaseOption)new IntFieldOption((ConfigEntry<int>)(object)entry, true);
		}
		if (entry is ConfigEntry<float>)
		{
			return (BaseOption)new FloatFieldOption((ConfigEntry<float>)(object)entry, true);
		}
		if (entry is ConfigEntry<string>)
		{
			return (BaseOption)new StringInputFieldOption((ConfigEntry<string>)(object)entry, true);
		}
		if (entry is ConfigEntry<KeyboardShortcut>)
		{
			return (BaseOption)new KeyBindOption((ConfigEntry<KeyboardShortcut>)(object)entry, true);
		}
		if (entry.SettingType.IsEnum)
		{
			return (BaseOption)new ChoiceOption(entry, true);
		}
		if (entry is ConfigEntry<long>)
		{
			ConfigEntry<long> original = (ConfigEntry<long>)(object)entry;
			if (original.Value < int.MinValue || original.Value > int.MaxValue)
			{
				return null;
			}
			ConfigEntry<int> proxy = ((BaseUnityPlugin)this).Config.Bind<int>(guid + "." + entry.Definition.Section, entry.Definition.Key, (int)original.Value, entry.Description.Description);
			proxy.Value = (int)original.Value;
			proxy.SettingChanged += delegate
			{
				original.Value = proxy.Value;
			};
			return (BaseOption)new IntFieldOption(proxy, true);
		}
		return null;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-OmniSprint/OmniSprintSupport.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Merc;
using EntityStates.Merc.Weapon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.OmniSprint", "Client Side OmniSprint Support", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class OmniSprintSupport : BaseUnityPlugin
{
	[HarmonyPatch(typeof(CharacterDirection), "Simulate")]
	private class MercFacing
	{
		private struct Saved
		{
			public bool changed;

			public Vector3 move;
		}

		[HarmonyPrefix]
		private static void Before(CharacterDirection __instance, ref Saved __state)
		{
			//IL_0082: 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_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: 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)
			if (!cameraMelee.Value)
			{
				return;
			}
			CharacterBody val = null;
			foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
			{
				CharacterBody cachedBody = readOnlyLocalUsers.cachedBody;
				if (Object.op_Implicit((Object)(object)cachedBody) && (Object)(object)((Component)cachedBody).GetComponent<CharacterDirection>() == (Object)(object)__instance)
				{
					val = cachedBody;
					break;
				}
			}
			if (!Object.op_Implicit((Object)(object)val) || BodyCatalog.GetBodyName(val.bodyIndex) != "MercBody")
			{
				return;
			}
			bool flag = false;
			EntityStateMachine[] components = ((Component)val).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val2 in components)
			{
				if (val2.state is GroundLight || val2.state is GroundLight2)
				{
					flag = true;
					break;
				}
			}
			if (flag && Object.op_Implicit((Object)(object)val.inputBank))
			{
				Vector3 val3 = HorizontalAim(val.inputBank.aimDirection);
				if (!(val3 == Vector3.zero))
				{
					__state.changed = true;
					__state.move = __instance.moveVector;
					__instance.moveVector = val3;
					__instance.forward = val3;
				}
			}
		}

		[HarmonyFinalizer]
		private static void Restore(CharacterDirection __instance, Saved __state)
		{
			//IL_000d: 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)
			if (__state.changed)
			{
				__instance.moveVector = __state.move;
			}
		}
	}

	[HarmonyPatch(typeof(GenericCharacterMain), "GatherInputs")]
	private class Patch
	{
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> source)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(source);
			FieldInfo field = AccessTools.Field(typeof(GenericCharacterMain), "sprintMinAimMoveDot");
			int count = 0;
			foreach (CodeInstruction i in list)
			{
				if (i.opcode == OpCodes.Ldsfld && object.Equals(i.operand, field))
				{
					count++;
				}
			}
			if (count != 1)
			{
				throw new InvalidOperationException("Unexpected sprint-direction implementation; no compatibility change applied.");
			}
			foreach (CodeInstruction i2 in list)
			{
				yield return i2;
				if (i2.opcode == OpCodes.Ldsfld && object.Equals(i2.operand, field))
				{
					yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
					yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(OmniSprintSupport), "Adjust", (Type[])null, (Type[])null));
					PatchedReads++;
				}
			}
		}
	}

	private static ConfigEntry<bool> enableOmni;

	private static ConfigEntry<bool> cameraMelee;

	public static int PatchedReads;

	private void Awake()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		enableOmni = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable OmniSprint", true, "Allow the local player's sprint in every direction. AutoSprint still controls skill delays and hold-to-walk.");
		cameraMelee = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Camera Facing Mercenary Primary", true, "Face camera aim during the local Mercenary primary sword attack, including while sprinting sideways.");
		new Harmony("ClientSideRepairs.OmniSprint").PatchAll(typeof(OmniSprintSupport).Assembly);
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Patched local sprint direction checks: " + PatchedReads));
	}

	public static Vector3 HorizontalAim(Vector3 aim)
	{
		//IL_0024: 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_0029: 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)
		aim.y = 0f;
		return (((Vector3)(ref aim)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref aim)).normalized : Vector3.zero;
	}

	public static float SelectThreshold(float original, bool enable, bool local)
	{
		return (enable && local) ? (-1.001f) : original;
	}

	private static float Adjust(float original, GenericCharacterMain state)
	{
		CharacterBody val = (Object.op_Implicit((Object)(object)((EntityState)state).outer) ? ((Component)((EntityState)state).outer).GetComponent<CharacterBody>() : null);
		bool local = false;
		if (Object.op_Implicit((Object)(object)val))
		{
			foreach (LocalUser readOnlyLocalUsers in LocalUserManager.readOnlyLocalUsersList)
			{
				if ((Object)(object)readOnlyLocalUsers.cachedBody == (Object)(object)val)
				{
					local = true;
					break;
				}
			}
		}
		return SelectThreshold(original, enableOmni.Value, local);
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-QoLChestSupport/QoLChestSupport.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using Faust.QoLChests.Api;
using Faust.QoLChests.Components;
using Faust.QoLChests.Handlers;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.QoLChestSupport", "QoL Chests DLC Compatibility", "1.4.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class QoLChestSupport : BaseUnityPlugin
{
	public class AvailableHighlightFallback : MonoBehaviour
	{
		public PurchaseInteraction Purchase;

		public Highlight Highlight;

		public InteractableCategory Category;

		private float next;

		private void LateUpdate()
		{
			if (Time.unscaledTime >= next)
			{
				next = Time.unscaledTime + 0.25f;
				Refresh();
			}
		}

		public void Refresh()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)Highlight))
			{
				if (!Object.op_Implicit((Object)(object)Purchase) || !((Behaviour)Purchase).isActiveAndEnabled || !Purchase.available || Object.op_Implicit((Object)(object)((Component)this).GetComponent<InteractableUsed>()) || categoryEnabled == null || !categoryEnabled(Category))
				{
					Highlight.isOn = false;
					return;
				}
				HighlightHandler.Enable(((Component)this).gameObject, false);
				EnsureRegistered(Highlight);
			}
		}
	}

	private float nextScan;

	private static Func<InteractableCategory, bool> categoryEnabled;

	private readonly HashSet<string> reported = new HashSet<string>();

	private readonly HashSet<string> inspected = new HashSet<string>();

	private readonly HashSet<string> candidates = new HashSet<string>();

	private int scannedRun;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Expected O, but got Unknown
		Harmony val = new Harmony("ClientSideRepairs.QoLChestSupport");
		val.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("Faust.QoLChests.Utils"), "DisableColliders", (Type[])null, (Type[])null), new HarmonyMethod(typeof(QoLChestSupport), "KeepColliders", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("Faust.QoLChests.Hooks.ShopHooks"), "PurchaseInteractionOnInteractionBegin", (Type[])null, (Type[])null), new HarmonyMethod(typeof(QoLChestSupport), "ProtectTimedInteraction", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(typeof(HighlightHandler), "Enable", new Type[2]
		{
			typeof(GameObject),
			typeof(bool)
		}, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(QoLChestSupport), "ProtectOutlineColour", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		string[] array = new string[6] { "DroneCombiner", "DroneCombinerStation", "DroneUpgradeStation", "HollowChest", "ShrineHalcyonite", "ShrineRebirth" };
		foreach (string text in array)
		{
			QoLChestsApi.BlackListInteractable(text);
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"QoLChests 1.3.6 API support installed. Official barrel and multi-renderer handling retained; visual-only hiding and timed-interaction safeguards preserved.");
		Type type = AccessTools.TypeByName("Faust.QoLChests.Configs.ModConfig");
		object value = AccessTools.Property(type, "Instance").GetValue(null, null);
		categoryEnabled = (Func<InteractableCategory, bool>)Delegate.CreateDelegate(typeof(Func<InteractableCategory, bool>), value, AccessTools.Method(type, "IsCategoryHighlightEnabled", (Type[])null, (Type[])null));
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Available-interactable highlight fallback enabled; includes late-spawned repair drones and missing renderer targets. Existing category colours retained.");
		((BaseUnityPlugin)this).Logger.LogInfo((object)"QoL outline colour guard installed: low-red cyan/blue/green colours receive a small visibility-channel floor.");
	}

	private unsafe void Update()
	{
		//IL_0270: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_0458: Unknown result type (might be due to invalid IL or missing references)
		//IL_058a: Unknown result type (might be due to invalid IL or missing references)
		//IL_058c: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)Run.instance) || categoryEnabled == null || Time.unscaledTime < nextScan)
		{
			return;
		}
		nextScan = Time.unscaledTime + 3f;
		PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>();
		if (array.Length != 0 && scannedRun != ((Object)Run.instance).GetInstanceID())
		{
			scannedRun = ((Object)Run.instance).GetInstanceID();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Highlight scene scan active; purchase interactions=" + array.Length));
		}
		PurchaseInteraction[] array2 = array;
		InteractableCategory val2 = default(InteractableCategory);
		foreach (PurchaseInteraction val in array2)
		{
			if (Object.op_Implicit((Object)(object)val) && (val.isDrone || ((Object)((Component)val).gameObject).name.IndexOf("Drone", StringComparison.OrdinalIgnoreCase) >= 0) && candidates.Count < 40 && candidates.Add(((Object)((Component)val).gameObject).name.Replace("(Clone)", "")))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Drone highlight candidate: " + ((Object)((Component)val).gameObject).name + "; active=" + ((Behaviour)val).isActiveAndEnabled + "; available=" + val.available + "; token=" + val.contextToken + "; body=" + ((Object)(object)((Component)val).GetComponentInParent<CharacterBody>() != (Object)null) + "; used=" + ((Object)(object)((Component)val).GetComponent<InteractableUsed>() != (Object)null)));
			}
			if (!Object.op_Implicit((Object)(object)val) || !((Behaviour)val).isActiveAndEnabled || !val.available)
			{
				continue;
			}
			GameObject gameObject = ((Component)val).gameObject;
			bool flag = GroundHighlightPolicy.IsRepairDrone(((Object)gameObject).name, val.contextToken, (Object)(object)gameObject.GetComponent<SummonMasterBehavior>() != (Object)null || (Object)(object)gameObject.GetComponent<DronePurchaseRepair>() != (Object)null);
			if (Object.op_Implicit((Object)(object)gameObject.GetComponentInParent<CharacterBody>()) && !flag)
			{
				continue;
			}
			InteractableHighlightCategoryMarker component = gameObject.GetComponent<InteractableHighlightCategoryMarker>();
			if (Object.op_Implicit((Object)(object)component))
			{
				val2 = component.Category;
			}
			else if (!InteractableRegistry.IsRegistered(((Object)gameObject).name, ref val2))
			{
				int num = GroundHighlightPolicy.Category(((Object)gameObject).name, val.contextToken, flag);
				if (num < 0)
				{
					continue;
				}
				val2 = (InteractableCategory)num;
			}
			if (!categoryEnabled(val2) || Object.op_Implicit((Object)(object)gameObject.GetComponent<InteractableUsed>()))
			{
				continue;
			}
			Highlight val3 = gameObject.GetComponent<Highlight>();
			string text = ((Object)gameObject).name.Replace("(Clone)", "");
			bool flag2 = HasActiveTarget(val3);
			bool flag3 = Object.op_Implicit((Object)(object)val3) && Highlight.readonlyHighlightList.Contains(val3);
			if (flag && inspected.Count < 40 && inspected.Add(text))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Repair drone outline audit: " + text + "; category=" + ((object)(*(InteractableCategory*)(&val2))/*cast due to .constrained prefix*/).ToString() + "; on=" + (Object.op_Implicit((Object)(object)val3) && val3.isOn) + "; enabled=" + (Object.op_Implicit((Object)(object)val3) && ((Behaviour)val3).enabled) + "; activeTarget=" + flag2 + "; registered=" + flag3));
			}
			if (!flag && Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)val3) && val3.isOn && ((Behaviour)val3).enabled && flag2 && flag3)
			{
				continue;
			}
			if (!Object.op_Implicit((Object)(object)component))
			{
				component = gameObject.AddComponent<InteractableHighlightCategoryMarker>().SetCategory(val2);
			}
			if (!Object.op_Implicit((Object)(object)val3))
			{
				val3 = gameObject.AddComponent<Highlight>();
			}
			AvailableHighlightFallback availableHighlightFallback = gameObject.GetComponent<AvailableHighlightFallback>();
			if (!flag2 || (flag && !Object.op_Implicit((Object)(object)availableHighlightFallback)))
			{
				List<Renderer> list = new List<Renderer>();
				ModelLocator component2 = gameObject.GetComponent<ModelLocator>();
				Transform val4 = ((Object.op_Implicit((Object)(object)component2) && Object.op_Implicit((Object)(object)component2.modelTransform)) ? component2.modelTransform : gameObject.transform);
				Renderer[] componentsInChildren = ((Component)val4).GetComponentsInChildren<Renderer>();
				foreach (Renderer val5 in componentsInChildren)
				{
					if (Object.op_Implicit((Object)(object)val5) && val5.enabled && (val5 is MeshRenderer || val5 is SkinnedMeshRenderer))
					{
						list.Add(val5);
					}
				}
				if (list.Count == 0)
				{
					continue;
				}
				val3.SetTargetRendererList(list);
			}
			if (!Object.op_Implicit((Object)(object)availableHighlightFallback))
			{
				availableHighlightFallback = gameObject.AddComponent<AvailableHighlightFallback>();
			}
			availableHighlightFallback.Purchase = val;
			availableHighlightFallback.Highlight = val3;
			availableHighlightFallback.Category = val2;
			availableHighlightFallback.Refresh();
			if (reported.Count < 80 && reported.Add(text))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)("Repaired available-interactable highlight: " + text + "; category=" + ((object)(*(InteractableCategory*)(&val2))/*cast due to .constrained prefix*/).ToString()));
			}
		}
	}

	private static bool ActiveRenderer(Renderer renderer)
	{
		return Object.op_Implicit((Object)(object)renderer) && renderer.enabled && ((Component)renderer).gameObject.activeInHierarchy && (renderer is MeshRenderer || renderer is SkinnedMeshRenderer);
	}

	private static bool HasActiveTarget(Highlight highlight)
	{
		if (!Object.op_Implicit((Object)(object)highlight))
		{
			return false;
		}
		if (Object.op_Implicit((Object)(object)highlight.targetRenderer))
		{
			return ActiveRenderer(highlight.targetRenderer);
		}
		List<Renderer> targetRendererList = highlight.GetTargetRendererList();
		if (targetRendererList != null)
		{
			foreach (Renderer item in targetRendererList)
			{
				if (ActiveRenderer(item))
				{
					return true;
				}
			}
		}
		return false;
	}

	private static void EnsureRegistered(Highlight highlight)
	{
		if (Object.op_Implicit((Object)(object)highlight) && !Highlight.readonlyHighlightList.Contains(highlight))
		{
			((Behaviour)highlight).enabled = false;
			((Behaviour)highlight).enabled = true;
		}
	}

	private static bool KeepColliders(ref Collider[] __result)
	{
		__result = Array.Empty<Collider>();
		return false;
	}

	private static void ProtectOutlineColour(GameObject __0)
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: 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_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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)
		if (Object.op_Implicit((Object)(object)__0))
		{
			Highlight component = __0.GetComponent<Highlight>();
			if (Object.op_Implicit((Object)(object)component) && component.isOn && (int)component.highlightColor == 3)
			{
				Color customColor = component.CustomColor;
				customColor.r = OutlineColourPolicy.SafeRed(customColor.r, customColor.g, customColor.b);
				component.CustomColor = customColor;
			}
		}
	}

	private static void ProtectTimedInteraction(PurchaseInteraction __1)
	{
		if (Object.op_Implicit((Object)(object)__1) && Object.op_Implicit((Object)(object)((Component)__1).gameObject))
		{
			string name = ((Object)((Component)__1).gameObject).name;
			string text = name.ToUpperInvariant();
			if (text.Contains("HOLLOW") || text.Contains("DRONECOMBIN") || text.Contains("DRONEUPGRADE") || text.Contains("HALCYON") || text.Contains("SHRINEREBIRTH"))
			{
				QoLChestsApi.BlackListInteractable(name);
			}
		}
	}
}
public static class OutlineColourPolicy
{
	public static float SafeRed(float red, float green, float blue)
	{
		return (green > 0f || blue > 0f) ? Math.Max(red, 0.1f) : red;
	}
}
public static class GroundHighlightPolicy
{
	public static bool IsRepairDrone(string name, string token, bool hasRepairComponent)
	{
		string text = (name ?? "").ToUpperInvariant();
		string text2 = (token ?? "").ToUpperInvariant();
		return hasRepairComponent && text.Contains("BROKEN") && (text.Contains("DRONE") || text.Contains("TURRET")) && (text2.Contains("DRONE") || text2.Contains("TURRET"));
	}

	public static int Category(string name, string token, bool repair)
	{
		string text = (name ?? "").Replace("(Clone)", "").ToUpperInvariant();
		if (repair)
		{
			return text.Contains("TURRET") ? 5 : 4;
		}
		if (text.Contains("TRIPLEDRONESHOP") || text.Contains("SHOPTERMINAL"))
		{
			return 1;
		}
		if (text.Contains("DRONESCRAPPER") || text == "SCRAPPER")
		{
			return 2;
		}
		if (text.Contains("DRONECOMBIN") || text.Contains("DRONEUPGRADE") || text.Contains("DRONEASSEMBLY") || text.Contains("DUPLICATOR"))
		{
			return 3;
		}
		if (text.Contains("LOCKBOX"))
		{
			return 8;
		}
		if (text.Contains("EQUIPMENTBARREL"))
		{
			return 12;
		}
		if (text == "BARREL1" || text == "BARREL2")
		{
			return 9;
		}
		if (text.Contains("VOIDCHEST") || text.Contains("VOIDCRADLE"))
		{
			return 14;
		}
		if (text.Contains("LUNARCHEST") || text.Contains("LUNARPOD"))
		{
			return 13;
		}
		if (text.Contains("CHEST") && text.Contains("STEALTH"))
		{
			return 6;
		}
		if (text.Contains("CHEST"))
		{
			return 0;
		}
		if (text.StartsWith("NEWTSTATUE"))
		{
			return 10;
		}
		if (text.Contains("PRESSUREPLATE"))
		{
			return 11;
		}
		if (text.StartsWith("SHRINE") || text.Contains("HALLOWINGSHRINE"))
		{
			return 7;
		}
		return -1;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-RunVisualSupport/RunVisualSupport.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Totem;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.Projectile;
using RoR2.UI;
using RoR2.UI.LogBook;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.RunVisualSupport", "Client Side Menu and Particle Support", "1.7.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class RunVisualSupport : BaseUnityPlugin
{
	private bool particleCheckPending;

	private float nextParticleCheck;

	private int checksWithoutRepair;

	private readonly Dictionary<int, int> collapsedChecks = new Dictionary<int, int>();

	private static readonly FieldInfo notificationList = AccessTools.Field(typeof(CharacterMasterNotificationQueue), "notifications");

	private static readonly Func<BaseCharacterMain, Animator> animatorOf = (Func<BaseCharacterMain, Animator>)Delegate.CreateDelegate(typeof(Func<BaseCharacterMain, Animator>), AccessTools.PropertyGetter(typeof(BaseCharacterMain), "modelAnimator"));

	private static readonly HashSet<int> missingAnimatorOwners = new HashSet<int>();

	private static ManualLogSource log;

	private static int staleTargetLookups;

	private int reportedStaleTargets;

	private float nextTargetReport;

	private static int seerFallbackReports;

	private void Awake()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Expected O, but got Unknown
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Expected O, but got Unknown
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Expected O, but got Unknown
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Expected O, but got Unknown
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Expected O, but got Unknown
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_0245: Expected O, but got Unknown
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a5: Expected O, but got Unknown
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_0386: Expected O, but got Unknown
		//IL_030a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Expected O, but got Unknown
		log = ((BaseUnityPlugin)this).Logger;
		MethodInfo methodInfo = AccessTools.Method(AccessTools.TypeByName("LookingGlass.CommandWindowBlur.NoWindowBlur"), "OnDisplayBegin", (Type[])null, (Type[])null);
		if (methodInfo == null)
		{
			throw new MissingMethodException("LookingGlass NoWindowBlur.OnDisplayBegin");
		}
		Harmony val = new Harmony("ClientSideRepairs.RunVisualSupport");
		ClientVisualGuards.Report = delegate(string message)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)message);
		};
		InstallVisualGuard(val, AccessTools.Method(typeof(BaseCharacterMain), "FixedUpdate", (Type[])null, (Type[])null), "GuardLandingAnimator");
		InstallVisualGuard(val, AccessTools.Method(typeof(DroneCommandReceiver), "FilterHits", (Type[])null, (Type[])null), "GuardDroneFilter");
		InstallVisualGuard(val, AccessTools.Method(typeof(DreamDemonProjectileController), "SetGrowthLevel", (Type[])null, (Type[])null), "GuardGrowthRenderers");
		Type nestedType = typeof(DreamDemonProjectileController).GetNestedType("GrowthThresholdInfo", BindingFlags.Public | BindingFlags.NonPublic);
		InstallVisualGuard(val, AccessTools.Method(nestedType, "SetActive", (Type[])null, (Type[])null), "GuardGrowthObjects");
		Type type = AccessTools.TypeByName("RoR2.SkinDef+RuntimeSkin+<ApplyAsync>d__9");
		InstallVisualGuard(val, AccessTools.Method(type, "MoveNext", (Type[])null, (Type[])null), "GuardSkinActivations");
		val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(RunVisualSupport), "GuardAbsentPanel", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LookingGlass.ItemStatsNameSpace.ItemStats"), "PutLastNotificationFirst", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RunVisualSupport), "HasNotification", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(typeof(LogBookController), "GetMonsterStatus", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RunVisualSupport), "ValidMonsterEntry", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(typeof(LogBookController), "GetSurvivorStatus", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RunVisualSupport), "ValidSurvivorEntry", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		val.Patch((MethodBase)AccessTools.Method(typeof(BaseCharacterMain), "UpdateAnimationParameters", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RunVisualSupport), "HasAnimator", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		try
		{
			val.Patch((MethodBase)AccessTools.Method(typeof(DroneCommandReceiver), "DoTargetInfoSearch", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(RunVisualSupport), "GuardDroneLookups", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Drone command lookup guard installed: destroyed locator targets are skipped; target filters, priorities and network commands unchanged.");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Drone targeting patch was not installed: " + ex.Message));
		}
		if (Chainloader.PluginInfos.ContainsKey("com.Moonlol.SeerPing"))
		{
			Type type2 = AccessTools.TypeByName("SeerPing.SeerPingPlugin+<>c");
			MethodInfo methodInfo2 = ((type2 == null) ? null : AccessTools.Method(type2, "<Awake>b__4_0", (Type[])null, (Type[])null));
			if (methodInfo2 != null && methodInfo2.ReturnType == typeof(string) && methodInfo2.GetParameters().Length == 2)
			{
				val.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(RunVisualSupport), "GuardSeerName", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"SeerPing missing-object/destination guard installed; valid destination names retained.");
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"SeerPing callback layout changed; optional guard not installed.");
			}
		}
		Type type3 = AccessTools.TypeByName("PingIconsOverhaul.PingIconsOverhaul");
		if (type3 != null)
		{
			val.Patch((MethodBase)AccessTools.Method(type3, "Start", (Type[])null, (Type[])null), new HarmonyMethod(typeof(RunVisualSupport), "AddTrialAliases", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
		HudProcAndPingSupport.Install(val, ((BaseUnityPlugin)this).Logger);
		Application.logMessageReceived += new LogCallback(OnLog);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"LookingGlass absent-panel guard installed; particle shape validation waits for the specific zero-area warning. Combat and network logic unchanged.");
	}

	private void OnDestroy()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		Application.logMessageReceived -= new LogCallback(OnLog);
	}

	private void InstallVisualGuard(Harmony harmony, MethodBase target, string patch)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		try
		{
			if (target == null)
			{
				throw new MissingMethodException(patch);
			}
			harmony.Patch(target, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ClientVisualGuards), patch, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Client visual guard installed: " + patch));
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Client visual guard not installed: " + patch + ": " + ex.Message));
		}
	}

	private static bool GuardSeerName(Delegate __0, GameObject __1, ref string __result)
	{
		bool flag = !Object.op_Implicit((Object)(object)__1);
		if (!flag && ((Object)__1).name.Contains("SeerStation"))
		{
			SeerStationController component = __1.GetComponent<SeerStationController>();
			flag = !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)SceneCatalog.GetSceneDef((SceneIndex)component.NetworktargetSceneDefIndex));
		}
		if (!flag)
		{
			return true;
		}
		__result = (((object)__0 == null) ? "???" : ((string)__0.DynamicInvoke(__1)));
		if (seerFallbackReports++ < 3)
		{
			log.LogInfo((object)"SeerPing used native name fallback for a missing object or unready destination.");
		}
		return false;
	}

	private static bool HasNotification(CharacterMaster characterMaster)
	{
		if (!Object.op_Implicit((Object)(object)characterMaster))
		{
			return false;
		}
		CharacterMasterNotificationQueue notificationQueueForMaster = CharacterMasterNotificationQueue.GetNotificationQueueForMaster(characterMaster);
		IList list = (Object.op_Implicit((Object)(object)notificationQueueForMaster) ? (notificationList.GetValue(notificationQueueForMaster) as IList) : null);
		return list != null && list.Count > 0;
	}

	private static bool ValidMonsterEntry(ref Entry entry, ref EntryStatus __result)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		if (entry != null && entry.extraData is CharacterBody && Object.op_Implicit((Object)(CharacterBody)entry.extraData))
		{
			return true;
		}
		__result = (EntryStatus)0;
		return false;
	}

	private static bool ValidSurvivorEntry(ref Entry entry, UserProfile viewerProfile, ref EntryStatus __result)
	{
		CharacterBody val = (CharacterBody)((entry == null) ? null : /*isinst with value type is only supported in some contexts*/);
		if (Object.op_Implicit((Object)(object)val) && viewerProfile != null && Object.op_Implicit((Object)(object)SurvivorCatalog.FindSurvivorDefFromBody(((Component)val).gameObject)))
		{
			return true;
		}
		__result = (EntryStatus)0;
		return false;
	}

	private static bool HasAnimator(BaseCharacterMain __instance)
	{
		if (__instance != null && Object.op_Implicit((Object)(object)animatorOf(__instance)))
		{
			return true;
		}
		EntityStateMachine val = ((EntityState)(__instance?)).outer;
		if (Object.op_Implicit((Object)(object)val) && missingAnimatorOwners.Count < 64 && missingAnimatorOwners.Add(((Object)val).GetInstanceID()))
		{
			log.LogWarning((object)("Animation parameter update deferred: missing Animator on " + PathOf(((Component)val).transform) + "; state=" + ((object)__instance).GetType().FullName + ". Movement and skills unchanged."));
		}
		return false;
	}

	public static IEnumerable<CodeInstruction> GuardDroneLookups(IEnumerable<CodeInstruction> source)
	{
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		int num2 = 0;
		int num3 = 0;
		foreach (CodeInstruction item in list)
		{
			MethodInfo methodInfo = item.operand as MethodInfo;
			if (!(methodInfo == null) && !(methodInfo.Name != "TryGetComponent") && methodInfo.IsGenericMethod)
			{
				Type type = methodInfo.GetGenericArguments()[0];
				string text = null;
				if (methodInfo.DeclaringType == typeof(Component) && type == typeof(EntityLocator))
				{
					text = "TryLocator";
					num++;
				}
				if (methodInfo.DeclaringType == typeof(GameObject) && type == typeof(ChestBehavior))
				{
					text = "TryChest";
					num2++;
				}
				if (methodInfo.DeclaringType == typeof(GameObject) && type == typeof(SpecialObjectAttributes))
				{
					text = "TryAttributes";
					num3++;
				}
				if (text != null)
				{
					item.opcode = OpCodes.Call;
					item.operand = AccessTools.Method(typeof(RunVisualSupport), text, (Type[])null, (Type[])null);
				}
			}
		}
		if (num != 1 || num2 != 1 || num3 != 1)
		{
			throw new InvalidOperationException("Drone lookup layout changed; refusing partial patch.");
		}
		return list;
	}

	private static bool TryLocator(Component candidate, out EntityLocator result)
	{
		result = null;
		if (!Object.op_Implicit((Object)(object)candidate))
		{
			staleTargetLookups++;
			return false;
		}
		return candidate.TryGetComponent<EntityLocator>(ref result);
	}

	private static bool TryChest(GameObject candidate, out ChestBehavior result)
	{
		result = null;
		if (!Object.op_Implicit((Object)(object)candidate))
		{
			staleTargetLookups++;
			return false;
		}
		return candidate.TryGetComponent<ChestBehavior>(ref result);
	}

	private static bool TryAttributes(GameObject candidate, out SpecialObjectAttributes result)
	{
		result = null;
		if (!Object.op_Implicit((Object)(object)candidate))
		{
			staleTargetLookups++;
			return false;
		}
		return candidate.TryGetComponent<SpecialObjectAttributes>(ref result);
	}

	private static void AddTrialAliases()
	{
		Type type = AccessTools.TypeByName("PingIconsOverhaul.PingIconsOverhaul");
		if (!(AccessTools.Field(type, "INTERACTABLES").GetValue(null) is IDictionary dictionary))
		{
			return;
		}
		string[][] array = new string[3][]
		{
			new string[2] { "TrialCategoryChestDamage", "CategoryChestDamage" },
			new string[2] { "TrialCategoryChest2Damage", "CategoryChest2Damage Variant" },
			new string[2] { "LockboxTrial", "Lockbox" }
		};
		foreach (string[] array2 in array)
		{
			if (!dictionary.Contains(array2[0]) && dictionary.Contains(array2[1]))
			{
				dictionary.Add(array2[0], dictionary[array2[1]]);
			}
		}
	}

	public static IEnumerable<CodeInstruction> GuardAbsentPanel(IEnumerable<CodeInstruction> source, ILGenerator generator)
	{
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Expected O, but got Unknown
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Expected O, but got Unknown
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Expected O, but got Unknown
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Expected O, but got Unknown
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		for (int i = 0; i < list.Count - 1; i++)
		{
			FieldInfo fieldInfo = list[i].operand as FieldInfo;
			MethodInfo methodInfo = list[i + 1].operand as MethodInfo;
			if (!(list[i].opcode != OpCodes.Ldfld) && !(fieldInfo == null) && !(fieldInfo.Name != "panelInstance") && !(methodInfo == null) && !(methodInfo.Name != "get_gameObject"))
			{
				Label label = generator.DefineLabel();
				list[i + 1].labels.Add(label);
				list.InsertRange(i + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Dup, (object)null),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null)),
					new CodeInstruction(OpCodes.Brtrue, (object)label),
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ret, (object)null)
				});
				num++;
				i += 5;
			}
		}
		if (num != 1)
		{
			throw new InvalidOperationException("Unexpected LookingGlass panel access layout; refusing to patch.");
		}
		return list;
	}

	private void OnLog(string message, string stack, LogType type)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Invalid comparison between Unknown and I4
		if ((int)type == 2 && message.Contains("Particle System is trying to spawn on a mesh with zero surface area"))
		{
			particleCheckPending = true;
		}
	}

	private void Update()
	{
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Invalid comparison between Unknown and I4
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Invalid comparison between Unknown and I4
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Invalid comparison between Unknown and I4
		//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Invalid comparison between Unknown and I4
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_021c: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0254: Expected O, but got Unknown
		if (staleTargetLookups != reportedStaleTargets && Time.unscaledTime >= nextTargetReport)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Drone target search skipped " + (staleTargetLookups - reportedStaleTargets) + " stale component/object lookups; total=" + staleTargetLookups + ". Search continued normally."));
			reportedStaleTargets = staleTargetLookups;
			nextTargetReport = Time.unscaledTime + 60f;
		}
		if (!particleCheckPending || Time.unscaledTime < nextParticleCheck)
		{
			return;
		}
		particleCheckPending = false;
		nextParticleCheck = Time.unscaledTime + 5f;
		int num = 0;
		ParticleSystem[] array = Object.FindObjectsOfType<ParticleSystem>();
		foreach (ParticleSystem val in array)
		{
			if (!Object.op_Implicit((Object)(object)val) || !val.isPlaying)
			{
				continue;
			}
			ShapeModule shape = val.shape;
			if (!((ShapeModule)(ref shape)).enabled || (int)((ShapeModule)(ref shape)).meshShapeType != 2)
			{
				continue;
			}
			Mesh val2 = null;
			bool flag = false;
			if ((int)((ShapeModule)(ref shape)).shapeType == 6)
			{
				val2 = ((ShapeModule)(ref shape)).mesh;
			}
			else if ((int)((ShapeModule)(ref shape)).shapeType == 14 && Object.op_Implicit((Object)(object)((ShapeModule)(ref shape)).skinnedMeshRenderer))
			{
				val2 = ((ShapeModule)(ref shape)).skinnedMeshRenderer.sharedMesh;
				flag = true;
			}
			else
			{
				if ((int)((ShapeModule)(ref shape)).shapeType != 13 || !Object.op_Implicit((Object)(object)((ShapeModule)(ref shape)).meshRenderer))
				{
					continue;
				}
				MeshFilter component = ((Component)((ShapeModule)(ref shape)).meshRenderer).GetComponent<MeshFilter>();
				if (Object.op_Implicit((Object)(object)component))
				{
					val2 = component.sharedMesh;
				}
			}
			if (!Object.op_Implicit((Object)(object)val2))
			{
				continue;
			}
			Bounds bounds = val2.bounds;
			Vector3 size = ((Bounds)(ref bounds)).size;
			bool flag2 = val2.vertexCount < 3 || (size.x == 0f && size.y == 0f && size.z == 0f);
			Mesh val3 = null;
			if (flag)
			{
				try
				{
					val3 = new Mesh();
					((ShapeModule)(ref shape)).skinnedMeshRenderer.BakeMesh(val3);
				}
				catch (Exception)
				{
					if (Object.op_Implicit((Object)(object)val3))
					{
						Object.Destroy((Object)(object)val3);
					}
					continue;
				}
			}
			Mesh val4 = (Object.op_Implicit((Object)(object)val3) ? val3 : val2);
			if (val4.isReadable)
			{
				try
				{
					int meshMaterialIndex = ((ShapeModule)(ref shape)).meshMaterialIndex;
					if (((ShapeModule)(ref shape)).useMeshMaterialIndex && (meshMaterialIndex < 0 || meshMaterialIndex >= val4.subMeshCount))
					{
						continue;
					}
					int[] triangles = (((ShapeModule)(ref shape)).useMeshMaterialIndex ? val4.GetTriangles(meshMaterialIndex) : val4.triangles);
					flag2 = !ParticleSurfacePolicy.HasSurface(val4.vertices, triangles);
					goto IL_0348;
				}
				catch (Exception)
				{
				}
				finally
				{
					if (Object.op_Implicit((Object)(object)val3))
					{
						Object.Destroy((Object)(object)val3);
					}
				}
				continue;
			}
			if (Object.op_Implicit((Object)(object)val3))
			{
				Object.Destroy((Object)(object)val3);
			}
			goto IL_0348;
			IL_0348:
			int instanceID = ((Object)val).GetInstanceID();
			if (!flag2)
			{
				collapsedChecks.Remove(instanceID);
				continue;
			}
			if (flag)
			{
				collapsedChecks.TryGetValue(instanceID, out var value);
				value = (collapsedChecks[instanceID] = value + 1);
				if (value < 3)
				{
					continue;
				}
			}
			((ShapeModule)(ref shape)).enabled = false;
			num++;
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Particle emitter fallback at " + PathOf(((Component)val).transform) + "; zero-area mesh=" + ((Object)val2).name + ". Shape disabled; emitter and effects retained."));
		}
		if (num > 0)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Repaired " + num + " invalid visual particle shapes."));
		}
		else if (checksWithoutRepair++ < 3)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"Zero-area particle warning observed, but no provably invalid readable/static mesh found. Animated/unreadable emitters left unchanged.");
		}
	}

	private static string PathOf(Transform t)
	{
		string text = ((Object)t).name;
		while (Object.op_Implicit((Object)(object)t.parent))
		{
			t = t.parent;
			text = ((Object)t).name + "/" + text;
		}
		return text;
	}
}
public static class ClientVisualGuards
{
	public static Action<string> Report;

	private static int missingRenderers;

	private static int missingObjects;

	private static int missingSkinParts;

	private static int missingLandingAnimators;

	private static int missingFilterTargets;

	public static IEnumerable<CodeInstruction> GuardLandingAnimator(IEnumerable<CodeInstruction> source)
	{
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		for (int i = 0; i < list.Count - 3; i++)
		{
			MethodInfo methodInfo = list[i].operand as MethodInfo;
			if (!(methodInfo == null) && !(methodInfo.DeclaringType != typeof(Animator)) && !(methodInfo.Name != "GetLayerIndex"))
			{
				if (list[i - 1].opcode != OpCodes.Ldstr || (string)list[i - 1].operand != "Impact" || list[i + 3].opcode != OpCodes.Ldc_I4_0 || (list[i + 4].opcode != OpCodes.Blt && list[i + 4].opcode != OpCodes.Blt_S))
				{
					throw new InvalidOperationException("Landing animation branch changed; patch refused.");
				}
				list[i].opcode = OpCodes.Call;
				list[i].operand = AccessTools.Method(typeof(ClientVisualGuards), "LandingLayer", (Type[])null, (Type[])null);
				num++;
			}
		}
		if (num != 1)
		{
			throw new InvalidOperationException("Landing Animator layout changed; patch refused.");
		}
		return list;
	}

	public static int LandingLayer(Animator animator, string name)
	{
		if (Object.op_Implicit((Object)(object)animator))
		{
			return animator.GetLayerIndex(name);
		}
		if (missingLandingAnimators++ < 3)
		{
			Report?.Invoke("Landing animation has no Animator; skipped only the visual impact layer. Grounding, movement and root motion continue.");
		}
		return -1;
	}

	public static IEnumerable<CodeInstruction> GuardDroneFilter(IEnumerable<CodeInstruction> source, ILGenerator generator)
	{
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0250: Expected O, but got Unknown
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Expected O, but got Unknown
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Expected O, but got Unknown
		//IL_028f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Expected O, but got Unknown
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Expected O, but got Unknown
		List<CodeInstruction> list = source.ToList();
		int num = -1;
		int num2 = 0;
		object obj = null;
		for (int i = 0; i < list.Count; i++)
		{
			MethodInfo methodInfo = list[i].operand as MethodInfo;
			if (methodInfo == null)
			{
				continue;
			}
			if (methodInfo.DeclaringType == typeof(Mathf) && methodInfo.Name == "Approximately" && i + 1 < list.Count && (list[i + 1].opcode == OpCodes.Brtrue || list[i + 1].opcode == OpCodes.Brtrue_S))
			{
				obj = list[i + 1].operand;
			}
			if (!methodInfo.IsGenericMethod || methodInfo.Name != "GetComponent")
			{
				continue;
			}
			if (methodInfo.DeclaringType == typeof(Component) && methodInfo.GetGenericArguments()[0] == typeof(HurtBox))
			{
				if (num >= 0)
				{
					throw new InvalidOperationException("Multiple drone hurtbox lookups");
				}
				num = i;
			}
			if (methodInfo.DeclaringType == typeof(GameObject) && methodInfo.GetGenericArguments()[0] == typeof(ChestBehavior))
			{
				list[i].opcode = OpCodes.Call;
				list[i].operand = AccessTools.Method(typeof(ClientVisualGuards), "FilterChest", (Type[])null, (Type[])null);
				num2++;
			}
		}
		if (num < 1 || !(obj is Label) || num2 != 1 || (list[num - 1].operand as MethodInfo)?.Name != "get_collider")
		{
			throw new InvalidOperationException("Drone hit filter layout changed; patch refused.");
		}
		Label label = generator.DefineLabel();
		list[num].labels.Add(label);
		list.InsertRange(num, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[5]
		{
			new CodeInstruction(OpCodes.Dup, (object)null),
			new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null)),
			new CodeInstruction(OpCodes.Brtrue, (object)label),
			new CodeInstruction(OpCodes.Pop, (object)null),
			new CodeInstruction(OpCodes.Br, obj)
		});
		return list;
	}

	public static ChestBehavior FilterChest(GameObject target)
	{
		if (Object.op_Implicit((Object)(object)target))
		{
			return target.GetComponent<ChestBehavior>();
		}
		if (missingFilterTargets++ < 3)
		{
			Report?.Invoke("Drone hit filter ignored a destroyed chest lookup; target search continues.");
		}
		return null;
	}

	public static IEnumerable<CodeInstruction> GuardGrowthRenderers(IEnumerable<CodeInstruction> source)
	{
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		int num2 = 0;
		foreach (CodeInstruction item in list)
		{
			MethodInfo methodInfo = item.operand as MethodInfo;
			if (!(methodInfo == null) && !(methodInfo.DeclaringType != typeof(Renderer)) && methodInfo.GetParameters().Length == 1 && !(methodInfo.GetParameters()[0].ParameterType != typeof(MaterialPropertyBlock)))
			{
				string text = null;
				if (methodInfo.Name == "GetPropertyBlock")
				{
					text = "ReadGrowthColour";
					num++;
				}
				if (methodInfo.Name == "SetPropertyBlock")
				{
					text = "WriteGrowthColour";
					num2++;
				}
				if (text != null)
				{
					item.opcode = OpCodes.Call;
					item.operand = AccessTools.Method(typeof(ClientVisualGuards), text, (Type[])null, (Type[])null);
				}
			}
		}
		if (num != 1 || num2 != 1)
		{
			throw new InvalidOperationException("Growth renderer layout changed; patch refused.");
		}
		return list;
	}

	public static void ReadGrowthColour(Renderer renderer, MaterialPropertyBlock block)
	{
		if (Object.op_Implicit((Object)(object)renderer))
		{
			renderer.GetPropertyBlock(block);
			return;
		}
		block.Clear();
		if (missingRenderers++ < 3)
		{
			Report?.Invoke("Skipped a missing DreamDemon colour renderer; remaining growth updates continue.");
		}
	}

	public static void WriteGrowthColour(Renderer renderer, MaterialPropertyBlock block)
	{
		if (Object.op_Implicit((Object)(object)renderer))
		{
			renderer.SetPropertyBlock(block);
		}
	}

	public static IEnumerable<CodeInstruction> GuardGrowthObjects(IEnumerable<CodeInstruction> source)
	{
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		foreach (CodeInstruction item in list)
		{
			MethodInfo methodInfo = item.operand as MethodInfo;
			if (!(methodInfo == null) && !(methodInfo.DeclaringType != typeof(GameObject)) && !(methodInfo.Name != "SetActive") && methodInfo.GetParameters().Length == 1)
			{
				item.opcode = OpCodes.Call;
				item.operand = AccessTools.Method(typeof(ClientVisualGuards), "SetGrowthObjectActive", (Type[])null, (Type[])null);
				num++;
			}
		}
		if (num != 1)
		{
			throw new InvalidOperationException("Growth object layout changed; patch refused.");
		}
		return list;
	}

	public static void SetGrowthObjectActive(GameObject obj, bool active)
	{
		if (Object.op_Implicit((Object)(object)obj))
		{
			obj.SetActive(active);
		}
		else if (missingObjects++ < 3)
		{
			Report?.Invoke("Skipped a missing DreamDemon growth object; remaining objects and charge events continue.");
		}
	}

	public static IEnumerable<CodeInstruction> GuardSkinActivations(IEnumerable<CodeInstruction> source, ILGenerator generator)
	{
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Expected O, but got Unknown
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Expected O, but got Unknown
		//IL_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Expected O, but got Unknown
		//IL_026d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Expected O, but got Unknown
		List<CodeInstruction> list = source.ToList();
		int num = -1;
		int num2 = -1;
		int num3 = 0;
		FieldInfo fieldInfo = null;
		for (int i = 0; i < list.Count; i++)
		{
			FieldInfo fieldInfo2 = list[i].operand as FieldInfo;
			if (list[i].opcode == OpCodes.Stfld && fieldInfo2 != null && fieldInfo2.Name == "<transform>5__7" && fieldInfo2.FieldType == typeof(Transform))
			{
				if (i > 0 && list[i - 1].opcode == OpCodes.Ldnull)
				{
					num2 = i;
				}
				else if (i > 0 && (list[i - 1].operand as MethodInfo)?.Name == "Find")
				{
					if (num != -1)
					{
						throw new InvalidOperationException("Multiple skin activation lookups");
					}
					num = i;
					fieldInfo = fieldInfo2;
				}
			}
			MethodInfo methodInfo = list[i].operand as MethodInfo;
			if (methodInfo != null && methodInfo.DeclaringType == typeof(Component) && methodInfo.Name == "get_gameObject")
			{
				num3++;
			}
		}
		if (num < 0 || num2 <= num || num2 + 2 >= list.Count || num3 != 5 || list[num2 + 1].opcode != OpCodes.Ldarg_0 || !(list[num2 + 2].operand is FieldInfo) || ((FieldInfo)list[num2 + 2].operand).Name != "<i>5__6")
		{
			throw new InvalidOperationException("Skin activation layout changed; patch refused.");
		}
		Label label = generator.DefineLabel();
		list[num2 + 1].labels.Add(label);
		list.InsertRange(num + 1, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[4]
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
			new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(ClientVisualGuards), "HasSkinPart", (Type[])null, (Type[])null)),
			new CodeInstruction(OpCodes.Brfalse, (object)label)
		});
		foreach (CodeInstruction item in list)
		{
			MethodInfo methodInfo2 = item.operand as MethodInfo;
			if (methodInfo2 != null && methodInfo2.DeclaringType == typeof(Component) && methodInfo2.Name == "get_gameObject")
			{
				item.opcode = OpCodes.Call;
				item.operand = AccessTools.Method(typeof(ClientVisualGuards), "SkinObject", (Type[])null, (Type[])null);
			}
		}
		return list;
	}

	public static bool HasSkinPart(Transform part)
	{
		if (Object.op_Implicit((Object)(object)part))
		{
			return true;
		}
		if (missingSkinParts++ < 3)
		{
			Report?.Invoke("Skin activation skipped a transform absent from this model; other skin entries continue.");
		}
		return false;
	}

	public static GameObject SkinObject(Component component)
	{
		return Object.op_Implicit((Object)(object)component) ? component.gameObject : null;
	}
}
public static class ParticleSurfacePolicy
{
	public static bool HasSurface(Vector3[] vertices, int[] triangles)
	{
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: 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_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
		if (vertices == null || triangles == null || vertices.Length < 3 || triangles.Length < 3)
		{
			return false;
		}
		for (int i = 0; i + 2 < triangles.Length; i += 3)
		{
			int num = triangles[i];
			int num2 = triangles[i + 1];
			int num3 = triangles[i + 2];
			if (num < 0 || num2 < 0 || num3 < 0 || num >= vertices.Length || num2 >= vertices.Length || num3 >= vertices.Length)
			{
				throw new ArgumentException("Invalid mesh triangle index");
			}
			Vector3 val = Vector3.Cross(vertices[num2] - vertices[num], vertices[num3] - vertices[num]);
			if (val.x != 0f || val.y != 0f || val.z != 0f)
			{
				return true;
			}
		}
		return false;
	}
}
public static class HudProcAndPingSupport
{
	private static ManualLogSource log;

	private static FieldInfo definitions;

	private static Func<float, float, float> lucky;

	private static Func<CharacterBody, float> luckOf;

	private static readonly Dictionary<string, Sprite> icons = new Dictionary<string, Sprite>(StringComparer.Ordinal);

	private static readonly Dictionary<string, Sprite> resolvedNames = new Dictionary<string, Sprite>(StringComparer.Ordinal);

	private static string[] keys = new string[0];

	public static void Install(Harmony harmony, ManualLogSource logger)
	{
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Expected O, but got Unknown
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Expected O, but got Unknown
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Expected O, but got Unknown
		log = logger;
		CleanupLifecycleGuards.Install(harmony, logger);
		ShrineDroneGuards.Install(harmony, logger);
		try
		{
			Type type = AccessTools.TypeByName("LookingGlass.StatsDisplay.StatsDisplayClass");
			definitions = AccessTools.Field(type, "statDictionary");
			Type type2 = AccessTools.TypeByName("LookingGlass.Utils");
			lucky = (Func<float, float, float>)Delegate.CreateDelegate(typeof(Func<float, float, float>), AccessTools.Method(type2, "CalculateChanceWithLuck", new Type[2]
			{
				typeof(float),
				typeof(float)
			}, (Type[])null));
			luckOf = (Func<CharacterBody, float>)Delegate.CreateDelegate(typeof(Func<CharacterBody, float>), AccessTools.Method(type2, "GetLuckFromCachedUserBody", new Type[1] { typeof(CharacterBody) }, (Type[])null));
			RegisterStats();
			harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LookingGlass.StatsDisplay.StatsDisplayDefinitions"), "SetupDefs", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HudProcAndPingSupport), "RegisterStats", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			log.LogInfo((object)"Conditional on-hit chance stats registered: zero-chance rows omitted; 1.0-proc hit values with current luck.");
		}
		catch (Exception ex)
		{
			log.LogError((object)("Conditional stat extension unavailable: " + ex.Message));
		}
		try
		{
			Type type3 = AccessTools.TypeByName("PingIconsOverhaul.PingIconsOverhaul");
			if (!(type3 == null))
			{
				harmony.Patch((MethodBase)AccessTools.Method(type3, "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HudProcAndPingSupport), "LoadPingMappings", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				harmony.Patch((MethodBase)AccessTools.Method(typeof(PingIndicator), "GetInteractableIcon", new Type[1] { typeof(GameObject) }, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HudProcAndPingSupport), "ResolvePingIcon", (Type[])null)
				{
					priority = 0
				}, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				log.LogInfo((object)"Custom ping icon resolver installed for prefab variants and child targets; minimap shares the same native resolver.");
			}
		}
		catch (Exception ex2)
		{
			log.LogError((object)("Custom ping resolver unavailable: " + ex2.Message));
		}
	}

	private static void RegisterStats()
	{
		if (!(definitions.GetValue(null) is Dictionary<string, Func<CharacterBody, string>> dictionary))
		{
			throw new InvalidOperationException("LookingGlass stat dictionary changed.");
		}
		dictionary["conditionalProcs"] = ProcText;
	}

	private static int Count(Inventory inventory, ItemDef item)
	{
		return Object.op_Implicit((Object)(object)item) ? inventory.GetItemCountEffective(item) : 0;
	}

	private static float Roll(float percent, float luck)
	{
		return lucky(Mathf.Clamp01(percent / 100f), luck) * 100f;
	}

	private static string ProcText(CharacterBody body)
	{
		if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory))
		{
			return "";
		}
		Inventory inventory = body.inventory;
		float luck = luckOf(body);
		float num = Roll(body.bleedChance, luck);
		if (Count(inventory, Items.BleedOnHitAndExplode) > 0)
		{
			num = ProcHudPolicy.UnionPercent(num, Roll(body.crit, luck));
		}
		int num2 = Count(inventory, Items.BleedOnHitVoid);
		if (body.HasBuff(Buffs.EliteVoid))
		{
			num2 += 10;
		}
		int num3 = Count(inventory, Items.Missile);
		List<KeyValuePair<string, float>> list = new List<KeyValuePair<string, float>>();
		list.Add(new KeyValuePair<string, float>("Bleed", num));
		list.Add(new KeyValuePair<string, float>("Collapse", Roll((float)num2 * 10f, luck)));
		list.Add(new KeyValuePair<string, float>("Sticky bomb", Roll((float)Count(inventory, Items.StickyBomb) * 5f, luck)));
		list.Add(new KeyValuePair<string, float>("Missile", (num3 > 0) ? Roll(10f, luck) : 0f));
		list.Add(new KeyValuePair<string, float>("Plasma shrimp", (num3 == 0 && Count(inventory, Items.MissileVoid) > 0 && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.shield > 0f) ? 100f : 0f));
		list.Add(new KeyValuePair<string, float>("Ukulele", (Count(inventory, Items.ChainLightning) > 0) ? Roll(25f, luck) : 0f));
		list.Add(new KeyValuePair<string, float>("Polylute", (Count(inventory, Items.ChainLightningVoid) > 0) ? Roll(25f, luck) : 0f));
		list.Add(new KeyValuePair<string, float>("Charged perforator", (Count(inventory, Items.LightningStrikeOnHit) > 0) ? Roll(10f, luck) : 0f));
		if (Count(inventory, Items.IgniteOnKill) > 0)
		{
			list.Add(new KeyValuePair<string, float>("Burn on kill", 100f));
		}
		return ProcHudPolicy.Format(list);
	}

	private static void LoadPingMappings()
	{
		try
		{
			Type type = AccessTools.TypeByName("PingIconsOverhaul.PingIconsOverhaul");
			object? value = AccessTools.Field(type, "bundle").GetValue(null);
			AssetBundle val = (AssetBundle)((value is AssetBundle) ? value : null);
			IDictionary dictionary = AccessTools.Field(type, "INTERACTABLES").GetValue(null) as IDictionary;
			if (!Object.op_Implicit((Object)(object)val) || dictionary == null)
			{
				throw new InvalidOperationException("Ping icon assets not available.");
			}
			icons.Clear();
			resolvedNames.Clear();
			List<string> list = new List<string>();
			foreach (DictionaryEntry item in dictionary)
			{
				string text = item.Key as string;
				string text2 = (string)item.Value.GetType().GetField("texName").GetValue(item.Value);
				Sprite val2 = val.LoadAsset<Sprite>(text2);
				if (Object.op_Implicit((Object)(object)val2))
				{
					icons[text] = val2;
				}
				else
				{
					list.Add(text + "=" + text2);
				}
			}
			keys = icons.Keys.OrderByDescending((string k) => k.Length).ThenBy<string, string>((string k) => k, StringComparer.Ordinal).ToArray();
			log.LogInfo((object)("Custom ping/map icon audit: " + icons.Count + " mappings available; missing=" + list.Count + ". Halcyon stage variants use texShrineHalcyonIcon."));
			if (list.Count > 0)
			{
				log.LogWarning((object)("Missing ping art: " + string.Join(", ", list)));
			}
		}
		catch (Exception ex)
		{
			log.LogError((object)("Ping icon mapping audit failed: " + ex.Message));
		}
	}

	private static void ResolvePingIcon(GameObject __0, ref Sprite __result)
	{
		if (!Object.op_Implicit((Object)(object)__0) || keys.Length == 0)
		{
			return;
		}
		Transform val = __0.transform;
		int num = 0;
		while (Object.op_Implicit((Object)(object)val) && num < 12)
		{
			string name = ((Object)val).name;
			if (!resolvedNames.TryGetValue(name, out var value))
			{
				string text = PingVariantPolicy.FindKey(name, keys);
				value = ((text == null) ? null : icons[text]);
				if (resolvedNames.Count > 2048)
				{
					resolvedNames.Clear();
				}
				resolvedNames[name] = value;
			}
			if (Object.op_Implicit((Object)(object)value))
			{
				__result = value;
				break;
			}
			num++;
			val = val.parent;
		}
	}
}
public static class PingVariantPolicy
{
	public static string FindKey(string name, IEnumerable<string> keys)
	{
		if (string.IsNullOrEmpty(name))
		{
			return null;
		}
		string text = null;
		foreach (string key in keys)
		{
			if (string.IsNullOrEmpty(key) || !name.StartsWith(key, StringComparison.Ordinal))
			{
				continue;
			}
			if (name.Length != key.Length)
			{
				char c = name[key.Length];
				if (c != '(' && c != '_' && c != ' ')
				{
					continue;
				}
			}
			if (text == null || key.Length > text.Length)
			{
				text = key;
			}
		}
		return text;
	}
}
public static class ProcHudPolicy
{
	public static string EffectColor(string effect)
	{
		return effect switch
		{
			"Bleed" => "#FF6464", 
			"Collapse" => "#D291FF", 
			"Sticky bomb" => "#FFC46B", 
			"Missile" => "#A8DD83", 
			"Plasma shrimp" => "#E293FF", 
			"Ukulele" => "#78DFFF", 
			"Polylute" => "#BF9BFF", 
			"Charged perforator" => "#FFE477", 
			"Burn on kill" => "#FF9A59", 
			_ => "#F5C96B", 
		};
	}

	public static float UnionPercent(float first, float second)
	{
		return 100f * (1f - (1f - Math.Min(100f, Math.Max(0f, first)) / 100f) * (1f - Math.Min(100f, Math.Max(0f, second)) / 100f));
	}

	public static string Format(IEnumerable<KeyValuePair<string, float>> rows)
	{
		StringBuilder stringBuilder = new StringBuilder();
		int num = 0;
		foreach (KeyValuePair<string, float> row in rows)
		{
			if (!float.IsNaN(row.Value) && !float.IsInfinity(row.Value) && !(row.Value <= 0f))
			{
				if (num++ == 0)
				{
					stringBuilder.Append("<size=80%>On-hit chances (1.0 proc, luck applied)</size>\n");
				}
				float num2 = Math.Min(100f, row.Value);
				stringBuilder.Append(row.Key).Append(": <color=").Append(EffectColor(row.Key))
					.Append(">")
					.Append((num2 < 0.01f) ? "<0.01" : num2.ToString("0.##", CultureInfo.InvariantCulture))
					.Append("%</color>\n");
			}
		}
		return stringBuilder.ToString();
	}
}
public static class CleanupLifecycleGuards
{
	private static ManualLogSource log;

	private static bool reportedHead;

	private static bool reportedTag;

	public static void Install(Harmony harmony, ManualLogSource logger)
	{
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_013c: Expected O, but got Unknown
		log = logger;
		try
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(MeridianEventTriggerInteraction), "ResetPMHeadState", Type.EmptyTypes, (Type[])null);
			if (methodInfo == null || AccessTools.Field(typeof(MeridianEventTriggerInteraction), "colossusHeadStateMachine") == null)
			{
				throw new MissingMemberException("Meridian head reset layout changed.");
			}
			harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(CleanupLifecycleGuards), "HeadResetReady", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			log.LogInfo((object)"Meridian cleanup guard installed: only missing/destroying head state machines are skipped; healthy reset behavior retained.");
		}
		catch (Exception ex)
		{
			log.LogError((object)("Meridian cleanup guard unavailable: " + ex.Message));
		}
		try
		{
			MethodInfo methodInfo2 = AccessTools.Method(typeof(ViewableTag), "Refresh", Type.EmptyTypes, (Type[])null);
			if (methodInfo2 == null || AccessTools.Field(typeof(ViewableTag), "tagPrefab") == null || AccessTools.Field(typeof(ViewableTag), "tagInstance") == null)
			{
				throw new MissingMemberException("ViewableTag layout changed.");
			}
			harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(CleanupLifecycleGuards), "ViewableRefreshReady", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			log.LogInfo((object)"Viewable marker guard installed: creation waits for a valid prefab; existing marker cleanup and viewed/unlock state remain native.");
		}
		catch (Exception ex2)
		{
			log.LogError((object)("Viewable marker guard unavailable: " + ex2.Message));
		}
	}

	public static bool HeadResetReady(MeridianEventTriggerInteraction __instance, EntityStateMachine ___colossusHeadStateMachine)
	{
		bool owner = Object.op_Implicit((Object)(object)__instance);
		bool flag = Object.op_Implicit((Object)(object)___colossusHeadStateMachine);
		bool flag2 = CleanupLifecyclePolicy.AllowHeadReset(owner, flag, flag && ___colossusHeadStateMachine.state != null, flag && ___colossusHeadStateMachine.destroying);
		if (!flag2 && !reportedHead)
		{
			reportedHead = true;
			ManualLogSource obj = log;
			if (obj != null)
			{
				obj.LogInfo((object)"Skipped stale Meridian head reset during object/state teardown.");
			}
		}
		return flag2;
	}

	public static bool ViewableRefreshReady(ViewableTag __instance, GameObject ___tagPrefab, GameObject ___tagInstance)
	{
		bool flag = CleanupLifecyclePolicy.AllowViewableRefresh(Object.op_Implicit((Object)(object)__instance), Object.op_Implicit((Object)(object)___tagPrefab), Object.op_Implicit((Object)(object)___tagInstance));
		if (!flag && !reportedTag)
		{
			reportedTag = true;
			ManualLogSource obj = log;
			if (obj != null)
			{
				obj.LogInfo((object)"Deferred NEW marker refresh: instance/prefab no longer available. Native OnDisable/TriggerView still run.");
			}
		}
		return flag;
	}
}
public static class CleanupLifecyclePolicy
{
	public static bool AllowHeadReset(bool owner, bool machine, bool state, bool destroying)
	{
		return owner && machine && state && !destroying;
	}

	public static bool AllowViewableRefresh(bool owner, bool prefab, bool existingTag)
	{
		return owner && (prefab || existingTag);
	}
}
public static class ShrineDroneGuards
{
	private static ManualLogSource log;

	private static bool reportedTether;

	private static bool reportedExplosion;

	private static readonly FieldInfo root = typeof(SacrificeSuccess).GetField("tetherRootTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo end = typeof(SacrificeSuccess).GetField("tetherEffectEndTransform", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private static readonly FieldInfo allies = typeof(SacrificeSuccess).GetField("alliesToRapture", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	public static void Install(Harmony harmony, ManualLogSource logger)
	{
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Expected O, but got Unknown
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Expected O, but got Unknown
		log = logger;
		try
		{
			if (root == null || end == null || allies == null)
			{
				throw new MissingFieldException("Sacrifice tether layout changed.");
			}
			harmony.Patch((MethodBase)AccessTools.Method(typeof(SacrificeSuccess), "FixedUpdate", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ShrineDroneGuards), "GuardTether", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			log.LogInfo((object)"Sacrifice tether guard installed: missing visual endpoints skip only tether positioning; native sacrifice and state progression retained.");
		}
		catch (Exception ex)
		{
			log.LogError((object)("Sacrifice tether guard unavailable: " + ex.Message));
		}
		try
		{
			harmony.Patch((MethodBase)AccessTools.Method(typeof(DroneBallShootableController), "OnTakeDamageServer", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ShrineDroneGuards), "GuardExplosion", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			log.LogInfo((object)"Drone ball explosion guard installed: stale explosion components no longer receive radius/lifetime writes; healthy values and damage storage unchanged.");
		}
		catch (Exception ex2)
		{
			log.LogError((object)("Drone ball explosion guard unavailable: " + ex2.Message));
		}
	}

	public static IEnumerable<CodeInstruction> GuardTether(IEnumerable<CodeInstruction> source)
	{
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Expected O, but got Unknown
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		for (int i = 0; i < list.Count - 1; i++)
		{
			FieldInfo fieldInfo = list[i].operand as FieldInfo;
			MethodInfo methodInfo = list[i + 1].operand as MethodInfo;
			if (!(list[i].opcode != OpCodes.Ldfld) && !(fieldInfo == null) && !(fieldInfo.DeclaringType != typeof(SacrificeSuccess)) && !(fieldInfo.Name != "tetherEffectInstance") && !(methodInfo == null) && !(methodInfo.Name != "op_Implicit") && num++ == 0)
			{
				CodeInstruction val = new CodeInstruction(OpCodes.Ldarg_0, (object)null);
				val.labels.AddRange(list[i + 1].labels);
				list[i + 1].labels.Clear();
				val.blocks.AddRange(list[i + 1].blocks);
				list[i + 1].blocks.Clear();
				list[i + 1].opcode = OpCodes.Call;
				list[i + 1].operand = typeof(ShrineDroneGuards).GetMethod("TetherReady");
				list.Insert(i + 1, val);
				i++;
			}
		}
		if (num != 2)
		{
			throw new InvalidOperationException("Expected visual and cleanup tether checks, found " + num);
		}
		return list;
	}

	public static bool TetherReady(GameObject effect, SacrificeSuccess state)
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		if (!Object.op_Implicit((Object)(object)effect))
		{
			return false;
		}
		GameObject[] array = allies.GetValue(state) as GameObject[];
		bool flag = ShrineDronePolicy.CanPositionTether(effect: true, Object.op_Implicit((Object)(Transform)root.GetValue(state)), Object.op_Implicit((Object)(Transform)end.GetValue(state)), (array != null) ? array.Length : 0, array != null && array.Length != 0 && Object.op_Implicit((Object)(object)array[0]));
		if (!flag && !reportedTether)
		{
			reportedTether = true;
			ManualLogSource obj = log;
			if (obj != null)
			{
				obj.LogInfo((object)"Skipped missing sacrifice tether endpoint; native timer and sacrifice continue.");
			}
		}
		return flag;
	}

	public static IEnumerable<CodeInstruction> GuardExplosion(IEnumerable<CodeInstruction> source)
	{
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		int num2 = 0;
		foreach (CodeInstruction item in list)
		{
			MethodInfo methodInfo = item.operand as MethodInfo;
			FieldInfo fieldInfo = item.operand as FieldInfo;
			if (item.opcode == OpCodes.Callvirt && methodInfo != null && methodInfo.DeclaringType == typeof(ProjectileExplosion) && methodInfo.Name == "SetExplosionRadius")
			{
				item.opcode = OpCodes.Call;
				item.operand = typeof(ShrineDroneGuards).GetMethod("SetRadiusIfPresent");
				num++;
			}
			if (item.opcode == OpCodes.Stfld && fieldInfo != null && fieldInfo.Name == "lifetime" && fieldInfo.DeclaringType == typeof(ProjectileImpactExplosion))
			{
				item.opcode = OpCodes.Call;
				item.operand = typeof(ShrineDroneGuards).GetMethod("SetLifetimeIfPresent");
				num2++;
			}
		}
		if (num != 1 || num2 != 1)
		{
			throw new InvalidOperationException("Drone ball layout changed: radius=" + num + ", lifetime=" + num2);
		}
		return list;
	}

	public static void SetRadiusIfPresent(ProjectileExplosion explosion, float radius)
	{
		if (Object.op_Implicit((Object)(object)explosion))
		{
			explosion.SetExplosionRadius(radius);
		}
		else
		{
			ReportExplosion();
		}
	}

	public static void SetLifetimeIfPresent(ProjectileImpactExplosion explosion, float lifetime)
	{
		if (Object.op_Implicit((Object)(object)explosion))
		{
			explosion.lifetime = lifetime;
		}
		else
		{
			ReportExplosion();
		}
	}

	private static void ReportExplosion()
	{
		if (!reportedExplosion)
		{
			reportedExplosion = true;
			ManualLogSource obj = log;
			if (obj != null)
			{
				obj.LogInfo((object)"Skipped drone ball radius/lifetime update after its explosion component disappeared.");
			}
		}
	}
}
public static class ShrineDronePolicy
{
	public static bool CanPositionTether(bool effect, bool root, bool end, int targetCount, bool firstAlive)
	{
		return effect && root && end && targetCount > 0 && firstAlive;
	}
}

plugins/ParlaysPack/Repairs/ClientSideRepairs-SkinCompatibility/SkinCompatibility.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("ClientSideRepairs.SkinCompatibility", "Client Side Skin Compatibility", "1.0.0")]
public class SkinCompatibility : BaseUnityPlugin
{
	private IEnumerator Start()
	{
		while (!((ResourceAvailability)(ref SkinCatalog.availability)).available || !((ResourceAvailability)(ref SurvivorCatalog.availability)).available)
		{
			yield return null;
		}
		int synced = 0;
		foreach (SurvivorDef def in SurvivorCatalog.allSurvivorDefs)
		{
			if (!Object.op_Implicit((Object)(object)def) || !Object.op_Implicit((Object)(object)def.bodyPrefab) || !Object.op_Implicit((Object)(object)def.displayPrefab))
			{
				continue;
			}
			SkinDef[] skins = SkinCatalog.GetBodySkinDefs(BodyCatalog.FindBodyIndex(def.bodyPrefab));
			if (skins == null || skins.Length == 0)
			{
				continue;
			}
			ModelSkinController[] componentsInChildren = def.displayPrefab.GetComponentsInChildren<ModelSkinController>(true);
			foreach (ModelSkinController ctl in componentsInChildren)
			{
				if (!ctl.skins.SequenceEqual(skins))
				{
					ctl.skins = skins;
					synced++;
				}
			}
			SkinDef[] array = skins;
			foreach (SkinDef skin in array)
			{
				if (!Object.op_Implicit((Object)(object)skin) || ((Object)skin).name != "AnakinMerc" || !Object.op_Implicit((Object)(object)skin.skinDefParams) || !Object.op_Implicit((Object)(object)skin.rootObject))
				{
					continue;
				}
				Renderer[] renderers = skin.rootObject.GetComponentsInChildren<Renderer>(true);
				Renderer body = ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MercMesh"));
				Renderer sword = ((IEnumerable<Renderer>)renderers).FirstOrDefault((Func<Renderer, bool>)((Renderer r) => ((Object)r).name == "MercSwordMesh"));
				if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)sword))
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"Anakin renderer repair skipped: expected Mercenary renderers missing.");
					continue;
				}
				SkinDefParams p = skin.skinDefParams;
				if (p.meshReplacements == null || p.meshReplacements.Length != 2 || p.rendererInfos == null || p.rendererInfos.Length != 2)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"Anakin repair skipped: unexpected skin layout.");
					continue;
				}
				for (int i2 = 0; i2 < 2; i2++)
				{
					p.meshReplacements[i2].renderer = ((i2 == 0) ? body : sword);
					p.rendererInfos[i2].renderer = ((i2 == 0) ? body : sword);
					if (skin.meshReplacements != null && skin.meshReplacements.Length == 2)
					{
						skin.meshReplacements[i2].renderer = ((i2 == 0) ? body : sword);
					}
					if (skin.rendererInfos != null && skin.rendererInfos.Length == 2)
					{
						skin.rendererInfos[i2].renderer = ((i2 == 0) ? body : sword);
					}
				}
				typeof(SkinDef).GetField("_runtimeSkin", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(skin, null);
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Repaired Anakin body and lightsaber renderer bindings.");
			}
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)("Synchronized " + synced + " survivor display skin lists with SkinCatalog. Client-side cosmetics only."));
	}
}

plugins/ParlaysPack/Repairs/LocalMods-ClientFPS/ClientFPS.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("LocalMods.ClientFPS", "Client FPS", "1.0.1")]
public sealed class ClientFPS : BaseUnityPlugin
{
	private ConfigEntry<bool> visible;

	private ConfigEntry<int> size;

	private ConfigEntry<int> margin;

	private ConfigEntry<float> interval;

	private ConfigEntry<KeyboardShortcut> toggle;

	private ConfigEntry<bool> right;

	private readonly Stopwatch clock = Stopwatch.StartNew();

	private double lastSample;

	private double nextProbe;

	private int frames;

	private int lastState = int.MinValue;

	private uint previousCount;

	private bool haveCount;

	private bool warned;

	private FieldInfo stateField;

	private FieldInfo countField;

	private static readonly FieldInfo hudCanvasField = typeof(HUD).GetField("canvas", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

	private GameObject overlay;

	private TextMeshProUGUI text;

	private string label = "Game: measuring...";

	private void Awake()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected O, but got Unknown
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Expected O, but got Unknown
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		visible = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "Enabled", true, "Show the FPS overlay.");
		right = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "TopRight", false, "Anchor to the top right; false uses top left.");
		size = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "FontSize", 20, new ConfigDescription("Text size at 1080p; scales with the screen.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(12, 48), Array.Empty<object>()));
		margin = ((BaseUnityPlugin)this).Config.Bind<int>("Display", "Margin", 12, new ConfigDescription("Distance from screen edges.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 200), Array.Empty<object>()));
		interval = ((BaseUnityPlugin)this).Config.Bind<float>("Display", "RefreshSeconds", 0.5f, new ConfigDescription("Measurement window; lower values fluctuate more.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 2f), Array.Empty<object>()));
		toggle = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Display", "ToggleKey", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "Toggle this counter.");
		lastSample = clock.Elapsed.TotalSeconds;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Client FPS ready. Game FPS uses real time; FG output uses SDK presentation counts, never an estimated multiplier. F9 toggles.");
	}

	private void Probe(double now)
	{
		if (now < nextProbe)
		{
			return;
		}
		nextProbe = now + 5.0;
		Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
		foreach (Assembly assembly in assemblies)
		{
			Type type = assembly.GetType("RiskOfRainUpscaling.NativeApi", throwOnError: false);
			if (!(type == null))
			{
				stateField = type.GetField("FrameGenerationState", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				countField = type.GetField("FrameGenerationPresentedFrames", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				break;
			}
		}
	}

	private void Update()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		KeyboardShortcut value = toggle.Value;
		if (((KeyboardShortcut)(ref value)).IsDown())
		{
			visible.Value = !visible.Value;
		}
		double totalSeconds = clock.Elapsed.TotalSeconds;
		frames++;
		double num = totalSeconds - lastSample;
		if (num < (double)interval.Value)
		{
			return;
		}
		double num2 = (double)frames / num;
		string text = "FG: unavailable";
		try
		{
			if (stateField == null || countField == null)
			{
				Probe(totalSeconds);
			}
			Delegate obj = ((stateField == null) ? null : (stateField.GetValue(null) as Delegate));
			Delegate obj2 = ((countField == null) ? null : (countField.GetValue(null) as Delegate));
			if ((object)obj != null && (object)obj2 != null)
			{
				int num3 = (int)obj.DynamicInvoke();
				uint current = (uint)(int)obj2.DynamicInvoke();
				if (num3 == 3)
				{
					double num4 = PresentationRate.Measure(previousCount, current, num, haveCount && lastState == 3);
					text = ((!double.IsNaN(num4)) ? ("Output: " + Math.Round(num4).ToString("0") + " FPS (FG)") : "Output: measuring... (FG)");
				}
				else
				{
					text = ((num3 == 2) ? "FG: waiting for gameplay" : ((num3 == 1) ? "FG: restart/startup pending" : ((num3 < 0) ? "FG: error" : "FG: off")));
				}
				previousCount = current;
				lastState = num3;
				haveCount = true;
			}
			else
			{
				haveCount = false;
				lastState = int.MinValue;
			}
		}
		catch (Exception ex)
		{
			haveCount = false;
			lastState = int.MinValue;
			text = "FG: unavailable";
			if (!warned)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Optional upscaler telemetry unavailable: " + ex.GetType().Name));
				warned = true;
			}
		}
		label = "Game: " + Math.Round(num2).ToString("0") + " FPS  |  " + (1000.0 / num2).ToString("0.0") + " ms\n" + text;
		lastSample = totalSeconds;
		frames = 0;
		Draw();
	}

	private void Draw()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: Expected O, but got Unknown
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_0322: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_032c: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_0372: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		TMP_FontAsset defaultLanguageFont = HGTextMeshProUGUI.defaultLanguageFont;
		if (!Object.op_Implicit((Object)(object)defaultLanguageFont))
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)overlay))
		{
			overlay = new GameObject("Client FPS Overlay", new Type[3]
			{
				typeof(RectTransform),
				typeof(Canvas),
				typeof(CanvasScaler)
			});
			Object.DontDestroyOnLoad((Object)(object)overlay);
			Canvas component = overlay.GetComponent<Canvas>();
			component.renderMode = (RenderMode)0;
			component.sortingOrder = 32760;
			CanvasScaler component2 = overlay.GetComponent<CanvasScaler>();
			component2.uiScaleMode = (ScaleMode)1;
			component2.referenceResolution = new Vector2(1920f, 1080f);
			component2.matchWidthOrHeight = 1f;
			GameObject val = new GameObject("FPS", new Type[2]
			{
				typeof(RectTransform),
				typeof(TextMeshProUGUI)
			});
			val.transform.SetParent(overlay.transform, false);
			text = val.GetComponent<TextMeshProUGUI>();
			((Graphic)text).raycastTarget = false;
			((TMP_Text)text).richText = false;
			((TMP_Text)text).enableWordWrapping = false;
			((Graphic)text).color = new Color(0.9f, 0.9f, 0.87f);
			((TMP_Text)text).font = defaultLanguageFont;
			((TMP_Text)text).outlineColor = new Color32((byte)15, (byte)18, (byte)23, byte.MaxValue);
			((TMP_Text)text).outlineWidth = 0.18f;
		}
		overlay.SetActive(visible.Value);
		Camera val2 = null;
		foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList)
		{
			Canvas val3 = (Canvas)((Object.op_Implicit((Object)(object)readOnlyInstance) && hudCanvasField != null) ? /*isinst with value type is only supported in some contexts*/: null);
			if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.worldCamera) && ((Behaviour)val3.worldCamera).isActiveAndEnabled)
			{
				val2 = val3.worldCamera;
				break;
			}
		}
		Canvas component3 = overlay.GetComponent<Canvas>();
		if (Object.op_Implicit((Object)(object)val2))
		{
			overlay.layer = 5;
			((Component)text).gameObject.layer = 5;
			component3.renderMode = (RenderMode)1;
			component3.worldCamera = val2;
			component3.planeDistance = val2.nearClipPlane + 0.1f;
			component3.targetDisplay = val2.targetDisplay;
		}
		else
		{
			component3.renderMode = (RenderMode)0;
			component3.worldCamera = null;
			if (Object.op_Implicit((Object)(object)Run.instance))
			{
				overlay.SetActive(false);
			}
		}
		RectTransform rectTransform = ((TMP_Text)text).rectTransform;
		Vector2 val4 = default(Vector2);
		((Vector2)(ref val4))..ctor((float)(right.Value ? 1 : 0), 1f);
		rectTransform.pivot = val4;
		Vector2 anchorMin = (rectTransform.anchorMax = val4);
		rectTransform.anchorMin = anchorMin;
		rectTransform.anchoredPosition = new Vector2((float)(right.Value ? (-margin.Value) : margin.Value), (float)(-margin.Value));
		rectTransform.sizeDelta = new Vector2(700f, (float)(size.Value * 3));
		((TMP_Text)text).fontSize = size.Value;
		((TMP_Text)text).alignment = (TextAlignmentOptions)(right.Value ? 260 : 257);
		((TMP_Text)text).text = label;
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)overlay))
		{
			Object.Destroy((Object)(object)overlay);
		}
	}
}
public static class PresentationRate
{
	public static double Measure(uint previous, uint current, double seconds, bool continuous)
	{
		if (!continuous || seconds <= 0.0 || double.IsNaN(seconds) || double.IsInfinity(seconds))
		{
			return double.NaN;
		}
		uint num = current - previous;
		double num2 = (double)num / seconds;
		return (num != 0 && num2 < 10000.0) ? num2 : double.NaN;
	}
}

plugins/ParlaysPack/Repairs/LocalMods-CombinedRuntimeSupport/CombinedRuntimeSupport.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.SurvivorMannequins;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("LocalMods.CombinedRuntimeSupport", "Combined Content Runtime Support", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class CombinedRuntimeSupport : BaseUnityPlugin
{
	private static readonly MethodInfo Alive = AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null);

	private static PropertyInfo survivor;

	private static FieldInfo loadout;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Expected O, but got Unknown
		Harmony val = new Harmony("LocalMods.CombinedRuntimeSupport");
		Patch(val, "Thiccify.ThiccMod", "MakeThicc", "GuardMesh");
		Patch(val, "MSU.ItemTierModule", "DestroyCustomModel", "GuardCleanup");
		Patch(val, "LookingGlass.ItemStatsNameSpace.ItemStats", "ItemPinged", "GuardRemotePing");
		Type typeFromHandle = typeof(SurvivorMannequinSlotController);
		survivor = AccessTools.Property(typeFromHandle, "currentSurvivorDef");
		loadout = AccessTools.Field(typeFromHandle, "currentLoadout");
		if (survivor == null || loadout == null)
		{
			throw new MissingMemberException("Mannequin state layout changed");
		}
		val.Patch((MethodBase)AccessTools.Method(typeFromHandle, "ApplyLoadoutToMannequinInstance", (Type[])null, (Type[])null), new HarmonyMethod(typeof(CombinedRuntimeSupport), "PreviewReady", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Installed mesh availability, item-display cleanup, local ping notification and lobby preview guards.");
	}

	private static void Patch(Harmony h, string type, string method, string transpiler)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		Type type2 = AccessTools.TypeByName(type);
		if (!(type2 == null))
		{
			MethodInfo methodInfo = AccessTools.Method(type2, method, (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				throw new MissingMethodException(type, method);
			}
			h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(CombinedRuntimeSupport), transpiler, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}

	private static bool PreviewReady(object __instance)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Expected O, but got Unknown
		return Object.op_Implicit((Object)(SurvivorDef)survivor.GetValue(__instance, null)) && loadout.GetValue(__instance) != null;
	}

	public static IEnumerable<CodeInstruction> GuardMesh(IEnumerable<CodeInstruction> source, ILGenerator gen)
	{
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Expected O, but got Unknown
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Expected O, but got Unknown
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Expected O, but got Unknown
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		for (int i = 0; i < list.Count - 2; i++)
		{
			MethodInfo methodInfo = list[i].operand as MethodInfo;
			if (!(methodInfo == null) && !(methodInfo.DeclaringType != typeof(SkinnedMeshRenderer)) && !(methodInfo.Name != "get_sharedMesh") && CodeInstructionExtensions.IsStloc(list[i + 1], (LocalBuilder)null))
			{
				CodeInstruction val = list[i + 2];
				if (CodeInstructionExtensions.IsLdloc(val, (LocalBuilder)null))
				{
					Label label = gen.DefineLabel();
					list.Last().labels.Add(label);
					list.InsertRange(i + 2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[3]
					{
						new CodeInstruction(val.opcode, val.operand),
						new CodeInstruction(OpCodes.Call, (object)Alive),
						new CodeInstruction(OpCodes.Brfalse, (object)label)
					});
					num++;
					break;
				}
			}
		}
		if (num != 1)
		{
			throw new InvalidOperationException("Thiccify mesh layout changed; refusing patch");
		}
		return list;
	}

	public static IEnumerable<CodeInstruction> GuardCleanup(IEnumerable<CodeInstruction> source, ILGenerator gen)
	{
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Expected O, but got Unknown
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Expected O, but got Unknown
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Expected O, but got Unknown
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Expected O, but got Unknown
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Expected O, but got Unknown
		List<CodeInstruction> list = source.ToList();
		int num = 0;
		Type helper = AccessTools.TypeByName("MSU.ItemTierPickupDisplayHelper");
		LocalBuilder localBuilder = gen.DeclareLocal(helper);
		for (int i = 0; i < list.Count; i++)
		{
			MethodInfo methodInfo = list[i].operand as MethodInfo;
			if (!(methodInfo == null) && !(methodInfo.Name != "EnsureComponent"))
			{
				list[i].operand = typeof(GameObject).GetMethods().Single((MethodInfo x) => x.Name == "GetComponent" && x.IsGenericMethodDefinition && x.GetParameters().Length == 0).MakeGenericMethod(helper);
				list[i].opcode = OpCodes.Callvirt;
				list.Insert(i + 1, new CodeInstruction(OpCodes.Stloc, (object)localBuilder));
				int num2 = list.FindIndex(i + 2, (CodeInstruction x) => (x.operand as MethodInfo)?.DeclaringType == helper && (x.operand as MethodInfo)?.Name == "DestroyCustomModel");
				if (num2 < 0)
				{
					throw new InvalidOperationException("MSU cleanup call missing");
				}
				Label label = gen.DefineLabel();
				list.Last().labels.Add(label);
				list.InsertRange(num2, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[4]
				{
					new CodeInstruction(OpCodes.Ldloc, (object)localBuilder),
					new CodeInstruction(OpCodes.Call, (object)Alive),
					new CodeInstruction(OpCodes.Brfalse, (object)label),
					new CodeInstruction(OpCodes.Ldloc, (object)localBuilder)
				});
				num++;
				break;
			}
		}
		if (num != 1)
		{
			throw new InvalidOperationException("MSU cleanup layout changed; refusing patch");
		}
		return list;
	}

	public static void LocalPickupNotification(CharacterMaster master, UniquePickup pickup)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)master) && ((NetworkBehaviour)master).hasAuthority)
		{
			CharacterMasterNotificationQueue.PushPickupNotification(master, pickup);
		}
	}

	public static IEnumerable<CodeInstruction> GuardRemotePing(IEnumerable<CodeInstruction> source)
	{
		int count = 0;
		foreach (CodeInstruction c in source)
		{
			MethodInfo m = c.operand as MethodInfo;
			if (m != null && m.DeclaringType == typeof(CharacterMasterNotificationQueue) && m.Name == "PushPickupNotification" && m.GetParameters().Length == 2)
			{
				c.operand = AccessTools.Method(typeof(CombinedRuntimeSupport), "LocalPickupNotification", (Type[])null, (Type[])null);
				count++;
			}
			yield return c;
		}
		if (count != 1)
		{
			throw new InvalidOperationException("LookingGlass ping layout changed; refusing patch");
		}
	}
}

plugins/ParlaysPack/Repairs/LocalMods-SkinPortraits/SkinPortraits.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("LocalMods.SkinPortraits", "Skin Portraits for Ally Cards", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class SkinPortraits : BaseUnityPlugin
{
	internal static SkinPortraits Instance;

	internal ConfigEntry<bool> portraitsEnabled;

	private readonly Dictionary<string, Texture2D> cache = new Dictionary<string, Texture2D>();

	private Harmony harmony;

	private void Awake()
	{
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		Instance = this;
		portraitsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Use model portraits for non-default survivor skins on ally cards. No model or network changes.");
		harmony = new Harmony("LocalMods.SkinPortraits");
		harmony.Patch((MethodBase)AccessTools.Method(typeof(AllyCardController), "UpdateInfo", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SkinPortraits), "AfterCard", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Skin portraits ready. Isolated mesh snapshots only; original character renderers are never modified.");
	}

	private static void AfterCard(AllyCardController __instance)
	{
		if (Object.op_Implicit((Object)(object)Instance) && Instance.portraitsEnabled.Value && Object.op_Implicit((Object)(object)__instance) && !Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<PortraitCard>()))
		{
			((Component)__instance).gameObject.AddComponent<PortraitCard>();
		}
	}

	internal Texture2D Get(string key)
	{
		Texture2D value;
		return cache.TryGetValue(key, out value) ? value : null;
	}

	internal Texture2D Capture(string key, CharacterBody body)
	{
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0310: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_031a: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0323: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0364: Expected O, but got Unknown
		//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0404: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_0416: Unknown result type (might be due to invalid IL or missing references)
		//IL_041b: Unknown result type (might be due to invalid IL or missing references)
		//IL_042d: Unknown result type (might be due to invalid IL or missing references)
		//IL_042f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0464: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Expected O, but got Unknown
		//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_051b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0522: Expected O, but got Unknown
		//IL_0538: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Expected O, but got Unknown
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Expected O, but got Unknown
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		if (cache.Count >= 32)
		{
			return null;
		}
		Transform val = (Object.op_Implicit((Object)(object)body.modelLocator) ? body.modelLocator.modelTransform : null);
		if (!Object.op_Implicit((Object)(object)val))
		{
			return null;
		}
		Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>();
		List<Mesh> list = new List<Mesh>();
		GameObject val2 = null;
		RenderTexture val3 = null;
		Texture2D val4 = null;
		RenderTexture active = RenderTexture.active;
		try
		{
			val2 = new GameObject("Temporary Skin Portrait");
			val2.transform.position = new Vector3(0f, -10000f, 0f);
			Bounds val5 = default(Bounds);
			bool flag = false;
			Renderer[] array = componentsInChildren;
			foreach (Renderer val6 in array)
			{
				if (!val6.enabled || !((Component)val6).gameObject.activeInHierarchy || val6 is ParticleSystemRenderer || val6 is TrailRenderer || val6 is LineRenderer)
				{
					continue;
				}
				Mesh val7 = null;
				SkinnedMeshRenderer val8 = (SkinnedMeshRenderer)(object)((val6 is SkinnedMeshRenderer) ? val6 : null);
				if (Object.op_Implicit((Object)(object)val8) && Object.op_Implicit((Object)(object)val8.sharedMesh))
				{
					val7 = new Mesh();
					list.Add(val7);
					val8.BakeMesh(val7);
				}
				else
				{
					MeshFilter component = ((Component)val6).GetComponent<MeshFilter>();
					if (Object.op_Implicit((Object)(object)component))
					{
						val7 = component.sharedMesh;
					}
				}
				if (Object.op_Implicit((Object)(object)val7) && val7.vertexCount != 0)
				{
					GameObject val9 = new GameObject("Portrait Mesh", new Type[2]
					{
						typeof(MeshFilter),
						typeof(MeshRenderer)
					});
					val9.layer = 31;
					val9.transform.SetParent(val2.transform, false);
					val9.transform.localPosition = ((Component)val6).transform.position - ((Component)body).transform.position;
					val9.transform.rotation = ((Component)val6).transform.rotation;
					val9.transform.localScale = ((Component)val6).transform.lossyScale;
					val9.GetComponent<MeshFilter>().sharedMesh = val7;
					MeshRenderer component2 = val9.GetComponent<MeshRenderer>();
					((Renderer)component2).sharedMaterials = val6.sharedMaterials;
					((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
					((Renderer)component2).receiveShadows = false;
					if (!flag)
					{
						val5 = ((Renderer)component2).bounds;
						flag = true;
					}
					else
					{
						((Bounds)(ref val5)).Encapsulate(((Renderer)component2).bounds);
					}
				}
			}
			if (!flag || ((Bounds)(ref val5)).size.y < 0.05f)
			{
				return null;
			}
			float y = ((Bounds)(ref val5)).size.y;
			Vector3 val10 = default(Vector3);
			((Vector3)(ref val10))..ctor(((Bounds)(ref val5)).center.x, ((Bounds)(ref val5)).max.y - y * 0.28f, ((Bounds)(ref val5)).center.z);
			Vector3 val11 = Vector3.ProjectOnPlane(((Component)body).transform.forward, Vector3.up);
			Vector3 val12 = ((Vector3)(ref val11)).normalized;
			if (((Vector3)(ref val12)).sqrMagnitude < 0.5f)
			{
				val12 = Vector3.forward;
			}
			GameObject val13 = new GameObject("Portrait Camera", new Type[1] { typeof(Camera) });
			val13.transform.SetParent(val2.transform, false);
			Camera component3 = val13.GetComponent<Camera>();
			((Behaviour)component3).enabled = false;
			component3.clearFlags = (CameraClearFlags)2;
			component3.backgroundColor = new Color(0.12f, 0.15f, 0.18f, 1f);
			component3.cullingMask = int.MinValue;
			component3.orthographic = true;
			component3.orthographicSize = y * 0.31f;
			component3.nearClipPlane = 0.01f;
			component3.farClipPlane = y * 8f + 10f;
			((Component)component3).transform.position = val10 + val12 * (y * 2f + 1f);
			((Component)component3).transform.LookAt(val10, Vector3.up);
			component3.allowHDR = false;
			component3.allowMSAA = false;
			GameObject val14 = new GameObject("Portrait Light", new Type[1] { typeof(Light) });
			val14.transform.SetParent(val2.transform, false);
			Light component4 = val14.GetComponent<Light>();
			component4.type = (LightType)1;
			component4.intensity = 1.3f;
			component4.cullingMask = int.MinValue;
			component4.shadows = (LightShadows)0;
			((Component)component4).transform.rotation = Quaternion.LookRotation(-val12 + Vector3.down * 0.5f);
			val3 = (component3.targetTexture = RenderTexture.GetTemporary(192, 192, 24, (RenderTextureFormat)0));
			component3.Render();
			RenderTexture.active = val3;
			val4 = new Texture2D(192, 192, (TextureFormat)3, false);
			val4.ReadPixels(new Rect(0f, 0f, 192f, 192f), 0, 0);
			val4.Apply(false, true);
			((Object)val4).name = "SkinPortrait_" + key;
			cache.Add(key, val4);
			return val4;
		}
		catch (Exception ex)
		{
			if (Object.op_Implicit((Object)(object)val4))
			{
				Object.Destroy((Object)(object)val4);
			}
			((BaseUnityPlugin)this).Logger.LogWarning((object)("Using standard portrait for " + key + ": " + ex.GetType().Name));
			return null;
		}
		finally
		{
			RenderTexture.active = active;
			if (Object.op_Implicit((Object)(object)val2))
			{
				val2.SetActive(false);
				Object.Destroy((Object)(object)val2);
			}
			if (Object.op_Implicit((Object)(object)val3))
			{
				RenderTexture.ReleaseTemporary(val3);
			}
			foreach (Mesh item in list)
			{
				Object.Destroy((Object)(object)item);
			}
		}
	}

	private void OnDestroy()
	{
		Harmony obj = harmony;
		if (obj != null)
		{
			obj.UnpatchSelf();
		}
		foreach (Texture2D value in cache.Values)
		{
			if (Object.op_Implicit((Object)(object)value))
			{
				Object.Destroy((Object)(object)value);
			}
		}
		cache.Clear();
		Instance = null;
	}
}
public sealed class PortraitCard : MonoBehaviour
{
	private AllyCardController card;

	private CharacterBody lastBody;

	private uint lastSkin;

	private string key;

	private float readyAt;

	private float nextCheck;

	private int attempts;

	private Texture applied;

	private void Awake()
	{
		card = ((Component)this).GetComponent<AllyCardController>();
	}

	private void LateUpdate()
	{
		SkinPortraits instance = SkinPortraits.Instance;
		if (!Object.op_Implicit((Object)(object)card) || !Object.op_Implicit((Object)(object)card.portraitIconImage))
		{
			return;
		}
		if (!Object.op_Implicit((Object)(object)instance) || !instance.portraitsEnabled.Value)
		{
			Restore();
			return;
		}
		CharacterMaster sourceMaster = card.sourceMaster;
		if (!Object.op_Implicit((Object)(object)sourceMaster) || !Object.op_Implicit((Object)(object)sourceMaster.playerCharacterMasterController))
		{
			return;
		}
		CharacterBody body = sourceMaster.GetBody();
		if (!Object.op_Implicit((Object)(object)body))
		{
			return;
		}
		if (body.skinIndex == 0)
		{
			Restore();
			lastBody = null;
			return;
		}
		if ((Object)(object)body != (Object)(object)lastBody || body.skinIndex != lastSkin)
		{
			lastBody = body;
			lastSkin = body.skinIndex;
			attempts = 0;
			readyAt = Time.unscaledTime + 2f;
			key = ((object)Unsafe.As<BodyIndex, BodyIndex>(ref body.bodyIndex)/*cast due to .constrained prefix*/).ToString() + ":" + lastSkin;
		}
		Texture2D val = instance.Get(key);
		if (!Object.op_Implicit((Object)(object)val) && Time.unscaledTime >= readyAt && Time.unscaledTime >= nextCheck && attempts < 3)
		{
			nextCheck = Time.unscaledTime + 2f;
			attempts++;
			val = instance.Capture(key, body);
		}
		if (Object.op_Implicit((Object)(object)val))
		{
			card.portraitIconImage.texture = (Texture)(object)val;
			((Behaviour)card.portraitIconImage).enabled = true;
			applied = (Texture)(object)val;
		}
	}

	private void Restore()
	{
		if (Object.op_Implicit((Object)(object)card) && Object.op_Implicit((Object)(object)card.portraitIconImage) && Object.op_Implicit((Object)(object)applied))
		{
			CharacterBody val = (Object.op_Implicit((Object)(object)card.sourceMaster) ? card.sourceMaster.GetBody() : null);
			if (Object.op_Implicit((Object)(object)val) && (Object)(object)card.portraitIconImage.texture == (Object)(object)applied)
			{
				card.portraitIconImage.texture = val.portraitIcon;
			}
			applied = null;
		}
	}

	private void OnDestroy()
	{
		Restore();
	}
}