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 EntityStates.LightningStorm;
using On.EntityStates.LightningStorm;
using On.RoR2;
using RoR2;
using RoR2.Navigation;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MeridianTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MeridianTweaks")]
[assembly: AssemblyTitle("MeridianTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MeridianTweaks;
[BepInPlugin("com.Nuxlar.MeridianTweaks", "MeridianTweaks", "1.0.0")]
public class MeridianTweaks : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_Start <>9__0_0;
public static hook_FireNextStrike <>9__0_1;
public static hook_FireLightningBolt <>9__0_2;
internal void <Awake>b__0_0(orig_Start orig, MeridianEventLightningTrigger self)
{
self.levelstartMonsterCredit = 300f;
orig.Invoke(self);
}
internal void <Awake>b__0_1(orig_FireNextStrike orig, LightningStormState self)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
if (self.positionsToStrike.Count < 1)
{
if (LightningStormController.instance.strikePatternID == 0)
{
self.stormStopwatch = LightningStormController.lightningPattern.frequencyOfLightningStrikes / 6f;
}
else
{
self.stormStopwatch = LightningStormController.lightningPattern.frequencyOfLightningStrikes;
}
self.ExecuteNextStep = self.GenerateTargetPositions;
}
else if (!((double)self.strikeStopwatch > 0.0))
{
self.strikeStopwatch = LightningStormController.lightningPattern.timeBetweenIndividualStrikes;
LightningStormController.FireLightningBolt(self.positionsToStrike.Dequeue(), self.lightningInstancePrefab, (BlastAttack)null);
}
}
internal LightningStrikeInstance <Awake>b__0_2(orig_FireLightningBolt orig, Vector3 position, GameObject lightningPrefab, BlastAttack _blastInfo)
{
//IL_0028: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)LightningStormController.instance != (Object)null && !LightningStormController.instance.stormActive)
{
return null;
}
if (LightningStormController.instance.strikePatternID != 0)
{
return orig.Invoke(position, lightningPrefab, _blastInfo);
}
GameObject val = Object.Instantiate<GameObject>(lightningPrefab);
LightningStrikeInstance component = val.GetComponent<LightningStrikeInstance>();
if (!Object.op_Implicit((Object)(object)component))
{
Object.Destroy((Object)(object)val);
return null;
}
NodeGraph groundNodes = SceneInfo.instance.groundNodes;
if (!Object.op_Implicit((Object)(object)groundNodes))
{
return null;
}
List<NodeIndex> activeNodesForHullMaskWithFlagConditions = groundNodes.GetActiveNodesForHullMaskWithFlagConditions((HullMask)2, (NodeFlags)0, (NodeFlags)4);
NodeIndex val2 = activeNodesForHullMaskWithFlagConditions[Random.Range(0, activeNodesForHullMaskWithFlagConditions.Count)];
Vector3 val3 = default(Vector3);
groundNodes.GetNodePosition(val2, ref val3);
component.Initialize(val3, _blastInfo);
return component;
}
}
public void Awake()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
//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_0067: Expected O, but got Unknown
object obj = <>c.<>9__0_0;
if (obj == null)
{
hook_Start val = delegate(orig_Start orig, MeridianEventLightningTrigger self)
{
self.levelstartMonsterCredit = 300f;
orig.Invoke(self);
};
<>c.<>9__0_0 = val;
obj = (object)val;
}
MeridianEventLightningTrigger.Start += (hook_Start)obj;
object obj2 = <>c.<>9__0_1;
if (obj2 == null)
{
hook_FireNextStrike val2 = delegate(orig_FireNextStrike orig, LightningStormState self)
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
if (self.positionsToStrike.Count < 1)
{
if (LightningStormController.instance.strikePatternID == 0)
{
self.stormStopwatch = LightningStormController.lightningPattern.frequencyOfLightningStrikes / 6f;
}
else
{
self.stormStopwatch = LightningStormController.lightningPattern.frequencyOfLightningStrikes;
}
self.ExecuteNextStep = self.GenerateTargetPositions;
}
else if (!((double)self.strikeStopwatch > 0.0))
{
self.strikeStopwatch = LightningStormController.lightningPattern.timeBetweenIndividualStrikes;
LightningStormController.FireLightningBolt(self.positionsToStrike.Dequeue(), self.lightningInstancePrefab, (BlastAttack)null);
}
};
<>c.<>9__0_1 = val2;
obj2 = (object)val2;
}
LightningStormState.FireNextStrike += (hook_FireNextStrike)obj2;
object obj3 = <>c.<>9__0_2;
if (obj3 == null)
{
hook_FireLightningBolt val3 = delegate(orig_FireLightningBolt orig, Vector3 position, GameObject lightningPrefab, BlastAttack _blastInfo)
{
//IL_0028: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)LightningStormController.instance != (Object)null && !LightningStormController.instance.stormActive)
{
return null;
}
if (LightningStormController.instance.strikePatternID != 0)
{
return orig.Invoke(position, lightningPrefab, _blastInfo);
}
GameObject val4 = Object.Instantiate<GameObject>(lightningPrefab);
LightningStrikeInstance component = val4.GetComponent<LightningStrikeInstance>();
if (!Object.op_Implicit((Object)(object)component))
{
Object.Destroy((Object)(object)val4);
return null;
}
NodeGraph groundNodes = SceneInfo.instance.groundNodes;
if (!Object.op_Implicit((Object)(object)groundNodes))
{
return null;
}
List<NodeIndex> activeNodesForHullMaskWithFlagConditions = groundNodes.GetActiveNodesForHullMaskWithFlagConditions((HullMask)2, (NodeFlags)0, (NodeFlags)4);
NodeIndex val5 = activeNodesForHullMaskWithFlagConditions[Random.Range(0, activeNodesForHullMaskWithFlagConditions.Count)];
Vector3 val6 = default(Vector3);
groundNodes.GetNodePosition(val5, ref val6);
component.Initialize(val6, _blastInfo);
return component;
};
<>c.<>9__0_2 = val3;
obj3 = (object)val3;
}
LightningStormController.FireLightningBolt += (hook_FireLightningBolt)obj3;
}
}