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 SteamDeathCapture v0.1.1
BepInEx/plugins/SteamDeathCapture.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Steamworks; using Steamworks.Data; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("smrkn")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1+c9ce1a10fa83c097ffc6c5c546f794cd06717c71")] [assembly: AssemblyProduct("SteamDeathCapture")] [assembly: AssemblyTitle("SteamDeathCapture")] [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 RepoDeathCapture { [HarmonyPatch(typeof(LoadingUI))] internal static class LoadingPatches { [HarmonyPostfix] [HarmonyPatch("StartLoading")] private static void StartLoadingPostfix(LoadingUI __instance) { if (SteamDeathCapture.isEnabledConfigEntry.Value) { SteamTimeline.ClearTimelineTooltip(0f); SteamTimeline.SetTimelineGameMode((TimelineGameMode)4); } } [HarmonyPostfix] [HarmonyPatch("StopLoading")] private static void StopLoadingPostfix(LoadingUI __instance) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!SteamDeathCapture.isEnabledConfigEntry.Value) { return; } if (SemiFunc.IsMainMenu() || SemiFunc.RunIsLobby() || SemiFunc.RunIsLobbyMenu()) { SteamTimeline.EndGamePhase(); SteamTimeline.SetTimelineGameMode((TimelineGameMode)3); } else if (SemiFunc.RunIsShop()) { SteamTimeline.SetTimelineTooltip("Shopping", 0f); SteamTimeline.SetTimelineGameMode((TimelineGameMode)2); } else if (SemiFunc.RunIsArena()) { if (SemiFunc.IsMultiplayer()) { SteamTimeline.AddInstantaneousTimelineEvent("Deathmatch", "Battling to become the biggest loser!", "steam_combat", 0u, 3f, (TimelineEventClipPriority)2); SteamTimeline.SetTimelineGameMode((TimelineGameMode)1); } else { SteamTimeline.ClearTimelineTooltip(0f); SteamTimeline.EndGamePhase(); } } else if (SemiFunc.RunIsLevel()) { SteamTimeline.StartGamePhase(); SteamTimeline.SetTimelineTooltip("Exploring " + ((TMP_Text)__instance.levelNameText).text, 0f); SteamTimeline.SetTimelineGameMode((TimelineGameMode)1); } } } [HarmonyPatch(typeof(PlayerAvatar))] internal static class PlayerControllerPatches { [CompilerGenerated] private sealed class <OpenSteamOverlay>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public TimelineEventHandle handle; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <OpenSteamOverlay>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!SteamDeathCapture.isOverlayEnabledConfigEntry.Value) { return false; } <>2__current = (object)new WaitForSecondsRealtime((float)SteamDeathCapture.overlayDelayConfigEntry.Value); <>1__state = 1; return true; case 1: <>1__state = -1; SteamTimeline.OpenOverlayToTimelineEvent(handle); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPostfix] [HarmonyPatch("PlayerDeathDone")] private static void PlayerDeathDonePostfix(PlayerAvatar __instance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (SteamDeathCapture.isEnabledConfigEntry.Value && (SemiFunc.IsMultiplayer() || !SemiFunc.RunIsArena())) { TimelineEventHandle handle = SteamTimeline.AddInstantaneousTimelineEvent("Death", "You died!", "steam_death", 1u, 0f, (TimelineEventClipPriority)3); ((MonoBehaviour)SteamDeathCapture.Instance).StartCoroutine(OpenSteamOverlay(handle)); } } [IteratorStateMachine(typeof(<OpenSteamOverlay>d__1))] private static IEnumerator OpenSteamOverlay(TimelineEventHandle handle) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <OpenSteamOverlay>d__1(0) { handle = handle }; } } [BepInPlugin("com.smrkn.repo-death-capture", "DeathCapture", "0.1.0")] public class SteamDeathCapture : BaseUnityPlugin { internal static ConfigEntry<bool> isEnabledConfigEntry; internal static ConfigEntry<bool> isOverlayEnabledConfigEntry; internal static ConfigEntry<int> overlayDelayConfigEntry; internal static SteamDeathCapture Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); isEnabledConfigEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Record Deaths", true, "Should the mod do anything?"); isEnabledConfigEntry.SettingChanged += delegate { if (!isEnabledConfigEntry.Value) { SteamTimeline.ClearTimelineTooltip(0f); SteamTimeline.EndGamePhase(); } }; isOverlayEnabledConfigEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Overlay", "Open Overlay upon Death", true, "Would you like to open the Steam Overlay upon death?"); overlayDelayConfigEntry = ((BaseUnityPlugin)this).Config.Bind<int>("Overlay", "Overlay Delay", 5, new ConfigDescription("Delay in seconds after death before opening the Steam Overlay.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10), Array.Empty<object>())); } internal void Patch() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0025: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } }