using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MinionsShareFate")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MinionsShareFate")]
[assembly: AssemblyTitle("MinionsShareFate")]
[assembly: AssemblyVersion("1.0.0.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 MinionsShareFate
{
[Serializable]
[BepInPlugin("com.brynzananas.minionssharefate", "Minions Share Fate", "1.0.0")]
public class Main : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static Manipulator <0>__MasterSummon_Perform;
public static Action<Inventory, CharacterMaster, CharacterMaster> <1>__GiveDeath;
}
public const string ModGuid = "com.brynzananas.minionssharefate";
public const string ModName = "Minions Share Fate";
public const string ModVer = "1.0.0";
private static bool _hooksSet;
public static ManualLogSource Log { get; private set; }
public void Awake()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
if (!_hooksSet)
{
_hooksSet = true;
object obj = <>O.<0>__MasterSummon_Perform;
if (obj == null)
{
Manipulator val = MasterSummon_Perform;
<>O.<0>__MasterSummon_Perform = val;
obj = (object)val;
}
MasterSummon.Perform += (Manipulator)obj;
}
}
public void OnDestroy()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
if (_hooksSet)
{
_hooksSet = false;
object obj = <>O.<0>__MasterSummon_Perform;
if (obj == null)
{
Manipulator val = MasterSummon_Perform;
<>O.<0>__MasterSummon_Perform = val;
obj = (object)val;
}
MasterSummon.Perform -= (Manipulator)obj;
}
}
private static void MasterSummon_Perform(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel iLLabel = null;
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 4),
(Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(Object), "op_Implicit"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
}))
{
val.GotoLabel(iLLabel, (MoveType)2, false);
val.Emit(OpCodes.Ldloc, 4);
val.Emit(OpCodes.Ldloc, 2);
val.Emit(OpCodes.Ldloc, 6);
val.EmitDelegate<Action<Inventory, CharacterMaster, CharacterMaster>>((Action<Inventory, CharacterMaster, CharacterMaster>)GiveDeath);
}
else
{
Log.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!"));
}
}
private static void GiveDeath(Inventory inventory, CharacterMaster ownerMaster, CharacterMaster characterMaster)
{
if (Object.op_Implicit((Object)(object)inventory) && Object.op_Implicit((Object)(object)characterMaster.inventory))
{
characterMaster.inventory.GiveItem(Items.HealthDecay, inventory.GetItemCount(Items.HealthDecay));
characterMaster.inventory.GiveItem(Items.Ghost, inventory.GetItemCount(Items.Ghost));
}
MasterSuicideOnTimer val = default(MasterSuicideOnTimer);
if (Object.op_Implicit((Object)(object)ownerMaster) && ((Component)ownerMaster).gameObject.TryGetComponent<MasterSuicideOnTimer>(ref val))
{
((Component)characterMaster).gameObject.AddComponent<MasterSuicideOnTimer>().lifeTimer = val.lifeTimer;
}
}
}
}