Decompiled source of BlahajPlush v1.1.0

com.github.zehsteam.BlahajPlush.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using com.github.zehsteam.BlahajPlush.Data;
using com.github.zehsteam.BlahajPlush.Dependencies;
using com.github.zehsteam.BlahajPlush.NetcodePatcher;

[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("com.github.zehsteam.BlahajPlush")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a customizable Blåhaj plushie scrap item.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+06dce856b121d36d545a9a444619f853954d1d25")]
[assembly: AssemblyProduct("BlahajPlush")]
[assembly: AssemblyTitle("com.github.zehsteam.BlahajPlush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 com.github.zehsteam.BlahajPlush
{
	internal static class ConfigHelper
	{
		public static void SetModIcon(Sprite sprite)
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SetModIcon(sprite);
			}
		}

		public static void SetModDescription(string description)
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SetModDescription(description);
			}
		}

		public static void SkipAutoGen()
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SkipAutoGen();
			}
		}

		public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			if (configFile == null)
			{
				configFile = ((BaseUnityPlugin)Plugin.Instance).Config;
			}
			ConfigEntry<T> configEntry = ((acceptableValues == null) ? configFile.Bind<T>(section, key, defaultValue, description) : configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>())));
			if (settingChanged != null)
			{
				configEntry.SettingChanged += delegate
				{
					settingChanged?.Invoke(configEntry.Value);
				};
			}
			if (LethalConfigProxy.Enabled)
			{
				if (acceptableValues == null)
				{
					LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart);
				}
				else
				{
					LethalConfigProxy.AddConfigSlider<T>(configEntry, requiresRestart);
				}
			}
			return configEntry;
		}

		public static void AddButton(string section, string name, string description, string buttonText, Action callback)
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.AddButton(section, name, description, buttonText, callback);
			}
		}
	}
	internal class ConfigManager
	{
		public ConfigEntry<bool> ExtendedLogging { get; private set; }

		public ConfigEntry<int> Blahaj_SpawnWeight { get; private set; }

		public ConfigEntry<bool> Blahaj_TwoHanded { get; private set; }

		public ConfigEntry<int> Blahaj_CarryWeight { get; private set; }

		public ConfigEntry<int> Blahaj_MinValue { get; private set; }

		public ConfigEntry<int> Blahaj_MaxValue { get; private set; }

		public ConfigManager()
		{
			BindConfigs();
			SetupChangedEvents();
			MigrateOldConfigSettings();
			ClearUnusedEntries();
		}

		private void BindConfigs()
		{
			ConfigHelper.SkipAutoGen();
			ExtendedLogging = ConfigHelper.Bind("General Settings", "ExtendedLogging", defaultValue: false, requiresRestart: false, "Enable extended logging.");
			Blahaj_SpawnWeight = ConfigHelper.Bind("Blahaj Settings", "SpawnWeight", 10, requiresRestart: false, "Blahaj plushie spawn chance weight.");
			Blahaj_TwoHanded = ConfigHelper.Bind("Blahaj Settings", "TwoHanded", defaultValue: true, requiresRestart: false, "If enabled, the Blahaj plushie will be two-handed.");
			Blahaj_CarryWeight = ConfigHelper.Bind("Blahaj Settings", "CarryWeight", 12, requiresRestart: false, "Blahaj plushie carry weight in pounds.");
			Blahaj_MinValue = ConfigHelper.Bind("Blahaj Settings", "MinValue", 150, requiresRestart: false, "Blahaj plushie min scrap value.");
			Blahaj_MaxValue = ConfigHelper.Bind("Blahaj Settings", "MaxValue", 380, requiresRestart: false, "Blahaj plushie max scrap value.");
		}

		private void SetupChangedEvents()
		{
			Blahaj_SpawnWeight.SettingChanged += Blahaj_SpawnWeight_SettingChanged;
			Blahaj_TwoHanded.SettingChanged += Blahaj_Properties_SettingChanged;
			Blahaj_CarryWeight.SettingChanged += Blahaj_Properties_SettingChanged;
			Blahaj_MinValue.SettingChanged += Blahaj_Properties_SettingChanged;
			Blahaj_MaxValue.SettingChanged += Blahaj_Properties_SettingChanged;
		}

		private void Blahaj_SpawnWeight_SettingChanged(object sender, EventArgs e)
		{
			ScrapHelper.UpdateScrapRarity(Content.Blahaj, Blahaj_SpawnWeight.Value);
		}

		private void Blahaj_Properties_SettingChanged(object sender, EventArgs e)
		{
			ScrapHelper.UpdateScrapProperties(Content.Blahaj, Blahaj_TwoHanded.Value, Blahaj_CarryWeight.Value, Blahaj_MinValue.Value, Blahaj_MaxValue.Value);
		}

		private void MigrateOldConfigSettings()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
			foreach (KeyValuePair<ConfigDefinition, string> item in dictionary)
			{
				MigrateOldConfigSetting(item.Key.Section, item.Key.Key, item.Value);
			}
		}

		private void MigrateOldConfigSetting(string section, string key, string value)
		{
			if (section == "General Settings")
			{
				switch (key)
				{
				case "SpawnWeight":
					SetConfigEntryValue<int>(Blahaj_SpawnWeight, value);
					break;
				case "TwoHanded":
					SetConfigEntryValue<bool>(Blahaj_TwoHanded, value);
					break;
				case "CarryWeight":
					SetConfigEntryValue<int>(Blahaj_CarryWeight, value);
					break;
				case "MinValue":
					SetConfigEntryValue<int>(Blahaj_MinValue, value);
					break;
				case "MaxValue":
					SetConfigEntryValue<int>(Blahaj_MaxValue, value);
					break;
				}
			}
		}

		private void SetConfigEntryValue<T>(ConfigEntry<T> configEntry, string value)
		{
			if (typeof(T) == typeof(int) && int.TryParse(value, out var result))
			{
				configEntry.Value = (T)(object)result;
				return;
			}
			if (typeof(T) == typeof(float) && float.TryParse(value, out var result2))
			{
				configEntry.Value = (T)(object)result2;
				return;
			}
			if (typeof(T) == typeof(double) && double.TryParse(value, out var result3))
			{
				configEntry.Value = (T)(object)result3;
				return;
			}
			if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result4))
			{
				configEntry.Value = (T)(object)result4;
				return;
			}
			if (typeof(T) == typeof(string))
			{
				configEntry.Value = (T)(object)value;
				return;
			}
			throw new InvalidOperationException($"Unsupported type: {typeof(T)}");
		}

		private void ClearUnusedEntries()
		{
			ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
			PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
			Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
			dictionary.Clear();
			config.Save();
		}
	}
	internal static class Content
	{
		public static Item Blahaj;

		public static Sprite ModIcon;

		public static void Load()
		{
			LoadAssetsFromAssetBundle();
		}

		private static void LoadAssetsFromAssetBundle()
		{
			try
			{
				string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
				string text = Path.Combine(directoryName, "blahajplush_assets");
				AssetBundle val = AssetBundle.LoadFromFile(text);
				Blahaj = val.LoadAsset<Item>("Blahaj");
				ModIcon = val.LoadAsset<Sprite>("ModIcon");
				Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
			}
			catch (Exception arg)
			{
				Plugin.logger.LogError((object)$"Failed to load assets from AssetBundle.\n\n{arg}");
			}
		}
	}
	internal static class NetworkUtils
	{
		public static bool IsServer
		{
			get
			{
				if ((Object)(object)NetworkManager.Singleton == (Object)null)
				{
					return false;
				}
				return NetworkManager.Singleton.IsServer;
			}
		}

		public static bool IsHost
		{
			get
			{
				if ((Object)(object)NetworkManager.Singleton == (Object)null)
				{
					return false;
				}
				return NetworkManager.Singleton.IsHost;
			}
		}

		public static ulong GetLocalClientId()
		{
			return NetworkManager.Singleton.LocalClientId;
		}

		public static bool IsLocalClientId(ulong clientId)
		{
			return clientId == GetLocalClientId();
		}
	}
	[BepInPlugin("com.github.zehsteam.BlahajPlush", "BlahajPlush", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		internal static Plugin Instance;

		internal static ManualLogSource logger;

		internal static ConfigManager ConfigManager;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("com.github.zehsteam.BlahajPlush");
			logger.LogInfo((object)"BlahajPlush has awoken!");
			ConfigManager = new ConfigManager();
			Content.Load();
			ConfigHelper.SetModIcon(Content.ModIcon);
			ConfigHelper.SetModDescription("Adds a customizable Blåhaj plushie scrap item.");
			RegisterScrapItems();
			NetcodePatcherAwake();
		}

		private void NetcodePatcherAwake()
		{
			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);
					}
				}
			}
		}

		private void RegisterScrapItems()
		{
			ScrapHelper.RegisterScrap(Content.Blahaj, ConfigManager.Blahaj_SpawnWeight.Value, ConfigManager.Blahaj_TwoHanded.Value, ConfigManager.Blahaj_CarryWeight.Value, ConfigManager.Blahaj_MinValue.Value, ConfigManager.Blahaj_MaxValue.Value);
		}

		public void LogInfoExtended(object data)
		{
			if (ConfigManager.ExtendedLogging.Value)
			{
				logger.LogInfo(data);
			}
		}
	}
	internal static class ScrapHelper
	{
		public static void RegisterScrap(Item item, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			item.twoHanded = twoHanded;
			item.weight = (float)carryWeight / 105f + 1f;
			item.minValue = minValue;
			item.maxValue = maxValue;
			Utilities.FixMixerGroups(item.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
			Items.RegisterScrap(item, rarity, (LevelTypes)(-1));
			Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {rarity} rarity.");
		}

		public static void UpdateScrapRarity(Item item, int rarity)
		{
			if ((Object)(object)item == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null)
			{
				return;
			}
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			foreach (SelectableLevel val in levels)
			{
				foreach (SpawnableItemWithRarity item2 in val.spawnableScrap)
				{
					if (!((Object)(object)item2.spawnableItem != (Object)(object)item))
					{
						item2.rarity = rarity;
						Plugin.logger.LogInfo((object)$"Updated \"{val.PlanetName}\" \"{item.itemName}\" scrap item rarity to {rarity}.");
					}
				}
			}
		}

		public static void UpdateScrapProperties(Item item, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			if (!((Object)(object)item == (Object)null))
			{
				item.twoHanded = twoHanded;
				item.weight = (float)carryWeight / 105f + 1f;
				item.minValue = minValue;
				item.maxValue = maxValue;
				Plugin.logger.LogInfo((object)$"Updated \"{item.itemName}\" scrap item properties. (TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.BlahajPlush";

		public const string PLUGIN_NAME = "BlahajPlush";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace com.github.zehsteam.BlahajPlush.MonoBehaviours
{
	public class AdvancedNoisemakerProp : GrabbableObject
	{
		[Space(20f)]
		[Header("Advanced Noisemaker Prop")]
		[Space(5f)]
		public AudioSourceGroup NoiseAudio;

		public AudioClipGroup[] NoiseSFX = Array.Empty<AudioClipGroup>();

		[Space(10f)]
		public float NoiseRange = 65f;

		public float MaxLoudness = 1f;

		public float MinLoudness = 0.95f;

		public float MinPitch = 1f;

		public float MaxPitch = 1f;

		[Space(10f)]
		public bool UseDynamicCooldown;

		public bool CancelActiveSFXOnItemActivate;

		public int UniqueId { get; private set; }

		public string SaveKey => string.Format("{0}_{1}", "AdvancedNoisemakerProp", UniqueId);

		public virtual void Awake()
		{
			if (NetworkUtils.IsServer)
			{
				UniqueId = Random.Range(0, 1000000);
			}
		}

		public override int GetItemDataToSave()
		{
			return UniqueId;
		}

		public override void LoadItemSaveData(int saveData)
		{
			((GrabbableObject)this).LoadItemSaveData(saveData);
			UniqueId = saveData;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (NoiseSFX.Length != 0)
			{
				int index = Random.Range(0, NoiseSFX.Length);
				PlaySound(index);
			}
		}

		public void PlaySound(int index)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (NoiseSFX.Length != 0)
			{
				PlaySoundServerRpc(index);
				PlaySoundOnLocalClient(index);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		protected void PlaySoundServerRpc(int index, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//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_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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1127378558u, serverRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, index);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1127378558u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ulong senderClientId = serverRpcParams.Receive.SenderClientId;
				if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId))
				{
					PlaySoundClientRpc(index, senderClientId);
				}
			}
		}

		[ClientRpc]
		protected void PlaySoundClientRpc(int index, ulong senderClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3720795733u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, index);
					BytePacker.WriteValueBitPacked(val2, senderClientId);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3720795733u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId))
				{
					PlaySoundOnLocalClient(index);
				}
			}
		}

		public void PlaySoundOnLocalClient(int index)
		{
			AudioClipGroup audioClipGroup = ((index >= 0 && index < NoiseSFX.Length) ? NoiseSFX[index] : null);
			PlaySoundOnLocalClient(audioClipGroup);
		}

		public float PlaySoundOnLocalClient(AudioClip audioClip, AudioClip audioClipFar)
		{
			return PlaySoundOnLocalClient(new AudioClipGroup(audioClip, audioClipFar));
		}

		public float PlaySoundOnLocalClient(AudioClipGroup audioClipGroup)
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			if (audioClipGroup == null || (Object)(object)audioClipGroup.AudioClip == (Object)null)
			{
				return 0f;
			}
			float num = (float)Random.Range((int)(MinLoudness * 100f), (int)(MaxLoudness * 100f)) / 100f;
			float pitch = (float)Random.Range((int)(MinPitch * 100f), (int)(MaxPitch * 100f)) / 100f;
			if (CancelActiveSFXOnItemActivate)
			{
				NoiseAudio.Stop();
			}
			if (UseDynamicCooldown && !CancelActiveSFXOnItemActivate)
			{
				base.currentUseCooldown = audioClipGroup.AudioClip.length;
			}
			NoiseAudio.Pitch = pitch;
			NoiseAudio.PlayOneShot(audioClipGroup, num);
			WalkieTalkie.TransmitOneShotAudio(NoiseAudio.AudioSource, audioClipGroup.AudioClip, num);
			RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, NoiseRange, num, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			if (MinLoudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
			{
				base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
			}
			return audioClipGroup.AudioClip.length;
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AdvancedNoisemakerProp()
		{
			//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(1127378558u, new RpcReceiveHandler(__rpc_handler_1127378558));
			NetworkManager.__rpc_func_table.Add(3720795733u, new RpcReceiveHandler(__rpc_handler_3720795733));
		}

		private static void __rpc_handler_1127378558(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((AdvancedNoisemakerProp)(object)target).PlaySoundServerRpc(index, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3720795733(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				ulong senderClientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AdvancedNoisemakerProp)(object)target).PlaySoundClientRpc(index, senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AdvancedNoisemakerProp";
		}
	}
	public class Blahaj : AdvancedNoisemakerProp
	{
		protected override void __initializeVariables()
		{
			base.__initializeVariables();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "Blahaj";
		}
	}
}
namespace com.github.zehsteam.BlahajPlush.Dependencies
{
	internal static class LethalConfigProxy
	{
		public const string PLUGIN_GUID = "ainavt.lc.lethalconfig";

		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void SetModIcon(Sprite sprite)
		{
			LethalConfigManager.SetModIcon(sprite);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void SetModDescription(string description)
		{
			LethalConfigManager.SetModDescription(description);
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void SkipAutoGen()
		{
			LethalConfigManager.SkipAutoGen();
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfig<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			if (!(configEntry is ConfigEntry<string> val))
			{
				if (!(configEntry is ConfigEntry<bool> val2))
				{
					if (!(configEntry is ConfigEntry<float> val3))
					{
						if (!(configEntry is ConfigEntry<int> val4))
						{
							throw new NotSupportedException($"Unsupported type: {typeof(T)}");
						}
						LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart));
					}
					else
					{
						LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart));
					}
				}
				else
				{
					LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart));
				}
			}
			else
			{
				LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart));
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddConfigSlider<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			if (!(configEntry is ConfigEntry<float> val))
			{
				if (!(configEntry is ConfigEntry<int> val2))
				{
					throw new NotSupportedException($"Slider not supported for type: {typeof(T)}");
				}
				LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart));
			}
			else
			{
				LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart));
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddButton(string section, string name, string description, string buttonText, Action callback)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate
			{
				callback?.Invoke();
			}));
		}
	}
}
namespace com.github.zehsteam.BlahajPlush.Data
{
	[Serializable]
	public class AudioClipGroup
	{
		public AudioClip AudioClip;

		public AudioClip AudioClipFar;

		public AudioClipGroup(AudioClip audioClip, AudioClip audioClipFar)
		{
			AudioClip = audioClip;
			AudioClipFar = audioClipFar;
		}
	}
	[Serializable]
	public class AudioSourceGroup
	{
		public AudioSource AudioSource;

		public AudioSource AudioSourceFar;

		public bool IsPlaying => AudioSource.isPlaying;

		public float Volume
		{
			get
			{
				return AudioSource.volume;
			}
			set
			{
				AudioSource.volume = value;
				AudioSourceFar.volume = value;
			}
		}

		public float Pitch
		{
			get
			{
				return AudioSource.pitch;
			}
			set
			{
				AudioSource.pitch = value;
				AudioSourceFar.pitch = value;
			}
		}

		public AudioSourceGroup(AudioSource audioSource, AudioSource audioSourceFar)
		{
			AudioSource = audioSource;
			AudioSourceFar = audioSourceFar;
		}

		public void Play()
		{
			AudioSource.Play();
			AudioSourceFar.Play();
		}

		public float PlayOneShot(AudioClipGroup audioClipGroup, float volumeScale = 1f)
		{
			if (audioClipGroup == null)
			{
				return 0f;
			}
			float result = 0f;
			if ((Object)(object)audioClipGroup.AudioClip != (Object)null)
			{
				result = audioClipGroup.AudioClip.length;
				AudioSource.PlayOneShot(audioClipGroup.AudioClip, volumeScale);
			}
			if ((Object)(object)audioClipGroup.AudioClipFar != (Object)null)
			{
				AudioSourceFar.PlayOneShot(audioClipGroup.AudioClipFar, volumeScale);
			}
			return result;
		}

		public void Pause()
		{
			AudioSource.Pause();
			AudioSourceFar.Pause();
		}

		public void Stop()
		{
			AudioSource.Stop();
			AudioSourceFar.Stop();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace com.github.zehsteam.BlahajPlush.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}