Decompiled source of PeakNSpeak v1.0.0

BepInEx/plugins/PeakNSpeak.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using ExitGames.Client.Photon;
using Photon.Pun;
using Photon.Realtime;
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("PeakNSpeak")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PeakNSpeak")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8a1e55f0-b7c4-4061-9fba-6aff62076331")]
[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 PeakNSpeak;

[BepInPlugin("synq.peak.peaknspeak", "Peak N Speak", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private string tstring = "";

	private Vector2 scrlp = Vector2.zero;

	private string chat = "";

	private bool open = true;

	private void KH()
	{
		if (Input.anyKey && Input.anyKeyDown && Input.GetKeyDown((KeyCode)92))
		{
			open = !open;
		}
	}

	private void Update()
	{
		KH();
	}

	private void OnGUI()
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: 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_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Invalid comparison between Unknown and I4
		if (Input.GetKeyDown((KeyCode)47))
		{
			GUI.FocusControl("ctf");
			if (tstring.EndsWith("/"))
			{
				tstring = tstring.Substring(0, tstring.Length - 1);
			}
		}
		if (open && PhotonNetwork.InRoom)
		{
			GUI.Box(new Rect(10f, 10f, 600f, 400f), "");
			GUI.Label(new Rect(24f, 379f, 540f, 28f), "Chat");
			GUI.SetNextControlName("ctf");
			tstring = GUI.TextField(new Rect(64f, 376f, 540f, 28f), tstring);
			GUI.Box(new Rect(15f, 15f, 590f, 355f), "");
			scrlp = GUI.BeginScrollView(new Rect(20f, 15f, 580f, 355f), scrlp, new Rect(0f, 0f, 560f, (float)(chat.Split(new char[1] { '\n' }).Length * 20)));
			GUI.Label(new Rect(0f, 0f, 560f, (float)(chat.Split(new char[1] { '\n' }).Length * 20)), chat);
			if (GUI.GetNameOfFocusedControl() == "ctf" && Event.current.isKey && (int)Event.current.keyCode == 13 && !string.IsNullOrWhiteSpace(tstring))
			{
				sendmsg(tstring);
				Debug.Log((object)Character.localCharacter.data.dead.ToString());
				tstring = "";
				GUI.FocusControl((string)null);
				Event.current.Use();
			}
			GUI.EndScrollView();
		}
	}

	private void Awake()
	{
		PhotonNetwork.NetworkingClient.EventReceived += Recieved;
	}

	private void Recieved(EventData eventData)
	{
		if (eventData.Code == 81)
		{
			object[] array = (object[])eventData.CustomData;
			string text = array[0].ToString();
			string text2 = array[1].ToString();
			string text3 = array[2].ToString();
			string text4 = array[3].ToString();
			text4 = ((!(text4 == "True")) ? "" : "<color=red>[DEAD]</color>");
			if (text.Contains("<color") || text.Contains("<size"))
			{
				text = "n/a";
			}
			addmsg(text4 + " " + text + ": " + text2);
		}
	}

	private void sendmsg(string msg)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		object[] array = new object[4]
		{
			PhotonNetwork.LocalPlayer.NickName,
			msg,
			PhotonNetwork.LocalPlayer.UserId,
			Character.localCharacter.data.dead.ToString()
		};
		RaiseEventOptions val = new RaiseEventOptions
		{
			Receivers = (ReceiverGroup)1
		};
		PhotonNetwork.RaiseEvent((byte)81, (object)array, val, SendOptions.SendReliable);
	}

	private void addmsg(string text)
	{
		chat = chat + text + "\n";
		scrlp.y = float.PositiveInfinity;
	}
}