using System;
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 DigitalRuby.ThunderAndLightning;
using EZLightning.Controllers;
using EZLightning.Data;
using HarmonyLib;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EZLightning")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+90b10dcb81627816b5517715f2851ec5838baac8")]
[assembly: AssemblyProduct("EZLightning")]
[assembly: AssemblyTitle("EZLightning")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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 EZLightning
{
public static class API
{
public static void Strike(Vector3 destination, float volume = 1f, float glowWidthMultiplier = 2.5f, float glowIntensity = -1f, int maxLights = -1, float intensity = -1f, float minTrunkWidth = 0.6f, float maxTrunkWidth = 1.2f, int minCount = -1, int maxCount = -1)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//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_004e: Unknown result type (might be due to invalid IL or missing references)
StrikeData strikeData = default(StrikeData);
strikeData.origin = new SVector3(destination + Vector3.up * 160f + new Vector3((float)Random.Range(-32, 32), 0f, (float)Random.Range(-32, 32)));
strikeData.destination = new SVector3(destination);
strikeData.volume = Mathf.Clamp01(volume);
strikeData.glowWidthMultiplier = glowWidthMultiplier;
strikeData.glowIntensity = glowIntensity;
strikeData.maxLights = maxLights;
strikeData.intensity = intensity;
strikeData.minTrunkWidth = minTrunkWidth;
strikeData.maxTrunkWidth = maxTrunkWidth;
strikeData.minCount = minCount;
strikeData.maxCount = maxCount;
StrikeData strikeData2 = strikeData;
EZLightning.StrikeMessage.SendServer(strikeData2);
}
public static void Strike(Vector3 destination, Vector3 origin, float volume = 1f, float glowWidthMultiplier = 2.5f, float glowIntensity = -1f, int maxLights = -1, float intensity = -1f, float minTrunkWidth = 0.6f, float maxTrunkWidth = 1.2f, int minCount = -1, int maxCount = -1)
{
//IL_000a: 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)
StrikeData strikeData = default(StrikeData);
strikeData.origin = new SVector3(origin);
strikeData.destination = new SVector3(destination);
strikeData.volume = Mathf.Clamp01(volume);
strikeData.glowWidthMultiplier = glowWidthMultiplier;
strikeData.glowIntensity = glowIntensity;
strikeData.maxLights = maxLights;
strikeData.intensity = intensity;
strikeData.minTrunkWidth = minTrunkWidth;
strikeData.maxTrunkWidth = maxTrunkWidth;
strikeData.minCount = minCount;
strikeData.maxCount = maxCount;
StrikeData strikeData2 = strikeData;
EZLightning.StrikeMessage.SendServer(strikeData2);
}
}
[BepInPlugin("com.jacobot5.EZLightning", "EZLightning API", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class EZLightning : BaseUnityPlugin
{
public const string GUID = "com.jacobot5.EZLightning";
public const string NAME = "EZLightning API";
public const string VERSION = "1.0.0";
private readonly Harmony harmony = new Harmony("com.jacobot5.EZLightning");
internal static ManualLogSource Log;
internal static LNetworkMessage<StrikeData> StrikeMessage { get; private set; }
private void Awake()
{
Log = Logger.CreateLogSource("com.jacobot5.EZLightning");
Log.LogInfo((object)"EZLightning API has awoken.");
StrikeMessage = LNetworkMessage<StrikeData>.Connect("EZLightning_Strike", (Action<StrikeData, ulong>)null, (Action<StrikeData>)null, (Action<StrikeData, ulong>)null);
StrikeMessage.OnServerReceived += OnStrikeServer;
StrikeMessage.OnClientReceived += OnStrikeClient;
}
private void OnStrikeServer(StrikeData data, ulong sender)
{
StrikeMessage.SendClients(data);
}
private void OnStrikeClient(StrikeData data)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
LightningController.SpawnLightningBolt(data.origin.ToVector3(), data.destination.ToVector3(), data.volume, data.glowWidthMultiplier, data.glowIntensity, data.maxLights, data.intensity, data.minTrunkWidth, data.maxTrunkWidth, data.minCount, data.maxCount);
}
}
}
namespace EZLightning.Data
{
[Serializable]
public struct SVector3
{
public float x;
public float y;
public float z;
public SVector3(Vector3 v)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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)
x = v.x;
y = v.y;
z = v.z;
}
public Vector3 ToVector3()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(x, y, z);
}
}
[Serializable]
public struct StrikeData
{
public SVector3 origin;
public SVector3 destination;
public float volume;
public float glowWidthMultiplier;
public float glowIntensity;
public int maxLights;
public float intensity;
public float minTrunkWidth;
public float maxTrunkWidth;
public int minCount;
public int maxCount;
}
}
namespace EZLightning.Controllers
{
public class LightningController
{
public static StormyWeather? stormyWeather;
public static void SpawnLightningBolt(Vector3 strikeOrigin, Vector3 strikeDestination, float strikeVolume, float glowWidthMultiplier, float glowIntensity, int maxLights, float intensity, float minTrunkWidth, float maxTrunkWidth, int minCount, int maxCount)
{
//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_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = GameObject.Find("LightningGrenade_ThunderAudioSource");
AudioSource val = ((obj != null) ? obj.GetComponent<AudioSource>() : null);
if ((Object)(object)val == (Object)null)
{
GameObject val2 = new GameObject("LightningGrenade_ThunderAudioSource");
val2.SetActive(true);
Object.DontDestroyOnLoad((Object)val2);
val = val2.AddComponent<AudioSource>();
val.spatialBlend = 0f;
val.minDistance = 5f;
val.maxDistance = 200f;
val.rolloffMode = (AudioRolloffMode)0;
val.playOnAwake = false;
val.loop = false;
((Behaviour)val).enabled = true;
}
if ((Object)(object)stormyWeather == (Object)null)
{
stormyWeather = Object.FindObjectOfType<StormyWeather>(true);
}
LightningBoltPrefabScript val3 = Object.Instantiate<LightningBoltPrefabScript>(stormyWeather.targetedThunder);
((Behaviour)val3).enabled = true;
((LightningBoltPrefabScriptBase)val3).GlowWidthMultiplier = glowWidthMultiplier;
((LightningBoltPrefabScriptBase)val3).DurationRange = new RangeOfFloats
{
Minimum = 0.6f,
Maximum = 1.2f
};
((LightningBoltPrefabScriptBase)val3).TrunkWidthRange = new RangeOfFloats
{
Minimum = minTrunkWidth,
Maximum = maxTrunkWidth
};
((LightningBoltScript)val3).Camera = GameNetworkManager.Instance.localPlayerController.gameplayCamera;
val3.Source.transform.position = strikeOrigin;
val3.Destination.transform.position = strikeDestination + Vector3.up;
((LightningBoltPrefabScriptBase)val3).AutomaticModeSeconds = 0.2f;
((LightningBoltPrefabScriptBase)val3).Generations = 8;
if (minCount >= 0 && maxCount >= 0)
{
((LightningBoltPrefabScriptBase)val3).CountRange = new RangeOfIntegers
{
Minimum = minCount,
Maximum = maxCount
};
}
if (intensity >= 0f)
{
((LightningBoltPrefabScriptBase)val3).Intensity = intensity;
}
if (glowIntensity >= 0f)
{
((LightningBoltPrefabScriptBase)val3).GlowIntensity = glowIntensity;
}
if (maxLights >= 0)
{
((LightningBoltPrefabScriptBase)val3).MaximumLightsPerBatch = maxLights;
}
((LightningBoltPrefabScriptBase)val3).CreateLightningBoltsNow();
((Component)val).transform.position = strikeDestination;
val.volume = strikeVolume;
stormyWeather.PlayThunderEffects(strikeDestination, val);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}