using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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;
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Poppycars.BTCP.Id", "BlockTriggerCooldownPatch", "1.0.0")]
[BepInProcess("Rounds.exe")]
public class main : BaseUnityPlugin
{
internal static string modInitials = "BTCP";
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("com.Poppycars.BTCP.Id");
val.PatchAll();
}
private void Start()
{
}
}
namespace BTCP.Patches
{
[Serializable]
[HarmonyPatch(typeof(BlockTrigger), "DoBlockEarly")]
internal class BlockTriggerPatch2
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return ThatOneFunction.DoThePatchyThing(instructions);
}
}
[Serializable]
[HarmonyPatch(typeof(BlockTrigger), "DoSuperFirstBlock")]
internal class BlockTriggerPatch3
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return ThatOneFunction.DoThePatchyThing(instructions);
}
}
[Serializable]
[HarmonyPatch(typeof(BlockTrigger), "DoFirstBlockThatDelaysOthers")]
internal class BlockTriggerPatch4
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
return ThatOneFunction.DoThePatchyThing(instructions);
}
}
public class ThatOneFunction
{
public static IEnumerable<CodeInstruction> DoThePatchyThing(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> list = instructions.ToList();
List<CodeInstruction> list2 = new List<CodeInstruction>();
MethodInfo methodInfo = AccessTools.PropertyGetter(typeof(Time), "time");
bool flag = false;
for (int i = 0; i < list.Count(); i++)
{
if (flag)
{
list2.Add(list[i]);
continue;
}
list2.Add(list[i]);
if (!flag && list[i].opcode == OpCodes.Ldarg_0 && CodeInstructionExtensions.Calls(list[i + 1], methodInfo) && list[i + 2].opcode == OpCodes.Stfld)
{
i += 3;
flag = true;
}
}
return list2;
}
}
}