using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LC_LightningRod.NetcodePatcher;
using LethalLib.Modules;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LC_LightningRod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LC_LightningRod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3b20a077-5f7c-46f8-a879-f1d9e0ca9edd")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace LC_LightningRod
{
public class LightningRod : NetworkBehaviour
{
public static LightningRod instance;
public InteractTrigger button;
public bool On;
private Animator an;
private AudioSource audio;
public AudioClip audio_on;
public AudioClip audio_off;
private TextMeshPro text;
public int boltsAvertedToday;
public int boltsAvertedAllTime;
public int lethalBoltsAvertedAllTime;
public int lethalBoltsAvertedToday;
public int randomChance;
public int targetChance;
public int minDistance;
public int maxDistance;
public Random seed;
public void Start()
{
LightningPatch.nextHitRandom = new List<bool>();
LightningPatch.nextHitTarget = new List<bool>();
an = ((Component)this).GetComponent<Animator>();
instance = this;
InteractTrigger val = (button = ((Component)this).gameObject.GetComponentInChildren<InteractTrigger>());
((UnityEventBase)val.onInteract).RemoveAllListeners();
((UnityEvent<PlayerControllerB>)(object)val.onInteract).AddListener((UnityAction<PlayerControllerB>)TurnOn);
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
randomChance = LightningRodMod.AvertRandomChance.Value;
targetChance = LightningRodMod.AvertTargetedChance.Value;
maxDistance = LightningRodMod.MaxDistance.Value;
minDistance = LightningRodMod.MinDistance.Value;
SendSettingsServerRpc();
}
else
{
RequestSettingsServerRpc();
}
audio = ((Component)this).GetComponent<AudioSource>();
text = ((Component)this).GetComponentInChildren<TextMeshPro>();
if ((Object)(object)text == (Object)null && (Object)(object)((Component)this).transform.parent != (Object)null)
{
text = ((Component)((Component)this).transform.parent).GetComponentInChildren<TextMeshPro>();
}
UpdateStats();
NewDay();
}
[ServerRpc(RequireOwnership = true)]
public void SendSettingsServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3211970085u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3211970085u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetSettingsClientRpc(randomChance, targetChance, minDistance, maxDistance);
}
}
[ClientRpc]
public void SetSettingsClientRpc(int RandomChance, int TargetChance, int min, int max)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3147731311u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, RandomChance);
BytePacker.WriteValueBitPacked(val2, TargetChance);
BytePacker.WriteValueBitPacked(val2, min);
BytePacker.WriteValueBitPacked(val2, max);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3147731311u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
randomChance = RandomChance;
targetChance = TargetChance;
minDistance = min;
maxDistance = max;
}
}
}
[ServerRpc(RequireOwnership = false)]
public void RequestSettingsServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1607212517u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1607212517u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
RequestSettingsClientRpc();
}
}
}
[ClientRpc]
public void RequestSettingsClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(372013076u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 372013076u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer))
{
SendSettingsServerRpc();
}
}
}
public void TurnOn(PlayerControllerB player)
{
On = !On;
button.hoverTip = (On ? "Turn off : [LMB]" : "Turn on : [LMB]");
an.SetBool("On", On);
an.SetTrigger("Pressed");
SendActiveServerRpc(On);
}
[ServerRpc(RequireOwnership = false)]
public void SendActiveServerRpc(bool on)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2424299290u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref on, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2424299290u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetActiveClientRpc(on);
}
}
}
[ClientRpc]
public void SetActiveClientRpc(bool on)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(655767285u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref on, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 655767285u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
SetActive(on);
}
}
}
public void SetActive(bool on)
{
if (On != on)
{
an.SetTrigger("Pressed");
}
On = on;
button.hoverTip = (On ? "Turn off : [LMB]" : "Turn on : [LMB]");
an.SetBool("On", On);
audio.PlayOneShot(On ? audio_on : audio_off);
}
[ServerRpc(RequireOwnership = true)]
public void NewRoundServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3920501128u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3920501128u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
NewRoundClientRpc();
}
}
[ClientRpc]
public void NewRoundClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(824396239u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 824396239u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
NewDay();
}
}
}
public void NewDay()
{
seed = new Random(StartOfRound.Instance.randomMapSeed);
boltsAvertedToday = 0;
lethalBoltsAvertedToday = 0;
UpdateStats();
}
public void AvertedBolt(bool lethal)
{
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
boltsAvertedToday++;
boltsAvertedAllTime++;
if (lethal)
{
lethalBoltsAvertedToday++;
lethalBoltsAvertedAllTime++;
}
UpdateStats();
SendStatsServerRpc(boltsAvertedToday, lethalBoltsAvertedToday, boltsAvertedAllTime, lethalBoltsAvertedAllTime);
}
}
[ServerRpc(RequireOwnership = true)]
public void SendStatsServerRpc(int today, int lethalToday, int total, int lethalTotal)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3712120492u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, today);
BytePacker.WriteValueBitPacked(val2, lethalToday);
BytePacker.WriteValueBitPacked(val2, total);
BytePacker.WriteValueBitPacked(val2, lethalTotal);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3712120492u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SetStatsClientRpc(today, lethalToday, total, lethalTotal);
}
}
[ClientRpc]
public void SetStatsClientRpc(int today, int lethalToday, int total, int lethalTotal)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1685888844u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, today);
BytePacker.WriteValueBitPacked(val2, lethalToday);
BytePacker.WriteValueBitPacked(val2, total);
BytePacker.WriteValueBitPacked(val2, lethalTotal);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1685888844u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
boltsAvertedToday = today;
boltsAvertedAllTime = total;
lethalBoltsAvertedToday = lethalToday;
lethalBoltsAvertedAllTime = lethalTotal;
UpdateStats();
}
}
}
public void UpdateStats()
{
((TMP_Text)text).text = $"Bolts averted today: <color=yellow>{boltsAvertedToday}</color>\n" + $"Lethal bolts prevented today: <color=red>{lethalBoltsAvertedToday}</color>\n" + $"Total bolts averted: <color=yellow>{boltsAvertedAllTime}</color>\n" + $"Total lethal bolts prevented: <color=red>{lethalBoltsAvertedAllTime}</color>\n";
}
public bool IsServerOrHost()
{
return ((NetworkBehaviour)this).IsServer || ((NetworkBehaviour)this).IsHost;
}
public int GetRandom(bool type)
{
if (seed == null)
{
NewDay();
}
int num = seed.Next(0, 100);
bool hit = ((!type) ? (num < instance.randomChance || instance.randomChance >= 100) : (num < instance.targetChance || instance.targetChance >= 100));
SendNextRandomServerRpc(hit, type);
return num;
}
[ServerRpc(RequireOwnership = true)]
public void SendNextRandomServerRpc(bool hit, bool type)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2629584090u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hit, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref type, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2629584090u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SendNextRandomClientRpc(hit, type);
}
}
[ClientRpc]
public void SendNextRandomClientRpc(bool hit, bool type)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1016128601u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hit, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref type, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1016128601u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsServer)
{
if (type)
{
LightningPatch.nextHitTarget.Add(hit);
}
else
{
LightningPatch.nextHitRandom.Add(hit);
}
}
}
public override void OnDestroy()
{
((NetworkBehaviour)this).OnDestroy();
instance = null;
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_LightningRod()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: 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
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3211970085u, new RpcReceiveHandler(__rpc_handler_3211970085));
NetworkManager.__rpc_func_table.Add(3147731311u, new RpcReceiveHandler(__rpc_handler_3147731311));
NetworkManager.__rpc_func_table.Add(1607212517u, new RpcReceiveHandler(__rpc_handler_1607212517));
NetworkManager.__rpc_func_table.Add(372013076u, new RpcReceiveHandler(__rpc_handler_372013076));
NetworkManager.__rpc_func_table.Add(2424299290u, new RpcReceiveHandler(__rpc_handler_2424299290));
NetworkManager.__rpc_func_table.Add(655767285u, new RpcReceiveHandler(__rpc_handler_655767285));
NetworkManager.__rpc_func_table.Add(3920501128u, new RpcReceiveHandler(__rpc_handler_3920501128));
NetworkManager.__rpc_func_table.Add(824396239u, new RpcReceiveHandler(__rpc_handler_824396239));
NetworkManager.__rpc_func_table.Add(3712120492u, new RpcReceiveHandler(__rpc_handler_3712120492));
NetworkManager.__rpc_func_table.Add(1685888844u, new RpcReceiveHandler(__rpc_handler_1685888844));
NetworkManager.__rpc_func_table.Add(2629584090u, new RpcReceiveHandler(__rpc_handler_2629584090));
NetworkManager.__rpc_func_table.Add(1016128601u, new RpcReceiveHandler(__rpc_handler_1016128601));
}
private static void __rpc_handler_3211970085(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((LightningRod)(object)target).SendSettingsServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3147731311(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int num = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref num);
int num2 = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref num2);
int min = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref min);
int max = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref max);
target.__rpc_exec_stage = (__RpcExecStage)2;
((LightningRod)(object)target).SetSettingsClientRpc(num, num2, min, max);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1607212517(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((LightningRod)(object)target).RequestSettingsServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_372013076(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((LightningRod)(object)target).RequestSettingsClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2424299290(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool on = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref on, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((LightningRod)(object)target).SendActiveServerRpc(on);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_655767285(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool activeClientRpc = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref activeClientRpc, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((LightningRod)(object)target).SetActiveClientRpc(activeClientRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3920501128(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((LightningRod)(object)target).NewRoundServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_824396239(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((LightningRod)(object)target).NewRoundClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3712120492(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//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_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
int today = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref today);
int lethalToday = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref lethalToday);
int total = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref total);
int lethalTotal = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref lethalTotal);
target.__rpc_exec_stage = (__RpcExecStage)1;
((LightningRod)(object)target).SendStatsServerRpc(today, lethalToday, total, lethalTotal);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
private static void __rpc_handler_1685888844(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int today = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref today);
int lethalToday = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref lethalToday);
int total = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref total);
int lethalTotal = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref lethalTotal);
target.__rpc_exec_stage = (__RpcExecStage)2;
((LightningRod)(object)target).SetStatsClientRpc(today, lethalToday, total, lethalTotal);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2629584090(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0082: 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_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
bool hit = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hit, default(ForPrimitives));
bool type = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref type, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((LightningRod)(object)target).SendNextRandomServerRpc(hit, type);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1016128601(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool hit = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hit, default(ForPrimitives));
bool type = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref type, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((LightningRod)(object)target).SendNextRandomClientRpc(hit, type);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "LightningRod";
}
}
internal class LightningPatch
{
public static List<bool> nextHitTarget;
public static List<bool> nextHitRandom;
[HarmonyPatch(typeof(StormyWeather), "LightningStrike")]
[HarmonyPrefix]
public static void OverrideLightningStirke(ref Vector3 strikePosition, ref bool useTargetedObject, StormyWeather __instance)
{
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: 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)
if (!((Object)(object)LightningRod.instance != (Object)null) || !LightningRod.instance.On)
{
return;
}
bool flag = false;
if (((NetworkBehaviour)LightningRod.instance).IsServer)
{
int random = LightningRod.instance.GetRandom(useTargetedObject);
int minDistance = LightningRod.instance.minDistance;
int maxDistance = LightningRod.instance.maxDistance;
int num = (useTargetedObject ? LightningRod.instance.targetChance : LightningRod.instance.randomChance);
int num2 = num;
if (maxDistance != 0 && minDistance != 0 && minDistance < maxDistance)
{
float num3 = Vector3.Distance(strikePosition, StartOfRound.Instance.insideShipPositions[0].position);
float num4 = Mathf.InverseLerp((float)maxDistance, (float)minDistance, num3);
num = (int)((float)num * num4);
}
LightningRodMod.mls.LogMessage((object)$"Before: {num2} After: {num}");
flag = random < num || num >= 100;
}
else
{
flag = (useTargetedObject ? nextHitTarget.FirstOrDefault() : nextHitRandom.FirstOrDefault());
if (useTargetedObject)
{
if (nextHitTarget.Count != 0)
{
nextHitTarget.RemoveAt(0);
}
}
else if (nextHitRandom.Count != 0)
{
nextHitRandom.RemoveAt(0);
}
}
if (!flag)
{
return;
}
bool lethal = false;
GameObject[] allPlayerObjects = StartOfRound.Instance.allPlayerObjects;
foreach (GameObject val in allPlayerObjects)
{
if (Mathf.Abs(strikePosition.x - val.transform.position.x) < 3f && Mathf.Abs(strikePosition.z - val.transform.position.z) < 3f)
{
lethal = true;
break;
}
}
LightningRod.instance.AvertedBolt(lethal);
strikePosition = StartOfRound.Instance.insideShipPositions[Random.Range(0, StartOfRound.Instance.insideShipPositions.Length)].position;
}
[HarmonyPatch(typeof(StartOfRound), "StartGame")]
[HarmonyPrefix]
public static void NewDay()
{
if ((Object)(object)LightningRod.instance != (Object)null && LightningRod.instance.IsServerOrHost())
{
LightningRod.instance.NewRoundServerRpc();
LightningRod.instance.SendActiveServerRpc(LightningRod.instance.On);
}
}
[HarmonyPatch(typeof(StartOfRound), "OnClientConnect")]
[HarmonyPostfix]
public static void SendSettings()
{
if ((Object)(object)LightningRod.instance != (Object)null)
{
LightningRod.instance.SendSettingsServerRpc();
}
}
}
[BepInPlugin("Mellowdy.LightningRod", "LightningRod", "1.0.5")]
public class LightningRodMod : BaseUnityPlugin
{
private const string modGUID = "Mellowdy.LightningRod";
private const string modName = "LightningRod";
private const string modVersion = "1.0.5";
private readonly Harmony harmony = new Harmony("Mellowdy.LightningRod");
public static ManualLogSource mls;
private static LightningRodMod instance;
public static AssetBundle assets;
public static string assetName = "lightning.rod";
public static string prefabName = "LightningBox.prefab";
public static string unlockableName = "Unlockable.asset";
public static ConfigEntry<int> Price;
public static ConfigEntry<int> AvertRandomChance;
public static ConfigEntry<int> AvertTargetedChance;
public static ConfigEntry<int> MinDistance;
public static ConfigEntry<int> MaxDistance;
private static bool runonce = false;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("Mellowdy.LightningRod");
if (!runonce)
{
RunNetcodePatcher();
}
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, assetName).Replace("\\", "/");
assets = AssetBundle.LoadFromFile(text);
GameObject val = assets.LoadAsset<GameObject>(prefabName);
LightningRod lightningRod = val.AddComponent<LightningRod>();
lightningRod.audio_on = assets.LoadAsset<AudioClip>("TurnOn.wav");
lightningRod.audio_off = assets.LoadAsset<AudioClip>("TurnOff.wav");
Price = ((BaseUnityPlugin)this).Config.Bind<int>("Lightning Rod", "Price", 100, "");
AvertRandomChance = ((BaseUnityPlugin)this).Config.Bind<int>("Lightning Rod", "Avert Random", 100, "Chance in percent to avert a random lightning strike to the ship");
AvertTargetedChance = ((BaseUnityPlugin)this).Config.Bind<int>("Lightning Rod", "Avert Targeted", 50, "Chance in percent to avert a targeted lightning strike to the ship");
MaxDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Lightning Rod", "Max Distance", 0, "Max distance a bolt can be from the ship before getting averted (if 0 ignore this setting)");
MinDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Lightning Rod", "Min Distance", 0, "Min distance before the chance equals the avert chance (if 0 ignore this setting)");
NetworkPrefabs.RegisterNetworkPrefab(val);
UnlockableItem val2 = assets.LoadAsset<UnlockablesList>(unlockableName).unlockables[0];
Unlockables.RegisterUnlockable(val2, (StoreType)1, (TerminalNode)null, (TerminalNode)null, (TerminalNode)null, Price.Value);
harmony.PatchAll();
harmony.PatchAll(typeof(LightningPatch));
mls.LogInfo((object)"LightningRod has been loaded");
}
public void RunNetcodePatcher()
{
runonce = true;
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
}
namespace LC_LightningRod.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}