Decompiled source of TTSPranks v1.0.0

TTSPranks.dll

Decompiled 3 days ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using OPJosMod;
using OpJosModREPO.TTSPranks.Patches;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("REPOMods")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPOMods")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ae067094-69b3-4aaf-9688-38ff78ee3b28")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace OpJosModREPO.TTSPranks
{
	public class DelayUtility : MonoBehaviour
	{
		private static DelayUtility _instance;

		public static DelayUtility Instance
		{
			get
			{
				//IL_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001c: Expected O, but got Unknown
				if ((Object)(object)_instance == (Object)null)
				{
					GameObject val = new GameObject("DelayUtility");
					_instance = val.AddComponent<DelayUtility>();
					Object.DontDestroyOnLoad((Object)(object)val);
				}
				return _instance;
			}
		}

		private void Awake()
		{
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			}
			else if ((Object)(object)_instance != (Object)(object)this)
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}

		public static void RunAfterDelay(float seconds, Action action)
		{
			((MonoBehaviour)Instance).StartCoroutine(Instance.DelayCoroutine(seconds, action));
		}

		private IEnumerator DelayCoroutine(float seconds, Action action)
		{
			yield return (object)new WaitForSeconds(seconds);
			action?.Invoke();
		}
	}
	public class Pranks
	{
		public static string FlashBang = "<size=10000><mark=#ffffff>Flash Bang";

		public static string DomainExpansion = "<size=10000><mark=#000000>DOMAIN EXPANSION";

		public static string HeartEyes = "<size=400><sprite=2>";

		public static string QuestionPing = "<size=300><sprite=12>";

		public static void PlayPrank(string prank, float time)
		{
			PlayerAvatar.instance.ChatMessageSend(prank, false);
			DelayUtility.RunAfterDelay(time, delegate
			{
				PlayerAvatar.instance.ChatMessageSend("-", false);
			});
		}
	}
	[BepInPlugin("OpJosModREPO.TTSPranks", "TTSPranks", "1.0.0")]
	public class OpJosModBase : BaseUnityPlugin
	{
		private const string modGUID = "OpJosModREPO.TTSPranks";

		private const string modName = "TTSPranks";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmoy = new Harmony("OpJosModREPO.TTSPranks");

		private static OpJosModBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("OpJosModREPO.TTSPranks");
			mls.LogInfo((object)"TTSPranks has started!");
			setupConfig();
			PlayerAvatarPatch.SetLogSource(mls);
			harmoy.PatchAll();
		}

		private void setupConfig()
		{
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: 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_0120: Unknown result type (might be due to invalid IL or missing references)
			ConfigEntry<Key> val = ((BaseUnityPlugin)this).Config.Bind<Key>("Flash whole screen white.", "FlashBangButton", (Key)20, "Button to briefly turn the whole screen white to players near you");
			ConfigEntry<Key> val2 = ((BaseUnityPlugin)this).Config.Bind<Key>("Turn whole screen black", "DomainExpansionButton", (Key)21, "Button to turn the whole screen black for players near you");
			ConfigEntry<Key> val3 = ((BaseUnityPlugin)this).Config.Bind<Key>("Display giant heart eyes emoji", "HeartEyesButton", (Key)22, "Button to display giant heart eyes emoji");
			ConfigEntry<Key> val4 = ((BaseUnityPlugin)this).Config.Bind<Key>("Display big question mark", "QuestionPingButton", (Key)24, "Button to display a quesiton mark");
			ConfigEntry<float> val5 = ((BaseUnityPlugin)this).Config.Bind<float>("How long flash bang lasts", "FlashBangTime", 2f, "how long flash bang lasts in seconds");
			ConfigEntry<float> val6 = ((BaseUnityPlugin)this).Config.Bind<float>("How long domain expansion lasts", "DomainExpansionTime", 6f, "How long screen stays black in seconds");
			ConfigEntry<float> val7 = ((BaseUnityPlugin)this).Config.Bind<float>("How long the heart eyes emoji stays up", "HeartEyesTime", 1f, "how long heart eyes emoji stays up in seconds");
			ConfigEntry<float> val8 = ((BaseUnityPlugin)this).Config.Bind<float>("How long quesiton mark stays up", "QuestionPingTime", 1f, "How long question mark ping stays up in seconds");
			ConfigVariables.flashBangKey = val.Value;
			ConfigVariables.domainExpansionKey = val2.Value;
			ConfigVariables.heartEyesKey = val3.Value;
			ConfigVariables.questionPingKey = val4.Value;
			ConfigVariables.flashBangTime = val5.Value;
			ConfigVariables.domainExpansionTime = val6.Value;
			ConfigVariables.heartEyesTime = val7.Value;
			ConfigVariables.questionPingTime = val8.Value;
			((BaseUnityPlugin)this).Config.Save();
		}
	}
}
namespace OpJosModREPO.TTSPranks.Patches
{
	[HarmonyPatch(typeof(PlayerAvatar))]
	internal class PlayerAvatarPatch
	{
		private static ManualLogSource mls;

		private static float nextExecutionTime = 0f;

		private static Random rng = new Random();

		public static bool isSpeakingBee = false;

		public static void SetLogSource(ManualLogSource logSource)
		{
			mls = logSource;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void UpdatePatch(PlayerAvatar __instance)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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)
			if (((Object)__instance).GetInstanceID() != ((Object)PlayerAvatar.instance).GetInstanceID())
			{
				return;
			}
			try
			{
				if (((ButtonControl)Keyboard.current[ConfigVariables.flashBangKey]).wasPressedThisFrame)
				{
					mls.LogInfo((object)"Activated Flash Bang");
					Pranks.PlayPrank(Pranks.FlashBang, ConfigVariables.flashBangTime);
				}
			}
			catch
			{
			}
			try
			{
				if (((ButtonControl)Keyboard.current[ConfigVariables.domainExpansionKey]).wasPressedThisFrame)
				{
					mls.LogInfo((object)"Activated Domain Expansion");
					Pranks.PlayPrank(Pranks.DomainExpansion, ConfigVariables.domainExpansionTime);
				}
			}
			catch
			{
			}
			try
			{
				if (((ButtonControl)Keyboard.current[ConfigVariables.heartEyesKey]).wasPressedThisFrame)
				{
					mls.LogInfo((object)"Heart Eyes");
					Pranks.PlayPrank(Pranks.HeartEyes, ConfigVariables.heartEyesTime);
				}
			}
			catch
			{
			}
			try
			{
				if (((ButtonControl)Keyboard.current[ConfigVariables.questionPingKey]).wasPressedThisFrame)
				{
					mls.LogInfo((object)"Question Ping");
					Pranks.PlayPrank(Pranks.QuestionPing, ConfigVariables.questionPingTime);
				}
			}
			catch
			{
			}
		}
	}
}
namespace OPJosMod
{
	public static class ConfigVariables
	{
		public static Key flashBangKey;

		public static float flashBangTime;

		public static Key domainExpansionKey;

		public static float domainExpansionTime = 6f;

		public static Key heartEyesKey;

		public static float heartEyesTime = 1f;

		public static Key questionPingKey;

		public static float questionPingTime = 1f;
	}
}