using System;
using System.Collections.Generic;
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 FastLadders.Patches;
using HarmonyLib;
using HarmonyLib.Tools;
using Microsoft.CodeAnalysis;
[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("FastLadders")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Make ladders go fast")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+43206f0475d7dae18e393eaa115cfd192399712f")]
[assembly: AssemblyProduct("FastLadders")]
[assembly: AssemblyTitle("FastLadders")]
[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 FastLadders
{
public class PluginInfo
{
public const string PLUGIN_GUID = "FasterLadders";
public const string PLUGIN_NAME = "FasterLadders";
public const string PLUGIN_VERSION = "1.0";
}
[BepInPlugin("FasterLadders", "FasterLadders", "1.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony;
private static ManualLogSource LogSource;
public static ConfigEntry<float> configSpeedMultiplier;
public Plugin()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
HarmonyFileLog.Enabled = true;
harmony = new Harmony("FasterLadders");
}
private void Awake()
{
LogSource = Logger.CreateLogSource("FasterLadders");
configSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "speedMultiplier", 7f, "Multiplier applied to the extension and falling speeds of the ladder.");
harmony.PatchAll(typeof(ExtensionLadderPatch));
LogSource.LogInfo((object)"Plugin FasterLadders is loaded!");
}
public static void Log(string message)
{
LogSource.LogInfo((object)message);
}
}
}
namespace FastLadders.Patches
{
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
internal class ExtensionLadderPatch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
int num = 2;
List<CodeInstruction> list = new List<CodeInstruction>();
foreach (CodeInstruction instruction in instructions)
{
if (list.Count < num)
{
list.Add(instruction);
}
else
{
list.RemoveAt(0);
list.Add(instruction);
}
if (instruction.opcode.Name == "newobj")
{
CodeInstruction val = list[list.Count - 2];
val.operand = 0f;
}
if (instruction.operand is float num2 && (num2 == 0.1f || num2 == 0.15f))
{
instruction.operand = num2 * Plugin.configSpeedMultiplier.Value;
}
}
return instructions;
}
}
}