Decompiled source of JOJOPlush v1.0.2

com.github.zehsteam.JOJOPlush.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FNV;
using FNV.NewFolder;
using GameNetcodeStuff;
using HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Steamworks;
using Unity.Netcode;
using UnityEngine;
using com.github.zehsteam.JOJOPlush.Dependencies;
using com.github.zehsteam.JOJOPlush.Dependencies.FalloutNewVegas;
using com.github.zehsteam.JOJOPlush.Dependencies.FalloutNewVegas.Patches;
using com.github.zehsteam.JOJOPlush.Extensions;
using com.github.zehsteam.JOJOPlush.Helpers;
using com.github.zehsteam.JOJOPlush.Managers;
using com.github.zehsteam.JOJOPlush.MonoBehaviours;
using com.github.zehsteam.JOJOPlush.NetcodePatcher;
using com.github.zehsteam.JOJOPlush.Objects;
using com.github.zehsteam.JOJOPlush.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("FNV")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zehs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2026 Zehs")]
[assembly: AssemblyDescription("[v73+] Adds a JOJOsaysbreee plushie scrap item.")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+9da07ae8d65e57d0faf5fe249190012da603d7ae")]
[assembly: AssemblyProduct("JOJOPlush")]
[assembly: AssemblyTitle("com.github.zehsteam.JOJOPlush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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.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.JOJOPlush
{
	internal static class Assets
	{
		public static AssetBundle AssetBundle { get; private set; }

		public static GameObject PluginNetworkManagerPrefab { get; private set; }

		public static Item JOJOPlush { get; private set; }

		public static void Load()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = "jojoplush_assets";
			string text2 = Path.Combine(directoryName, text);
			if (!File.Exists(text2))
			{
				Logger.LogFatal("Failed to load assets. AssetBundle file could not be found at path \"" + text2 + "\". Make sure the \"" + text + "\" file is in the same folder as the mod's DLL file.");
			}
			else
			{
				AssetBundle val = AssetBundle.LoadFromFile(text2);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogFatal("Failed to load assets. AssetBundle is null.");
				}
				else
				{
					OnAssetBundleLoaded(val);
				}
			}
		}

		private static void OnAssetBundleLoaded(AssetBundle assetBundle)
		{
			AssetBundle = assetBundle;
			PluginNetworkManagerPrefab = LoadAsset<GameObject>("PluginNetworkManager", assetBundle);
			PluginNetworkManagerPrefab.AddComponent<PluginNetworkBehaviour>();
			JOJOPlush = LoadAsset<Item>("JOJOPlush", assetBundle);
		}

		private static T LoadAsset<T>(string name, AssetBundle assetBundle) where T : Object
		{
			if (string.IsNullOrWhiteSpace(name))
			{
				Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" from AssetBundle. Name is null or whitespace.");
				return default(T);
			}
			if ((Object)(object)assetBundle == (Object)null)
			{
				Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. AssetBundle is null.");
				return default(T);
			}
			T val = assetBundle.LoadAsset<T>(name);
			if ((Object)(object)val == (Object)null)
			{
				Logger.LogError("Failed to load asset of type \"" + typeof(T).Name + "\" with name \"" + name + "\" from AssetBundle. No asset found with that type and name.");
				return default(T);
			}
			return val;
		}

		private static bool TryLoadAsset<T>(string name, AssetBundle assetBundle, out T asset) where T : Object
		{
			asset = LoadAsset<T>(name, assetBundle);
			return (Object)(object)asset != (Object)null;
		}
	}
	internal static class Logger
	{
		public static ManualLogSource ManualLogSource { get; private set; }

		public static void Initialize(ManualLogSource manualLogSource)
		{
			ManualLogSource = manualLogSource;
		}

		public static void LogDebug(object data, bool extended = false)
		{
			Log((LogLevel)32, data, extended);
		}

		public static void LogInfo(object data, bool extended = false)
		{
			Log((LogLevel)16, data, extended);
		}

		public static void LogWarning(object data, bool extended = false)
		{
			Log((LogLevel)4, data, extended);
		}

		public static void LogError(object data, bool extended = false)
		{
			Log((LogLevel)2, data, extended);
		}

		public static void LogFatal(object data, bool extended = false)
		{
			Log((LogLevel)1, data, extended);
		}

		public static void Log(LogLevel logLevel, object data, bool extended = false)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (!extended || IsExtendedLoggingEnabled())
			{
				ManualLogSource manualLogSource = ManualLogSource;
				if (manualLogSource != null)
				{
					manualLogSource.Log(logLevel, data);
				}
			}
		}

		public static bool IsExtendedLoggingEnabled()
		{
			return ConfigManager.ExtendedLogging?.Value ?? false;
		}
	}
	[BepInPlugin("com.github.zehsteam.JOJOPlush", "JOJOPlush", "1.0.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("com.github.zehsteam.JOJOPlush");

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			Instance = this;
			Logger.Initialize(Logger.CreateLogSource("com.github.zehsteam.JOJOPlush"));
			Logger.LogInfo("JOJOPlush has awoken!");
			_harmony.PatchAll(typeof(GameNetworkManagerPatch));
			_harmony.PatchAll(typeof(StartOfRoundPatch));
			_harmony.PatchAll(typeof(GrabbableObjectPatch));
			if (FalloutNewVegasProxy.Enabled)
			{
				FalloutNewVegasProxy.PatchAll(_harmony);
			}
			Assets.Load();
			ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
			RegisterScrapItems();
			NetcodePatcherAwake();
		}

		private void NetcodePatcherAwake()
		{
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				Type[] types = executingAssembly.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)
					{
						try
						{
							object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
							if (customAttributes.Length != 0)
							{
								try
								{
									methodInfo.Invoke(null, null);
								}
								catch (TargetInvocationException ex)
								{
									((BaseUnityPlugin)this).Logger.LogWarning((object)("Failed to invoke method " + methodInfo.Name + ": " + ex.Message));
								}
							}
						}
						catch (Exception ex2)
						{
							((BaseUnityPlugin)this).Logger.LogWarning((object)("Error processing method " + methodInfo.Name + " in type " + type.Name + ": " + ex2.Message));
						}
					}
				}
			}
			catch (Exception ex3)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("An error occurred in NetcodePatcherAwake: " + ex3.Message));
			}
		}

		private void RegisterScrapItems()
		{
			ItemHelper.RegisterScrap(ConfigManager.JOJOPlush);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.zehsteam.JOJOPlush";

		public const string PLUGIN_NAME = "JOJOPlush";

		public const string PLUGIN_VERSION = "1.0.2";
	}
}
namespace com.github.zehsteam.JOJOPlush.Patches
{
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal static class GameNetworkManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch()
		{
			AddNetworkPrefabs();
		}

		private static void AddNetworkPrefabs()
		{
			AddNetworkPrefab(Assets.PluginNetworkManagerPrefab);
		}

		private static void AddNetworkPrefab(GameObject prefab)
		{
			if ((Object)(object)prefab == (Object)null)
			{
				Logger.LogError("Failed to register network prefab. GameObject is null.");
				return;
			}
			NetworkManager.Singleton.AddNetworkPrefab(prefab);
			Logger.LogInfo("Registered \"" + ((Object)prefab).name + "\" network prefab.");
		}
	}
	[HarmonyPatch(typeof(GrabbableObject))]
	internal static class GrabbableObjectPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPatch(GrabbableObject __instance)
		{
			string itemName = __instance.itemProperties.itemName;
			if (itemName.Equals("Jar of pickles", StringComparison.OrdinalIgnoreCase) && PlayerUtils.IsHost(PlayerUtils.GetJOJOsaysbreeeInfo()))
			{
				ScanNodeProperties componentInChildren = ((Component)__instance).GetComponentInChildren<ScanNodeProperties>();
				if (!((Object)(object)componentInChildren == (Object)null))
				{
					componentInChildren.headerText = "Turtle dicks";
				}
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal static class StartOfRoundPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch()
		{
			SpawnNetworkHandler();
		}

		private static void SpawnNetworkHandler()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkUtils.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(Assets.PluginNetworkManagerPrefab, Vector3.zero, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
		}

		[HarmonyPatch("OnClientConnect")]
		[HarmonyPrefix]
		private static void OnClientConnectPatch(ref ulong clientId)
		{
			if (NetworkUtils.IsServer)
			{
				SyncedConfigEntryBase.SendConfigsToClient(clientId);
			}
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Objects
{
	[Serializable]
	public class AudioClipGroup
	{
		public AudioClip AudioClip;

		public AudioClip AudioClipFar;

		public float Length => AudioClip.length;

		public AudioClipGroup(AudioClip audioClip, AudioClip audioClipFar)
		{
			AudioClip = audioClip;
			AudioClipFar = audioClipFar;
		}
	}
	[Serializable]
	public class AudioClipGroupWithWeight : AudioClipGroup
	{
		[Range(0f, 100f)]
		public int Weight = 10;

		public AudioClipGroupWithWeight(AudioClip audioClip, AudioClip audioClipFar, int weight = 10)
			: base(audioClip, audioClipFar)
		{
			Weight = weight;
		}
	}
	[Serializable]
	public class AudioClipGroupWithData<T> : AudioClipGroup
	{
		public T Data;

		public AudioClipGroupWithData(AudioClip audioClip, AudioClip audioClipFar, T data)
			: base(audioClip, audioClipFar)
		{
			Data = data;
		}
	}
	[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();
		}
	}
	public class ItemConfigEntry
	{
		public static List<ItemConfigEntry> Instances { get; private set; } = new List<ItemConfigEntry>();


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

		public SyncedConfigEntry<bool> TwoHanded { get; private set; }

		public SyncedConfigEntry<int> CarryWeight { get; private set; }

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

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

		public Item Item { get; private set; }

		public ItemConfigEntry(Item item, string section, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			Instances.Add(this);
			Item = item;
			Bind(section, rarity, twoHanded, carryWeight, minValue, maxValue);
		}

		private void Bind(string section, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			if (!((Object)(object)Item == (Object)null))
			{
				SpawnWeight = ConfigHelper.Bind(section, "SpawnWeight", rarity, Item.itemName + " spawn chance weight.");
				TwoHanded = ConfigHelper.BindSynced(section, "TwoHanded", twoHanded, "If enabled, " + Item.itemName + " will be two-handed.");
				CarryWeight = ConfigHelper.BindSynced(section, "CarryWeight", carryWeight, Item.itemName + " carry weight in pounds.");
				MinValue = ConfigHelper.Bind(section, "MinValue", minValue, Item.itemName + " min scrap value.");
				MaxValue = ConfigHelper.Bind(section, "MaxValue", maxValue, Item.itemName + " max scrap value.");
				SpawnWeight.SettingChanged += delegate
				{
					SpawnWeight_SettingsChanged();
				};
				TwoHanded.SettingChanged += delegate
				{
					Properties_SettingsChanged();
				};
				CarryWeight.SettingChanged += delegate
				{
					Properties_SettingsChanged();
				};
				MinValue.SettingChanged += delegate
				{
					Properties_SettingsChanged();
				};
				MaxValue.SettingChanged += delegate
				{
					Properties_SettingsChanged();
				};
			}
		}

		private void SpawnWeight_SettingsChanged()
		{
			ItemHelper.UpdateScrapRarity(this);
		}

		private void Properties_SettingsChanged()
		{
			ItemHelper.UpdateItemProperties(this);
		}
	}
	public class SyncedConfigEntry<T> : SyncedConfigEntryBase
	{
		private ConfigEntry<T> _configEntry;

		private T _serverValue;

		public T Value
		{
			get
			{
				return GetValue();
			}
			set
			{
				SetValue(value);
			}
		}

		public T DefaultValue => (T)((ConfigEntryBase)_configEntry).DefaultValue;

		public override ConfigDefinition Definition => ((ConfigEntryBase)_configEntry).Definition;

		public event Action<T> SettingChanged;

		public SyncedConfigEntry(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null, ConfigFile configFile = null)
		{
			SyncedConfigEntryBase.AddInstance(this);
			base.SettingType = typeof(T);
			_configEntry = ConfigHelper.Bind(section, key, defaultValue, description, requiresRestart: false, acceptableValues, null, configFile);
			_configEntry.SettingChanged += SettingChangedInternal;
			Application.quitting += delegate
			{
				_configEntry.SettingChanged -= SettingChangedInternal;
			};
		}

		public T GetValue()
		{
			if (NetworkUtils.IsConnected && !NetworkUtils.IsServer)
			{
				return _serverValue;
			}
			return _configEntry.Value;
		}

		public void SetValue(T value)
		{
			if (!NetworkUtils.IsConnected || NetworkUtils.IsServer)
			{
				_configEntry.Value = value;
			}
		}

		public void ResetToDefault()
		{
			if (!NetworkUtils.IsConnected || NetworkUtils.IsServer)
			{
				_configEntry.Value = DefaultValue;
			}
		}

		private void SettingChangedInternal(object sender, EventArgs e)
		{
			if (NetworkUtils.IsConnected && NetworkUtils.IsServer)
			{
				this.SettingChanged?.Invoke(Value);
				SendConfigToClients();
			}
		}

		private void SendConfigToClients()
		{
			//IL_003b: 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)
			if (NetworkUtils.IsConnected && NetworkUtils.IsServer)
			{
				PluginNetworkBehaviour.Instance?.SetSyncedConfigValueClientRpc(base.Section, base.Key, Value.ToString());
			}
		}

		public override void SendConfigToClient(ulong clientId)
		{
			//IL_0011: 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)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkUtils.IsConnected && NetworkUtils.IsServer)
			{
				ClientRpcParams val = default(ClientRpcParams);
				val.Send = new ClientRpcSendParams
				{
					TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId)
				};
				ClientRpcParams clientRpcParams = val;
				PluginNetworkBehaviour.Instance?.SetSyncedConfigValueClientRpc(base.Section, base.Key, Value.ToString(), clientRpcParams);
			}
		}

		public override void SetValueFromServer(string value)
		{
			if (NetworkUtils.IsConnected && !NetworkUtils.IsServer)
			{
				if (!Utils.TryParseValue<T>(value, out var result))
				{
					throw new InvalidOperationException($"Failed to parse value: \"{value}\" for type {typeof(T)}");
				}
				_serverValue = result;
				Logger.LogInfo("Set synced config entry value from server. (Section: \"" + base.Section + "\", Key: \"" + base.Key + "\", Value: \"" + value + "\")", extended: true);
				this.SettingChanged?.Invoke(result);
			}
		}
	}
	public abstract class SyncedConfigEntryBase
	{
		private static readonly object _instancesLock = new object();

		public static List<SyncedConfigEntryBase> Instances { get; private set; } = new List<SyncedConfigEntryBase>();


		public abstract ConfigDefinition Definition { get; }

		public string Section => Definition.Section;

		public string Key => Definition.Key;

		public Type SettingType { get; protected set; }

		public static void AddInstance(SyncedConfigEntryBase instance)
		{
			lock (_instancesLock)
			{
				Instances.Add(instance);
			}
		}

		public static void RemoveInstance(SyncedConfigEntryBase instance)
		{
			lock (_instancesLock)
			{
				Instances.Remove(instance);
			}
		}

		public abstract void SendConfigToClient(ulong clientId);

		public abstract void SetValueFromServer(string value);

		public static void SendConfigsToClient(ulong clientId)
		{
			if (!NetworkUtils.IsConnected || !NetworkUtils.IsServer || NetworkUtils.IsLocalClientId(clientId))
			{
				return;
			}
			foreach (SyncedConfigEntryBase instance in Instances)
			{
				instance.SendConfigToClient(clientId);
			}
		}

		public static void SetValueFromServer(string section, string key, string value)
		{
			if (NetworkUtils.IsConnected && !NetworkUtils.IsServer)
			{
				SyncedConfigEntryBase syncedConfigEntryBase = Instances.Find((SyncedConfigEntryBase x) => x.Section == section && x.Key == key);
				if (syncedConfigEntryBase == null)
				{
					Logger.LogWarning("No matching synced config entry found for section: \"" + section + "\", key: \"" + key + "\"");
				}
				else
				{
					syncedConfigEntryBase.SetValueFromServer(value);
				}
			}
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.MonoBehaviours
{
	public abstract class AdvancedGrabbableObject : GrabbableObject
	{
		public int UniqueId { get; private set; }

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

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

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if (NetworkUtils.IsServer)
			{
				NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
			}
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			if (NetworkUtils.IsServer)
			{
				NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnected;
			}
		}

		protected virtual void OnClientConnected(ulong clientId)
		{
		}

		public override int GetItemDataToSave()
		{
			return UniqueId;
		}

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

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

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

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "AdvancedGrabbableObject";
		}
	}
	public class AdvancedNoisemakerProp : AdvancedGrabbableObject
	{
		[Space(20f)]
		[Header("Advanced Noisemaker Prop")]
		[Space(5f)]
		public AudioSourceGroup NoiseAudio;

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

		[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 override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (NoiseSFX.Length != 0)
			{
				int randomIndexFromWeightList = Utils.GetRandomIndexFromWeightList(NoiseSFX.Select((AudioClipGroupWithWeight x) => x.Weight).ToList());
				PlaySound(randomIndexFromWeightList);
			}
		}

		public void PlaySound(int index)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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(99839116u, serverRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, index);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 99839116u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				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)
			//IL_00db: 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.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3084224684u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, index);
				BytePacker.WriteValueBitPacked(val2, senderClientId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3084224684u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!NetworkUtils.IsLocalClientId(senderClientId))
				{
					PlaySoundOnLocalClient(index);
				}
			}
		}

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

		protected virtual void OnPlaySoundFromIndex(int index)
		{
		}

		public float PlaySoundOnLocalClient(AudioClip audioClip, AudioClip audioClipFar, bool stopPreviousSFX = false)
		{
			return PlaySoundOnLocalClient(new AudioClipGroup(audioClip, audioClipFar), stopPreviousSFX);
		}

		public float PlaySoundOnLocalClient(AudioClipGroup audioClipGroup, bool stopPreviousSFX = false)
		{
			//IL_00d2: 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 || stopPreviousSFX)
			{
				NoiseAudio.Stop();
			}
			if (UseDynamicCooldown && !CancelActiveSFXOnItemActivate)
			{
				((GrabbableObject)this).currentUseCooldown = audioClipGroup.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, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			if (MinLoudness >= 0.6f && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				((GrabbableObject)this).playerHeldBy.timeSinceMakingLoudNoise = 0f;
			}
			return audioClipGroup.Length;
		}

		protected override void __initializeVariables()
		{
			base.__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
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(99839116u, new RpcReceiveHandler(__rpc_handler_99839116), "PlaySoundServerRpc");
			((NetworkBehaviour)this).__registerRpc(3084224684u, new RpcReceiveHandler(__rpc_handler_3084224684), "PlaySoundClientRpc");
			base.__initializeRpcs();
		}

		private static void __rpc_handler_99839116(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_3084224684(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)1;
				((AdvancedNoisemakerProp)(object)target).PlaySoundClientRpc(index, senderClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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

		protected override void __initializeRpcs()
		{
			base.__initializeRpcs();
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "JOJOPlush";
		}
	}
	public class PluginNetworkBehaviour : NetworkBehaviour
	{
		public static PluginNetworkBehaviour Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
				return;
			}
			Instance = this;
			((Object)((Component)this).gameObject).name = "JOJOPlush PluginNetworkBehaviour";
		}

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
			}
			else
			{
				Instance = this;
			}
		}

		[ClientRpc]
		public void SetSyncedConfigValueClientRpc(string section, string key, string value, ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: 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 && (networkManager.IsServer || networkManager.IsHost))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2952255261u, clientRpcParams, (RpcDelivery)0);
				bool flag = section != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(section, false);
				}
				bool flag2 = key != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives));
				if (flag2)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(key, false);
				}
				bool flag3 = value != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives));
				if (flag3)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe(value, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 2952255261u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (!NetworkUtils.IsServer)
				{
					SyncedConfigEntryBase.SetValueFromServer(section, key, value);
				}
			}
		}

		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(2952255261u, new RpcReceiveHandler(__rpc_handler_2952255261), "SetSyncedConfigValueClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_2952255261(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				string section = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref section, false);
				}
				bool flag2 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives));
				string key = null;
				if (flag2)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref key, false);
				}
				bool flag3 = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives));
				string value = null;
				if (flag3)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref value, false);
				}
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PluginNetworkBehaviour)(object)target).SetSyncedConfigValueClientRpc(section, key, value, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PluginNetworkBehaviour";
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Managers
{
	internal static class ConfigManager
	{
		public static ConfigFile ConfigFile { get; private set; }

		public static ConfigEntry<bool> ExtendedLogging { get; private set; }

		public static ConfigEntry<bool> FNV_FixCopyrightPrevention { get; private set; }

		public static ItemConfigEntry JOJOPlush { get; private set; }

		public static void Initialize(ConfigFile configFile)
		{
			ConfigFile = configFile;
			BindConfigs();
		}

		private static void BindConfigs()
		{
			ConfigHelper.SkipAutoGen();
			ExtendedLogging = ConfigHelper.Bind("General", "ExtendedLogging", defaultValue: false, "Enable extended logging.");
			if (FalloutNewVegasProxy.Enabled)
			{
				FNV_FixCopyrightPrevention = ConfigHelper.Bind("Fallout NewVegas Compat", "FixCopyrightPrevention", defaultValue: true, "If enabled, will disable all songs from the Fallout NewVegas mod if you have 'Enable copyrighted tracks' disabled in the mods config.");
			}
			JOJOPlush = new ItemConfigEntry(Assets.JOJOPlush, "JOJOsaysbreee", 20, twoHanded: false, 6, 80, 250);
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Helpers
{
	internal static class ConfigHelper
	{
		public static void SkipAutoGen()
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.SkipAutoGen();
			}
		}

		public static void AddButton(string section, string name, string buttonText, string description, Action callback)
		{
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.AddButton(section, name, buttonText, description, callback);
			}
		}

		public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description, bool requiresRestart = false, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null)
		{
			if (configFile == null)
			{
				configFile = ((BaseUnityPlugin)Plugin.Instance).Config;
			}
			ConfigEntry<T> configEntry = configFile.Bind(section, key, defaultValue, description, acceptableValues);
			if (settingChanged != null)
			{
				configEntry.SettingChanged += delegate
				{
					settingChanged?.Invoke(configEntry.Value);
				};
			}
			if (LethalConfigProxy.Enabled)
			{
				LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart);
			}
			return configEntry;
		}

		public static SyncedConfigEntry<T> BindSynced<T>(string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null)
		{
			SyncedConfigEntry<T> syncedConfigEntry = new SyncedConfigEntry<T>(section, key, defaultValue, description, acceptableValues, configFile);
			if (settingChanged != null)
			{
				syncedConfigEntry.SettingChanged += settingChanged;
			}
			return syncedConfigEntry;
		}
	}
	internal static class ItemHelper
	{
		public static void RegisterScrap(Item item, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			if ((Object)(object)item == (Object)null)
			{
				Logger.LogError("Failed to register scrap item. Item is null.");
				return;
			}
			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));
			Logger.LogInfo($"Registered \"{item.itemName}\" scrap item. (Rarity: {rarity}, TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})");
		}

		public static void RegisterScrap(ItemConfigEntry ItemConfigEntry)
		{
			RegisterScrap(ItemConfigEntry.Item, ItemConfigEntry.SpawnWeight.Value, ItemConfigEntry.TwoHanded.Value, ItemConfigEntry.CarryWeight.Value, ItemConfigEntry.MinValue.Value, ItemConfigEntry.MaxValue.Value);
		}

		public static void UpdateScrapRarity(Item item, int rarity)
		{
			if ((Object)(object)item == (Object)null)
			{
				Logger.LogError("Failed to update scrap item rarity. Item is null.");
				return;
			}
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				Logger.LogError("Failed to update scrap item rarity. StartOfRound instance is 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;
						Logger.LogInfo($"Updated \"{item.itemName}\" scrap item rarity to {rarity} on \"{val.PlanetName}\".");
					}
				}
			}
		}

		public static void UpdateScrapRarity(ItemConfigEntry ItemConfigEntry)
		{
			UpdateScrapRarity(ItemConfigEntry.Item, ItemConfigEntry.SpawnWeight.Value);
		}

		public static void UpdateItemProperties(Item item, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			if ((Object)(object)item == (Object)null)
			{
				Logger.LogError("Failed to update item properties. Item is null.");
				return;
			}
			item.twoHanded = twoHanded;
			item.weight = (float)carryWeight / 105f + 1f;
			item.minValue = minValue;
			item.maxValue = maxValue;
			Logger.LogInfo($"Updated \"{item.itemName}\" item properties. (TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})");
		}

		public static void UpdateItemProperties(string itemName, bool twoHanded, int carryWeight, int minValue, int maxValue)
		{
			if (!TryGetItem(itemName, out var item, matchCase: false))
			{
				Logger.LogError("Failed to update item properties. Item is null. (ItemName: " + itemName + ")");
			}
			else
			{
				UpdateItemProperties(item, twoHanded, carryWeight, minValue, maxValue);
			}
		}

		public static void UpdateItemProperties(ItemConfigEntry ItemConfigEntry)
		{
			UpdateItemProperties(ItemConfigEntry.Item, ItemConfigEntry.TwoHanded.Value, ItemConfigEntry.CarryWeight.Value, ItemConfigEntry.MinValue.Value, ItemConfigEntry.MaxValue.Value);
		}

		public static Item GetItem(string itemName, bool matchCase = true)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				Logger.LogError("Failed to get item by name. StartOfRound instance is null.");
				return null;
			}
			StringComparison comparisonType = ((!matchCase) ? StringComparison.OrdinalIgnoreCase : StringComparison.CurrentCulture);
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				if (items.itemName.Equals(itemName, comparisonType))
				{
					return items;
				}
			}
			return null;
		}

		public static bool TryGetItem(string itemName, out Item item, bool matchCase = true)
		{
			item = GetItem(itemName, matchCase);
			return (Object)(object)item != (Object)null;
		}

		public static List<Item> GetItems(string[] itemNames, bool matchCase = true)
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null)
			{
				Logger.LogError("Failed to get items by names. StartOfRound instance is null.");
				return new List<Item>();
			}
			List<Item> list = new List<Item>();
			foreach (string itemName in itemNames)
			{
				if (TryGetItem(itemName, out var item, matchCase))
				{
					list.Add(item);
				}
			}
			return list;
		}
	}
	internal static class NetworkUtils
	{
		public static bool IsConnected
		{
			get
			{
				NetworkManager singleton = NetworkManager.Singleton;
				if (singleton == null)
				{
					return false;
				}
				return singleton.IsConnectedClient;
			}
		}

		public static bool IsServer
		{
			get
			{
				NetworkManager singleton = NetworkManager.Singleton;
				if (singleton == null)
				{
					return false;
				}
				return singleton.IsServer;
			}
		}

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

		public static int ConnectedPlayerCount => GameNetworkManager.Instance?.connectedPlayers ?? 0;

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

		public static bool IsLocalClientId(ulong clientId)
		{
			return clientId == GetLocalClientId();
		}
	}
	internal static class PlayerUtils
	{
		public static bool IsLocalPlayer(PlayerInfo playerInfo)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (SteamClient.Name.Equals(playerInfo.Username, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (SteamId.op_Implicit(SteamClient.SteamId) == playerInfo.SteamId)
			{
				return true;
			}
			return false;
		}

		public static bool IsPlayer(PlayerControllerB playerScript, PlayerInfo playerInfo)
		{
			if (playerScript.playerUsername.Equals(playerInfo.Username, StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (playerScript.playerSteamId == playerInfo.SteamId)
			{
				return true;
			}
			return false;
		}

		public static bool HasPlayer(PlayerInfo playerInfo)
		{
			return StartOfRound.Instance.allPlayerScripts.Any((PlayerControllerB x) => IsPlayer(x, playerInfo));
		}

		public static bool IsHost(PlayerInfo playerInfo)
		{
			PlayerControllerB val = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB x) => ((NetworkBehaviour)x).IsHost));
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			return IsPlayer(val, playerInfo);
		}

		public static PlayerInfo GetJOJOsaysbreeeInfo()
		{
			return new PlayerInfo("JOJOsaysbreee", 76561198060495494uL);
		}
	}
	internal struct PlayerInfo
	{
		public string Username { get; set; }

		public ulong SteamId { get; set; }

		public PlayerInfo(string username, ulong steamId)
		{
			Username = username;
			SteamId = steamId;
		}
	}
	internal static class Utils
	{
		public static string GetPluginDirectoryPath()
		{
			return Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
		}

		public static string GetConfigDirectoryPath()
		{
			return Paths.ConfigPath;
		}

		public static string GetGlobalConfigDirectoryPath()
		{
			return Path.Combine(Application.persistentDataPath, "JOJOPlush");
		}

		public static string GetPluginPersistentDataPath()
		{
			return Path.Combine(Application.persistentDataPath, "JOJOPlush");
		}

		public static ConfigFile CreateConfigFile(BaseUnityPlugin plugin, string path, string name = null, bool saveOnInit = false)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			BepInPlugin metadata = MetadataHelper.GetMetadata((object)plugin);
			if (name == null)
			{
				name = metadata.GUID;
			}
			name += ".cfg";
			return new ConfigFile(Path.Combine(path, name), saveOnInit, metadata);
		}

		public static ConfigFile CreateLocalConfigFile(BaseUnityPlugin plugin, string name = null, bool saveOnInit = false)
		{
			return CreateConfigFile(plugin, Paths.ConfigPath, name, saveOnInit);
		}

		public static ConfigFile CreateGlobalConfigFile(BaseUnityPlugin plugin, string name = null, bool saveOnInit = false)
		{
			string pluginPersistentDataPath = GetPluginPersistentDataPath();
			if (name == null)
			{
				name = "global";
			}
			return CreateConfigFile(plugin, pluginPersistentDataPath, name, saveOnInit);
		}

		public static bool RollPercentChance(float percent)
		{
			if (percent <= 0f)
			{
				return false;
			}
			if (percent >= 100f)
			{
				return true;
			}
			return Random.value * 100f <= percent;
		}

		public static int GetRandomIndexFromWeightList(List<int> weightList)
		{
			List<(int, int)> list = new List<(int, int)>();
			for (int i = 0; i < weightList.Count; i++)
			{
				int num = weightList[i];
				if (num > 0)
				{
					list.Add((i, num));
				}
			}
			int num2 = 0;
			foreach (var item4 in list)
			{
				int item = item4.Item2;
				num2 += item;
			}
			if (num2 == 0)
			{
				return -1;
			}
			int num3 = Random.Range(0, num2);
			int num4 = 0;
			foreach (var item5 in list)
			{
				int item2 = item5.Item1;
				int item3 = item5.Item2;
				num4 += item3;
				if (num3 < num4)
				{
					return item2;
				}
			}
			throw new InvalidOperationException("Weights are not properly specified.");
		}

		public static bool TryParseValue<T>(string value, out T result)
		{
			try
			{
				if (typeof(T) == typeof(int) && int.TryParse(value, out var result2))
				{
					result = (T)(object)result2;
					return true;
				}
				if (typeof(T) == typeof(float) && float.TryParse(value, out var result3))
				{
					result = (T)(object)result3;
					return true;
				}
				if (typeof(T) == typeof(double) && double.TryParse(value, out var result4))
				{
					result = (T)(object)result4;
					return true;
				}
				if (typeof(T) == typeof(bool) && bool.TryParse(value, out var result5))
				{
					result = (T)(object)result5;
					return true;
				}
				if (typeof(T) == typeof(string))
				{
					result = (T)(object)value;
					return true;
				}
			}
			catch
			{
			}
			result = default(T);
			return false;
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Extensions
{
	internal static class ConfigFileExtensions
	{
		public static ConfigEntry<T> Bind<T>(this ConfigFile configFile, string section, string key, T defaultValue, string description, AcceptableValueBase acceptableValues)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (acceptableValues == null)
			{
				return configFile.Bind<T>(section, key, defaultValue, description);
			}
			return configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>()));
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Dependencies
{
	internal static class LethalConfigProxy
	{
		public const string PLUGIN_GUID = "ainavt.lc.lethalconfig";

		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			AcceptableValueBase acceptableValues = ((ConfigEntryBase)configEntry).Description.AcceptableValues;
			if (acceptableValues != null)
			{
				if (acceptableValues is AcceptableValueRange<float> || acceptableValues is AcceptableValueRange<int>)
				{
					AddConfigSlider<T>(configEntry, requiresRestart);
					return;
				}
				if (acceptableValues is AcceptableValueList<string>)
				{
					AddConfigDropdown<T>(configEntry, requiresRestart);
					return;
				}
			}
			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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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 AddConfigDropdown<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			if (configEntry is ConfigEntry<string> val)
			{
				LethalConfigManager.AddConfigItem((BaseConfigItem)new TextDropDownConfigItem(val, requiresRestart));
				return;
			}
			throw new NotSupportedException($"Dropdown not supported for type: {typeof(T)}");
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddButton(string section, string name, string buttonText, string description, Action callback)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate
			{
				callback?.Invoke();
			}));
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Dependencies.FalloutNewVegas
{
	internal static class FalloutNewVegasProxy
	{
		public const string PLUGIN_GUID = "lostpoet.NewVegasMod";

		private static bool? _enabled;

		public static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled.GetValueOrDefault();
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("lostpoet.NewVegasMod");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void PatchAll(Harmony harmony)
		{
			try
			{
				harmony.PatchAll(typeof(IntercomsManagerPatch));
				Logger.LogInfo("[FalloutNewVegasProxy] Applied patches.");
			}
			catch (Exception arg)
			{
				Logger.LogError(string.Format("[{0}] Failed to apply patches. {1}", "FalloutNewVegasProxy", arg));
			}
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.Dependencies.FalloutNewVegas.Patches
{
	[HarmonyPatch(typeof(IntercomsManager))]
	internal static class IntercomsManagerPatch
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch(IntercomsManager __instance)
		{
			if (!Plugin.VegasConfig.radio_UseCopyrightedAudio.Value && ConfigManager.FNV_FixCopyrightPrevention.Value)
			{
				__instance.Songs = Array.Empty<RadioTrack>();
				Logger.LogInfo("[FalloutNewVegasProxy] Disabled all songs to prevent copyright.");
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			if (!_moveNextCalled)
			{
				return _moveNextCalled = true;
			}
			return false;
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, (T)value))
		{
			return -1;
		}
		return 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		if (!EqualityComparer<T>.Default.Equals(_item, item))
		{
			return -1;
		}
		return 0;
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace com.github.zehsteam.JOJOPlush.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}