using System; using System.CodeDom.Compiler; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Accolades.Plugin; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; 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("Accolades")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Accolades")] [assembly: AssemblyTitle("Accolades")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace Accolades.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("Accolades.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal Resources() { } } } namespace Accolades.Plugin { internal static class AccoladePlugin { public static string[] Best = new string[4]; public static void CalculateProfit() { PlayerStats[] allPlayerStats = StartOfRound.Instance.gameStats.allPlayerStats; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int[] array = new int[StartOfRound.Instance.allPlayerScripts.Length]; int[] array2 = new int[StartOfRound.Instance.allPlayerScripts.Length]; int[] array3 = new int[StartOfRound.Instance.allPlayerScripts.Length]; int[] array4 = new int[StartOfRound.Instance.allPlayerScripts.Length]; for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { array2[i] = allPlayerStats[i].profitable; array4[i] = allPlayerStats[i].damageTaken; array[i] = allPlayerStats[i].stepsTaken; array3[i] = allPlayerStats[i].turnAmount; } for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++) { if (array.Min() == allPlayerStats[j].stepsTaken) { Best[1] = allPlayerScripts[j].playerUsername; } if (array.Max() == allPlayerStats[j].stepsTaken && array2.Max() == allPlayerStats[j].profitable) { Best[2] = allPlayerScripts[j].playerUsername; } if (array4.Max() == allPlayerStats[j].damageTaken) { Best[3] = allPlayerScripts[j].playerUsername; } if (array3.Max() == allPlayerStats[j].turnAmount) { Best[4] = allPlayerScripts[j].playerUsername; } } } [HarmonyPatch(typeof(StartOfRound))] [HarmonyPatch("WritePlayerNotes")] [HarmonyPrefix] public static void WriteNotes() { int num = StartOfRound.Instance.allPlayerScripts.Length; PlayerStats[] allPlayerStats = StartOfRound.Instance.gameStats.allPlayerStats; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; int num2 = TimeOfDay.Instance.profitQuota / 65; int num3 = num2 * num2; bool flag = StartOfRound.Instance.scrapCollectedLastRound >= num2; bool flag2 = StartOfRound.Instance.scrapCollectedLastRound >= num3 || StartOfRound.Instance.scrapCollectedLastRound >= 30; if (StartOfRound.Instance.connectedPlayersAmount == 0) { if (flag) { if (flag2) { StartOfRound.Instance.gameStats.allPlayerStats[0].playerNotes.Add("REALLY Profitable!"); } else { StartOfRound.Instance.gameStats.allPlayerStats[0].playerNotes.Add("Profitable!"); } } else { StartOfRound.Instance.gameStats.allPlayerStats[0].playerNotes.Add("Failed, but no penalty."); StartOfRound.Instance.gameStats.allPlayerStats[0].playerNotes.Add("Base quota is " + num2 + " items."); } } if (StartOfRound.Instance.connectedPlayersAmount <= 0) { return; } CalculateProfit(); for (int i = 0; i < num; i++) { bool flag3 = !StartOfRound.Instance.allPlayerScripts[i].isPlayerDead && !StartOfRound.Instance.allPlayerScripts[i].disconnectedMidGame; StartOfRound.Instance.gameStats.allPlayerStats[i].isActivePlayer = StartOfRound.Instance.allPlayerScripts[i].disconnectedMidGame || StartOfRound.Instance.allPlayerScripts[i].isPlayerDead || StartOfRound.Instance.allPlayerScripts[i].isPlayerControlled; if (!allPlayerStats[i].isActivePlayer) { continue; } if (allPlayerScripts[i].playerUsername == Best[1]) { if (flag3) { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Laziest!"); Best[1] = ""; } else { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Wasn't too careful."); Best[1] = ""; } } if (allPlayerScripts[i].playerUsername == Best[2]) { if (flag3) { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Most Profitable!"); Best[2] = ""; } else { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Gave their life for the cause."); Best[2] = ""; } } if (allPlayerScripts[i].playerUsername == Best[3]) { if (flag3) { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Most injured!"); Best[3] = ""; } else { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Gave in to their injuries."); Best[3] = ""; } } if (allPlayerScripts[i].playerUsername == Best[4]) { if (flag3) { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Wariest!"); Best[4] = ""; } else { StartOfRound.Instance.gameStats.allPlayerStats[i].playerNotes.Add("Most clueless."); Best[4] = ""; } } } } } } namespace Accolade { [BepInPlugin("GHAccoladesMod", "GH Accolades", "1.0.0")] public class AccoladeModBase : BaseUnityPlugin { private const string modGUID = "GHAccoladesMod"; private const string modName = "GH Accolades"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("GHAccoladesMod"); private static AccoladeModBase Instance; internal ManualLogSource LOGGER; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } LOGGER = Logger.CreateLogSource("GHAccoladesMod"); LOGGER.LogInfo((object)"GH Accolades has awoken!!"); harmony.PatchAll(typeof(AccoladeModBase)); harmony.PatchAll(typeof(AccoladePlugin)); } } }