Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MoreStatistics v2.0.2
plugins/MoreStatistics/MoreStatistics.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HG.Reflection; using Microsoft.CodeAnalysis; using On.RoR2.UI; using RoR2; using RoR2.Stats; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreStatistics")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f9a324a8467463fdc075018d9154b9f88d58028d")] [assembly: AssemblyProduct("MoreStatistics")] [assembly: AssemblyTitle("MoreStatistics")] [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 MoreStatistics { public static class Assets { public static AssetBundle mainBundle; public const string bundleName = "morebundles"; public const string assetBundleFolder = "assetbundles"; public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(MoreStatistics.PInfo.Location), "assetbundles", "morebundles"); public static void Init() { mainBundle = AssetBundle.LoadFromFile(AssetBundlePath); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Nullos.MoreStatistics", "MoreStatistics", "2.0.2")] public class MoreStatistics : BaseUnityPlugin { public const string PluginGUID = "com.Nullos.MoreStatistics"; public const string PluginName = "MoreStatistics"; public const string PluginVersion = "2.0.2"; private string[] statsToDisplay = new string[7] { "totalHealthHealed", "totalDistanceTraveled", "totalBloodPurchases", "totalLunarPurchases", "totalDronesPurchased", "totalTurretsPurchased", "totalEliteKills" }; private Transform gameEndReportPanel; private GameObject moreButtonsPrefab; private GameObject mobStatsPanelPrefab; private GameObject mobStatsStripPrefab; private Transform parentTransform; private GameObject mobStatsPanel = null; private List<string> mobBlacklist; private string[] statPrefix = new string[3] { "damageDealtTo", "damageTakenFrom", "killsAgainst" }; private TMP_FontAsset font = null; public static PluginInfo PInfo { get; private set; } private void OnEnable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GameEndReportPanelController.SetPlayerInfo += new hook_SetPlayerInfo(PlayerInfoHook); GameEndReportPanelController.Awake += new hook_Awake(EndMenuHook); } private void OnDisable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown GameEndReportPanelController.SetPlayerInfo -= new hook_SetPlayerInfo(PlayerInfoHook); GameEndReportPanelController.Awake -= new hook_Awake(EndMenuHook); } public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); PInfo = ((BaseUnityPlugin)this).Info; string path = Path.Combine(Path.GetDirectoryName(PInfo.Location), "mobNames.txt"); populateMobList(path); Assets.Init(); if ((Object)(object)Assets.mainBundle == (Object)null) { Log.Error("Bundle is null"); } mobStatsPanelPrefab = Assets.mainBundle.LoadAsset<GameObject>("MobStats"); mobStatsStripPrefab = Assets.mainBundle.LoadAsset<GameObject>("StatStrip"); moreButtonsPrefab = Assets.mainBundle.LoadAsset<GameObject>("MoreButtonsArea"); } private void EndMenuHook(orig_Awake orig, GameEndReportPanelController self) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown orig.Invoke(self); parentTransform = ((Component)self).transform.Find("SafeArea (JUICED)/BodyArea"); GameObject val = Object.Instantiate<GameObject>(moreButtonsPrefab, parentTransform); GameObject gameObject = ((Component)val.transform.Find("MobStatsButton")).gameObject; Button component = gameObject.GetComponent<Button>(); ((UnityEvent)component.onClick).AddListener(new UnityAction(openStatPanel)); setFont(((Component)self).transform); } private void PlayerInfoHook(orig_SetPlayerInfo orig, GameEndReportPanelController self, PlayerInfo playerInfo, int playerIndex) { if (!self.statsToDisplay.Contains(statsToDisplay[0])) { self.statsToDisplay = self.statsToDisplay.Concat(statsToDisplay).ToArray(); } orig.Invoke(self, playerInfo, playerIndex); List<string> enemiesNamesPlayerInteractedWith = GetEnemiesNamesPlayerInteractedWith(playerInfo.statSheet); createMobStatPanel(); Transform val = mobStatsPanel.transform.Find("Panel/Scroll View/Viewport/Container"); StatSheet statSheet = playerInfo.statSheet; ulong num = 0uL; ulong num2 = 0uL; ulong num3 = 0uL; GameObject val2 = null; foreach (string item in enemiesNamesPlayerInteractedWith) { GameObject val3 = BodyCatalog.FindBodyPrefab(item); CharacterBody component = val3.GetComponent<CharacterBody>(); Texture portraitIcon = component.portraitIcon; StatDef val4 = StatDef.Find("killsAgainst." + item); ulong statValueULong = statSheet.GetStatValueULong(val4); val4 = StatDef.Find("damageDealtTo." + item); ulong statValueULong2 = statSheet.GetStatValueULong(val4); val4 = StatDef.Find("damageTakenFrom." + item); ulong statValueULong3 = statSheet.GetStatValueULong(val4); switch (item) { default: if (!(item == "BrotherHurtBody")) { GameObject statStrip = Object.Instantiate<GameObject>(mobStatsStripPrefab, val); fillStatStrip(statStrip, portraitIcon, statValueULong, statValueULong2, statValueULong3); break; } goto case "BrotherBody"; case "BrotherBody": case "BrotherGlassBody": case "BrotherHauntBody": if ((Object)(object)val2 == (Object)null) { val2 = Object.Instantiate<GameObject>(mobStatsStripPrefab, val); } num += statValueULong; num2 += statValueULong2; num3 += statValueULong3; fillStatStrip(val2, portraitIcon, num, num2, num3); break; } } } private void fillStatStrip(GameObject statStrip, Texture icon, ulong kills, ulong damageDealt, ulong damageTaken) { if ((Object)(object)icon != (Object)null) { ((Component)statStrip.transform.Find("Image/Image")).GetComponent<RawImage>().texture = icon; } ((TMP_Text)((Component)statStrip.transform.Find("Killed/Value")).GetComponent<TextMeshProUGUI>()).text = TextSerialization.ToStringNumeric(kills); ((TMP_Text)((Component)statStrip.transform.Find("DamageDealt/Value")).GetComponent<TextMeshProUGUI>()).text = TextSerialization.ToStringNumeric(damageDealt); ((TMP_Text)((Component)statStrip.transform.Find("DamageTaken/Value")).GetComponent<TextMeshProUGUI>()).text = TextSerialization.ToStringNumeric(damageTaken); } private List<string> GetEnemiesNamesPlayerInteractedWith(StatSheet statSheet) { List<string> list = new List<string>(); string[] bodyNames = BodyCatalog.bodyNames; foreach (string text in bodyNames) { if (mobBlacklist.Contains(text)) { continue; } string[] array = statPrefix; foreach (string text2 in array) { string text3 = text2 + "." + text; StatDef val = StatDef.Find(text3); string statDisplayValue = statSheet.GetStatDisplayValue(val); if (int.TryParse(statDisplayValue, out var result) && result != 0) { list.Add(text); break; } } } return list; } private void populateMobList(string path) { char[] trimChars = new char[2] { ' ', '\n' }; mobBlacklist = new List<string>(); IEnumerable<string> enumerable = File.ReadLines(path); foreach (string item in enumerable) { mobBlacklist.Add(item.Trim(trimChars)); } } private void createMobStatPanel() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if ((Object)(object)mobStatsPanel != (Object)null) { Object.Destroy((Object)(object)mobStatsPanel); } mobStatsPanel = Object.Instantiate<GameObject>(mobStatsPanelPrefab, parentTransform); ((UnityEvent)((Component)mobStatsPanel.transform.Find("Panel/Top/Close")).GetComponent<Button>().onClick).AddListener(new UnityAction(closeStatPanel)); mobStatsPanel.SetActive(false); } private void closeStatPanel() { if (!((Object)(object)mobStatsPanel == (Object)null)) { mobStatsPanel.SetActive(false); } } private void openStatPanel() { if ((Object)(object)mobStatsPanel != (Object)null) { mobStatsPanel.SetActive(true); } } private void setFont(Transform gameEndReportPanel) { font = ((TMP_Text)((Component)gameEndReportPanel.Find("SafeArea (JUICED)/HeaderArea/DeathFlavorText")).GetComponent<HGTextMeshProUGUI>()).font; ((TMP_Text)((Component)mobStatsPanelPrefab.transform.Find("Panel/Header/Killed/Value")).GetComponent<TextMeshProUGUI>()).font = font; ((TMP_Text)((Component)mobStatsPanelPrefab.transform.Find("Panel/Header/DamageDealt/Value")).GetComponent<TextMeshProUGUI>()).font = font; ((TMP_Text)((Component)mobStatsPanelPrefab.transform.Find("Panel/Header/DamageTaken/Value")).GetComponent<TextMeshProUGUI>()).font = font; ((TMP_Text)((Component)mobStatsStripPrefab.transform.Find("Killed/Value")).GetComponent<TextMeshProUGUI>()).font = font; ((TMP_Text)((Component)mobStatsStripPrefab.transform.Find("DamageDealt/Value")).GetComponent<TextMeshProUGUI>()).font = font; ((TMP_Text)((Component)mobStatsStripPrefab.transform.Find("DamageTaken/Value")).GetComponent<TextMeshProUGUI>()).font = font; } private void Update() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)283)) { StatSheet currentStats = ((Component)PlayerCharacterMasterController.instances[0].master).GetComponent<PlayerStatsComponent>().currentStats; Log.Info("STAT FIELDS\n"); StatField[] fields = currentStats.fields; for (int i = 0; i < fields.Length; i++) { StatField val = fields[i]; Log.Info(((StatField)(ref val)).name ?? ""); } } else if (Input.GetKeyDown((KeyCode)284)) { CharacterBody body = PlayerCharacterMasterController.instances[0].master.GetBody(); body.healthComponent.Die(false); } } [ConCommand(/*Could not decode attribute arguments.*/)] private static void cmd_bodyPortraits(ConCommandArgs args) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterBody allBodyPrefabBodyBodyComponent in BodyCatalog.allBodyPrefabBodyBodyComponents) { string bodyName = BodyCatalog.GetBodyName(BodyCatalog.FindBodyIndex(allBodyPrefabBodyBodyComponent)); string name = ((Object)allBodyPrefabBodyBodyComponent.portraitIcon).name; Log.Info(bodyName + " - " + name); } } } }