Decompiled source of ProfileViewer v1.0.0

REPOProfileViewer.dll

Decompiled a month 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 HarmonyLib;
using JetBrains.Annotations;
using Steamworks;
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("REPOProfileViewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("REPOProfileViewer")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("ACBEBD9A-7589-47C1-AE4E-A194B1375496")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace REPOProfileViewer;

[HarmonyPatch(typeof(ChatManager), "MessageSend")]
public class ChatPatcher
{
	[HarmonyPrefix]
	public static bool Prefix(ref string ___chatMessage, ref List<string> ___chatHistory)
	{
		if (!___chatMessage.StartsWith("profile "))
		{
			return true;
		}
		string text = ___chatMessage;
		int length = "profile ".Length;
		string nameApproximation = text.Substring(length, text.Length - length).Trim().ToLower();
		PlayerAvatar playerFromNameApproximation = GetPlayerFromNameApproximation(nameApproximation);
		if ((Object)(object)playerFromNameApproximation == (Object)null)
		{
			return true;
		}
		Plugin.OpenProfile(playerFromNameApproximation);
		return false;
	}

	[CanBeNull]
	public static PlayerAvatar GetPlayerFromNameApproximation(string nameApproximation)
	{
		List<PlayerAvatar> playerList = GameDirector.instance.PlayerList;
		foreach (PlayerAvatar item in playerList)
		{
			string text = SemiFunc.PlayerGetName(item);
			if (text == null)
			{
				Debug.Log((object)"Player's name could not be found out!");
			}
			else if (text.ToLower().Trim().StartsWith(nameApproximation.ToLower().Trim()))
			{
				return item;
			}
		}
		return null;
	}
}
[BepInPlugin("com.asigsegv.repoprofileviewer", "Profile Viewer", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin instance;

	public const string VERSION = "1.0.0";

	public const string GUID = "com.asigsegv.repoprofileviewer";

	private void Awake()
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		instance = this;
		Harmony val = new Harmony("com.asigsegv.repoprofileviewer");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)(((Object)this).name + " successfully awoken. Gagagoogoo -ASIGSEGV"));
	}

	public static void OpenProfile(PlayerAvatar player)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: 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)
		string text = SemiFunc.PlayerGetSteamID(player);
		if (text == null || !ulong.TryParse(text, out var result))
		{
			Debug.LogWarning((object)"Cannot find or parse steamID for player!");
			return;
		}
		SteamId val = default(SteamId);
		val.Value = result;
		SteamId val2 = val;
		SteamFriends.OpenUserOverlay(val2, "steamid");
		Debug.Log((object)("Open profile for " + val2.Value));
	}
}