Decompiled source of HighPitchCompany v1.0.1

BepInEx/plugins/HighPitchCompany.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using HighPitchCompany.Patches;
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("HighPitchCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HighPitchCompany")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("80a9675f-666e-437c-b84a-5e2f456148be")]
[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")]
namespace HighPitchCompany
{
	[BepInPlugin("Ashay.HighPitchCompany", "High Pitch Company", "1.0.1")]
	public class HighPitchCompany : BaseUnityPlugin
	{
		private const string modGUID = "Ashay.HighPitchCompany";

		private const string modName = "High Pitch Company";

		private const string modVersion = "1.0.1";

		private readonly Harmony harmony = new Harmony("Ashay.HighPitchCompany");

		private static HighPitchCompany Instance;

		internal ManualLogSource manualLogSource;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			manualLogSource = Logger.CreateLogSource("Ashay.HighPitchCompany");
			manualLogSource.LogInfo((object)"High Pitch Company Loaded");
			harmony.PatchAll(typeof(HighPitchCompany));
			harmony.PatchAll(typeof(SoundManagerPatch));
		}
	}
}
namespace HighPitchCompany.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void playerControllerBPatch(PlayerControllerB playerControllerB)
		{
			SoundManager.Instance.playerVoicePitchTargets[playerControllerB.playerClientId] = 3f;
		}
	}
	[HarmonyPatch(typeof(SoundManager))]
	internal class SoundManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void highPitchPatch(ref float[] ___playerVoicePitchTargets, ref float[] ___playerVoicePitches)
		{
			___playerVoicePitches = new float[4] { 3f, 3f, 3f, 3f };
			___playerVoicePitchTargets = new float[4] { 3f, 3f, 3f, 3f };
		}
	}
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPatch("UpdatePlayerVoiceEffects")]
		[HarmonyPostfix]
		private static void updatePlayerVoiceEffectsPatch(PlayerControllerB playerControllerB)
		{
			SoundManager.Instance.playerVoicePitchTargets[playerControllerB.playerClientId] = 3f;
			SoundManager.Instance.SetPlayerPitch(3f, (int)playerControllerB.playerClientId);
		}
	}
}