using System;
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 UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClassLibraryq")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibraryq")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c28fd137-b115-4734-bbbf-2271aae7ce58")]
[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 GModTerminal;
[BepInPlugin("com.yourname.gmodterminal", "PEAK GMod Terminal", "1.0.0")]
public class TerminalPlugin : BaseUnityPlugin
{
private bool isVisible = false;
private string inputStr = "";
private List<string> history = new List<string>();
private Rect windowRect = new Rect(50f, 50f, 550f, 350f);
private Vector2 scrollPos;
private void Update()
{
if (Input.GetKeyDown((KeyCode)96) || Input.GetKeyDown((KeyCode)282))
{
isVisible = !isVisible;
Cursor.visible = isVisible;
Cursor.lockState = (CursorLockMode)((!isVisible) ? 1 : 0);
}
}
private void OnGUI()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
if (isVisible)
{
GUI.backgroundColor = new Color(0.15f, 0.15f, 0.15f, 0.95f);
windowRect = GUILayout.Window(0, windowRect, new WindowFunction(DrawConsoleWindow), "Developer Console", Array.Empty<GUILayoutOption>());
}
}
private void DrawConsoleWindow(int windowID)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Invalid comparison between Unknown and I4
scrollPos = GUILayout.BeginScrollView(scrollPos, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(280f) });
GUIStyle val = new GUIStyle(GUI.skin.label);
val.richText = true;
val.fontSize = 14;
foreach (string item in history)
{
GUILayout.Label(item, val, Array.Empty<GUILayoutOption>());
}
GUILayout.EndScrollView();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUI.SetNextControlName("InputF");
inputStr = GUILayout.TextField(inputStr, Array.Empty<GUILayoutOption>());
if (isVisible)
{
GUI.FocusControl("InputF");
}
if (GUILayout.Button("Send", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }) || (Event.current.isKey && (int)Event.current.keyCode == 13))
{
ProcessCommand(inputStr);
inputStr = "";
}
GUILayout.EndHorizontal();
GUI.DragWindow();
}
private void ProcessCommand(string cmd)
{
if (string.IsNullOrEmpty(cmd))
{
return;
}
history.Add("<color=#999999>] " + cmd + "</color>");
string[] array = cmd.ToLower().Split(new char[1] { ' ' });
switch (array[0])
{
case "help":
history.Add("<color=cyan>Commands: help, clear, noclip, sv_gravity, die</color>");
break;
case "clear":
history.Clear();
break;
case "noclip":
{
Rigidbody val = Object.FindAnyObjectByType<Rigidbody>();
if ((Object)(object)val != (Object)null)
{
val.isKinematic = !val.isKinematic;
history.Add(val.isKinematic ? "Noclip: ON" : "Noclip: OFF");
}
break;
}
case "die":
history.Add("<color=red>Kill command sent.</color>");
break;
default:
history.Add("<color=red>Unknown command: " + array[0] + "</color>");
break;
}
scrollPos.y = float.MaxValue;
}
}