using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Lethal_Nuke.NetcodePatcher;
using Microsoft.CodeAnalysis;
using On;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[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("bcs4313")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a nuke as a rare scrap that may or may not be extremely dangerous.")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cd9e2c801759e115bb3ab98ef537ed8ed3634744")]
[assembly: AssemblyProduct("Lethal_Nuke")]
[assembly: AssemblyTitle("Lethal_Nuke")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Lethal_Nuke
{
public class NuclearBomb : GrabbableObject, IHittable
{
public int dangerLevel = 0;
public AudioSource sound0;
public AudioSource sound1;
public AudioSource sound2;
public AudioSource BOOMDelayed;
public AudioSource BOOMImmediate;
public ParticleSystem nuclearParticles;
public GameObject nukeModel;
public GameObject scanNode;
private bool exploded = false;
private bool armedSoundRinged = false;
private float dropCooldown = 2f;
private float lastDropTime = 0f;
private bool playedNukeSound = false;
public override void Start()
{
((GrabbableObject)this).Start();
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
{
if ((double)Random.Range(0f, 1f) < 0.25)
{
dangerLevel++;
}
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
dangerResultActivateClientRpc(dangerLevel);
}
else
{
dangerResultActivateServerRpc();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void dangerResultActivateServerRpc()
{
//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1563172482u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1563172482u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
dangerResultActivateClientRpc(dangerLevel);
}
}
}
public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
dangerLevel += force;
dangerResultActivateClientRpc(dangerLevel);
return true;
}
[ClientRpc]
public void dangerResultActivateClientRpc(int _dangerLevel_)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_0089: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2848495735u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, _dangerLevel_);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2848495735u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
switch (_dangerLevel_)
{
case 0:
playSoundClientRpc("sound0", play: true);
break;
case 1:
if (!armedSoundRinged)
{
playSoundClientRpc("sound0", play: false);
playSoundClientRpc("sound1", play: true);
armedSoundRinged = true;
}
else
{
playSoundClientRpc("sound0", play: false);
playSoundClientRpc("sound1", play: false);
playSoundClientRpc("sound2", play: true);
}
break;
case 2:
playSoundClientRpc("sound0", play: false);
playSoundClientRpc("sound1", play: false);
playSoundClientRpc("sound2", play: true);
break;
case 3:
playSoundClientRpc("sound0", play: false);
playSoundClientRpc("sound1", play: false);
playSoundClientRpc("sound2", play: false);
playSoundClientRpc("BOOMDelayed", play: true);
BOOMAwait();
break;
default:
playSoundClientRpc("sound0", play: false);
playSoundClientRpc("sound1", play: false);
playSoundClientRpc("sound2", play: false);
playSoundClientRpc("BOOMDelayed", play: false);
playSoundClientRpc("BOOMImmediate", play: true);
BOOMClientRpc();
break;
}
}
[ClientRpc]
public void playSoundClientRpc(string soundName, bool play)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1385800393u, val, (RpcDelivery)0);
bool flag = soundName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(soundName, false);
}
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref play, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1385800393u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
switch (soundName)
{
case "sound0":
if (play)
{
sound0.Play();
}
else
{
sound0.Stop();
}
break;
case "sound1":
if (play)
{
sound1.Play();
}
else
{
sound0.Stop();
}
break;
case "sound2":
if (play)
{
sound2.Play();
}
else
{
sound0.Stop();
}
break;
case "BOOMDelayed":
if (play)
{
BOOMDelayed.Play();
}
else
{
BOOMDelayed.Stop();
}
break;
case "BOOMImmediate":
if (!playedNukeSound)
{
if (play)
{
BOOMImmediate.Play();
}
else
{
BOOMImmediate.Stop();
}
playedNukeSound = true;
}
break;
}
}
public async void BOOMAwait()
{
await Task.Delay(5600);
BOOMClientRpc();
}
public async void boomasync()
{
if (exploded)
{
return;
}
exploded = true;
nuclearParticles.Play();
Object.Destroy((Object)(object)nukeModel);
Object.Destroy((Object)(object)scanNode);
base.grabbable = false;
base.grabbableToEnemies = false;
PlayerControllerB[] players = RoundManager.Instance.playersManager.allPlayerScripts;
EnemyAI[] enemies = Object.FindObjectsOfType<EnemyAI>();
NavMeshHit knockbackHit = default(NavMeshHit);
for (int i = 0; i < 24; i++)
{
Landmine.SpawnExplosion(((Component)this).transform.position, false, (float)(10 * i), (float)(11 * i), 20, (float)(100 - i * 2), (GameObject)null, false);
await Task.Delay(200);
float radius = 10 * i;
Vector3 origin = ((Component)this).transform.position;
PlayerControllerB[] array = players;
Vector3 val;
foreach (PlayerControllerB player in array)
{
if (player.isPlayerDead || !player.isPlayerControlled)
{
continue;
}
Vector3 playerPos = ((Component)player).transform.position;
float distFromNuke = Vector3.Distance(origin, playerPos);
if (!(distFromNuke > radius))
{
val = playerPos - origin;
Vector3 blastDir = ((Vector3)(ref val)).normalized;
float offsetDist = Random.Range(1f, 2f);
Vector3 knockbackPos = playerPos - blastDir * offsetDist;
if (NavMesh.SamplePosition(knockbackPos, ref knockbackHit, 2f, -1))
{
int physicsForce = Mathf.Clamp((int)(600f / Mathf.Max(distFromNuke, 1f)), 0, 200);
Landmine.SpawnExplosion(((NavMeshHit)(ref knockbackHit)).position, false, 0f, 0f, 0, (float)physicsForce, (GameObject)null, false);
}
knockbackHit = default(NavMeshHit);
}
}
Vector3 randomPos = origin + Random.insideUnitSphere * radius;
randomPos.y = origin.y;
for (int j = 0; j < 5 + i / 4; j++)
{
Vector3 microOffset = Random.insideUnitSphere * 2f;
Vector3 microPos = randomPos + microOffset;
microPos.y = origin.y;
PlayerControllerB[] array2 = players;
foreach (PlayerControllerB player2 in array2)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)player2).gameObject.transform.position) < (float)(i * 5))
{
int num = (int)(100f / Vector3.Distance(((Component)this).transform.position, ((Component)player2).gameObject.transform.position));
val = default(Vector3);
player2.DamagePlayer(num, true, true, (CauseOfDeath)13, 0, false, val);
}
}
EnemyAI[] array3 = enemies;
foreach (EnemyAI enemy in array3)
{
if (Vector3.Distance(((Component)this).transform.position, ((Component)enemy).gameObject.transform.position) < (float)(i * 10) && ((NetworkBehaviour)RoundManager.Instance).IsHost)
{
enemy.HitEnemyClientRpc(3, -1, true, -1);
}
}
}
}
await Task.Delay(7500);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
public override void OnHitGround()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).OnHitGround();
if (!(dropCooldown + lastDropTime > Time.time) && ((NetworkBehaviour)RoundManager.Instance).IsHost)
{
float num = Vector3.Distance(base.startFallingPosition, base.targetFloorPosition);
Debug.Log((object)$"Nuke dropped from height: {num}");
float num2 = num / 3f;
float num3 = num2 * 0.25f;
if (Random.value < num3)
{
dangerLevel++;
Debug.Log((object)$"Nuke danger increased to {dangerLevel} due to impact!");
dangerResultActivateClientRpc(dangerLevel);
}
if (num > 9f)
{
dangerLevel = 3;
Debug.Log((object)$"Nuke danger increased to {dangerLevel} due to impact!");
dangerResultActivateClientRpc(dangerLevel);
}
if (num > 12f)
{
dangerLevel = 4;
Debug.Log((object)$"Nuke danger increased to {dangerLevel} due to impact!");
dangerResultActivateClientRpc(dangerLevel);
}
lastDropTime = Time.time;
}
}
[ClientRpc]
public void BOOMClientRpc()
{
//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1462921972u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1462921972u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
boomasync();
}
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_NuclearBomb()
{
//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
NetworkManager.__rpc_func_table.Add(1563172482u, new RpcReceiveHandler(__rpc_handler_1563172482));
NetworkManager.__rpc_func_table.Add(2848495735u, new RpcReceiveHandler(__rpc_handler_2848495735));
NetworkManager.__rpc_func_table.Add(1385800393u, new RpcReceiveHandler(__rpc_handler_1385800393));
NetworkManager.__rpc_func_table.Add(1462921972u, new RpcReceiveHandler(__rpc_handler_1462921972));
}
private static void __rpc_handler_1563172482(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;
((NuclearBomb)(object)target).dangerResultActivateServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2848495735(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int dangerLevel_ = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref dangerLevel_);
target.__rpc_exec_stage = (__RpcExecStage)2;
((NuclearBomb)(object)target).dangerResultActivateClientRpc(dangerLevel_);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1385800393(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_0067: 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)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string soundName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref soundName, false);
}
bool play = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref play, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((NuclearBomb)(object)target).playSoundClientRpc(soundName, play);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1462921972(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;
((NuclearBomb)(object)target).BOOMClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "NuclearBomb";
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Lethal_Nuke", "Lethal_Nuke", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_SpawnExplosion <>9__7_0;
public static hook_ExplodeStunGrenade <>9__7_1;
internal void <Awake>b__7_0(orig_SpawnExplosion orig, Vector3 explosionPosition, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, GameObject overridePrefab, bool goThroughCar)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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)
orig.Invoke(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar);
if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
{
return;
}
try
{
NuclearBomb[] array = Object.FindObjectsOfType<NuclearBomb>();
NuclearBomb[] array2 = array;
foreach (NuclearBomb nuclearBomb in array2)
{
if (Vector3.Distance(explosionPosition, ((Component)nuclearBomb).transform.position) < 7.2f)
{
nuclearBomb.dangerLevel += 2;
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
nuclearBomb.dangerResultActivateClientRpc(nuclearBomb.dangerLevel);
}
}
if (Vector3.Distance(explosionPosition, ((Component)nuclearBomb).transform.position) < 4f)
{
nuclearBomb.dangerLevel += 2;
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
nuclearBomb.dangerResultActivateClientRpc(nuclearBomb.dangerLevel);
}
}
}
}
catch (Exception ex)
{
Debug.LogError((object)ex);
}
}
internal void <Awake>b__7_1(orig_ExplodeStunGrenade orig, StunGrenadeItem self, bool destroy)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, destroy);
if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
{
return;
}
try
{
NuclearBomb[] array = Object.FindObjectsOfType<NuclearBomb>();
NuclearBomb[] array2 = array;
foreach (NuclearBomb nuclearBomb in array2)
{
if (Vector3.Distance(((Component)self).transform.position, ((Component)nuclearBomb).transform.position) < 7.2f)
{
nuclearBomb.dangerLevel++;
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
nuclearBomb.dangerResultActivateClientRpc(nuclearBomb.dangerLevel);
}
}
}
}
catch (Exception ex)
{
Debug.LogError((object)ex);
}
}
}
public static Harmony _harmony;
public static ManualLogSource Logger;
public static AssetBundle nukeBundle;
public static GameObject nukePrefab;
public static Item nukeItem;
public static List<PlayerControllerB> highPlayers = new List<PlayerControllerB>();
public static ConfigEntry<int> nukeWeight;
public static ConfigEntry<int> minValue;
public static ConfigEntry<int> maxValue;
public void LogIfDebugBuild(string text)
{
Logger.LogInfo((object)text);
}
private void Awake()
{
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
PopulateAssets();
bindVars();
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);
}
}
}
nukeItem = nukeBundle.LoadAsset<Item>("LETHAL_NUKE");
nukePrefab = nukeBundle.LoadAsset<GameObject>("LethalNuke");
Random.InitState((int)DateTime.Now.Ticks);
if (maxValue.Value < 2)
{
maxValue.Value = 2;
}
if (minValue.Value > maxValue.Value)
{
minValue.Value = maxValue.Value - 1;
}
nukeItem.minValue = (int)((float)minValue.Value / 0.4f);
nukeItem.maxValue = (int)((float)maxValue.Value / 0.4f);
NetworkPrefabs.RegisterNetworkPrefab(nukePrefab);
Items.RegisterScrap(nukeItem, nukeWeight.Value, (LevelTypes)(-1));
object obj = <>c.<>9__7_0;
if (obj == null)
{
hook_SpawnExplosion val = delegate(orig_SpawnExplosion orig, Vector3 explosionPosition, bool spawnExplosionEffect, float killRange, float damageRange, int nonLethalDamage, float physicsForce, GameObject overridePrefab, bool goThroughCar)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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)
orig.Invoke(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, goThroughCar);
if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
{
return;
}
try
{
NuclearBomb[] array5 = Object.FindObjectsOfType<NuclearBomb>();
NuclearBomb[] array6 = array5;
foreach (NuclearBomb nuclearBomb2 in array6)
{
if (Vector3.Distance(explosionPosition, ((Component)nuclearBomb2).transform.position) < 7.2f)
{
nuclearBomb2.dangerLevel += 2;
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
nuclearBomb2.dangerResultActivateClientRpc(nuclearBomb2.dangerLevel);
}
}
if (Vector3.Distance(explosionPosition, ((Component)nuclearBomb2).transform.position) < 4f)
{
nuclearBomb2.dangerLevel += 2;
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
nuclearBomb2.dangerResultActivateClientRpc(nuclearBomb2.dangerLevel);
}
}
}
}
catch (Exception ex2)
{
Debug.LogError((object)ex2);
}
};
<>c.<>9__7_0 = val;
obj = (object)val;
}
Landmine.SpawnExplosion += (hook_SpawnExplosion)obj;
object obj2 = <>c.<>9__7_1;
if (obj2 == null)
{
hook_ExplodeStunGrenade val2 = delegate(orig_ExplodeStunGrenade orig, StunGrenadeItem self, bool destroy)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, destroy);
if (!((NetworkBehaviour)RoundManager.Instance).IsServer)
{
return;
}
try
{
NuclearBomb[] array3 = Object.FindObjectsOfType<NuclearBomb>();
NuclearBomb[] array4 = array3;
foreach (NuclearBomb nuclearBomb in array4)
{
if (Vector3.Distance(((Component)self).transform.position, ((Component)nuclearBomb).transform.position) < 7.2f)
{
nuclearBomb.dangerLevel++;
if (((NetworkBehaviour)RoundManager.Instance).IsHost)
{
nuclearBomb.dangerResultActivateClientRpc(nuclearBomb.dangerLevel);
}
}
}
}
catch (Exception ex)
{
Debug.LogError((object)ex);
}
};
<>c.<>9__7_1 = val2;
obj2 = (object)val2;
}
StunGrenadeItem.ExplodeStunGrenade += (hook_ExplodeStunGrenade)obj2;
}
public void bindVars()
{
//IL_006c: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0092: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Expected O, but got Unknown
//IL_0098: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_00be: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_00c4: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
//IL_00ea: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Expected O, but got Unknown
nukeWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Global", "Nuke Spawn Weight", 24, "The higher this value is, the more often the nuke will spawn in-game.");
minValue = ((BaseUnityPlugin)this).Config.Bind<int>("Global", "Minimum Value", 120, "Minimum scrap value the nuke sells for.");
maxValue = ((BaseUnityPlugin)this).Config.Bind<int>("Global", "Maximum Value", 200, "Maximum scrap value the nuke sells for.");
ConfigEntry<int> obj = nukeWeight;
IntInputFieldOptions val = new IntInputFieldOptions
{
RequiresRestart = true
};
((BaseRangeOptions<int>)val).Min = 0;
((BaseRangeOptions<int>)val).Max = 100000000;
IntInputFieldConfigItem val2 = new IntInputFieldConfigItem(obj, val);
ConfigEntry<int> obj2 = minValue;
IntInputFieldOptions val3 = new IntInputFieldOptions
{
RequiresRestart = true
};
((BaseRangeOptions<int>)val3).Min = 0;
((BaseRangeOptions<int>)val3).Max = 100000000;
IntInputFieldConfigItem val4 = new IntInputFieldConfigItem(obj2, val3);
ConfigEntry<int> obj3 = maxValue;
IntInputFieldOptions val5 = new IntInputFieldOptions
{
RequiresRestart = true
};
((BaseRangeOptions<int>)val5).Min = 0;
((BaseRangeOptions<int>)val5).Max = 100000000;
IntInputFieldConfigItem val6 = new IntInputFieldConfigItem(obj3, val5);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6);
}
public static void PopulateAssets()
{
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
nukeBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "bcs_lethal_nuke"));
Debug.Log((object)("Lethal Nuke Bundle::: " + (object)nukeBundle));
}
}
}
namespace EasterIsland
{
internal class ConfigModel
{
public static ConfigEntry<float> moaiGlobalSize;
public static ConfigEntry<float> moaiGlobalMusicVol;
public static ConfigEntry<float> moaiGlobalRarity;
public static ConfigEntry<float> moaiGlobalSpeed;
public static void setupConfig()
{
//IL_0006: 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_0016: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0028: Expected O, but got Unknown
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_002e: 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_003e: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0050: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_0078: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_007e: 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_008e: Expected O, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
//IL_00a0: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
ConfigEntry<float> obj = moaiGlobalSize;
FloatSliderOptions val = new FloatSliderOptions();
((BaseRangeOptions<float>)val).Min = 0.05f;
((BaseRangeOptions<float>)val).Max = 5f;
FloatSliderConfigItem val2 = new FloatSliderConfigItem(obj, val);
ConfigEntry<float> obj2 = moaiGlobalMusicVol;
FloatSliderOptions val3 = new FloatSliderOptions();
((BaseRangeOptions<float>)val3).Min = 0f;
((BaseRangeOptions<float>)val3).Max = 2f;
FloatSliderConfigItem val4 = new FloatSliderConfigItem(obj2, val3);
ConfigEntry<float> obj3 = moaiGlobalRarity;
FloatSliderOptions val5 = new FloatSliderOptions();
((BaseRangeOptions<float>)val5).Min = 0f;
((BaseRangeOptions<float>)val5).Max = 10f;
FloatSliderConfigItem val6 = new FloatSliderConfigItem(obj3, val5);
ConfigEntry<float> obj4 = moaiGlobalSpeed;
FloatSliderOptions val7 = new FloatSliderOptions();
((BaseRangeOptions<float>)val7).Min = 0f;
((BaseRangeOptions<float>)val7).Max = 5f;
FloatSliderConfigItem val8 = new FloatSliderConfigItem(obj4, val7);
}
}
}
namespace Lethal_Nuke.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}