using System;
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.Permissions;
using BepInEx;
using EntityStates.Commando.CommandoWeapon;
using HG.Reflection;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.1.0")]
[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 Prototype
{
[BepInPlugin("prototype.commando.pierce", "DoubleTapPierce", "0.1.1")]
public class DoubleTapPierce : BaseUnityPlugin
{
public const string version = "0.1.1";
public const string identifier = "prototype.commando.pierce";
protected void Awake()
{
Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
}
[HarmonyPatch(typeof(FirePistol2), "FireBullet")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> IL)
{
MethodInfo method = typeof(BulletAttack).GetMethod("Fire");
foreach (CodeInstruction instruction in IL)
{
if (CodeInstructionExtensions.Calls(instruction, method))
{
yield return new CodeInstruction(OpCodes.Dup, (object)null);
yield return Transpilers.EmitDelegate<Action<BulletAttack>>((Action<BulletAttack>)delegate(BulletAttack attack)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
attack.radius = 1f;
roll(attack);
BulletAttack obj = attack;
obj.modifyOutgoingDamageCallback = (ModifyOutgoingDamageCallback)Delegate.Combine((Delegate?)(object)obj.modifyOutgoingDamageCallback, (Delegate?)(ModifyOutgoingDamageCallback)delegate
{
BulletAttack obj2 = attack;
obj2.procCoefficient /= 2f;
roll(attack);
});
});
}
yield return instruction;
}
static void roll(BulletAttack bullet)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
bullet.stopperMask = (Util.CheckRoll(50f, 0f, (CharacterMaster)null) ? ((LayerIndex)(ref LayerIndex.world)).mask : BulletAttack.defaultStopperMask);
}
}
[SystemInitializer(new Type[] { typeof(BodyCatalog) })]
private static void Initialize()
{
get("CommandoBody").levelDamage = get("ToolbotBody").levelDamage;
static CharacterBody get(string identifier)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return BodyCatalog.GetBodyPrefabBodyComponent(BodyCatalog.FindBodyIndex(identifier));
}
}
}
}