using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using 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("3.0.1.0")] [assembly: AssemblyInformationalVersion("3.0.1+7aeda39ea6ad9334e13ae5234a3069fc89670763")] [assembly: AssemblyProduct("LegalizeNuclearBombs")] [assembly: AssemblyTitle("LegalizeNuclearBombs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.1.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", "3.0.1")] public class LegalizeNuclearBombs : BaseUnityPlugin { public enum HitSensitivity { Light, Medium, Heavy } public static ConfigEntry configHitSensitivity; public static ConfigEntry configMaxHitCount; public static ConfigEntry configExplosionStrength; public static ConfigEntry configPlayerDamage; public static ConfigEntry configEnemyDamage; public static ConfigEntry configCameraShakeStrength; public static ConfigEntry configExplosionDelayTime; public static ConfigEntry configExplosionDelayVolume; public static ConfigEntry configExplosionDelayParticles; public static ConfigEntry configExplosionDelayCameraGlitch; public static ConfigEntry configExplosionUraniumCloud; public static ConfigEntry configWarningVolume; public static ConfigEntry configShowWarningVisual; public static ConfigEntry configWarningCameraShakeStrength; internal static ConfigEntry configEnableDebug; internal static LegalizeNuclearBombs Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; RegisterConfig(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); Debug("Debug logging is enabled."); } private void RegisterConfig() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown configHitSensitivity = ((BaseUnityPlugin)this).Config.Bind("Nuke", "HitSensitivity", HitSensitivity.Medium, "The minimum impact strength that the nuke is sensitive to."); configMaxHitCount = ((BaseUnityPlugin)this).Config.Bind("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 (this will disable the explosion delay!).", (AcceptableValueBase)(object)new AcceptableValueRange(0, 10), Array.Empty())); configExplosionStrength = ((BaseUnityPlugin)this).Config.Bind("Nuke", "ExplosionStrength", 12f, new ConfigDescription("The strength of the explosion.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 25f), Array.Empty())); configPlayerDamage = ((BaseUnityPlugin)this).Config.Bind("Nuke", "PlayerDamage", 200, new ConfigDescription("The amount of damage dealt to players.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 1000), Array.Empty())); configEnemyDamage = ((BaseUnityPlugin)this).Config.Bind("Nuke", "EnemyDamage", 400, new ConfigDescription("The amount of damage dealt to enemies.", (AcceptableValueBase)(object)new AcceptableValueRange(0, 1000), Array.Empty())); configCameraShakeStrength = ((BaseUnityPlugin)this).Config.Bind("Nuke", "CameraShakeStrength", 5f, new ConfigDescription("The intensity of the explosion camera shake.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); configExplosionDelayTime = ((BaseUnityPlugin)this).Config.Bind("Explosion Delay", "ExplosionDelayTime", 1f, new ConfigDescription("Time in seconds that the explosion will be delayed after the nuke has taken its last hit. Can be adjusted to match the length of a custom sound added with loaforcsSoundAPI, as long as it's under 10 seconds. Please do not change if using the default sound.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 10f), Array.Empty())); configExplosionDelayVolume = ((BaseUnityPlugin)this).Config.Bind("Explosion Delay", "ExplosionDelayVolume", 0.65f, new ConfigDescription("The volume of the explosion delay sound.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); configExplosionDelayParticles = ((BaseUnityPlugin)this).Config.Bind("Explosion Delay", "ExplosionDelayParticles", true, "Whether to play particle effects during the explosion delay."); configExplosionDelayCameraGlitch = ((BaseUnityPlugin)this).Config.Bind("Explosion Delay", "ExplosionDelayCameraGlitch", true, "Whether to play the camera glitch effect to players holding the nuke when its explosion delay begins."); configExplosionUraniumCloud = ((BaseUnityPlugin)this).Config.Bind("Uranium Cloud", "ExplosionUraniumCloud", true, "Whether to spawn a uranium cloud upon explosion."); configWarningVolume = ((BaseUnityPlugin)this).Config.Bind("Break Warning", "WarningVolume", 0.35f, new ConfigDescription("The volume of the warning sound. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); configShowWarningVisual = ((BaseUnityPlugin)this).Config.Bind("Break Warning", "ShowWarningVisual", true, "Whether to momentarily show a red glow on the nuke when the break warning triggers."); configWarningCameraShakeStrength = ((BaseUnityPlugin)this).Config.Bind("Break Warning", "WarningCameraShakeStrength", 1.5f, new ConfigDescription("The intensity of the warning camera shake.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 3f), Array.Empty())); configEnableDebug = ((BaseUnityPlugin)this).Config.Bind("Debug", "EnableDebugLogging", false, "Whether to enable debug logging."); } public static void Debug(string message, Object? obj = null) { if (configEnableDebug.Value) { Logger.LogDebug((object)(Object.op_Implicit(obj) ? (((object)obj)?.ToString() + ": " + message) : message)); } } } public class NukeValuable : MonoBehaviour { public Transform center; public GameObject mesh; private Material material; private static readonly int emissionColor = Shader.PropertyToID("_EmissionColor"); private PhysGrabObject physGrabObject; private PhotonView photonView; public GameObject uraniumCloudPrefab; public Sound warningSound; public Sound explosionDelaySound; private int hitCount; private bool detonated; public List explosionParticles; private bool explosionDelayActive; private bool explosionDelayImpulse = true; private float explosionDelayTime; private bool emissionActive; private bool emissionImpulse; private float emissionTime; private void Start() { material = ((Renderer)mesh.GetComponent()).material; physGrabObject = ((Component)this).GetComponent(); photonView = ((Component)this).GetComponent(); LegalizeNuclearBombs.Debug("New nuke valuable spawned", (Object?)(object)this); } private void Update() { EmissionLogic(); if (!SemiFunc.IsNotMasterClient() && explosionDelayActive) { ExplosionDelayLogic(); } } private void EmissionLogic() { //IL_0072: 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_00a8: 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_00e7: 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_012d: Unknown result type (might be due to invalid IL or missing references) if (!emissionActive) { emissionImpulse = true; return; } if (emissionImpulse) { GameDirector.instance.CameraImpact.ShakeDistance(LegalizeNuclearBombs.configWarningCameraShakeStrength.Value, 1f, 6f, ((Component)this).transform.position, 0.25f); emissionImpulse = false; } LegalizeNuclearBombs.Debug($"emissionColor: {material.GetColor(emissionColor).r}"); material.SetColor(emissionColor, Color.white * Mathf.Lerp(material.GetColor(emissionColor).r, Mathf.Clamp(emissionTime, 0f, 1f), 0.35f)); if (material.GetColor(emissionColor).r > 0.01f) { if (emissionTime > 0f) { emissionTime -= Time.deltaTime; } } else { material.SetColor(emissionColor, Color.black); emissionActive = false; } } private void ExplosionDelayLogic() { //IL_0061: 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) explosionDelayTime -= Time.deltaTime; if (explosionDelayTime <= 0f) { SetExplode(); } else if (explosionDelayImpulse) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("ExplosionDelayRPC", (RpcTarget)0, Array.Empty()); } else { ExplosionDelayRPC(); } explosionDelayImpulse = false; } } [PunRPC] private void ExplosionDelayRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } float value = LegalizeNuclearBombs.configExplosionDelayVolume.Value; if (value > 0f) { explosionDelaySound.Play(((Component)center).transform.position, value, 1f, 1f, 1f); } material.SetColor(emissionColor, Color.white); if (GameplayManager.instance.photosensitivity) { return; } if (LegalizeNuclearBombs.configExplosionDelayCameraGlitch.Value && physGrabObject.grabbedLocal) { CameraGlitch.Instance.PlayLong(); } foreach (ParticleSystem explosionParticle in explosionParticles) { explosionParticle.Play(); } } public void PotentialExplodeLight() { if (!SemiFunc.IsNotMasterClient() && LegalizeNuclearBombs.configHitSensitivity.Value == LegalizeNuclearBombs.HitSensitivity.Light) { PotentialExplodeHeavy(); } } public void PotentialExplodeMedium() { if (!SemiFunc.IsNotMasterClient() && LegalizeNuclearBombs.configHitSensitivity.Value != LegalizeNuclearBombs.HitSensitivity.Heavy) { PotentialExplodeHeavy(); } } public void PotentialExplodeHeavy() { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsNotMasterClient() || LegalizeNuclearBombs.configMaxHitCount.Value <= 0) { return; } hitCount++; if (hitCount >= LegalizeNuclearBombs.configMaxHitCount.Value) { if (explosionDelayActive) { return; } if (LegalizeNuclearBombs.configExplosionDelayTime.Value <= 0f) { SetExplode(); } else { explosionDelayTime = LegalizeNuclearBombs.configExplosionDelayTime.Value; explosionDelayActive = true; } } else if (hitCount >= LegalizeNuclearBombs.configMaxHitCount.Value - 1) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("PlayWarningRPC", (RpcTarget)0, Array.Empty()); } else { PlayWarningRPC(); } } LegalizeNuclearBombs.Debug("hitCount: " + hitCount, (Object?)(object)this); } [PunRPC] private void PlayWarningRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: 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) if (SemiFunc.MasterOnlyRPC(info)) { float value = LegalizeNuclearBombs.configWarningVolume.Value; if (value > 0f) { warningSound.Play(center.position, value, 1f, 1f, 1f); } if (LegalizeNuclearBombs.configShowWarningVisual.Value) { emissionTime = 1.5f; emissionImpulse = true; emissionActive = true; } LegalizeNuclearBombs.Debug("Played warning, one hit left", (Object?)(object)this); } } public void SetExplode() { if (!SemiFunc.IsNotMasterClient()) { float value = LegalizeNuclearBombs.configExplosionStrength.Value; int value2 = LegalizeNuclearBombs.configPlayerDamage.Value; bool value3 = LegalizeNuclearBombs.configExplosionUraniumCloud.Value; if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetExplodeRPC", (RpcTarget)1, new object[3] { value, value2, value3 }); } Explode(value, value2, value3); } } [PunRPC] private void SetExplodeRPC(float explosionStrength, int playerDamage, bool uranium, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { Explode(explosionStrength, playerDamage, uranium); } } public void Explode(float explosionStrength, int playerDamage, bool uranium) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (!detonated) { detonated = true; ((Component)this).GetComponent().Spawn(center.position, explosionStrength, playerDamage, LegalizeNuclearBombs.configEnemyDamage.Value, LegalizeNuclearBombs.configExplosionStrength.Value, false, false, LegalizeNuclearBombs.configCameraShakeStrength.Value); if (uranium) { Object.Instantiate(uraniumCloudPrefab, ((Component)center).transform.position, Quaternion.identity).GetComponent(); } if (Object.op_Implicit((Object)(object)physGrabObject)) { physGrabObject.impactDetector.DestroyObject(true); } LegalizeNuclearBombs.Debug($"Explode (explosionStrength: {explosionStrength}, playerDamage = {playerDamage}, uranium = {uranium})", (Object?)(object)this); } } } }