Decompiled source of Mid Run Score v10.0.0

MidRunScore/ExamplePlugin.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using ExamplePlugin;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.Stats;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExamplePlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ExamplePlugin")]
[assembly: AssemblyTitle("ExamplePlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 ExamplePlugin
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		private static string Format(object data, string file, int line)
		{
			string fileName = Path.GetFileName(file);
			return $"[{fileName}:{line}] {data}";
		}

		internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogDebug((object)Format(data, file, line));
		}

		internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogError((object)Format(data, file, line));
		}

		internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogFatal((object)Format(data, file, line));
		}

		internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogInfo((object)Format(data, file, line));
		}

		internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogMessage((object)Format(data, file, line));
		}

		internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0)
		{
			_logSource.LogWarning((object)Format(data, file, line));
		}
	}
}
namespace BestPluginEver
{
	[BepInPlugin("Jac000bi.MidRunScore", "MidRunScore", "1.0.0")]
	public class FindFuckerPlugin : BaseUnityPlugin
	{
		private class MyObjective : ObjectiveTracker
		{
			public override string GenerateString()
			{
				StatSheet recordedStats = ((Component)base.sourceDescriptor.master).GetComponent<PlayerStatsComponent>().recordedStats;
				ulong num = 0uL;
				for (int i = 0; i < statsToDisplay.Length; i++)
				{
					string text = statsToDisplay[i];
					StatDef val = StatDef.Find(text);
					if (val == null)
					{
						Debug.LogWarningFormat("GameEndReportPanelController.SetStatSheet: Could not find stat def \"{0}\".", new object[1] { text });
					}
					else
					{
						num += recordedStats.GetStatPointValue(val);
					}
				}
				return $"Total Score: {num}";
			}

			public override bool IsDirty()
			{
				return true;
			}
		}

		public const string PluginGUID = "Jac000bi.MidRunScore";

		public const string PluginAuthor = "Jac000bi";

		public const string PluginName = "MidRunScore";

		public const string PluginVersion = "1.0.0";

		public static string[] statsToDisplay;

		public static FindFuckerPlugin instance;

		public void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			instance = this;
			Log.Init(((BaseUnityPlugin)this).Logger);
			statsToDisplay = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/GameEndReportPanel.prefab").WaitForCompletion().GetComponent<GameEndReportPanelController>()
				.statsToDisplay;
			ObjectivePanelController.collectObjectiveSources += ObjectivePanelController_collectObjectiveSources;
		}

		private void ObjectivePanelController_collectObjectiveSources(CharacterMaster master, List<ObjectiveSourceDescriptor> sources)
		{
			//IL_0004: 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)
			sources.Add(new ObjectiveSourceDescriptor
			{
				master = master,
				objectiveType = typeof(MyObjective),
				source = (Object)(object)Run.instance
			});
		}
	}
}