Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of TransportToggle v1.0.5
TransportToggle.dll
Decompiled 4 months agousing 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 BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Toolbot; using HarmonyLib; using IL.EntityStates.Toolbot; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Toolbot; using RoR2; using RoR2.Skills; 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("TransportToggle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TransportToggle")] [assembly: AssemblyTitle("TransportToggle")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 TransportToggle { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Jeffdev.TransportToggle", "TransportToggle", "1.0.4")] public class TransportToggle : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnter <>9__11_0; public static Func<Instruction, bool> <>9__11_4; public static Manipulator <>9__11_2; internal void <Awake>b__11_0(orig_OnEnter orig, ToolbotDash self) { orig.Invoke(self); self.duration = 9999f; self.baseDuration = 9999f; } internal void <Awake>b__11_2(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ArmorBoost") })) { val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldsfld, AccessTools.DeclaredField(typeof(Buffs), "SmallArmorBoost")); } else { Log.Error("Failed to find match for Armor Boost!"); } } internal bool <Awake>b__11_4(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ArmorBoost"); } } public const string PluginGUID = "Jeffdev.TransportToggle"; public const string PluginAuthor = "Jeffdev"; public const string PluginName = "TransportToggle"; public const string PluginVersion = "1.0.4"; public bool dashReleased; public bool hasDashStarted; public bool escapedWithShift; public static ConfigEntry<bool> hitEnemyMultipleTimes; public static ConfigEntry<bool> armorChanges; public static ConfigEntry<bool> jumpHeightChanges; public static ConfigEntry<bool> freeToggleTransport; public void Awake() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); armorChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Less Armor In Transport Mode", true, "Changes transport mode to give you less armor (false is vanilla default)"); jumpHeightChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Lower Transport Mode Jump Height", true, "Makes you jump less high in transport mode. (false changes to vanilla jump height)"); freeToggleTransport = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Transport Mode Free Toggle", true, "Allows freely toggling transport mode on or off without cooldown (false is vanilla default)"); object obj = <>c.<>9__11_0; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, ToolbotDash self) { orig.Invoke(self); self.duration = 9999f; self.baseDuration = 9999f; }; <>c.<>9__11_0 = val; obj = (object)val; } ToolbotDash.OnEnter += (hook_OnEnter)obj; ToolbotDash.OnExit += (hook_OnExit)delegate(orig_OnExit orig, ToolbotDash self) { orig.Invoke(self); if (((EntityState)self).isAuthority && freeToggleTransport.Value) { CharacterBody characterBody = ((EntityState)self).characterBody; SkillLocator val4 = ((characterBody != null) ? characterBody.skillLocator : null); if (!((Object)(object)val4 == (Object)null)) { GenericSkill utility = val4.utility; if (!((Object)(object)utility == (Object)null)) { utility.rechargeStopwatch += (escapedWithShift ? (utility.finalRechargeInterval - 0.25f) : 0f); escapedWithShift = false; } } } }; object obj2 = <>c.<>9__11_2; if (obj2 == null) { Manipulator val2 = delegate(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ILCursor val3 = new ILCursor(il); if (val3.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "ArmorBoost") })) { val3.Emit(OpCodes.Pop); val3.Emit(OpCodes.Ldsfld, AccessTools.DeclaredField(typeof(Buffs), "SmallArmorBoost")); } else { Log.Error("Failed to find match for Armor Boost!"); } }; <>c.<>9__11_2 = val2; obj2 = (object)val2; } ToolbotDash.OnEnter += (Manipulator)obj2; ToolbotDash.FixedUpdate += (hook_FixedUpdate)delegate(orig_FixedUpdate orig, ToolbotDash self) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown if (!((EntityState)self).isAuthority) { orig.Invoke(self); } else { SkillDef skillDef = SkillCatalog.GetSkillDef(SkillCatalog.FindSkillIndexByName("ToolbotDash")); if ((Object)(object)skillDef == (Object)null) { Log.Error($"One or more SkillDefs could not be found! Check skill names. {skillDef}"); orig.Invoke(self); } else { if (Object.op_Implicit((Object)(object)((EntityState)self).inputBank) && ((ButtonState)(ref ((EntityState)self).inputBank.skill3)).justReleased) { dashReleased = true; } if (Object.op_Implicit((Object)(object)((EntityState)self).inputBank) && ((ButtonState)(ref ((EntityState)self).inputBank.skill3)).justPressed && dashReleased) { escapedWithShift = true; ((EntityState)self).outer.SetNextStateToMain(); dashReleased = false; } if (Object.op_Implicit((Object)(object)((EntityState)self).inputBank) && ((ButtonState)(ref ((EntityState)self).inputBank.skill4)).justPressed) { SkillLocator skillLocator = ((EntityState)self).skillLocator; if ((Object)(object)skillLocator != (Object)null && (Object)(object)skillLocator.special != (Object)null && skillLocator.special.IsReady()) { escapedWithShift = true; ((EntityState)self).outer.SetNextState((EntityState)new ToolbotDualWieldStart()); } } if ((Object)(object)((EntityState)self).inputBank != (Object)null && (Object)(object)((EntityState)self).characterBody != (Object)null && (Object)(object)((EntityState)self).characterMotor != (Object)null && ((ButtonState)(ref ((EntityState)self).inputBank.jump)).justPressed && !((EntityState)self).inputBank.jump.hasPressBeenClaimed && ((EntityState)self).characterMotor.jumpCount < ((EntityState)self).characterBody.maxJumpCount) { bool num = ((EntityState)self).characterMotor.jumpCount >= ((EntityState)self).characterBody.baseJumpCount; float num2 = (jumpHeightChanges.Value ? 1.25f : 1.5f); float num3 = (jumpHeightChanges.Value ? 0.65f : 1f); float num4 = (num ? num2 : num3); float num5 = (num ? num2 : num3); GenericCharacterMain.ApplyJumpVelocity(((EntityState)self).characterMotor, ((EntityState)self).characterBody, num4, num5, false); CharacterMotor characterMotor = ((EntityState)self).characterMotor; characterMotor.jumpCount++; JumpDelegate onJump = ((EntityState)self).characterBody.onJump; if (onJump != null) { onJump.Invoke(); } ((EntityState)self).inputBank.jump.hasPressBeenClaimed = true; } orig.Invoke(self); } } }; } } }