using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using RoR2;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("VoidInfestorTweak")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("VoidInfestorTweak")]
[assembly: AssemblyTitle("VoidInfestorTweak")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VoidInfestorTweak;
[BepInPlugin("com.kking117.VoidInfestorTweak", "VoidInfestorTweak", "1.2.2")]
public class VoidInfestorTweak : BaseUnityPlugin
{
public const string MODUID = "com.kking117.VoidInfestorTweak";
public const string MODNAME = "VoidInfestorTweak";
public const string MODVERSION = "1.2.2";
public void Awake()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
GlobalEventManager.OnCharacterDeath += new Manipulator(IL_CharacterDeath);
}
private static void IL_CharacterDeath(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 4),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterMaster>(x, "set_teamIndex")
}))
{
val.Remove();
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Func<DamageReport, TeamIndex>>((Func<DamageReport, TeamIndex>)((DamageReport dr) => Object.op_Implicit((Object)(object)dr.victimBody) ? dr.victimTeamIndex : ((TeamIndex)4)));
}
else
{
Debug.LogError((object)"VoidInfestorTweak: IL Hook failed");
}
}
}