Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of GrappleVelocityFix v1.0.0
GrappleVelocityFix.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Dolso; using Dolso.RiskofOptions; using HG.Reflection; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Projectile; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GrappleVelocityFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e31184d200db35a2ef867104b4486f0f3b2776af")] [assembly: AssemblyProduct("GrappleVelocityFix")] [assembly: AssemblyTitle("GrappleVelocityFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Dolso { internal static class log { private static ManualLogSource logger; internal static void start(ManualLogSource logSource) { logger = logSource; } internal static void start(string name) { logger = Logger.CreateLogSource(name); } internal static void debug(object data) { logger.LogDebug(data); } internal static void info(object data) { logger.LogInfo(data); } internal static void message(object data) { logger.LogMessage(data); } internal static void warning(object data) { logger.LogWarning(data); } internal static void error(object data) { logger.LogError(data); } internal static void fatal(object data) { logger.LogFatal(data); } internal static void LogError(this ILCursor c, object data) { logger.LogError((object)string.Format($"ILCursor failure: {data}\n{c}")); } internal static void LogErrorCaller(this ILCursor c, object data, [CallerMemberName] string callerName = "") { logger.LogError((object)string.Format($"ILCursor failure in {callerName}: {data}\n{c}")); } } internal static class HookManager { internal const BindingFlags allFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly List<IDetour> hooks = new List<IDetour>(); private static ILHookConfig ilHookConfig = new ILHookConfig { ManualApply = true }; private static HookConfig onHookConfig = new HookConfig { ManualApply = true }; internal static void Hook(Type typeFrom, string methodFrom, Manipulator ilHook) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown try { ILHook val = new ILHook((MethodBase)GetMethod(typeFrom, methodFrom), ilHook, ref ilHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply ILHook: {val.Method.DeclaringType}.{val.Method.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make ILHook {typeFrom}.{methodFrom} - {((Delegate)(object)ilHook).Method.Name}\n{ex2}"); } } internal static void Hook(MethodBase methodFrom, Manipulator ilHook) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown try { ILHook val = new ILHook(methodFrom, ilHook, ref ilHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply ILHook: {val.Method.DeclaringType}.{val.Method.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make ILHook {methodFrom.DeclaringType}.{methodFrom.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex2}"); } } internal static void Hook(Delegate from, Manipulator ilHook) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown try { ILHook val = new ILHook((MethodBase)from.Method, ilHook, ref ilHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply ILHook: {val.Method.DeclaringType}.{val.Method.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make ILHook {from.Method.DeclaringType}.{from.Method.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex2}"); } } internal static void Hook<T>(Expression<Action<T>> from, Manipulator ilHook) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown MethodInfo method = ((MethodCallExpression)from.Body).Method; try { ILHook val = new ILHook((MethodBase)method, ilHook, ref ilHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply ILHook: {val.Method.DeclaringType}.{val.Method.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make ILHook: {method.DeclaringType}.{method.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex2}"); } } internal static void Hook(Type typeFrom, string methodFrom, Delegate onHook) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown try { Hook val = new Hook((MethodBase)GetMethod(typeFrom, methodFrom), onHook, ref onHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply onHook: {val.Method.DeclaringType}.{val.Method.Name} - {onHook.Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make onHook {typeFrom}.{methodFrom} - {onHook.Method.Name}\n{ex2}"); } } internal static void Hook(MethodInfo methodFrom, MethodInfo onHook) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown try { Hook val = new Hook((MethodBase)methodFrom, onHook, ref onHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply onHook: {val.Method.DeclaringType}.{val.Method.Name} - {val.Target.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make onHook {methodFrom.DeclaringType}.{methodFrom.Name} - {onHook.Name}\n{ex2}"); } } internal static void Hook(MethodBase methodFrom, Delegate onHook) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown try { Hook val = new Hook(methodFrom, onHook, ref onHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply onHook: {val.Method.DeclaringType}.{val.Method.Name} - {onHook.Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make onHook {methodFrom.DeclaringType}.{methodFrom.Name} - {onHook.Method.Name}\n{ex2}"); } } internal static void Hook(Delegate from, Delegate onHook) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown try { Hook val = new Hook((MethodBase)from.Method, onHook, ref onHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply onHook: {val.Method.DeclaringType}.{val.Method.Name} - {onHook.Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make onHook {from.Method.DeclaringType}.{from.Method.Name} - {onHook.Method.Name}\n{ex2}"); } } internal static void Hook<T>(Expression<Action<T>> from, Delegate onto) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown try { Hook val = new Hook((MethodBase)((MethodCallExpression)from.Body).Method, onto, ref onHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply onHook: {val.Method.DeclaringType}.{val.Method.Name} - {onto.Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make onHook {((MethodCallExpression)from.Body).Method.DeclaringType}.{((MethodCallExpression)from.Body).Method.Name} - {onto.Method.Name}\n{ex2}"); } } internal static void Hook(Type typeFrom, string methodFrom, Delegate onHook, object instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown try { Hook val = new Hook((MethodBase)GetMethod(typeFrom, methodFrom), onHook.Method, instance, ref onHookConfig); try { val.Apply(); hooks.Add((IDetour)(object)val); } catch (Exception ex) { log.error($"Failed to apply onHook: {val.Method.DeclaringType}.{val.Method.Name} - {onHook.Method.Name}\n{ex}"); } } catch (Exception ex2) { log.error($"Failed to make onHook {typeFrom}.{methodFrom} - {onHook.Method.Name}\n{ex2}"); } } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, Func<bool> enabled, Type typeFrom, string methodFrom, Manipulator ilHook) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown try { configEntry.AddHookConfig<T>(enabled, (IDetour)new ILHook((MethodBase)GetMethod(typeFrom, methodFrom), ilHook, ref ilHookConfig)); } catch (Exception ex) { log.error($"Failed to ILHook {typeFrom}.{methodFrom} - {((Delegate)(object)ilHook).Method.Name}\n{ex}"); } } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, Func<bool> enabled, MethodBase methodFrom, Manipulator ilHook) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown try { configEntry.AddHookConfig<T>(enabled, (IDetour)new ILHook(methodFrom, ilHook, ref ilHookConfig)); } catch (Exception ex) { log.error($"Failed to ILHook {methodFrom.DeclaringType}.{methodFrom.Name} - {((Delegate)(object)ilHook).Method.Name}\n{ex}"); } } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, Func<bool> enabled, Type typeFrom, string methodFrom, Delegate onHook) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown try { configEntry.AddHookConfig<T>(enabled, (IDetour)new Hook((MethodBase)GetMethod(typeFrom, methodFrom), onHook, ref onHookConfig)); } catch (Exception ex) { log.error($"Failed to onHook {typeFrom}.{methodFrom} - {onHook.Method.Name}\n{ex}"); } } internal static void HookConfig<T>(this ConfigEntry<T> configEntry, Func<bool> enabled, MethodBase methodFrom, Delegate onHook) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown try { configEntry.AddHookConfig<T>(enabled, (IDetour)new Hook(methodFrom, onHook, ref onHookConfig)); } catch (Exception ex) { log.error($"Failed to onHook {methodFrom.DeclaringType}.{methodFrom.Name} - {onHook.Method.Name}\n{ex}"); } } internal static void HookConfig(this ConfigEntry<bool> configEntry, Type typeFrom, string methodFrom, Manipulator ilHook) { configEntry.HookConfig<bool>(() => configEntry.Value, typeFrom, methodFrom, ilHook); } internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase methodFrom, Manipulator ilHook) { configEntry.HookConfig<bool>(() => configEntry.Value, methodFrom, ilHook); } internal static void HookConfig(this ConfigEntry<bool> configEntry, Type typeFrom, string methodFrom, Delegate onHook) { configEntry.HookConfig<bool>(() => configEntry.Value, typeFrom, methodFrom, onHook); } internal static void HookConfig(this ConfigEntry<bool> configEntry, MethodBase methodFrom, Delegate onHook) { configEntry.HookConfig<bool>(() => configEntry.Value, methodFrom, onHook); } private static void AddHookConfig<T>(this ConfigEntry<T> configEntry, Func<bool> enabled, IDetour detour) { hooks.Add(detour); configEntry.SettingChanged += delegate { UpdateHook(detour, enabled()); }; if (enabled()) { detour.Apply(); } } private static void UpdateHook(IDetour hook, bool enabled) { if (enabled) { if (!hook.IsApplied) { hook.Apply(); } } else if (hook.IsApplied) { hook.Undo(); } } internal static void PriorityFirst() { ilHookConfig.Before = new string[1] { "*" }; onHookConfig.Before = new string[1] { "*" }; } internal static void PriorityLast() { ilHookConfig.After = new string[1] { "*" }; onHookConfig.After = new string[1] { "*" }; } internal static void PriorityNormal() { ilHookConfig.Before = null; onHookConfig.Before = null; ilHookConfig.After = null; onHookConfig.After = null; } internal static IDetour ManualDetour(Type typeFrom, string methodFrom, Delegate onHook) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown try { return (IDetour)new Hook((MethodBase)GetMethod(typeFrom, methodFrom), onHook, ref onHookConfig); } catch (Exception ex) { log.error($"Failed to make onHook {typeFrom}.{methodFrom} - {onHook.Method.Name}\n{ex}"); } return null; } private static MethodInfo GetMethod(Type typeFrom, string methodFrom) { IEnumerable<MethodInfo> source = from predicate in typeFrom.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where predicate.Name == methodFrom select predicate; if (source.Count() == 0) { throw new Exception($"Failed to find method: {typeFrom}.{methodFrom}"); } if (source.Count() > 1) { throw new AmbiguousMatchException($"{source.Count()} ambiguous matches found for: {typeFrom}.{methodFrom}"); } return source.First(); } } } namespace Dolso.RiskofOptions { internal static class RiskofOptions { internal const string rooGuid = "com.rune580.riskofoptions"; internal static bool enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); internal static void SetSprite(Sprite sprite) { ModSettingsManager.SetModIcon(sprite); } internal static void SetSpriteDefaultIcon() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); string path = ((!(directoryInfo.Name == "plugins")) ? directoryInfo.FullName : directoryInfo.Parent.FullName); Texture2D val = new Texture2D(256, 256); if (ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(path, "icon.png")))) { ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } else { log.error("Failed to load icon.png"); } } internal static void AddBool(ConfigEntry<bool> entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, new CheckBoxConfig { description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddBool(ConfigEntry<bool> entry, string categoryName, string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, new CheckBoxConfig { category = categoryName, name = name, description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddBool(ConfigEntry<bool> entry, string categoryName) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, new CheckBoxConfig { category = categoryName, description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddEnum<T>(ConfigEntry<T> entry) where T : Enum { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, new ChoiceConfig { description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddColor(ConfigEntry<Color> entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new ColorOption(entry, new ColorOptionConfig { description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddKey(ConfigEntry<KeyboardShortcut> entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry, new KeyBindConfig { description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddFloat(ConfigEntry<float> entry, float min, float max, string format = "{0:f2}") { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig { min = min, max = max, formatString = format, description = ((ConfigEntryBase)(object)entry).DescWithDefault(format) })); } internal static void AddFloat(ConfigEntry<float> entry, string categoryName, float min, float max, string format = "{0:f2}") { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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) //IL_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig { min = min, max = max, formatString = format, category = categoryName, description = ((ConfigEntryBase)(object)entry).DescWithDefault(format) })); } internal static void AddFloatField(ConfigEntry<float> entry, float min = float.MinValue, float max = float.MaxValue, string format = "{0:f2}") { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown FloatFieldConfig val = new FloatFieldConfig(); ((NumericFieldConfig<float>)val).Min = min; ((NumericFieldConfig<float>)val).Max = max; ((BaseOptionConfig)val).description = ((ConfigEntryBase)(object)entry).DescWithDefault(format); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(entry, val)); } internal static void AddInt(ConfigEntry<int> entry, int min = int.MinValue, int max = int.MaxValue) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown IntFieldConfig val = new IntFieldConfig(); ((NumericFieldConfig<int>)val).Min = min; ((NumericFieldConfig<int>)val).Max = max; ((BaseOptionConfig)val).description = ((ConfigEntryBase)(object)entry).DescWithDefault(); ModSettingsManager.AddOption((BaseOption)new IntFieldOption(entry, val)); } internal static void AddIntSlider(ConfigEntry<int> entry, int min, int max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig { min = min, max = max, description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddIntSlider(ConfigEntry<int> entry, string categoryName, int min, int max) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, new IntSliderConfig { min = min, max = max, category = categoryName, description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddString(ConfigEntry<string> entry) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(entry, new InputFieldConfig { submitOn = (SubmitEnum)6, lineType = (LineType)0, description = ((ConfigEntryBase)(object)entry).DescWithDefault() })); } internal static void AddOption(ConfigEntry<bool> entry) { AddBool(entry); } internal static void AddOption(ConfigEntry<bool> entry, string categoryName, string name) { AddBool(entry, categoryName, name); } internal static void AddOption(ConfigEntry<bool> entry, string categoryName) { AddBool(entry, categoryName); } internal static void AddOption<T>(ConfigEntry<T> entry) where T : Enum { AddEnum<T>(entry); } internal static void AddOption(ConfigEntry<Color> entry) { AddColor(entry); } internal static void AddOption(ConfigEntry<KeyboardShortcut> entry) { AddKey(entry); } internal static void AddOption(ConfigEntry<int> entry) { AddInt(entry); } internal static void AddOption(ConfigEntry<string> entry) { AddString(entry); } private static string DescWithDefault(this ConfigEntryBase entry) { return $"{entry.Description.Description}\n[Default: {entry.DefaultValue}]"; } private static string DescWithDefault(this ConfigEntryBase entry, string format) { return string.Format("{1}\n[Default: " + format + "]", entry.DefaultValue, entry.Description.Description); } } } namespace GrappleVelocityFix { internal class Config { private static ConfigFile configFile; public static ConfigEntry<bool> enabled; internal static void DoConfig(ConfigFile bepConfigFile) { configFile = bepConfigFile; enabled = configFile.Bind<bool>("", "Enabled", true, "If fix should be applied"); if (RiskofOptions.enabled) { DoRiskOfOptions(); } } internal static void DoRiskOfOptions() { RiskofOptions.SetSpriteDefaultIcon(); RiskofOptions.AddOption(enabled); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void ReloadConfig(ConCommandArgs args) { if (enabled.Value) { Debug.Log((object)"<color=green>Disabled GrappleVelocityFix</color>"); } else { Debug.Log((object)"<color=red>Enabled GrappleVelocityFix</color>"); } enabled.Value = !enabled.Value; } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("dolso.GrappleVelocityFix", "GrappleVelocityFix", "1.0.0")] public class GrappleVelocityFixPlugin : BaseUnityPlugin { private void Awake() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown log.start(((BaseUnityPlugin)this).Logger); Config.DoConfig(((BaseUnityPlugin)this).Config); Config.enabled.HookConfig(typeof(GripState), "FixedUpdateBehavior", new Manipulator(IL_Grapple_FixedUpdateBehavior_ReplaceFixedDeltaTime)); Config.enabled.HookConfig(typeof(YankState), "FixedUpdateBehavior", new Manipulator(IL_Grapple_FixedUpdateBehavior_ReplaceFixedDeltaTime)); Config.enabled.HookConfig(typeof(ReturnState), "FixedUpdateBehavior", new Manipulator(IL_Grapple_FixedUpdateBehavior_ReplaceFixedDeltaTime)); } private static void IL_Grapple_FixedUpdateBehavior_ReplaceFixedDeltaTime(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0020: 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) //IL_004b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); while (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction a) => ILPatternMatchingExt.MatchCallOrCallvirt(a, typeof(Time), "get_fixedDeltaTime") })) { ILCursor obj = val.Clone(); int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Pop); obj.Emit(OpCodes.Call, (MethodBase)typeof(Time).GetMethod("get_deltaTime")); obj.Emit(OpCodes.Br, (object)val.MarkLabel()); } } } }