Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Billiard Vapes v1.2.1
BilliardHorn.VapeMod.dll
Decompiled 2 years agousing System; using System.Collections; 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 BepInEx; using BepInEx.Logging; using BilliardHorn.VapeMod.NetcodePatcher; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using VapeMod.Behaviors; [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("BilliardHorn.VapeMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("A mod to let you rip vapes in Lethal Company")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+26ce533a19fd87bf229591982af66ca035bd6865")] [assembly: AssemblyProduct("BilliardHorn.VapeMod")] [assembly: AssemblyTitle("BilliardHorn.VapeMod")] [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 VapeMod { [BepInPlugin("BilliardHorn.LCVapeMod", "Vape Mod", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class VapeMod : BaseUnityPlugin { public static AssetBundle vapeAssets; public Item[] Vapes; private AudioClip drop; private AudioClip pickup; private const string modGUID = "BilliardHorn.LCVapeMod"; private const string modName = "Vape Mod"; private const string modVersion = "1.2.0"; public AudioSource audioSource; public AudioClip[] drinkClips; private static VapeMod Instance; private bool IsOwner; private void Awake() { 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); } } } Instance = this; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); vapeAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "vapes")); if ((Object)(object)vapeAssets == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets."); return; } drop = vapeAssets.LoadAsset<AudioClip>("Assets/Vape/Items/drop.mp3"); pickup = vapeAssets.LoadAsset<AudioClip>("Assets/Vape/Items/pickup.mp3"); int num = 100; Vapes = vapeAssets.LoadAllAssets<Item>(); Item[] vapes = Vapes; foreach (Item val in vapes) { RipVape ripVape = val.spawnPrefab.AddComponent<RipVape>(); ((GrabbableObject)ripVape).grabbable = true; ((GrabbableObject)ripVape).grabbableToEnemies = true; ((GrabbableObject)ripVape).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); AssetBundle.UnloadAllAssetBundles(false); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Vape mod loaded"); } } } namespace VapeMod.Behaviors { internal class RipVape : PhysicsProp { public ParticleSystem ps; public AudioSource audioSource; public AudioClip ripClip; public AssetBundle smokeAssetBundle; private ManualLogSource Logger; public bool isLoaded = false; public GameObject smoke; public PlayerControllerB previousPlayerHeldBy; public bool isRipping = false; public override void OnNetworkSpawn() { ((GrabbableObject)this).insertedBattery.charge = 1f; ((NetworkBehaviour)this).OnNetworkSpawn(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; audioSource = ((Component)this).GetComponent<AudioSource>(); isRipping = true; ((MonoBehaviour)this).StartCoroutine(doAnimation()); if (((GrabbableObject)this).insertedBattery.charge > 0f) { Battery insertedBattery = ((GrabbableObject)this).insertedBattery; insertedBattery.charge -= 0.05f; RipVapeServerRpc(); } ((MonoBehaviour)this).StartCoroutine(undoAnimation()); AssetBundle.UnloadAllAssetBundles(false); } public override void DiscardItem() { if (!isRipping) { ((GrabbableObject)this).DiscardItem(); return; } previousPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false); previousPlayerHeldBy.activatingItem = false; ((GrabbableObject)this).itemProperties.rotationOffset.y = 0f; ((GrabbableObject)this).itemProperties.positionOffset.z = 0f; ((GrabbableObject)this).DiscardItem(); } public override void OnPlaceObject() { if (!isRipping) { ((GrabbableObject)this).OnPlaceObject(); return; } previousPlayerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false); previousPlayerHeldBy.activatingItem = false; ((GrabbableObject)this).itemProperties.rotationOffset.y = 0f; ((GrabbableObject)this).itemProperties.positionOffset.z = 0f; ((GrabbableObject)this).DiscardItem(); } [ServerRpc] private void RipVapeServerRpc() { //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)((NetworkBehaviour)this).__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(3260280387u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3260280387u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { RipVapeClientRpc(); } } [ClientRpc] private void RipVapeClientRpc() { //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) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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(1930679439u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1930679439u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); smokeAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "smoke")); if ((Object)(object)smokeAssetBundle == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } isLoaded = true; smoke = smokeAssetBundle.LoadAsset<GameObject>("Assets/msVFX_Free Smoke Effects Pack/Prefabs/msVFX_Stylized Smoke 1.prefab"); NetworkPrefabs.RegisterNetworkPrefab(smoke); ripClip = smokeAssetBundle.LoadAsset<AudioClip>("Assets/Vape/audio/vaperip.mp3"); audioSource.PlayOneShot(ripClip); WalkieTalkie.TransmitOneShotAudio(audioSource, ripClip, 1f); Utilities.FixMixerGroups(smoke); Object.Instantiate<GameObject>(smoke, ((GrabbableObject)this).parentObject.position, Quaternion.identity); ps = smoke.GetComponent<ParticleSystem>(); ps.Play(); ((MonoBehaviour)this).StartCoroutine(destroyObject()); } } private IEnumerator destroyObject() { if (isLoaded) { AssetBundle.UnloadAllAssetBundles(false); yield return (object)new WaitForSeconds(5f); Object.Destroy((Object)(object)smoke); isLoaded = false; } } public IEnumerator doAnimation() { if (((NetworkBehaviour)this).IsOwner) { yield return (object)new WaitForSeconds(0f); ((GrabbableObject)this).playerHeldBy.activatingItem = true; ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", true); ((GrabbableObject)this).itemProperties.rotationOffset.y = 45f; ((GrabbableObject)this).itemProperties.positionOffset.z = 0.2f; } } public IEnumerator undoAnimation() { yield return (object)new WaitForSeconds(1f); if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false); ((GrabbableObject)this).playerHeldBy.activatingItem = false; ((GrabbableObject)this).itemProperties.rotationOffset.y = 0f; ((GrabbableObject)this).itemProperties.positionOffset.z = 0f; isRipping = false; } } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RipVape() { //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 NetworkManager.__rpc_func_table.Add(3260280387u, new RpcReceiveHandler(__rpc_handler_3260280387)); NetworkManager.__rpc_func_table.Add(1930679439u, new RpcReceiveHandler(__rpc_handler_1930679439)); } private static void __rpc_handler_3260280387(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; ((RipVape)(object)target).RipVapeServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1930679439(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; ((RipVape)(object)target).RipVapeClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "RipVape"; } } } namespace BilliardHorn.VapeMod.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }