using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using EntityStates;
using EntityStates.EngiTurret.EngiTurretWeapon;
using EntityStates.FalseSon;
using EntityStates.FalseSonBoss;
using EntityStates.GolemMonster;
using EntityStates.Halcyonite;
using EntityStates.TitanMonster;
using Microsoft.CodeAnalysis;
using On.EntityStates.EngiTurret.EngiTurretWeapon;
using On.EntityStates.FalseSon;
using On.EntityStates.FalseSonBoss;
using On.EntityStates.GolemMonster;
using On.EntityStates.Halcyonite;
using On.EntityStates.TitanMonster;
using On.RoR2;
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("DefenseMatrixManager")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+be3b3510e80626bea179cd00494118908e63bbfe")]
[assembly: AssemblyProduct("DefenseMatrixManager")]
[assembly: AssemblyTitle("DefenseMatrixManager")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace DefenseMatrixManager
{
[Tooltip("Can be added to a GameObject to manage adding/removing colliders to the Defense Matrix Manager.")]
[RequireComponent(typeof(TeamFilter))]
public class DefenseMatrixComponent : MonoBehaviour
{
[Tooltip("Automatically add this to the Defense Matrix Manager on Start.")]
public bool addOnStart = true;
public DefenseMatrixManager.DefenseMatrixInfo? defenseMatrixInfo = null;
public virtual void Start()
{
GenerateDefenseMatrixInfo();
if (addOnStart)
{
AddMatrix();
}
}
public virtual void GenerateDefenseMatrixInfo()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (defenseMatrixInfo != null)
{
RemoveMatrix();
}
TeamFilter component = ((Component)this).GetComponent<TeamFilter>();
if (Object.op_Implicit((Object)(object)component))
{
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>();
if (componentsInChildren != null && componentsInChildren.Length != 0)
{
defenseMatrixInfo = new DefenseMatrixManager.DefenseMatrixInfo(componentsInChildren, component.teamIndex);
}
}
}
public virtual void AddMatrix()
{
if (defenseMatrixInfo != null)
{
DefenseMatrixManager.AddMatrix(defenseMatrixInfo);
}
}
public virtual void RemoveMatrix()
{
if (defenseMatrixInfo != null)
{
DefenseMatrixManager.RemoveMatrix(defenseMatrixInfo);
}
}
public virtual void OnDestroy()
{
RemoveMatrix();
}
}
public static class DefenseMatrixManager
{
public class DefenseMatrixInfo
{
public Collider[] colliders;
public TeamIndex teamIndex;
public DefenseMatrixInfo(Collider[] colliders, TeamIndex teamIndex)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
this.colliders = colliders;
this.teamIndex = teamIndex;
}
public void EnableColliders()
{
for (int i = 0; i < colliders.Length; i++)
{
if ((Object)(object)colliders[i] != (Object)null)
{
colliders[i].enabled = true;
}
}
}
public void DisableColliders()
{
for (int i = 0; i < colliders.Length; i++)
{
if ((Object)(object)colliders[i] != (Object)null)
{
colliders[i].enabled = false;
}
}
}
}
private static List<DefenseMatrixInfo> activeDefenseMatrices = new List<DefenseMatrixInfo>();
public static DefenseMatrixInfo AddMatrix(DefenseMatrixInfo defenseMatrixInfo)
{
if (activeDefenseMatrices.Contains(defenseMatrixInfo))
{
return defenseMatrixInfo;
}
if (defenseMatrixInfo != null && defenseMatrixInfo.colliders != null && defenseMatrixInfo.colliders.Length != 0)
{
activeDefenseMatrices.Add(defenseMatrixInfo);
return defenseMatrixInfo;
}
return null;
}
public static void RemoveMatrix(DefenseMatrixInfo defenseMatrixInfo)
{
activeDefenseMatrices.Remove(defenseMatrixInfo);
}
public static void EnableMatrices(TeamIndex attackerTeam)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
foreach (DefenseMatrixInfo activeDefenseMatrix in activeDefenseMatrices)
{
if (activeDefenseMatrix.teamIndex != attackerTeam)
{
activeDefenseMatrix.EnableColliders();
}
}
}
public static void DisableMatrices(TeamIndex attackerTeam)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
foreach (DefenseMatrixInfo activeDefenseMatrix in activeDefenseMatrices)
{
if (activeDefenseMatrix.teamIndex != attackerTeam)
{
activeDefenseMatrix.DisableColliders();
}
}
}
internal static void Init()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
Stage.onStageStartGlobal += ClearDefenseMatrices;
BulletAttack.Fire += new hook_Fire(BulletAttack_CheckDefenseMatrix);
BlastAttack.Fire += new hook_Fire(BlastAttack_Fire);
BulletAttack.Fire_ReturnHit += new hook_Fire_ReturnHit(BulletAttack_Fire_ReturnHit);
FireLaser.OnEnter += new hook_OnEnter(FireLaser_OnEnter);
LaserFatherBurst.FireBurstLaser += new hook_FireBurstLaser(LaserFatherBurst_FireBurstLaser);
TriLaser.FireTriLaser += new hook_FireTriLaser(TriLaser_FireTriLaser);
ChargeLaser.Update += new hook_Update(ChargeLaser_Update);
ChargeMegaLaser.FixedUpdate += new hook_FixedUpdate(ChargeMegaLaser_FixedUpdate);
FireMegaLaser.FixedUpdate += new hook_FixedUpdate(FireMegaLaser_FixedUpdate);
FireBeam.GetBeamEndPoint += new hook_GetBeamEndPoint(FireBeam_GetBeamEndPoint);
ChargeTriLaser.Update += new hook_Update(ChargeTriLaser_Update);
LaserFatherCharged.FixedUpdate += new hook_FixedUpdate(LaserFatherCharged_FixedUpdate);
LunarGazeCharge.Update += new hook_Update(LunarGazeCharge_Update);
LunarGazeFire.FixedUpdate += new hook_FixedUpdate(LunarGazeFire_FixedUpdate);
}
private static Vector3 BulletAttack_Fire_ReturnHit(orig_Fire_ReturnHit orig, BulletAttack self)
{
//IL_0002: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
TeamIndex attackerTeam = (TeamIndex)(-1);
if (Object.op_Implicit((Object)(object)self.owner))
{
TeamComponent component = self.owner.GetComponent<TeamComponent>();
if (Object.op_Implicit((Object)(object)component))
{
attackerTeam = component.teamIndex;
}
}
EnableMatrices(attackerTeam);
Vector3 result = orig.Invoke(self);
DisableMatrices(attackerTeam);
return result;
}
private static Result BlastAttack_Fire(orig_Fire orig, BlastAttack self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
bool flag = (int)self.losType > 0;
TeamIndex teamIndex = self.teamIndex;
if (flag)
{
EnableMatrices(teamIndex);
}
Result result = orig.Invoke(self);
if (flag)
{
DisableMatrices(teamIndex);
}
return result;
}
private static void LaserFatherCharged_FixedUpdate(orig_FixedUpdate orig, LaserFatherCharged self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void LunarGazeFire_FixedUpdate(orig_FixedUpdate orig, LunarGazeFire self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void LunarGazeCharge_Update(orig_Update orig, LunarGazeCharge self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void LaserFatherBurst_FireBurstLaser(orig_FireBurstLaser orig, LaserFatherBurst self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void TriLaser_FireTriLaser(orig_FireTriLaser orig, TriLaser self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void ChargeTriLaser_Update(orig_Update orig, ChargeTriLaser self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static Vector3 FireBeam_GetBeamEndPoint(orig_GetBeamEndPoint orig, FireBeam self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
Vector3 result = orig.Invoke(self);
DisableMatrices(team);
return result;
}
private static void FireMegaLaser_FixedUpdate(orig_FixedUpdate orig, FireMegaLaser self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void ChargeMegaLaser_FixedUpdate(orig_FixedUpdate orig, ChargeMegaLaser self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void ChargeLaser_Update(orig_Update orig, ChargeLaser self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void FireLaser_OnEnter(orig_OnEnter orig, FireLaser self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
TeamIndex team = ((BaseState)self).GetTeam();
EnableMatrices(team);
orig.Invoke(self);
DisableMatrices(team);
}
private static void BulletAttack_CheckDefenseMatrix(orig_Fire orig, BulletAttack self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: 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_002f: Unknown result type (might be due to invalid IL or missing references)
TeamIndex attackerTeam = (TeamIndex)(-1);
if (Object.op_Implicit((Object)(object)self.owner))
{
TeamComponent component = self.owner.GetComponent<TeamComponent>();
if (Object.op_Implicit((Object)(object)component))
{
attackerTeam = component.teamIndex;
}
}
EnableMatrices(attackerTeam);
orig.Invoke(self);
DisableMatrices(attackerTeam);
}
private static void ClearDefenseMatrices(Stage obj)
{
activeDefenseMatrices.Clear();
}
}
[BepInPlugin("com.Moffein.DefenseMatrixManager", "DefenseMatrixManager", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
DefenseMatrixManager.Init();
}
}
}