Decompiled source of Peak Late Join but it Actually Works v1.0.0

BepInEx/plugins/PeakLateJoinButItActuallyWorks.dll

Decompiled 2 days 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PeakLateJoinButItActuallyWorks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PeakLateJoinButItActuallyWorks")]
[assembly: AssemblyTitle("PeakLateJoinButItActuallyWorks")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 peaklg
{
	[BepInPlugin("peaklatejoinfr", "peaklatejoinbutitactuallyworks", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ConfigEntry<KeyCode> reviveKeyBind;

		internal static ConfigEntry<KeyCode> cycleForwardKey;

		internal static ConfigEntry<KeyCode> cycleBackwardKey;

		internal static ManualLogSource Log { get; private set; }

		private void Awake()
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			reviveKeyBind = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Manual Revive Binds", "Revive Bind", (KeyCode)47, (ConfigDescription)null);
			cycleForwardKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Manual Revive Binds", "Cycle Forward Bind", (KeyCode)46, (ConfigDescription)null);
			cycleBackwardKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Manual Revive Binds", "Cycle Backward Bind", (KeyCode)44, (ConfigDescription)null);
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Plugin peak late join but it actually works is loaded!");
			Harmony val = new Harmony("peaklg");
			val.PatchAll();
		}
	}
	[HarmonyPatch(typeof(Character), "Update")]
	internal static class reviveKey
	{
		public static PlayerConnectionLog playerconnectionlog;

		public static int index;

		public static bool hasPressedInARow;

		internal static void Prefix(Character __instance)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0413: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0309: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			if (!__instance.IsLocal || !PhotonNetwork.IsMasterClient)
			{
				return;
			}
			if ((Object)(object)playerconnectionlog == (Object)null)
			{
				playerconnectionlog = Object.FindAnyObjectByType<PlayerConnectionLog>();
			}
			bool flag = false;
			if (Input.GetKeyDown(Plugin.cycleForwardKey.Value))
			{
				flag = true;
				index++;
			}
			else if (Input.GetKeyDown(Plugin.cycleBackwardKey.Value))
			{
				flag = true;
				index--;
			}
			Vector3 val;
			if (flag)
			{
				hasPressedInARow = false;
				if ((Object)(object)playerconnectionlog != (Object)null)
				{
					if (index > Character.AllCharacters.Count - 1)
					{
						index = 0;
					}
					else if (index < 0)
					{
						index = Character.AllCharacters.Count - 1;
					}
					string text = (Character.AllCharacters[index].data.dead ? "dead" : (Character.AllCharacters[index].data.passedOut ? "passed out" : "not dead"));
					playerconnectionlog.AddMessage("<color=#" + ColorUtility.ToHtmlStringRGB(Color.white) + ">Currently selecting " + Character.AllCharacters[index].characterName + " this player is " + text);
					SFX_Instance sfxJoin = playerconnectionlog.sfxJoin;
					val = default(Vector3);
					sfxJoin.Play(val);
				}
			}
			if (!Input.GetKeyDown(Plugin.reviveKeyBind.Value))
			{
				return;
			}
			if (index > Character.AllCharacters.Count - 1)
			{
				index = 0;
			}
			else if (index < 0)
			{
				index = Character.AllCharacters.Count - 1;
			}
			if (Character.AllCharacters[index].data.dead || hasPressedInARow)
			{
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(0f, 0f, 0f);
				if (__instance.data.dead)
				{
					if (!((Object)(object)GUIManager.instance.currentSpecCharacter != (Object)null) || GUIManager.instance.currentSpecCharacter.data.dead)
					{
						playerconnectionlog.AddMessage("<color=#" + ColorUtility.ToHtmlStringRGB(Color.red) + ">Couldnt find spectated player! They are either dead or the game has ended.");
						SFX_Instance sfxLeave = playerconnectionlog.sfxLeave;
						val = default(Vector3);
						sfxLeave.Play(val);
						return;
					}
					val2 = GUIManager.instance.currentSpecCharacter.Center + new Vector3(0f, 3f, 0f);
				}
				else
				{
					val2 = __instance.Center + new Vector3(0f, 3f, 0f);
				}
				((MonoBehaviourPun)Character.AllCharacters[index]).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2] { val2, false });
				PlayerConnectionLog obj = playerconnectionlog;
				string[] obj2 = new string[6]
				{
					"<color=#",
					ColorUtility.ToHtmlStringRGB(Color.green),
					">Revived ",
					Character.AllCharacters[index].characterName,
					" at ",
					null
				};
				val = val2;
				obj2[5] = ((object)(Vector3)(ref val)).ToString();
				obj.AddMessage(string.Concat(obj2));
				SFX_Instance sfxJoin2 = playerconnectionlog.sfxJoin;
				val = default(Vector3);
				sfxJoin2.Play(val);
				hasPressedInARow = false;
			}
			else
			{
				playerconnectionlog.AddMessage("<color=#" + ColorUtility.ToHtmlStringRGB(Color.red) + ">" + Character.AllCharacters[index].characterName + " Is still alive! Press revive again to do it anyway.");
				SFX_Instance sfxLeave2 = playerconnectionlog.sfxLeave;
				val = default(Vector3);
				sfxLeave2.Play(val);
				hasPressedInARow = true;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}