Decompiled source of RestoreScoreboard v1.0.0

plugins/RestoreScoreboard/RestoreScoreboard.dll

Decompiled 2 months ago
using System;
using System.Collections.ObjectModel;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RestoreScoreboard")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a540dcd49fcbc0fca46b9b7435a8bf98b9677f99")]
[assembly: AssemblyProduct("RestoreScoreboard")]
[assembly: AssemblyTitle("RestoreScoreboard")]
[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 RestoreScoreboard
{
	[HarmonyPatch]
	[BepInPlugin("itsschwer.RestoreScoreboard", "RestoreScoreboard", "1.0.0")]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string GUID = "itsschwer.RestoreScoreboard";

		public const string Author = "itsschwer";

		public const string Name = "RestoreScoreboard";

		public const string Version = "1.0.0";

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			Logger.Sources.Remove((ILogSource)(object)((BaseUnityPlugin)this).Logger);
			Logger = Logger.CreateLogSource("itsschwer.RestoreScoreboard");
			new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
			Logger.LogMessage((object)"Patched.");
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(ScoreboardController), "Rebuild")]
		private static bool ScoreboardController_Rebuild(ScoreboardController __instance)
		{
			ReadOnlyCollection<PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
			int count = instances.Count;
			__instance.SetStripCount(count);
			for (int i = 0; i < count; i++)
			{
				__instance.stripAllocator.elements[i].SetMaster(instances[i].master);
			}
			return false;
		}
	}
}