using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using RoR2; [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("PutZiprailVehicleUnusedFieldNamedSpeedToUse")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PutZiprailVehicleUnusedFieldNamedSpeedToUse")] [assembly: AssemblyTitle("PutZiprailVehicleUnusedFieldNamedSpeedToUse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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; } } } namespace PutZiprailVehicleUnusedFieldNamedSpeedToUse { [Serializable] [BepInPlugin("com.brynzananas.putziprailvehicleunusedfieldnamedspeedtouse", "Put Ziprail Vehicle Unused Field Named Speed To Use", "1.0.0")] public class PutZiprailVehicleUnusedFieldNamedSpeedToUsePlugin : BaseUnityPlugin { [HarmonyPatch] private class Patches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyILManipulator] private static void ZiprailVehicle_movementSpeed(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0067: 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_0093: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "get_speed") })) { ((BaseUnityPlugin)instance).Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!")); return; } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, AccessTools.Field(typeof(ZiprailVehicle), "_speed")); val.Emit(OpCodes.Mul); } } public static PutZiprailVehicleUnusedFieldNamedSpeedToUsePlugin instance; public const string ModGuid = "com.brynzananas.putziprailvehicleunusedfieldnamedspeedtouse"; public const string ModName = "Put Ziprail Vehicle Unused Field Named Speed To Use"; public const string ModVer = "1.0.0"; private static Harmony harmonyPatcher; public void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown instance = this; if (!(typeof(ZiprailVehicle).GetField("_speed") == null)) { ZiprailVehicle.ctor += new hook_ctor(ZiprailVehicle_ctor); harmonyPatcher = new Harmony("com.brynzananas.putziprailvehicleunusedfieldnamedspeedtouse"); harmonyPatcher.CreateClassProcessor(typeof(Patches)).Patch(); } } private void ZiprailVehicle_ctor(orig_ctor orig, ZiprailVehicle self) { orig.Invoke(self); self._speed = 1f; } } }