Decompiled source of ZSSK sounds v2.0.0

Zssk_company.dll

Decompiled 6 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using Zssk_company.Patches;

[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("Zssk_company")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Zssk_company")]
[assembly: AssemblyTitle("Zssk_company")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace Zssk_company
{
	[BepInPlugin("zssk.filo.company", "Zssk Company", "1.0.0")]
	public class ZsskCompany : BaseUnityPlugin
	{
		private const string modGUID = "zssk.filo.company";

		private const string modName = "Zssk Company";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("zssk.filo.company");

		private static ZsskCompany Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> SoundFx;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("zssk.filo.company");
			harmony.PatchAll(typeof(ZsskCompany));
			harmony.PatchAll(typeof(StartOfRoundPatch));
			SoundFx = new List<AudioClip>();
			string text = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("Zssk_company.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(text + "zssk_company");
			if ((Object)(object)Bundle != (Object)null)
			{
				SoundFx = Bundle.LoadAllAssets<AudioClip>().ToList();
				mls.LogError((object)"\n\nUpozornenie na meskanie vlaku! Vlak Regional Express 1947 Zeleznicnej spolocnosti slovenkso zo smeru Lipany, ktory pokracuje smer Kysak a Kosice pravidelny odchod 10 hodin 42 minut bude z prevadzkovych dovodov meskat asi 10 minut, ohlasena doba meskania sa moze zmenit, za vziknute neprijemnosti sa ospravedlnujeme.\nZSSK company loaded successfully!");
				for (int i = 0; i < SoundFx.Count(); i++)
				{
					mls.LogInfo((object)(i + ": " + ((Object)SoundFx[i]).name));
				}
			}
			else
			{
				mls.LogError((object)"Failed to load ZSSK asset bundle!");
			}
		}
	}
}
namespace Zssk_company.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		internal static Random rand = new Random(42);

		private const string modGUID = "zssk.filo.company";

		[HarmonyPatch("TravelToLevelEffects")]
		[HarmonyPrefix]
		private static void OverrideTravelAudio(ref AudioClip ___shipArriveSFX, StartOfRound __instance)
		{
			string planetName = __instance.currentLevel.PlanetName;
			int index = rand.Next(4, 8);
			___shipArriveSFX = ZsskCompany.SoundFx[index];
		}

		[HarmonyPatch("openingDoorsSequence")]
		[HarmonyPrefix]
		private static void OverrideDoorsAudio(StartOfRound __instance)
		{
			string planetName = __instance.currentLevel.PlanetName;
			int index = rand.Next(0, 4);
			__instance.openingHangarDoorAudio = ZsskCompany.SoundFx[index];
		}
	}
}