Decompiled source of LethalClips v0.0.1

plugins/LethalClips.dll

Decompiled 5 hours ago
using System;
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.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Steamworks;
using Steamworks.Data;
using Unity.Netcode;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalClips")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LalaDancer")]
[assembly: AssemblyTitle("LethalClips")]
[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 LethalClips
{
	[BepInPlugin("com.lalabuff.lethal.lethalclips", "LethalClips", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "com.lalabuff.lethal.lethalclips";

		private const string NAME = "LethalClips";

		private const string VERSION = "0.0.1";

		internal static ManualLogSource Log;

		internal void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.lalabuff.lethal.lethalclips").PatchAll();
			Log.LogInfo((object)"Successfully loaded LethalClips (com.lalabuff.lethal.lethalclips) v0.0.1!");
		}
	}
	internal static class State<T> where T : new()
	{
		private static readonly Dictionary<object, T> states = new Dictionary<object, T>();

		internal static T Of(object obj)
		{
			if (!states.TryGetValue(obj, out var value))
			{
				return states[obj] = new T();
			}
			return value;
		}
	}
}
namespace LethalClips.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
	internal class KillPlayer
	{
		private static void Prefix(PlayerControllerB __instance, ref bool __state)
		{
			__state = ((NetworkBehaviour)__instance).IsOwner && !__instance.isPlayerDead && __instance.AllowPlayerDeath();
		}

		private static void Postfix(bool __state, CauseOfDeath causeOfDeath)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			if (__state)
			{
				Plugin.Log.LogInfo((object)$"Player was killed by {causeOfDeath}!");
				TimelineEventHandle val = SteamTimeline.AddInstantaneousTimelineEvent("Killed by " + Enum.GetName(typeof(CauseOfDeath), causeOfDeath), "git gud lol", "steam_death", 0u, 0f, (TimelineEventClipPriority)2);
				Plugin.Log.LogInfo((object)$"Added timeline event {val}.");
			}
		}
	}
}