using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BrotherMonster;
using On.EntityStates.BrotherMonster;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MithrixMinions")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MithrixMinions")]
[assembly: AssemblyTitle("MithrixMinions")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MithrixMinions;
internal static class Log
{
internal static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void LogDebug(object data)
{
_logSource.LogDebug(data);
}
internal static void LogError(object data)
{
_logSource.LogError(data);
}
internal static void LogFatal(object data)
{
_logSource.LogFatal(data);
}
internal static void LogInfo(object data)
{
_logSource.LogInfo(data);
}
internal static void LogMessage(object data)
{
_logSource.LogMessage(data);
}
internal static void LogWarning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInPlugin("OakPrime.MithrixMinions", "MithrixMinions", "1.0.0")]
public class MithrixMinions : BaseUnityPlugin
{
public const string PluginGUID = "OakPrime.MithrixMinions";
public const string PluginAuthor = "OakPrime";
public const string PluginName = "MithrixMinions";
public const string PluginVersion = "1.0.0";
private SpawnCard minionSpawnCard = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/LunarExploder/cscLunarExploder.asset").WaitForCompletion();
public void Awake()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
try
{
ExitSkyLeap.OnEnter += (hook_OnEnter)delegate(orig_OnEnter orig, ExitSkyLeap self)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
MithrixMinionsBehavior mithrixMinionsBehavior = ((Component)((EntityState)self).characterBody).GetComponent<MithrixMinionsBehavior>();
if ((Object)(object)mithrixMinionsBehavior == (Object)null)
{
Log.LogDebug("New behavior created");
mithrixMinionsBehavior = ((Component)((EntityState)self).characterBody).gameObject.AddComponent<MithrixMinionsBehavior>();
}
int num = mithrixMinionsBehavior.MinionCount();
Vector3[] array = (Vector3[])(object)new Vector3[4]
{
new Vector3(25f, 0f, 25f),
new Vector3(-25f, 0f, -25f),
new Vector3(25f, 0f, -25f),
new Vector3(-25f, 0f, 25f)
};
for (int i = num; i < 4; i++)
{
GameObject spawnedInstance = minionSpawnCard.DoSpawn(((EntityState)self).characterBody.footPosition + array[i], Quaternion.identity, new DirectorSpawnRequest(minionSpawnCard, new DirectorPlacementRule
{
placementMode = (PlacementMode)0
}, Run.instance.runRNG)
{
teamIndexOverride = (TeamIndex)2
}).spawnedInstance;
NetworkServer.Spawn(spawnedInstance);
mithrixMinionsBehavior.AddMinion(spawnedInstance.gameObject.GetComponent<CharacterMaster>().GetBody());
}
};
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
}
}
}
internal class MithrixMinionsBehavior : MonoBehaviour
{
private List<CharacterBody> minions = new List<CharacterBody>();
private void OnDisable()
{
for (int i = 0; i < minions.Count; i++)
{
minions[i].healthComponent.health = 0f;
}
minions.Clear();
}
public int MinionCount()
{
minions.RemoveAll((CharacterBody minion) => (Object)(object)minion == (Object)null);
return minions.Count;
}
public void AddMinion(CharacterBody minion)
{
minions.Add(minion);
}
}