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 FixedFlyIonSurge v1.0.0
FixedFlyIonSurge.dll
Decompiled 3 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Mage; using IL.EntityStates.Mage; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FixedFlyIonSurge")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FixedFlyIonSurge")] [assembly: AssemblyTitle("FixedFlyIonSurge")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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; } } } namespace FixedFlyIonSurge { [BepInPlugin("Masosu.FixedFlyIonSurge", "FixedFlyIonSurge", "1.0.0")] public class FixedFlyIonSurge : BaseUnityPlugin { public const string PluginGUID = "Masosu.FixedFlyIonSurge"; public const string PluginAuthor = "Masosu"; public const string PluginName = "FixedFlyIonSurge"; public const string PluginVersion = "1.0.0"; private ConfigEntry<float> jumpMultiplierConfig; public void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Log.Info("FixedIonSurge loaded successfully!", "C:\\Users\\Masu\\Documents\\RoR2mod\\ExamplePlugin-main\\ExamplePlugin\\FixedFlyIonSurge.cs", 24); jumpMultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<float>("GeneralSettings", "JumpMultiplier", 1f, "Multiplier applied to the base movement speed to adjust the jump height. Allowed range: 0.5 to 5.0. Default is 1.0."); FlyUpState.HandleMovements += new Manipulator(FlyUp_HandleMovementsIL); } private void FlyUp_HandleMovementsIL(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Func<Instruction, bool> func = IsMoveSpeedFieldInstruction; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { func })) { val.Emit(OpCodes.Ldarg_0); Func<float, FlyUpState, float> func2 = ReplaceSpeedWithBase; val.EmitDelegate<Func<float, FlyUpState, float>>(func2); Log.Info("IL Hook successfully applied!", "C:\\Users\\Masu\\Documents\\RoR2mod\\ExamplePlugin-main\\ExamplePlugin\\FixedFlyIonSurge.cs", 55); } else { Log.Error("IL Hook failed: moveSpeedStat field instruction not found.", "C:\\Users\\Masu\\Documents\\RoR2mod\\ExamplePlugin-main\\ExamplePlugin\\FixedFlyIonSurge.cs", 59); } } private bool IsMoveSpeedFieldInstruction(Instruction instruction) { //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) if (instruction.OpCode == OpCodes.Ldfld) { object operand = instruction.Operand; FieldReference val = (FieldReference)((operand is FieldReference) ? operand : null); if (val != null && ((MemberReference)val).Name == "moveSpeedStat") { return true; } } return false; } private float ReplaceSpeedWithBase(float originalMoveSpeed, FlyUpState stateInstance) { if ((Object)(object)((EntityState)stateInstance).characterBody != (Object)null) { float baseMoveSpeed = ((EntityState)stateInstance).characterBody.baseMoveSpeed; float num = jumpMultiplierConfig.Value; if (num < 0.5f) { num = 0.5f; } if (num > 5f) { num = 5f; } return baseMoveSpeed * num; } return originalMoveSpeed; } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string Format(object data, string file, int line) { string fileName = Path.GetFileName(file); return $"[{fileName}:{line}] {data}"; } internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogDebug((object)Format(data, file, line)); } internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogError((object)Format(data, file, line)); } internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogFatal((object)Format(data, file, line)); } internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogInfo((object)Format(data, file, line)); } internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogMessage((object)Format(data, file, line)); } internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogWarning((object)Format(data, file, line)); } } }