using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
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: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SmokeBomb")]
[assembly: AssemblyTitle("SmokeBomb")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[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;
}
}
}
[RequireComponent(typeof(ItemToggle))]
public class SmokeBombItem : MonoBehaviour
{
private PhotonView photonView;
private AudioSource audioSource;
private ParticleScriptExplosion particleScriptExplosion;
private ItemToggle itemToggle;
[Header("Audio Settings")]
public AudioClip explodeSound;
public AudioClip armSound;
public AudioClip disarmSound;
[Header("Visual Settings")]
public GameObject smokeEffect;
[Header("Physics Settings")]
public float triggerThreshold = 3f;
private bool hasTriggered = false;
private bool previousToggleState;
private void Awake()
{
photonView = ((Component)this).GetComponent<PhotonView>();
itemToggle = ((Component)this).GetComponent<ItemToggle>();
itemToggle.playSound = false;
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.spatialBlend = 1f;
audioSource.minDistance = 1f;
audioSource.maxDistance = 15f;
particleScriptExplosion = ((Component)this).gameObject.AddComponent<ParticleScriptExplosion>();
ExplosionPreset[] source = Resources.FindObjectsOfTypeAll<ExplosionPreset>();
ExplosionPreset val = ((IEnumerable<ExplosionPreset>)source).FirstOrDefault((Func<ExplosionPreset, bool>)((ExplosionPreset p) => ((Object)p).name.Contains("Grenade"))) ?? source.FirstOrDefault();
if ((Object)(object)val != (Object)null)
{
particleScriptExplosion.explosionPreset = val;
}
}
private void Start()
{
previousToggleState = itemToggle.toggleState;
}
private void Update()
{
if (itemToggle.toggleState == previousToggleState)
{
return;
}
if (itemToggle.toggleState)
{
if (Object.op_Implicit((Object)(object)armSound))
{
audioSource.PlayOneShot(armSound);
}
}
else if (Object.op_Implicit((Object)(object)disarmSound))
{
audioSource.PlayOneShot(disarmSound);
}
previousToggleState = itemToggle.toggleState;
}
private void OnCollisionEnter(Collision collision)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (!hasTriggered && itemToggle.toggleState)
{
Vector3 relativeVelocity = collision.relativeVelocity;
if (((Vector3)(ref relativeVelocity)).magnitude > triggerThreshold)
{
TryTriggerSmokeBomb();
}
}
}
private void TryTriggerSmokeBomb()
{
hasTriggered = true;
if (PhotonNetwork.IsConnected)
{
photonView.RPC("ActivateSmokeRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
ActivateSmokeRPC();
}
TeleportLocalPlayer();
if (PhotonNetwork.IsMasterClient || !PhotonNetwork.IsConnected)
{
PhotonNetwork.Destroy(((Component)this).gameObject);
}
}
[PunRPC]
public void ActivateSmokeRPC()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)explodeSound != (Object)null)
{
AudioSource.PlayClipAtPoint(explodeSound, ((Component)this).transform.position);
}
if ((Object)(object)smokeEffect != (Object)null)
{
Object.Instantiate<GameObject>(smokeEffect, ((Component)this).transform.position, Quaternion.identity);
}
if ((Object)(object)particleScriptExplosion != (Object)null)
{
particleScriptExplosion.Spawn(((Component)this).transform.position, 1.2f, 0, 0, 2f, false, false, 1f);
}
}
private void TeleportLocalPlayer()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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)
PlayerController instance = PlayerController.instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
LevelPoint[] array = Object.FindObjectsOfType<LevelPoint>();
if (array != null && array.Length != 0)
{
LevelPoint val = array[Random.Range(0, array.Length)];
((Component)instance).transform.position = ((Component)val).transform.position + Vector3.up * 0.5f;
Rigidbody component = ((Component)instance).GetComponent<Rigidbody>();
if ((Object)(object)component != (Object)null)
{
component.velocity = Vector3.zero;
}
}
}
}
namespace SmokeBombMod
{
[BepInPlugin("user.smokebomb.mod", "Smoke Bomb Mod", "1.0.0")]
public class SmokeBombPlugin : BaseUnityPlugin
{
public static SmokeBombPlugin Instance;
private void Awake()
{
Instance = this;
((BaseUnityPlugin)this).Logger.LogInfo((object)"Smoke Bomb Mod Loaded!");
}
}
}