Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of SeekersPatcher v1.4.1
BepInEx/patchers/SeekersPatcher/SeekersPatcher.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SeekersPatcher")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+28250b19ab0a8958d724f2cade6606c818e5d0b1")] [assembly: AssemblyProduct("SeekersPatcher")] [assembly: AssemblyTitle("SeekersPatcher")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace _SeekersPatcher { public static class _SeekersPatcher { internal static class Logger { private static readonly ManualLogSource logSource = Logger.CreateLogSource("SeekersPatcher"); public static void Info(object data) { logSource.LogInfo(data); } public static void Error(object data) { logSource.LogError(data); } public static void Warn(object data) { logSource.LogWarning(data); } public static void Fatal(object data) { logSource.LogFatal(data); } public static void Message(object data) { logSource.LogMessage(data); } public static void Debug(object data) { logSource.LogDebug(data); } } private const string RoR2 = "RoR2"; private const string RoR2UI = "RoR2.UI"; private const string RoR2Projectile = "RoR2.Projectile"; private const string RoR2Skills = "RoR2.Skills"; private static ModuleDefinition ror2; public static IEnumerable<string> TargetDLLs { get { yield return "RoR2.dll"; } } public static void Patch(AssemblyDefinition assemblyDef) { object obj; if (assemblyDef == null) { obj = null; } else { AssemblyNameDefinition name = assemblyDef.Name; obj = ((name != null) ? ((AssemblyNameReference)name).Name : null); } if (!((string?)obj != "RoR2")) { ror2 = assemblyDef.MainModule; PatchMissingFields(); PatchSuicide(); PatchProjectileFire(); ror2 = null; } } private static void PatchMissingFields() { TypeDefinition type = ror2.GetType("RoR2.DLC2Content/Items"); TypeDefinition type2 = ror2.GetType("RoR2", "ItemDef"); AddField(type, (TypeReference)(object)type2, "NegateAttack", (FieldAttributes)22); AddField(type, (TypeReference)(object)type2, "LowerHealthHigherDamage", (FieldAttributes)22); AddField(type, (TypeReference)(object)type2, "GoldOnStageStart", (FieldAttributes)22); AddField(type, (TypeReference)(object)type2, "ResetChests", (FieldAttributes)22); TypeDefinition type3 = ror2.GetType("RoR2.DLC2Content/Buffs"); TypeDefinition type4 = ror2.GetType("RoR2", "BuffDef"); AddField(type3, (TypeReference)(object)type4, "LowerHealthHigherDamageBuff", (FieldAttributes)22); TypeDefinition type5 = ror2.GetType("RoR2", "BulletAttack"); TypeDefinition type6 = ror2.GetType("RoR2", "EffectData"); TypeReference fieldTypeRef2 = ror2.ImportReference(typeof(bool)); AddField(type5, (TypeReference)(object)type6, "_EffectData", (FieldAttributes)22); AddField(type5, fieldTypeRef2, "_UsePools", (FieldAttributes)22); TypeDefinition type7 = ror2.GetType("RoR2", "PlayerCharacterMasterController"); AddField(type7, fieldTypeRef2, "wasClaimed", (FieldAttributes)6); TypeDefinition type8 = ror2.GetType("RoR2", "Inventory"); TypeReference fieldTypeRef3 = ror2.ImportReference(typeof(int[])); AddField(type8, fieldTypeRef3, "itemStacks", (FieldAttributes)6); TypeDefinition type9 = ror2.GetType("RoR2.PickupPickerController/Option"); TypeDefinition type10 = ror2.GetType("RoR2", "PickupIndex"); AddField(type9, (TypeReference)(object)type10, "pickupIndex", (FieldAttributes)6); TypeDefinition type11 = ror2.GetType("RoR2", "ShopTerminalBehavior"); AddField(type11, (TypeReference)(object)type10, "pickupIndex", (FieldAttributes)6); TypeDefinition type12 = ror2.GetType("RoR2", "GenericPickupController"); AddField(type12, (TypeReference)(object)type10, "pickupIndex", (FieldAttributes)6); TypeDefinition type13 = ror2.GetType("RoR2", "CharacterModel"); TypeReference fieldTypeRef4 = ror2.ImportReference(typeof(int)); AddField(type13, fieldTypeRef4, "invisibilityCount", (FieldAttributes)6); static void AddField(TypeDefinition typeDef, TypeReference fieldTypeRef, string fieldName, FieldAttributes attr) { //IL_005b: 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_006c: Expected O, but got Unknown if (((IEnumerable<FieldDefinition>)typeDef.Fields).Any((FieldDefinition f) => ((MemberReference)f).Name == fieldName && ((MemberReference)((FieldReference)f).FieldType).Name == ((MemberReference)fieldTypeRef).Name)) { Logger.Warn(fieldName + " already exists in " + ((MemberReference)typeDef).FullName); } else { typeDef.Fields.Add(new FieldDefinition(fieldName, attr, fieldTypeRef)); Logger.Debug("Added " + ((MemberReference)((IEnumerable<FieldDefinition>)typeDef.Fields).Last()).FullName); } } } private static void PatchSuicide() { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) string name = "Suicide"; TypeDefinition tdDamageType = ror2.GetType("RoR2", "DamageType"); TypeDefinition type = ror2.GetType("RoR2", "DamageTypeCombo"); TypeDefinition type2 = ror2.GetType("RoR2", "HealthComponent"); TypeReference val = ror2.ImportReference(typeof(GameObject)); TypeReference val2 = ror2.ImportReference(typeof(void)); if (((IEnumerable<MethodDefinition>)type2.Methods).Any((MethodDefinition m) => ((MemberReference)m).Name == name && ((MethodReference)m).HasParameters && ((MethodReference)m).Parameters.Count == 3 && ((MemberReference)((ParameterReference)((IEnumerable<ParameterDefinition>)((MethodReference)m).Parameters).Last()).ParameterType).Name == ((MemberReference)tdDamageType).Name)) { Logger.Warn(name + " exists, abort patch"); return; } MethodDefinition val3 = ((IEnumerable<MethodDefinition>)type2.Methods).First((MethodDefinition m) => ((MemberReference)m).Name == name); MethodDefinition val4 = ((IEnumerable<MethodDefinition>)type.Methods).First((MethodDefinition m) => ((MemberReference)m).Name == "op_Implicit" && ((MethodReference)m).HasParameters && ((MethodReference)m).Parameters.Count == 1 && ((MemberReference)((ParameterReference)((MethodReference)m).Parameters[0]).ParameterType).Name == ((MemberReference)tdDamageType).Name); MethodDefinition val5 = new MethodDefinition(name, (MethodAttributes)6, val2); ((MethodReference)val5).Parameters.Add(new ParameterDefinition(val)); ((MethodReference)val5).Parameters.Add(new ParameterDefinition(val)); ((MethodReference)val5).Parameters.Add(new ParameterDefinition((TypeReference)(object)tdDamageType)); ILProcessor iLProcessor = val5.Body.GetILProcessor(); iLProcessor.Emit(OpCodes.Ldarg_0); iLProcessor.Emit(OpCodes.Ldarg_1); iLProcessor.Emit(OpCodes.Ldarg_2); iLProcessor.Emit(OpCodes.Ldarg_3); iLProcessor.Emit(OpCodes.Call, (MethodReference)(object)val4); iLProcessor.Emit(OpCodes.Callvirt, (MethodReference)(object)val3); iLProcessor.Emit(OpCodes.Ret); type2.Methods.Add(val5); Logger.Debug(((MemberReference)val5).FullName); } private static void PatchProjectileFire() { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) string name = "FireProjectile"; TypeDefinition type = ror2.GetType("RoR2.Projectile", "ProjectileManager"); TypeDefinition type2 = ror2.GetType("RoR2", "DamageColorIndex"); TypeReference val = ror2.ImportReference(typeof(Vector3)); TypeReference val2 = ror2.ImportReference(typeof(Quaternion)); TypeReference val3 = ror2.ImportReference(typeof(GameObject)); TypeReference val4 = ror2.ImportReference(typeof(void)); TypeReference val5 = ror2.ImportReference(typeof(float)); TypeReference val6 = ror2.ImportReference(typeof(bool)); if (((IEnumerable<MethodDefinition>)type.Methods).Any((MethodDefinition m) => ((MemberReference)m).Name == name && ((MethodReference)m).HasParameters && ((MethodReference)m).Parameters.Count == 10)) { Logger.Warn(name + " exists, abort patch"); return; } MethodDefinition val7 = ((IEnumerable<MethodDefinition>)type.Methods).First((MethodDefinition m) => ((MemberReference)m).Name == "FireProjectileWithoutDamageType"); MethodDefinition val8 = new MethodDefinition(name, (MethodAttributes)6, val4); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val3)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val2)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val3)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val5)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val5)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val6)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition((TypeReference)(object)type2)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val3)); ((MethodReference)val8).Parameters.Add(new ParameterDefinition(val5)); ILProcessor iLProcessor = val8.Body.GetILProcessor(); iLProcessor.Emit(OpCodes.Ldarg_0); iLProcessor.Emit(OpCodes.Ldarg_1); iLProcessor.Emit(OpCodes.Ldarg_2); iLProcessor.Emit(OpCodes.Ldarg_3); iLProcessor.Emit(OpCodes.Ldarg, 4); iLProcessor.Emit(OpCodes.Ldarg, 5); iLProcessor.Emit(OpCodes.Ldarg, 6); iLProcessor.Emit(OpCodes.Ldarg, 7); iLProcessor.Emit(OpCodes.Ldarg, 8); iLProcessor.Emit(OpCodes.Ldarg, 9); iLProcessor.Emit(OpCodes.Ldarg, 10); iLProcessor.Emit(OpCodes.Callvirt, (MethodReference)(object)val7); iLProcessor.Emit(OpCodes.Ret); type.Methods.Add(val8); Logger.Debug(((MemberReference)val8).FullName); } } }
SeekersPatcherDLL.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using RoR2; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SeekersPatcherDLL")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+28250b19ab0a8958d724f2cade6606c818e5d0b1")] [assembly: AssemblyProduct("SeekersPatcherDLL")] [assembly: AssemblyTitle("SeekersPatcherDLL")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SeekersPatcherDLL { [BepInPlugin("___0pseudopulse.__SeekersPatcherDLL", "__SeekersPatcherDLL", "1.0.0")] public class _0Main : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action<Action<PlayerCharacterMasterController>, PlayerCharacterMasterController> <0>__JumpClaimed; public static Manipulator <1>__InvisibilityGet; public static Manipulator <2>__InvisibilitySet; public static Action<Action<Inventory>, Inventory> <3>__AcquirePools; public static Action<Action<Inventory>, Inventory> <4>__ReleasePools; public static Action<Inventory> <5>__Inventory_onInventoryChangedGlobal; } public const string PluginGUID = "___0pseudopulse.__SeekersPatcherDLL"; public const string PluginAuthor = "___0pseudopulse"; public const string PluginName = "__SeekersPatcherDLL"; public const string PluginVersion = "1.0.0"; public static ManualLogSource ModLogger; private static FieldInfo oldStacksField; private void Awake() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_009f: 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_00aa: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) ModLogger = ((BaseUnityPlugin)this).Logger; oldStacksField = typeof(Inventory).GetFields().FirstOrDefault((FieldInfo f) => f.Name == "itemStacks" && f.FieldType == typeof(int[])); Hook val = new Hook((MethodBase)AccessTools.Method(typeof(PlayerCharacterMasterController), "Update", (Type[])null, (Type[])null), (Delegate)new Action<Action<PlayerCharacterMasterController>, PlayerCharacterMasterController>(JumpClaimed)); MethodInfo methodInfo = AccessTools.PropertyGetter(typeof(CharacterModel), "invisibilityCount"); object obj = <>O.<1>__InvisibilityGet; if (obj == null) { Manipulator val2 = InvisibilityGet; <>O.<1>__InvisibilityGet = val2; obj = (object)val2; } ILHook val3 = new ILHook((MethodBase)methodInfo, (Manipulator)obj); MethodInfo methodInfo2 = AccessTools.PropertySetter(typeof(CharacterModel), "invisibilityCount"); object obj2 = <>O.<2>__InvisibilitySet; if (obj2 == null) { Manipulator val4 = InvisibilitySet; <>O.<2>__InvisibilitySet = val4; obj2 = (object)val4; } ILHook val5 = new ILHook((MethodBase)methodInfo2, (Manipulator)obj2); Hook val6 = new Hook((MethodBase)AccessTools.Method(typeof(Inventory), "AcquirePooledResources", (Type[])null, (Type[])null), (Delegate)new Action<Action<Inventory>, Inventory>(AcquirePools)); Hook val7 = new Hook((MethodBase)AccessTools.Method(typeof(Inventory), "ReleasePooledResources", (Type[])null, (Type[])null), (Delegate)new Action<Action<Inventory>, Inventory>(ReleasePools)); Inventory.onInventoryChangedGlobal += Inventory_onInventoryChangedGlobal; typeof(Items).GetField("NegateAttack").SetValue(null, Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC2_Items_SpeedBoostPickup.SpeedBoostPickup_asset).WaitForCompletion()); typeof(Items).GetField("GoldOnStageStart").SetValue(null, Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC2_Items_BarrageOnBoss.BarrageOnBoss_asset).WaitForCompletion()); typeof(Items).GetField("ResetChests").SetValue(null, Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC2_Items_ItemDropChanceOnKill.ItemDropChanceOnKill_asset).WaitForCompletion()); typeof(Items).GetField("LowerHealthHigherDamage").SetValue(null, Addressables.LoadAssetAsync<ItemDef>((object)RoR2_DLC2_Items_AttackSpeedPerNearbyAllyOrEnemy.AttackSpeedPerNearbyAllyOrEnemy_asset).WaitForCompletion()); typeof(Buffs).GetField("LowerHealthHigherDamageBuff").SetValue(null, Addressables.LoadAssetAsync<BuffDef>((object)RoR2_DLC2.bdAttackSpeedPerNearbyAllyOrEnemyBuff_asset).WaitForCompletion()); } private static void Inventory_onInventoryChangedGlobal(Inventory inventory) { if (oldStacksField?.GetValue(inventory) is int[] array) { inventory.WriteAllPermanentItemStacks((Span<int>)array); } } private static void AcquirePools(Action<Inventory> orig, Inventory self) { orig(self); oldStacksField?.SetValue(self, PerItemBufferPool.Request<int>()); } private static void ReleasePools(Action<Inventory> orig, Inventory self) { orig(self); int[] array = oldStacksField?.GetValue(self) as int[]; if (array != null) { PerItemBufferPool.Return<int>(ref array); } } private static void JumpClaimed(Action<PlayerCharacterMasterController> orig, PlayerCharacterMasterController self) { orig(self); AccessTools.Field(typeof(PlayerCharacterMasterController), "wasClaimed").SetValue(self, self.jumpWasClaimed); } private static void InvisibilityGet(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); FieldReference val2 = default(FieldReference); if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2) })) { ModLogger.LogError((object)"InvisibilityGet failed"); } else { val.Next.Operand = AccessTools.Field(typeof(CharacterModel), "invisibilityCount"); } } private static void InvisibilitySet(ILContext il) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) ILCursor[] array = null; FieldReference val2 = default(FieldReference); FieldReference val = default(FieldReference); if (!new ILCursor(il).TryFindNext(ref array, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref val) })) { ModLogger.LogError((object)"InvisibilitySet failed"); return; } array[0].Next.Operand = AccessTools.Field(typeof(CharacterModel), "invisibilityCount"); array[1].Next.Operand = AccessTools.Field(typeof(CharacterModel), "invisibilityCount"); } } }