using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LeviathanSlowdown.Patches;
[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 = "")]
[assembly: AssemblyCompany("LeviathanSlowdown")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Extends the length between which the ground starts rumbling and an Earth Leviathan emerges")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LeviathanSlowdown")]
[assembly: AssemblyTitle("LeviathanSlowdown")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LeviathanSlowdown
{
[BepInPlugin("LeviathanSlowdown", "LeviathanSlowdown", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private bool _patched;
public static ManualLogSource Logger { get; set; }
private void Awake()
{
if (_patched)
{
Logger.LogWarning((object)"Aleady Patched");
return;
}
Logger = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(typeof(LeviathanPatch), "LeviathanSlowdown");
Logger.LogInfo((object)"Plugin LeviathanSlowdown is loaded!");
_patched = true;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "LeviathanSlowdown";
public const string PLUGIN_NAME = "LeviathanSlowdown";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LeviathanSlowdown.Patches
{
internal class LeviathanPatch
{
[HarmonyTranspiler]
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
private static IEnumerable<CodeInstruction> TranspileEmergeFromGround(IEnumerable<CodeInstruction> instructions)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
{
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_7, (object)null, (string)null)
}).Advance(1).SetOperandAndAdvance((object)2)
.InstructionEnumeration();
}
}
}