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 DeathCounter v0.1.1
Tomatobird.DeathCounter.dll
Decompiled 4 months agousing 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 GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Tomatobird.DeathCounter")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+9cd6d748f320a30915b8ee6a96d7051257575988")] [assembly: AssemblyProduct("LCDeathCounter")] [assembly: AssemblyTitle("Tomatobird.DeathCounter")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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.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; } } [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 LCDeathCounter { public class DeathCounter : MonoBehaviour { public static int deathcount; } [BepInPlugin("Tomatobird.DeathCounter", "LCDeathCounter", "0.1.1")] public class LCDeathCounter : BaseUnityPlugin { public static LCDeathCounter Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); Logger.LogInfo((object)"Tomatobird.DeathCounter v0.1.1 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Tomatobird.DeathCounter"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Tomatobird.DeathCounter"; public const string PLUGIN_NAME = "LCDeathCounter"; public const string PLUGIN_VERSION = "0.1.1"; } } namespace LCDeathCounter.Patches { [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerPatcher { [HarmonyPatch("KillPlayer")] [HarmonyPostfix] internal static void KillPlayerPatch(PlayerControllerB __instance) { if (((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerDead && __instance.AllowPlayerDeath()) { DeathCounter.deathcount++; } } } [HarmonyPatch(typeof(QuickMenuManager))] internal class QuickMenuPatcher { [HarmonyPatch("Start")] [HarmonyPostfix] internal static void QuickMenuStartPatch(QuickMenuManager __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("DeathCounterText"); val.transform.parent = __instance.menuContainer.transform; TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); Transform obj = __instance.menuContainer.transform.Find("MainButtons"); object obj2; if (obj == null) { obj2 = null; } else { Transform obj3 = obj.Find("Quit"); if (obj3 == null) { obj2 = null; } else { TextMeshProUGUI componentInChildren = ((Component)obj3).GetComponentInChildren<TextMeshProUGUI>(); obj2 = ((componentInChildren != null) ? ((TMP_Text)componentInChildren).font : null); } } TMP_FontAsset val3 = (TMP_FontAsset)obj2; if ((Object)(object)val3 != (Object)null) { ((TMP_Text)val2).font = val3; } ((Graphic)val2).color = new Color(1f, 0.5647f, 0f, 1f); ((TMP_Text)val2).alignment = (TextAlignmentOptions)1026; ((Transform)((TMP_Text)val2).rectTransform).localScale = Vector3.one; ((TMP_Text)val2).rectTransform.anchoredPosition = new Vector2(0f, 30f); ((TMP_Text)val2).rectTransform.anchoredPosition3D = new Vector3(0f, 0f, 0f); ((TMP_Text)val2).rectTransform.anchorMax = new Vector2(1f, 0f); ((TMP_Text)val2).rectTransform.anchorMin = new Vector2(0f, 0f); ((TMP_Text)val2).rectTransform.offsetMax = new Vector2(0f, 4f); ((TMP_Text)val2).rectTransform.offsetMin = new Vector2(0f, 4f); ((TMP_Text)val2).rectTransform.sizeDelta = new Vector2(0f, 0f); ((TMP_Text)val2).fontSize = 24f; ((TMP_Text)val2).text = "Deaths: 0"; } [HarmonyPatch("OpenQuickMenu")] [HarmonyPostfix] internal static void QuickMenuEnablePatch(QuickMenuManager __instance) { Transform obj = __instance.menuContainer.transform.Find("DeathCounterText"); TextMeshProUGUI val = ((obj != null) ? ((Component)obj).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)val != (Object)null) { ((TMP_Text)val).text = $"Deaths: {DeathCounter.deathcount}"; } } } }