Decompiled source of LeastProfitable v1.0.0

LeastProfitable.dll

Decompiled 6 months 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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LeastProfitable")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Expose who did no work!")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LeastProfitable")]
[assembly: AssemblyTitle("LeastProfitable")]
[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 LeastProfitable
{
	[BepInPlugin("evelritual.LeastProfitable", "Least Profitable", "1.0.0")]
	public class LeastProfitable : BaseUnityPlugin
	{
		private const string modGUID = "evelritual.LeastProfitable";

		private const string modName = "Least Profitable";

		private const string modSemVer = "1.0.0";

		private readonly Harmony harmony = new Harmony("evelritual.LeastProfitable");

		private static LeastProfitable Instance;

		public static ManualLogSource logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("evelritual.LeastProfitable");
			harmony.PatchAll();
			logger.LogInfo((object)"LeastProfitable loaded!");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LeastProfitable";

		public const string PLUGIN_NAME = "LeastProfitable";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LeastProfitable.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class profitPatch
	{
		[HarmonyPatch("WritePlayerNotes")]
		[HarmonyPostfix]
		private static void LeastProfitable(ref EndOfGameStats ___gameStats, ref int ___connectedPlayersAmount)
		{
			if (___connectedPlayersAmount <= 0)
			{
				return;
			}
			int num = 999999;
			for (int i = 0; i < ___gameStats.allPlayerStats.Length; i++)
			{
				if (___gameStats.allPlayerStats[i].isActivePlayer && ___gameStats.allPlayerStats[i].profitable < num)
				{
					num = ___gameStats.allPlayerStats[i].profitable;
				}
			}
			for (int j = 0; j < ___gameStats.allPlayerStats.Length; j++)
			{
				if (___gameStats.allPlayerStats[j].isActivePlayer && ___gameStats.allPlayerStats[j].profitable == num)
				{
					___gameStats.allPlayerStats[j].playerNotes.Add("Least profitable :(");
				}
			}
		}
	}
}