Decompiled source of LootableMusicTapes v1.0.1

LootableMusicTapes.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LootableMusicTapes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LootableMusicTapes")]
[assembly: AssemblyCopyright("Copyright c  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f2b95627-162b-4df4-a33a-0bd7a6bb221b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace LootableMusicTapes;

[BepInPlugin("ohotdog.lootablemusictapes", "Lootable Music Tapes", "1.0.1")]
public class LootableMusicTapesBase : BaseUnityPlugin
{
	private const string modGUID = "ohotdog.lootablemusictapes";

	private const string modName = "Lootable Music Tapes";

	private const string modVersion = "1.0.1";

	private static string bundlePath = "";

	private readonly Harmony harmony = new Harmony("ohotdog.lootablemusictapes");

	private static LootableMusicTapesBase Instance;

	internal ManualLogSource logSource;

	public static GameObject cassettePlayerPrefab;

	private void Awake()
	{
		if ((Object)(object)Instance == (Object)null)
		{
			Instance = this;
		}
		logSource = Logger.CreateLogSource("ohotdog.lootablemusictapes");
		bundlePath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "cassetteitem");
		Assets.LoadAssetBundle(bundlePath);
		AssetBundle bundle = Assets.GetBundle();
		Item val = bundle.LoadAsset<Item>("cassetteplayeritem");
		CassettePlayer cassettePlayer = val.spawnPrefab.AddComponent<CassettePlayer>();
		((GrabbableObject)cassettePlayer).itemProperties = val;
		((GrabbableObject)cassettePlayer).itemProperties.creditsWorth = 35;
		((GrabbableObject)cassettePlayer).itemProperties.minValue = 25;
		((GrabbableObject)cassettePlayer).itemProperties.maxValue = 50;
		((GrabbableObject)cassettePlayer).itemProperties.highestSalePercentage = 60;
		cassettePlayer.insert = bundle.LoadAsset<AudioClip>("walkman-insert");
		cassettePlayer.eject = bundle.LoadAsset<AudioClip>("walkman-eject");
		cassettePlayer.play = bundle.LoadAsset<AudioClip>("walkman-play");
		cassettePlayer.stop = bundle.LoadAsset<AudioClip>("walkman-stop");
		cassettePlayer.close = bundle.LoadAsset<AudioClip>("walkman-close");
		CassettePlayer.cassetteSongs = new List<AudioClip>();
		CreateCassetteItem(0, bundle, "cassettenazareitem", 973, "na-zare", 65, 20, 30, (LevelTypes)2);
		CreateCassetteItem(1, bundle, "cassettelastchristmasitem", 974, "lastchristmas", 60, 20, 30, (LevelTypes)510);
		CreateCassetteItem(2, bundle, "cassettestayinaliveitem", 975, "stayinalive", 61, 25, 35, (LevelTypes)8);
		CreateCassetteItem(3, bundle, "cassettemammasdontitem", 976, "mammasdont", 68, 25, 35, (LevelTypes)4);
		CreateCassetteItem(4, bundle, "cassetteshadilayitem", 977, "shadilay", 67, 30, 40, (LevelTypes)32);
		CreateCassetteItem(5, bundle, "cassettehounddogitem", 978, "hounddog", 54, 35, 45, (LevelTypes)4);
		CreateCassetteItem(6, bundle, "cassettewhitechristmasitem", 979, "whitechristmas", 52, 40, 50, (LevelTypes)256);
		CreateCassetteItem(7, bundle, "cassettesleepwalkitem", 980, "sleepwalk", 51, 45, 55, (LevelTypes)16);
		CreateCassetteItem(8, bundle, "cassetteoutoftouchitem", 981, "outoftouch", 45, 50, 60, (LevelTypes)2);
		CreateCassetteItem(9, bundle, "cassettefeliznavidaditem", 982, "feliznavidad", 43, 55, 65, (LevelTypes)64);
		CreateCassetteItem(10, bundle, "cassetteitsrainingmenitem", 983, "itsrainingmen", 48, 60, 70, (LevelTypes)8);
		CreateCassetteItem(11, bundle, "cassettetimeaftertimeitem", 984, "timeaftertime", 45, 65, 75, (LevelTypes)510);
		CreateCassetteItem(12, bundle, "cassettelivinonaprayeritem", 985, "livinonaprayer", 43, 70, 80, (LevelTypes)32);
		CreateCassetteItem(13, bundle, "cassetteheartacheitem", 986, "heartache", 41, 75, 85, (LevelTypes)16);
		CreateCassetteItem(14, bundle, "cassettekletkaitem", 987, "kletka", 40, 80, 90, (LevelTypes)64);
		CreateCassetteItem(15, bundle, "cassettecountryroadsitem", 988, "countryroads", 35, 85, 95, (LevelTypes)4);
		CreateCassetteItem(16, bundle, "cassettetotaleclipseitem", 989, "totaleclipse", 27, 90, 100, (LevelTypes)8);
		CreateCassetteItem(17, bundle, "cassetteineedaheroitem", 990, "ineedahero", 27, 90, 100, (LevelTypes)8);
		CreateCassetteItem(18, bundle, "cassettedangerzoneitem", 991, "dangerzone", 23, 95, 115, (LevelTypes)256);
		CreateCassetteItem(19, bundle, "cassetteroundaboutitem", 992, "roundabout", 14, 100, 110, (LevelTypes)2);
		CreateCassetteItem(20, bundle, "cassettekonchitsyaitem", 993, "konchitsya", 8, 110, 130, (LevelTypes)510);
		CreateCassetteItem(21, bundle, "cassetteworstbanditem", 994, "worstband", 40, 25, 35, (LevelTypes)510);
		CreateCassetteItem(22, bundle, "cassettemrsquareitem", 995, "mrsquare", 30, 79, 89, (LevelTypes)4);
		Items.RegisterShopItem(val, 35);
		cassettePlayerPrefab = val.spawnPrefab;
		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);
				}
			}
		}
		NetworkPrefabs.RegisterNetworkPrefab(cassettePlayerPrefab);
		harmony.PatchAll();
		logSource.LogInfo((object)"Lootable Music Tapes started successfully!");
	}

	public static void AddNewSong(AudioClip songClip)
	{
		CassettePlayer.cassetteSongs.Add(songClip);
	}

	public void CreateCassetteItem(int songIndex, AssetBundle assetBundle, string itemAssetName, int cassetteItemId, string assetSongName, int rarity, int minValue, int maxValue, LevelTypes levelType)
	{
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		Item val = assetBundle.LoadAsset<Item>(itemAssetName);
		val.itemId = cassetteItemId;
		Cassette cassette = val.spawnPrefab.AddComponent<Cassette>();
		val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().minRange = 2;
		val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().maxRange = 15;
		val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().requiresLineOfSight = true;
		val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().nodeType = 2;
		val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().creatureScanID = -1;
		string subText = val.spawnPrefab.GetComponentInChildren<ScanNodeProperties>().subText;
		((GrabbableObject)cassette).itemProperties = val;
		cassette.songIndex = songIndex;
		AddNewSong(assetBundle.LoadAsset<AudioClip>(assetSongName));
		cassette.cassetteName = subText;
		((GrabbableObject)cassette).itemProperties.itemName = "Cassette - " + subText;
		((GrabbableObject)cassette).itemProperties.minValue = minValue;
		((GrabbableObject)cassette).itemProperties.maxValue = maxValue;
		((GrabbableObject)cassette).itemProperties.isScrap = true;
		((GrabbableObject)cassette).itemProperties.isConductiveMetal = false;
		((GrabbableObject)cassette).itemProperties.creditsWorth = maxValue - 5;
		((GrabbableObject)cassette).scrapValue = maxValue - 5;
		NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
		Items.RegisterScrap(val, rarity, levelType);
	}
}
public class Cassette : GrabbableObject
{
	private AudioSource audioSource;

	public string cassetteName;

	public int songIndex;

	public void Awake()
	{
		audioSource = ((Component)this).GetComponent<AudioSource>();
		base.grabbable = true;
		base.grabbableToEnemies = true;
		base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
		base.itemProperties.toolTips = new string[2] { "Insert into Walkman : [LMB]", "Inspect : [Z]" };
		base.customGrabTooltip = "Grab " + base.itemProperties.itemName + " : [E]";
		Debug.Log((object)("Cassette " + cassetteName + " has spawned!"));
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)base.playerHeldBy == (Object)null || !((NetworkBehaviour)this).IsOwner)
		{
			return;
		}
		Debug.Log((object)"Casting ray");
		RaycastHit val = default(RaycastHit);
		if (Physics.Raycast(new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward), ref val, 5f, 832) && ((Component)((RaycastHit)(ref val)).collider).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val)).collider).tag == "PhysicsProp")
		{
			CassettePlayer component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<CassettePlayer>();
			Debug.Log((object)((object)(RaycastHit)(ref val)).ToString());
			Debug.Log((object)((Object)((RaycastHit)(ref val)).transform).name);
			if ((Object)(object)component != (Object)null && !component.insertedCassette)
			{
				component.InsertCassetteSyncWithServer(songIndex);
				base.playerHeldBy.DiscardHeldObject(true, ((Component)component).GetComponent<NetworkObject>(), default(Vector3), true);
			}
		}
		((GrabbableObject)this).ItemActivate(used, buttonDown);
	}

	public override void GrabItem()
	{
		((GrabbableObject)this).GrabItem();
		if ((Object)(object)((Component)this).transform != (Object)null && (Object)(object)((Component)this).transform.parent != (Object)null && (Object)(object)((Component)((Component)this).transform.parent).GetComponent<CassettePlayer>() != (Object)null)
		{
			((Component)((Component)this).transform.parent).GetComponent<CassettePlayer>().EjectCassetteSyncWithServer();
			((Component)this).transform.SetParent(StartOfRound.Instance.propsContainer, true);
		}
	}

	public override void PocketItem()
	{
		((GrabbableObject)this).PocketItem();
		((Component)this).gameObject.SetActive(false);
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
		((Component)this).gameObject.SetActive(true);
	}

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

	protected internal override string __getTypeName()
	{
		return "Cassette";
	}
}
public class CassettePlayer : GrabbableObject
{
	private AudioSource audioSource;

	public AudioClip song;

	public AudioClip insert;

	public AudioClip eject;

	public AudioClip stop;

	public AudioClip play;

	public AudioClip close;

	public bool insertedCassette;

	private RoundManager roundManager;

	private StartOfRound playersManager;

	public bool isPlayingMusic;

	private int timesPlayedWithoutTurningOff;

	private float noiseInterval;

	private bool isPlayPressed = false;

	public static List<AudioClip> cassetteSongs;

	public NetworkVariable<int> audioIndex = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1);

	public int _audioIndex = -1;

	public static event Action<string> CassetteEvent;

	public override void OnNetworkSpawn()
	{
		_audioIndex = -1;
		NetworkVariable<int> obj = audioIndex;
		obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnAudioIndexChanged));
		((NetworkBehaviour)this).OnNetworkSpawn();
	}

	public override void OnNetworkDespawn()
	{
		((NetworkBehaviour)this).OnNetworkDespawn();
		NetworkVariable<int> obj = audioIndex;
		obj.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)obj.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnAudioIndexChanged));
	}

	private void OnAudioIndexChanged(int previous, int current)
	{
		_audioIndex = current;
		if (_audioIndex != -1)
		{
			song = cassetteSongs[_audioIndex];
			audioSource.PlayOneShot(insert);
		}
		else
		{
			song = null;
			audioSource.Stop();
			audioSource.PlayOneShot(stop);
		}
	}

	public override void Start()
	{
		((GrabbableObject)this).Start();
		insertedCassette = false;
		audioSource = ((Component)this).GetComponent<AudioSource>();
		base.grabbable = true;
		base.grabbableToEnemies = true;
		base.mainObjectRenderer = ((Component)this).GetComponent<MeshRenderer>();
		base.useCooldown = 0.5f;
		base.itemProperties.requiresBattery = false;
		playersManager = Object.FindObjectOfType<StartOfRound>();
		roundManager = Object.FindObjectOfType<RoundManager>();
		base.customGrabTooltip = "Grab Walkman : [E]";
	}

	private void InsertCassette(int songIndex)
	{
		if (!insertedCassette)
		{
			insertedCassette = true;
			_audioIndex = songIndex;
			if (songIndex != -1)
			{
				song = cassetteSongs[_audioIndex];
			}
			if (((NetworkBehaviour)this).IsOwner)
			{
				audioIndex.Value = songIndex;
			}
		}
	}

	public void InsertCassetteSyncWithServer(int songIndex)
	{
		if (!insertedCassette)
		{
			InsertCassette(songIndex);
			InsertCassetteServerRpc(songIndex);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void InsertCassetteServerRpc(int songIndex)
	{
		//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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(720241444u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, songIndex);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 720241444u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				InsertCassetteClientRpc(songIndex);
			}
		}
	}

	[ClientRpc]
	public void InsertCassetteClientRpc(int songIndex)
	{
		//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)
		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(3622550067u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, songIndex);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3622550067u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				InsertCassette(songIndex);
			}
		}
	}

	private void EjectCassette()
	{
		if (insertedCassette)
		{
			StartMusic(startMusic: false);
			insertedCassette = false;
			_audioIndex = -1;
			if (((NetworkBehaviour)this).IsOwner)
			{
				audioIndex.Value = -1;
			}
			song = null;
		}
	}

	public void EjectCassetteSyncWithServer()
	{
		if (insertedCassette)
		{
			EjectCassette();
			EjectCassetteServerRpc();
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void EjectCassetteServerRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1658162722u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1658162722u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				EjectCassetteClientRpc();
			}
		}
	}

	[ClientRpc]
	public void EjectCassetteClientRpc()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Invalid comparison between Unknown and I4
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		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(3164336292u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3164336292u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				EjectCassette();
			}
		}
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (!isPlayingMusic)
		{
			StartMusic(startMusic: true);
		}
		else
		{
			StartMusic(startMusic: false);
		}
	}

	public void StartMusic(bool startMusic, bool pitchDown = false)
	{
		if (!insertedCassette)
		{
			if (isPlayPressed)
			{
				audioSource.PlayOneShot(play);
				isPlayPressed = false;
			}
			else
			{
				audioSource.PlayOneShot(stop);
				isPlayPressed = true;
			}
			return;
		}
		if (startMusic && !isPlayingMusic)
		{
			audioSource.PlayOneShot(play);
			audioSource.PlayOneShot(song);
		}
		else if (isPlayingMusic)
		{
			audioSource.Stop();
			audioSource.PlayOneShot(stop);
			timesPlayedWithoutTurningOff = 0;
		}
		base.isBeingUsed = startMusic;
		isPlayingMusic = startMusic;
	}

	public override void Update()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		((GrabbableObject)this).Update();
		if (isPlayingMusic)
		{
			if (noiseInterval <= 0f)
			{
				noiseInterval = 1f;
				timesPlayedWithoutTurningOff++;
				roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, 0.9f, timesPlayedWithoutTurningOff, false, 5);
			}
			else
			{
				noiseInterval -= Time.deltaTime;
			}
		}
	}

	protected override void __initializeVariables()
	{
		if (audioIndex == null)
		{
			throw new Exception("CassettePlayer.audioIndex cannot be null. All NetworkVariableBase instances must be initialized.");
		}
		((NetworkVariableBase)audioIndex).Initialize((NetworkBehaviour)(object)this);
		((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)audioIndex, "audioIndex");
		((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)audioIndex);
		((GrabbableObject)this).__initializeVariables();
	}

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_CassettePlayer()
	{
		//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
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(720241444u, new RpcReceiveHandler(__rpc_handler_720241444));
		NetworkManager.__rpc_func_table.Add(3622550067u, new RpcReceiveHandler(__rpc_handler_3622550067));
		NetworkManager.__rpc_func_table.Add(1658162722u, new RpcReceiveHandler(__rpc_handler_1658162722));
		NetworkManager.__rpc_func_table.Add(3164336292u, new RpcReceiveHandler(__rpc_handler_3164336292));
	}

	private static void __rpc_handler_720241444(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			int songIndex = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref songIndex);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CassettePlayer)(object)target).InsertCassetteServerRpc(songIndex);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

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

	private static void __rpc_handler_1658162722(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((CassettePlayer)(object)target).EjectCassetteServerRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_3164336292(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((CassettePlayer)(object)target).EjectCassetteClientRpc();
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	protected internal override string __getTypeName()
	{
		return "CassettePlayer";
	}
}
internal class Assets
{
	internal static AssetBundle mainAssetBundle;

	private static string[] assetNames = new string[0];

	internal static void LoadAssetBundle(string assetBundlePath)
	{
		if ((Object)(object)mainAssetBundle == (Object)null)
		{
			mainAssetBundle = AssetBundle.LoadFromFile(assetBundlePath);
		}
		assetNames = mainAssetBundle.GetAllAssetNames();
	}

	internal static AssetBundle GetBundle()
	{
		return mainAssetBundle;
	}
}