using System.Collections.Generic; using System.Linq; using Mono.Cecil; namespace IcyClawz.CustomInteractions { public static class Prepatch { public static IEnumerable TargetDLLs => new[] { "Assembly-CSharp.dll" }; public static void Patch(ref AssemblyDefinition assembly) { var type = assembly.MainModule.GetType("GClass2816"); // DynamicInteraction if (type != null) { type.IsSealed = false; var field = type.Fields.SingleOrDefault(c => c.Name == "action_0"); if (field != null) { field.IsFamily = true; field.IsInitOnly = false; } var ctor = type.Methods.SingleOrDefault(c => c.Name == ".ctor"); if (ctor != null) { var param = ctor.Parameters.SingleOrDefault(c => c.Name == "callback"); if (param != null) { param.IsOptional = true; param.HasDefault = true; param.Constant = null; } } } //assembly.Write("Assembly-CSharp-CustomInteractions.dll"); } } }