Decompiled source of ModPsychose v2.0.0

ModPsychose.dll

Decompiled a day ago
using System.Collections.Generic;
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 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("ModPsychose")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ModPsychose")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("09bab297-43ec-412f-ae27-64e343a8dd69")]
[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 ModPsychose;

[BepInPlugin("Utilisateur.ModPsychose", "Psychose (DOBBY EDITION)", "2.0.0")]
public class ModPsychoseBase : BaseUnityPlugin
{
	private const string modGUID = "Utilisateur.ModPsychose";

	private const string modName = "Psychose (DOBBY EDITION)";

	private const string modVersion = "2.0.0";

	private readonly Harmony harmony = new Harmony("Utilisateur.ModPsychose");

	public static ManualLogSource mls;

	public static float minDelai = 60f;

	public static float maxDelai = 180f;

	private void Awake()
	{
		mls = Logger.CreateLogSource("Utilisateur.ModPsychose");
		mls.LogInfo((object)">>> MOD PSYCHOSE 2.0 : DOBBY EST PRET <<<");
		harmony.PatchAll();
	}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
public class PatchParanoiaAudio
{
	private static float timerAudio = 0f;

	private static float prochainSon = 30f;

	[HarmonyPostfix]
	private static void JouerSonFantome(PlayerControllerB __instance)
	{
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkBehaviour)__instance).IsOwner || __instance.isPlayerDead || !__instance.isInsideFactory)
		{
			return;
		}
		timerAudio += Time.deltaTime;
		if (!(timerAudio >= prochainSon))
		{
			return;
		}
		timerAudio = 0f;
		prochainSon = Random.Range(ModPsychoseBase.minDelai, ModPsychoseBase.maxDelai);
		int[] array = new int[2] { 3, 4 };
		int num = array[Random.Range(0, array.Length)];
		if (StartOfRound.Instance.footstepSurfaces.Length > num)
		{
			AudioClip[] clips = StartOfRound.Instance.footstepSurfaces[num].clips;
			if (clips != null && clips.Length != 0)
			{
				AudioClip val = clips[Random.Range(0, clips.Length)];
				Vector3 val2 = ((Component)__instance).transform.position - ((Component)__instance).transform.forward * 1.5f;
				AudioSource.PlayClipAtPoint(val, val2, 1.2f);
				ModPsychoseBase.mls.LogInfo((object)"PSYCHOSE : Bruit de pas joué !");
			}
		}
	}
}
[HarmonyPatch(typeof(HUDManager), "Update")]
public class PatchParanoiaVisuelle
{
	private static float timerVisuel = 0f;

	private static float prochainVisuel = 60f;

	[HarmonyPostfix]
	private static void GlitchRadar(HUDManager __instance)
	{
		if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)
		{
			return;
		}
		timerVisuel += Time.deltaTime;
		if (!(timerVisuel >= prochainVisuel))
		{
			return;
		}
		timerVisuel = 0f;
		prochainVisuel = Random.Range(ModPsychoseBase.minDelai, ModPsychoseBase.maxDelai);
		int num = Random.Range(0, 1000);
		string playerUsername = GameNetworkManager.Instance.localPlayerController.playerUsername;
		if (num == 0)
		{
			__instance.DisplayTip("MAITRE...", "DOBBY, ATTAQUE !!", true, false, "LC_Tip1");
			ModPsychoseBase.mls.LogInfo((object)"PSYCHOSE : DOBBY A ATTAQUÉ !");
		}
		else if (num < 50)
		{
			__instance.DisplayTip("...", "DERRIERE TOI " + playerUsername.ToUpper() + " !!!", true, false, "LC_Tip1");
		}
		else if (num < 500)
		{
			string text = "COEQUIPIER";
			List<string> list = new List<string>();
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if (val.isPlayerControlled && (Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					list.Add(val.playerUsername);
				}
			}
			if (list.Count > 0)
			{
				text = list[Random.Range(0, list.Count)];
			}
			string[] array = new string[12]
			{
				"ERREUR COMBINAISON",
				"NIVEAU OXYGENE CRITIQUE",
				"BATTERIE FAIBLE",
				"SIGNAL NON IDENTIFIE",
				"SIGNES VITAUX " + text.ToUpper() + " : CRITIQUE",
				text.ToUpper() + " : ARRET CARDIAQUE",
				"CONNEXION PERDUE : " + text.ToUpper(),
				"NE RESPIRE PAS",
				"ILS SONT LA",
				"CACHE TOI",
				"NE CLIGNE PAS DES YEUX",
				"COURS"
			};
			string text2 = array[Random.Range(0, array.Length)];
			string text3 = ((text2.Length < 15) ? "..." : "SYSTEME");
			__instance.DisplayTip(text3, text2, true, false, "LC_Tip1");
		}
		else
		{
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}
	}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
public class PatchVoixDesMorts
{
	private static float timerVoix = 0f;

	private static float prochainCri = 120f;

	[HarmonyPostfix]
	private static void JouerCriLointain(PlayerControllerB __instance)
	{
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0092: 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_00a0: 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_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b8: Expected O, but got Unknown
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isInsideFactory || __instance.isPlayerDead)
		{
			return;
		}
		timerVoix += Time.deltaTime;
		if (timerVoix >= prochainCri)
		{
			timerVoix = 0f;
			prochainCri = Random.Range(ModPsychoseBase.minDelai, ModPsychoseBase.maxDelai);
			AudioClip playerJumpSFX = StartOfRound.Instance.playerJumpSFX;
			if ((Object)(object)playerJumpSFX != (Object)null)
			{
				Vector3 position = ((Component)__instance).transform.position;
				Vector3 onUnitSphere = Random.onUnitSphere;
				Vector3 position2 = position + ((Vector3)(ref onUnitSphere)).normalized * 10f;
				GameObject val = new GameObject("SonFantome");
				val.transform.position = position2;
				AudioSource val2 = val.AddComponent<AudioSource>();
				val2.clip = playerJumpSFX;
				val2.volume = 1f;
				val2.spatialBlend = 1f;
				val2.maxDistance = 25f;
				val2.rolloffMode = (AudioRolloffMode)1;
				val2.pitch = Random.Range(0.6f, 1.4f);
				val2.Play();
				Object.Destroy((Object)(object)val, playerJumpSFX.length + 1f);
				ModPsychoseBase.mls.LogInfo((object)$"PSYCHOSE : Voix jouée (Pitch: {val2.pitch}) !");
			}
		}
	}
}