using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
[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("ScrapRanking")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ScrapRanking")]
[assembly: AssemblyTitle("ScrapRanking")]
[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 ScrapRanking
{
public class Class1
{
}
[BepInPlugin("mai.scrapranking", "Scrap Ranking", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("mai.scrapranking");
private void Awake()
{
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"ScrapRanking cargado!");
}
}
[HarmonyPatch(typeof(HUDManager), "FillEndGameStats")]
public class FillEndGameStatsPatch
{
private static void Postfix(HUDManager __instance, EndOfGameStats stats)
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
List<(string, int, bool)> list = new List<(string, int, bool)>();
for (int i = 0; i < allPlayerScripts.Length; i++)
{
PlayerControllerB val = allPlayerScripts[i];
if (val.isPlayerControlled || val.isPlayerDead || val.disconnectedMidGame)
{
int profitable = stats.allPlayerStats[i].profitable;
list.Add((val.playerUsername, profitable, val.isPlayerDead));
}
}
list = list.OrderByDescending<(string, int, bool), int>(((string name, int scrap, bool isDead) p) => p.scrap).ToList();
int num = 0;
foreach (var item in list)
{
if (num >= __instance.statsUIElements.playerNamesText.Length)
{
break;
}
string text = num switch
{
2 => "#3",
1 => "#2",
0 => "#1",
_ => "#" + (num + 1),
};
((TMP_Text)__instance.statsUIElements.playerNamesText[num]).text = text + " " + item.Item1;
((TMP_Text)__instance.statsUIElements.playerNotesText[num]).text = "Scrap: $" + item.Item2;
((TMP_Text)__instance.statsUIElements.playerNotesText[num]).fontSize = 16f;
num++;
}
}
}
}