Decompiled source of DeadIdPlayer v1.0.1

Antro.DeadIdPlayer.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.IL2CPP;
using CrabDevKit.Intermediary;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Antro.DeadIdPlayer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Antro.DeadIdPlayer")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Antro.DeadIdPlayer")]
[assembly: AssemblyTitle("Antro.DeadIdPlayer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Antro.DeadIdPlayer
{
	[BepInPlugin("Antro.DeadIdPlayer", "Antro.DeadIdPlayer", "1.0.0")]
	public sealed class Plugin : BasePlugin
	{
		public static Plugin Instance;

		internal static Harmony Harmony;

		private static MonoBehaviourPublicGapaTrconaGaDi2UIObUnique _cachedPlayerList;

		private static MonoBehaviourPublicCSDi2UIInstObUIloDiUnique _cachedLobbyManager;

		public override void Load()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Expected O, but got Unknown
			Instance = this;
			Harmony = new Harmony("Antro.DeadIdPlayer");
			((BasePlugin)this).Log.LogInfo((object)">>> [Antro.DeadIdPlayer] Loading... Lobby ID + 1 fix.");
			MethodInfo methodInfo = AccessTools.Method(typeof(MonoBehaviourPublicGaroloGaObInCacachGaUnique), "Update", (Type[])null, (Type[])null);
			if (methodInfo != null)
			{
				Harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin).GetMethod("GameUiPostfix", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		private static void GameUiPostfix(MonoBehaviourPublicGaroloGaObInCacachGaUnique __instance)
		{
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_cachedPlayerList == (Object)null)
			{
				_cachedPlayerList = Object.FindObjectOfType<MonoBehaviourPublicGapaTrconaGaDi2UIObUnique>();
			}
			if ((Object)(object)_cachedLobbyManager == (Object)null)
			{
				_cachedLobbyManager = Object.FindObjectOfType<MonoBehaviourPublicCSDi2UIInstObUIloDiUnique>();
			}
			if ((Object)(object)_cachedPlayerList == (Object)null || (Object)(object)_cachedLobbyManager == (Object)null)
			{
				return;
			}
			ObjectPublicBoInBoCSItBoInSiBySiUnique[] array = LobbyManagerExtensions[_cachedLobbyManager];
			if (array == null)
			{
				return;
			}
			Dictionary<ulong, MonoBehaviourPublicRabaicRaTeusscTepiObUnique> val = PlayerListExtensions[_cachedPlayerList];
			if (val == null)
			{
				return;
			}
			for (int i = 0; i < array.Length; i++)
			{
				ObjectPublicBoInBoCSItBoInSiBySiUnique val2 = array[i];
				if (val2 == null)
				{
					continue;
				}
				ulong steamID = ClientExtensions[val2].m_SteamID;
				if (steamID == 0 || !val.ContainsKey(steamID))
				{
					continue;
				}
				MonoBehaviourPublicRabaicRaTeusscTepiObUnique val3 = val[steamID];
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				Transform val4 = ((Component)val3).transform.Find("Name");
				if (!((Object)(object)val4 != (Object)null))
				{
					continue;
				}
				TextMeshProUGUI component = ((Component)val4).GetComponent<TextMeshProUGUI>();
				if ((Object)(object)component != (Object)null)
				{
					string text = ((TMP_Text)component).text;
					if (!string.IsNullOrEmpty(text) && !text.Contains("#"))
					{
						int num = i + 1;
						((TMP_Text)component).text = $"#{num} {text}";
						((TMP_Text)component).ForceMeshUpdate(false, false);
					}
				}
			}
		}
	}
}