Please disclose if your mod was created primarily 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 HookahPlace v4.20.0
BepInEx/plugins/HookahPlace/Ratijas.HookahPlace.dll
Decompiled 2 days agousing System; using System.CodeDom.Compiler; 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 BepInEx.Configuration; using BepInEx.Logging; using Dawn; using Dawn.Utils; using Dusk; using HarmonyLib; using HookahPlace.Content; using Microsoft.CodeAnalysis; using Ratijas.HookahPlace.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Ratijas.HookahPlace")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("4.20.0.0")] [assembly: AssemblyInformationalVersion("4.20.0+f30ce7c155364b9d1e4ea80a051d819575fbe7c5")] [assembly: AssemblyProduct("HookahPlace")] [assembly: AssemblyTitle("Ratijas.HookahPlace")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("4.20.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] 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; } } } namespace HookahPlace { internal class HookahBehaviour : NetworkBehaviour { public Transform? smokePosition; public GameObject? smokePrefab; public Color[] Palette = Array.Empty<Color>(); private Color? ApplyLaterSmokeColor; private LocalVolumetricFog? ApplyLaterSmokeVolumetricFog; public void SpawnSmoke() { //IL_003a: 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) //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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)smokePosition == (Object)null || (Object)(object)smokePrefab == (Object)null) { return; } Transform parent = ((Component)this).transform.parent.parent; GameObject val = Object.Instantiate<GameObject>(smokePrefab, smokePosition.position, Quaternion.identity, parent); LocalVolumetricFog componentInChildren = val.GetComponentInChildren<LocalVolumetricFog>(); int num = Random.RandomRangeInt(0, Palette.Length); Color val2 = Palette[num]; if (((NetworkBehaviour)this).IsServer) { SetSmokeColorClientRpc(val2); ApplySmokeColor(componentInChildren, val2); return; } Color? applyLaterSmokeColor = ApplyLaterSmokeColor; if (applyLaterSmokeColor.HasValue) { Color valueOrDefault = applyLaterSmokeColor.GetValueOrDefault(); ApplySmokeColor(componentInChildren, valueOrDefault); ApplyLaterSmokeColor = null; } else { ApplySmokeColor(componentInChildren, val2); ApplyLaterSmokeVolumetricFog = componentInChildren; } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetSmokeColorClientRpc(Color color) { //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_0043: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c2: 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)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1141110921u, val2, val, (SendTo)3, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref color); ((NetworkBehaviour)this).__endSendRpc(ref val3, 1141110921u, val2, val, (SendTo)3, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; LocalVolumetricFog applyLaterSmokeVolumetricFog = ApplyLaterSmokeVolumetricFog; if (applyLaterSmokeVolumetricFog != null) { ApplySmokeColor(applyLaterSmokeVolumetricFog, color); ApplyLaterSmokeVolumetricFog = null; } else { ApplyLaterSmokeColor = color; } } } private static void ApplySmokeColor(LocalVolumetricFog fog, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) LocalVolumetricFogArtistParameters parameters = fog.parameters; parameters.albedo = color; fog.parameters = parameters; } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(1141110921u, new RpcReceiveHandler(__rpc_handler_1141110921), "SetSmokeColorClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1141110921(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) { Color smokeColorClientRpc = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref smokeColorClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((HookahBehaviour)(object)target).SetSmokeColorClientRpc(smokeColorClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string? __getTypeName() { return "HookahBehaviour"; } } [BepInPlugin("Ratijas.HookahPlace", "HookahPlace", "4.20.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class HookahPlace : BaseUnityPlugin { internal static ManualLogSource Logger { get; private set; } internal static ConfigFile Config { get; private set; } internal static DuskMod Mod { get; private set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Config = ((BaseUnityPlugin)this).Config; Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Ratijas.HookahPlace"); AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "hookahplaceasset"); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); new HookahContentHandler(Mod); Logger.LogInfo((object)"Ratijas.HookahPlace v4.20.0 has loaded!"); } } [GeneratedCode("DawnLib", "0.9.3")] public static class HookahPlaceKeys { public const string Namespace = "hookah_place"; internal static NamespacedKey LastVersion = NamespacedKey.From("hookah_place", "last_version"); public static NamespacedKey<DawnUnlockableItemInfo> Hookah = NamespacedKey<DawnUnlockableItemInfo>.From("hookah_place", "hookah"); public static NamespacedKey<DawnUnlockableItemInfo>? GetByReflection(string name) { return (NamespacedKey<DawnUnlockableItemInfo>)(typeof(HookahPlaceKeys).GetField(name)?.GetValue(null)); } } [HarmonyPatch(typeof(Terminal))] internal static class TerminalPatch { [HarmonyPrefix] [HarmonyPatch("Update")] private static void UpdatePatch(Terminal __instance) { TerminalNode hookahNode = ((Registry<DawnUnlockableItemInfo>)(object)LethalContent.Unlockables)[HookahPlaceKeys.Hookah].UnlockableItem.shopSelectionNode; if (!__instance.ShipDecorSelection.Any((TerminalNode node) => node.shipUnlockableID == hookahNode.shipUnlockableID)) { HookahPlace.Logger.LogInfo((object)$"Patching terminal selection list {hookahNode.shipUnlockableID}"); List<TerminalNode> shipDecorSelection = __instance.ShipDecorSelection; List<TerminalNode> list = new List<TerminalNode>(1 + shipDecorSelection.Count); list.AddRange(shipDecorSelection); list.Add(hookahNode); __instance.ShipDecorSelection = list; } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Ratijas.HookahPlace"; public const string PLUGIN_NAME = "HookahPlace"; public const string PLUGIN_VERSION = "4.20.0"; } } namespace HookahPlace.Content { public class HookahContentHandler : ContentHandler<HookahContentHandler> { public HookahContentHandler(DuskMod mod) : base(mod) { DefaultBundle val = default(DefaultBundle); if (!((ContentHandler)this).RegisterContent<DefaultBundle>("hookahunlockableassets", ref val, true) || val == null) { HookahPlace.Logger.LogError((object)"Failed to register content"); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Ratijas.HookahPlace.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }