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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("BLOKBUSTR")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+61dc5189317f30c52ba658d8109446e8b115b64b")]
[assembly: AssemblyProduct("LegalizeNuclearBombs")]
[assembly: AssemblyTitle("LegalizeNuclearBombs")]
[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 LegalizeNuclearBombs
{
[BepInPlugin("BLOKBUSTR.LegalizeNuclearBombs", "LegalizeNuclearBombs", "1.0.0")]
public class LegalizeNuclearBombs : BaseUnityPlugin
{
public static ConfigEntry<int> ConfigHitSensitivity;
public static ConfigEntry<int> ConfigMaxHitCount;
public static ConfigEntry<float> ConfigExplosionStrength;
public static ConfigEntry<int> ConfigPlayerDamage;
public static ConfigEntry<int> ConfigEnemyDamage;
public static ConfigEntry<float> ConfigShakeMultiplier;
public static ConfigEntry<bool> ConfigPlayWarningSound;
public static ConfigEntry<float> ConfigWarningVolume;
private static ConfigEntry<bool> _configEnableDebugLogging;
internal static LegalizeNuclearBombs Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
private void Awake()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: 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_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Expected O, but got Unknown
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Expected O, but got Unknown
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: Expected O, but got Unknown
ConfigHitSensitivity = ((BaseUnityPlugin)this).Config.Bind<int>("1 - Nuke", "HitSensitivity", 1, new ConfigDescription("How sensitive the nuke is to impacts. The higher the value, the higher the sensitivity.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 2), Array.Empty<object>()));
ConfigMaxHitCount = ((BaseUnityPlugin)this).Config.Bind<int>("1 - Nuke", "MaxHitCount", 3, new ConfigDescription("The number of hits the nuke can take until it explodes. Set to 0 to disable and make it explode only when it loses all value.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>()));
ConfigExplosionStrength = ((BaseUnityPlugin)this).Config.Bind<float>("1 - Nuke", "ExplosionStrength", 15f, new ConfigDescription("The strength of the explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 25f), Array.Empty<object>()));
ConfigPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("1 - Nuke", "PlayerDamage", 200, new ConfigDescription("The amount of damage dealt to players.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
ConfigEnemyDamage = ((BaseUnityPlugin)this).Config.Bind<int>("1 - Nuke", "EnemyDamage", 400, new ConfigDescription("The amount of damage dealt to enemies.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>()));
ConfigShakeMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("1 - Nuke", "ShakeMultiplier", 3f, new ConfigDescription("The intensity of the camera shake.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>()));
ConfigPlayWarningSound = ((BaseUnityPlugin)this).Config.Bind<bool>("2 - Break Warning", "PlayWarningSound", true, new ConfigDescription("Whether to play a fizzing sound as a warning when the nuke has only one hit remaining.", (AcceptableValueBase)null, Array.Empty<object>()));
ConfigWarningVolume = ((BaseUnityPlugin)this).Config.Bind<float>("2 - Break Warning", "WarningVolume", 0.3f, new ConfigDescription("The volume of the warning sound.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
_configEnableDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebugLogging", false, new ConfigDescription("Whether to enable debug logging.", (AcceptableValueBase)null, Array.Empty<object>()));
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
public static void Debug(string message)
{
if (_configEnableDebugLogging.Value)
{
Logger.LogDebug((object)message);
}
}
}
public class NukeValuable : Trap
{
public Transform center;
private ParticleScriptExplosion _particleScriptExplosion;
private int _hitCount;
public Sound warningSound;
public override void Start()
{
((Trap)this).Start();
_particleScriptExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>();
LegalizeNuclearBombs.Debug($"New nuke valuable spawned ({((Object)this).GetInstanceID()})");
}
public void Explode()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
_particleScriptExplosion.Spawn(center.position, LegalizeNuclearBombs.ConfigExplosionStrength.Value, LegalizeNuclearBombs.ConfigPlayerDamage.Value, LegalizeNuclearBombs.ConfigEnemyDamage.Value, LegalizeNuclearBombs.ConfigExplosionStrength.Value, false, false, LegalizeNuclearBombs.ConfigShakeMultiplier.Value);
LegalizeNuclearBombs.Debug($"KABOOM ({((Object)this).GetInstanceID()})");
}
public void PotentialExplodeLight()
{
if (base.isLocal && LegalizeNuclearBombs.ConfigHitSensitivity.Value > 1)
{
PotentialExplodeHeavy();
}
}
public void PotentialExplodeMedium()
{
if (base.isLocal && LegalizeNuclearBombs.ConfigHitSensitivity.Value > 0)
{
PotentialExplodeHeavy();
}
}
public void PotentialExplodeHeavy()
{
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
if (!base.isLocal || LegalizeNuclearBombs.ConfigMaxHitCount.Value <= 0)
{
return;
}
if (_hitCount >= LegalizeNuclearBombs.ConfigMaxHitCount.Value - 1)
{
Explode();
return;
}
LegalizeNuclearBombs.Debug($"_hitCount: {_hitCount + 1} ({((Object)this).GetInstanceID()})");
if (_hitCount >= LegalizeNuclearBombs.ConfigMaxHitCount.Value - 2)
{
if (SemiFunc.IsMultiplayer())
{
base.photonView.RPC("PlayWarningRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
PlayWarningRPC();
}
}
_hitCount++;
}
[PunRPC]
public void PlayWarningRPC(PhotonMessageInfo info = default(PhotonMessageInfo))
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
if (LegalizeNuclearBombs.ConfigPlayWarningSound.Value)
{
warningSound.Volume = LegalizeNuclearBombs.ConfigWarningVolume.Value;
warningSound.Play(center.position, 1f, 1f, 1f, 1f);
LegalizeNuclearBombs.Debug($"Played audio warning; one hit left ({((Object)this).GetInstanceID()})");
}
}
}
}