Decompiled source of MoreDeathNotes v1.4.0

MoreDeathNotes.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Coroner.LCAPI;
using GameNetcodeStuff;
using HarmonyLib;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
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: AssemblyCompany("AnythingGoesGit")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Update the Performance Report to include new information, such as the cause of death.")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0")]
[assembly: AssemblyProduct("MoreDeathNotes")]
[assembly: AssemblyTitle("MoreDeathNotes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.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 Coroner
{
	internal class AdvancedDeathTracker
	{
		public const int PLAYER_CAUSE_OF_DEATH_DROPSHIP = 300;

		public static readonly string[] FUNNY_NOTES = new string[41]
		{
			"The goofiest goober.", "The cutest employee.", "Had the most fun.", "Had the least fun.", "The bravest employee.", "Did a sick flip.", "Stubbed their toe.", "The most likely to die next time.", "The least likely to die next time.", "Dislikes smoke.",
			"A team player.", "A real go-getter.", "Ate the most snacks.", "Passed GO and collected $200.", "Got freaky on a Friday night.", "I think this one's a serial killer.", "Perfectly unremarkable.", "Hasn't called their mother in a while.", "Has IP address 127.0.0.1.", "Secretly a lizard",
			"Believed they could fly.", "Thought they had nine lives.", "Believes in Santa Claus.", "Still uses a flip phone.", "Can't cook instant noodles right.", "Thinks the Earth is flat.", "Still afraid of the dark.", "Always the first in line for coffee.", "Lost a bet with a parrot.", "Can't remember their passwords.",
			"Secretly a superhero on weekends.", "Tried to high-five a mirror.", "Thinks pineapple belongs on pizza.", "Never finishes their... ", "Talks to plants.", "Has a pet rock named Steve.", "Wanted to be an astronaut.", "Sleeps with a night light.", "Once got stuck in a revolving door.", "Has a collection of rubber ducks.",
			"Dances when no one is watching."
		};

		private static readonly Dictionary<int, AdvancedCauseOfDeath> PlayerCauseOfDeath = new Dictionary<int, AdvancedCauseOfDeath>();

		private static readonly Dictionary<int, string> PlayerNotes = new Dictionary<int, string>();

		public static void ClearDeathTracker()
		{
			PlayerCauseOfDeath.Clear();
			PlayerNotes.Clear();
		}

		public static void SetCauseOfDeath(int playerIndex, AdvancedCauseOfDeath causeOfDeath, bool broadcast = true)
		{
			PlayerCauseOfDeath[playerIndex] = causeOfDeath;
			if (broadcast)
			{
				DeathBroadcaster.BroadcastCauseOfDeath(playerIndex, causeOfDeath);
			}
		}

		public static void SetCauseOfDeath(int playerIndex, CauseOfDeath causeOfDeath, bool broadcast = true)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			SetCauseOfDeath(playerIndex, ConvertCauseOfDeath(causeOfDeath), broadcast);
		}

		public static void SetCauseOfDeath(PlayerControllerB playerController, CauseOfDeath causeOfDeath, bool broadcast = true)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			SetCauseOfDeath((int)playerController.playerClientId, ConvertCauseOfDeath(causeOfDeath), broadcast);
		}

		public static void SetCauseOfDeath(PlayerControllerB playerController, AdvancedCauseOfDeath causeOfDeath, bool broadcast = true)
		{
			SetCauseOfDeath((int)playerController.playerClientId, causeOfDeath, broadcast);
		}

		public static AdvancedCauseOfDeath GetCauseOfDeath(int playerIndex)
		{
			return GetCauseOfDeath(StartOfRound.Instance.allPlayerScripts[playerIndex]);
		}

		public static AdvancedCauseOfDeath GetCauseOfDeath(PlayerControllerB playerController)
		{
			if (!PlayerCauseOfDeath.ContainsKey((int)playerController.playerClientId))
			{
				Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerController.playerClientId} has no custom cause of death stored! Using fallback...");
				return GuessCauseOfDeath(playerController);
			}
			Plugin.Instance.PluginLogger.LogDebug((object)$"Player {playerController.playerClientId} has custom cause of death stored! {PlayerCauseOfDeath[(int)playerController.playerClientId]}");
			return PlayerCauseOfDeath[(int)playerController.playerClientId];
		}

		public static AdvancedCauseOfDeath GuessCauseOfDeath(PlayerControllerB playerController)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			if (playerController.isPlayerDead)
			{
				if (IsHoldingJetpack(playerController))
				{
					if ((int)playerController.causeOfDeath == 2)
					{
						return AdvancedCauseOfDeath.Player_Jetpack_Gravity;
					}
					if ((int)playerController.causeOfDeath == 3)
					{
						return AdvancedCauseOfDeath.Player_Jetpack_Blast;
					}
				}
				return ConvertCauseOfDeath(playerController.causeOfDeath);
			}
			return AdvancedCauseOfDeath.Unknown;
		}

		public static bool IsHoldingJetpack(PlayerControllerB playerController)
		{
			GrabbableObject currentlyHeldObjectServer = playerController.currentlyHeldObjectServer;
			if ((Object)(object)currentlyHeldObjectServer == (Object)null)
			{
				return false;
			}
			GameObject gameObject = ((Component)currentlyHeldObjectServer).gameObject;
			if ((Object)(object)gameObject == (Object)null)
			{
				return false;
			}
			GrabbableObject component = gameObject.GetComponent<GrabbableObject>();
			if ((Object)(object)component == (Object)null)
			{
				return false;
			}
			if (component is JetpackItem)
			{
				return true;
			}
			return false;
		}

		public static AdvancedCauseOfDeath ConvertCauseOfDeath(CauseOfDeath causeOfDeath)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected I4, but got Unknown
			return (int)causeOfDeath switch
			{
				0 => AdvancedCauseOfDeath.Unknown, 
				1 => AdvancedCauseOfDeath.Bludgeoning, 
				2 => AdvancedCauseOfDeath.Gravity, 
				3 => AdvancedCauseOfDeath.Blast, 
				4 => AdvancedCauseOfDeath.Strangulation, 
				5 => AdvancedCauseOfDeath.Suffocation, 
				6 => AdvancedCauseOfDeath.Mauling, 
				7 => AdvancedCauseOfDeath.Gunshots, 
				8 => AdvancedCauseOfDeath.Crushing, 
				9 => AdvancedCauseOfDeath.Drowning, 
				10 => AdvancedCauseOfDeath.Abandoned, 
				11 => AdvancedCauseOfDeath.Electrocution, 
				_ => AdvancedCauseOfDeath.Unknown, 
			};
		}

		public static string StringifyCauseOfDeath(CauseOfDeath causeOfDeath)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return StringifyCauseOfDeath(ConvertCauseOfDeath(causeOfDeath), Plugin.RANDOM);
		}

		public static string StringifyCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
		{
			return StringifyCauseOfDeath(causeOfDeath, Plugin.RANDOM);
		}

		public static string StringifyCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath, Random random)
		{
			string[] array = SelectCauseOfDeath(causeOfDeath);
			if (array.Length == 1 || Plugin.Instance.PluginConfig.ShouldUseSeriousDeathMessages())
			{
				return array[0];
			}
			return array[random.Next(array.Length)];
		}

		public static string[] SelectCauseOfDeath(AdvancedCauseOfDeath? causeOfDeath)
		{
			if (!causeOfDeath.HasValue)
			{
				return FUNNY_NOTES;
			}
			return causeOfDeath switch
			{
				AdvancedCauseOfDeath.Bludgeoning => new string[10] { "Bludgeoned to death.", "Met the business end of a hammer.", "Learned that gravity and rocks don't mix.", "Discovered why pillows are safer than bricks.", "Took a hard hit, literally.", "Found out hammers aren't just for nails.", "Tried to catch a falling anvil.", "Wrestled with a rock and the rock won.", "Received a heavy dose of blunt force trauma.", "Had an unexpected rendezvous with a bat." }, 
				AdvancedCauseOfDeath.Gravity => new string[10] { "Fell to their death.", "Fell off a cliff.", "Discovered flying isn't for everyone.", "Took a dive, forgot to stop.", "Learned that what goes up must come down.", "Gravity: 1, Common Sense: 0.", "Had a falling out with the ground.", "Tried skydiving without a parachute.", "Did not stick the landing.", "Was a victim of the law of gravity." }, 
				AdvancedCauseOfDeath.Blast => new string[10] { "Went out with a bang.", "Exploded.", "Was blown to smithereens.", "Tried to juggle grenades.", "Learned the hard way that red barrels explode.", "Found out bombs are not toys.", "Misunderstood the 'keep away from fire' warning.", "Had a blast, but not in a good way.", "Went out in a blaze of glory.", "Had an explosive personality." }, 
				AdvancedCauseOfDeath.Strangulation => new string[10] { "Strangled to death.", "Tried to swallow a boa constrictor.", "Underestimated the strength of a necktie.", "Took a chokehold way too seriously.", "Tried a scarf, found it a bit too tight.", "Played a deadly game of tug-o-war with a python.", "Tried to deep throat a rope.", "Realized too late that 'breath play' is not for everyone.", "Found out the hard way that neck massages can be deadly.", "Discovered that some necklaces are too tight." }, 
				AdvancedCauseOfDeath.Suffocation => new string[10] { "Suffocated to death.", "Forgot how to breathe.", "Played hide and seek in a vacuum.", "Took a deadly nap in a plastic bag.", "Tried to hold their breath indefinitely.", "Got a little too intimate with a pillow.", "Misplaced their oxygen.", "Found out that vacuum cleaners are not for internal use.", "Thought they could breathe underwater without equipment.", "Didn't believe in the concept of breathing." }, 
				AdvancedCauseOfDeath.Mauling => new string[10] { "Mauled to death.", "Tried to pet a bear.", "Played fetch with a lion.", "Thought they could outrun a cheetah.", "Discovered too late that 'do not feed the animals' was a suggestion.", "Tried to take a selfie with a tiger.", "Decided to go for a midnight stroll in a wolf-infested forest.", "Realized too late that 'playing dead' doesn't work with grizzly bears.", "Found out the hard way that you can't tame a wild beast with a steak.", "Got a little too close to nature." }, 
				AdvancedCauseOfDeath.Gunshots => new string[10] { "Shot to death by a turret.", "Caught a bullet with their name on it.", "Played dodgeball with bullets and lost.", "Realized they weren't faster than a speeding bullet.", "Learned that gunfights are not like the movies.", "Found out what 'bullet time' really means.", "Discovered that shooting stars can be lethal.", "Took 'biting the bullet' too literally.", "Had a fatal attraction to flying lead.", "Learned the hard way that bullets are bad for health." }, 
				AdvancedCauseOfDeath.Crushing => new string[10] { "Crushed to death.", "Had a smashing time, literally.", "Played rock-paper-scissors with a boulder.", "Discovered that walls can hug too tightly.", "Found out that heavy lifting can be fatal.", "Learned that ceilings can drop without notice.", "Got a bit too close to a compactor.", "Tried to fight gravity, and the floor won.", "Experienced the squeeze of a lifetime.", "Learned that sometimes the world weighs you down." }, 
				AdvancedCauseOfDeath.Drowning => new string[10] { "Drowned to death.", "Took water aerobics too far.", "Learned swimming the hard way.", "Thought they could breathe underwater.", "Got lost in the deep end.", "Discovered the ocean's bottom isn't a fun visit.", "Played mermaid/merman without the tail.", "Went for a swim in cement shoes.", "Underestimated the power of a puddle.", "Had a wet and deadly encounter." }, 
				AdvancedCauseOfDeath.Abandoned => new string[10] { "Abandoned by their coworkers.", "Learned that loneliness can be fatal.", "Found out that being left behind wasn't a game.", "Discovered that solitude can kill.", "Got ghosted by their survival team.", "Realized too late that no man is an island.", "Was the last one at the party... forever.", "Tried to solo a team sport.", "Learned that 'alone time' should be limited.", "Found out the hard way that there's no 'I' in team." }, 
				AdvancedCauseOfDeath.Electrocution => new string[10] { "Electrocuted to death.", "Got a shocking surprise.", "Tried to conduct electricity with their body.", "Discovered that toasters and bathtubs don't mix.", "Learned that power lines aren't for tightrope walking.", "Had an electrifying dance with death.", "Decided to chew on a power cord.", "Found out lightning does strike twice.", "Had a hair-raising experience with high voltage.", "Received a jolt to the heart, and they're to blame." }, 
				AdvancedCauseOfDeath.Kicking => new string[10] { "Kicked to death.", "Got a kick out of life, literally.", "Learned that high-kicks can be deadly.", "Discovered that shoes can pack a punch.", "Faced the wrath of a thousand angry legs.", "Took a boot to the head one too many times.", "Received the ultimate kick-off.", "Realized that being kicked around is more than an expression.", "Became a victim of a lethal leg day.", "Learned the hard way that some kicks are not for sport." }, 
				AdvancedCauseOfDeath.Enemy_Bracken => new string[10] { "Had their neck snapped by a Bracken.", "Stared at a Bracken too long.", "Hugged a Bracken. It didn't hug back.", "Played peek-a-boo with a Bracken. Lost terribly.", "Tried to make a Bracken smile.", "Thought 'Bracken' was just a weird tree.", "Gave a Bracken a stern talking to.", "Brought a knife to a Bracken fight.", "Tried to outstretch a Bracken.", "Found out Brackens aren't vegetarians." }, 
				AdvancedCauseOfDeath.Enemy_EyelessDog => new string[10] { "Got caught using a mechanical keyboard.", "Was eaten by an Eyeless Dog.", "Forgot to 'speak softly' around an Eyeless Dog.", "Wasn't quiet around an Eyeless Dog.", "Played fetch and became the stick.", "Tried to teach an Eyeless Dog new tricks.", "Thought 'Eyeless' meant 'harmless'.", "Learned Eyeless Dogs don't play dead.", "Whistled in the dark. It came running.", "Misjudged the bite of an Eyeless Dog." }, 
				AdvancedCauseOfDeath.Enemy_ForestGiant => new string[10] { "Swallowed whole by a Forest Giant.", "Played hide-and-seek with a Forest Giant.", "Tried to climb a Forest Giant. Fell.", "Was the small spoon to a Forest Giant.", "Went nature walking in tall-tall grass.", "Gave a Forest Giant a flower. Got a tree.", "Thought 'Forest Giant' was a metaphor.", "Got stepped on during a Forest Giant's stroll.", "Tried to outrun a Forest Giant's appetite.", "Learned that Forest Giants don't do handshakes." }, 
				AdvancedCauseOfDeath.Enemy_CircuitBees => new string[10] { "Electro-stung to death by Circuit Bees.", "Thought Circuit Bees made honey. They made pain.", "Tried to swat a Circuit Bee. Bad idea.", "Disturbed a Circuit Beehive. Lived shortly after.", "Took a zap from the bee zap brigade.", "Wore flower-scented cologne near Circuit Bees.", "Learned that Circuit Bees don't do buzz-offs.", "Caught in the crossfire of a Circuit Bee buzzsaw.", "Tried to catch a Circuit Bee. It caught back.", "Discovered the true meaning of 'shock and awe'." }, 
				AdvancedCauseOfDeath.Enemy_GhostGirl => new string[10] { "Died a mysterious death.", "???", "Played hide-and-seek with a Ghost Girl.", "Tried to exorcise a Ghost Girl. Got exercised.", "Became part of a Ghost Girl's haunting routine.", "Misunderstood the concept of a 'spiritual encounter'.", "Thought Ghost Girl was just a regular girl.", "Learned that Ghost Girls don't like small talk.", "Brought a Ouija board to a Ghost Girl fight.", "Received a ghoulish goodbye." }, 
				AdvancedCauseOfDeath.Enemy_EarthLeviathan => new string[10] { "Swallowed whole by an Earth Leviathan.", "Thought 'Earth Leviathan' was an exotic plant.", "Tried to outdig an Earth Leviathan.", "Learned Earth Leviathans don't play fetch.", "Mistook an Earth Leviathan for a hill.", "Got a one-way ticket to the Earth's core.", "Found out that Earth Leviathans don't do piggybacks.", "Tried to ride the Earth Leviathan express.", "Learned that Earth Leviathans aren't herbivores.", "Discovered the Earth Leviathan's insatiable appetite." }, 
				AdvancedCauseOfDeath.Enemy_BaboonHawk => new string[10] { "Was eaten by a Baboon Hawk.", "Was mauled by a Baboon Hawk.", "Mistook a Baboon Hawk for a friendly parrot.", "Tried to outfly a Baboon Hawk.", "Learned that Baboon Hawks don't do tricks.", "Got a peck on the cheek, Baboon Hawk style.", "Thought a Baboon Hawk was a new yoga pose.", "Offered a Baboon Hawk a banana. Big mistake.", "Played chicken with a Baboon Hawk. Lost.", "Tried to enter a no-fly zone. Baboon Hawk disagreed." }, 
				AdvancedCauseOfDeath.Enemy_Jester => new string[10] { "Was the butt of the Jester's joke.", "Got pranked by the Jester.", "Got popped like a weasel.", "Laughed to death by a Jester's prank.", "Took a Jester seriously. Fatal error.", "Played cards with a Jester. Dealt a dead hand.", "Tried to outjoke a Jester.", "Became the punchline of a deadly joke.", "Received a deadly pie in the face.", "Thought the Jester was just clowning around." }, 
				AdvancedCauseOfDeath.Enemy_CoilHead => new string[10] { "Got in a staring contest with a Coil Head.", "Lost a staring contest with a Coil Head.", "Tried to coil up with a Coil Head.", "Learned that Coil Heads have a tight grip.", "Thought a Coil Head was just misunderstood.", "Tried to untangle a Coil Head's thoughts.", "Played 'Simon Says' with a Coil Head.", "Got wrapped up in a Coil Head's embrace.", "Stared into the abyss, Coil Head stared back.", "Tried to headbutt a Coil Head." }, 
				AdvancedCauseOfDeath.Enemy_SnareFlea => new string[10] { "Was suffocated by a Snare Flea.", "Got caught by a Snare Flea's hug.", "Learned that Snare Fleas aren't cuddly.", "Tried to outjump a Snare Flea.", "Flea circus audition turned deadly.", "Found out Snare Fleas don't play fetch.", "Discovered the Snare Flea's sticky situation.", "Thought they could squash a Snare Flea.", "Played leapfrog with a Snare Flea.", "Learned that Snare Fleas have a tight grip." }, 
				AdvancedCauseOfDeath.Enemy_Hygrodere => new string[10] { "Was absorbed by a Hygrodere.", "Got lost in the sauce.", "Tried to moisturize with a Hygrodere.", "Went for a dip in a Hygrodere pond.", "Got a little too absorbed in nature.", "Learned that Hygroderes aren't for hydration.", "Mistook a Hygrodere for a waterbed.", "Tried to bottle a Hygrodere's essence.", "Learned that Hygroderes don't do splash fights.", "Faced the Hygrodere's engulfing embrace." }, 
				AdvancedCauseOfDeath.Enemy_HoarderBug => new string[10] { "Was hoarded by a Hoarder Bug.", "Became part of a Hoarder Bug's collection.", "Learned that Hoarder Bugs don't share.", "Tried to declutter a Hoarder Bug's nest.", "Mistook a Hoarder Bug for a treasure chest.", "Got a little too possessive with a Hoarder Bug.", "Learned that Hoarder Bugs don't do trades.", "Found out that Hoarder Bugs are avid collectors.", "Thought Hoarder Bugs were just big fans.", "Discovered the Hoarder Bug's greedy grasp." }, 
				AdvancedCauseOfDeath.Enemy_SporeLizard => new string[10] { "Was puffed by a Spore Lizard.", "Inhaled more than just fresh air.", "Thought Spore Lizard spores were perfume.", "Learned that Spore Lizards don't do aromatherapy.", "Tried to catch spores with their tongue.", "Discovered the Spore Lizard's deadly dandruff.", "Thought spores were just fancy confetti.", "Tried to domesticate a Spore Lizard.", "Learned that Spore Lizards are bad for allergies.", "Mistook a Spore Lizard for a mushroom." }, 
				AdvancedCauseOfDeath.Enemy_BunkerSpider => new string[10] { "Ensnared in the Bunker Spider's web.", "Got caught in a web of lies... and death.", "Learned that Bunker Spiders don't do piggybacks.", "Tried to outweb a Bunker Spider.", "Thought web design was easy.", "Discovered the Bunker Spider's sticky situation.", "Played peek-a-boo with a Bunker Spider.", "Mistook a Bunker Spider for a cuddly pet.", "Learned that Bunker Spider silk isn't for knitting.", "Got tangled in a deadly game of cat's cradle." }, 
				AdvancedCauseOfDeath.Enemy_Thumper => new string[10] { "Was ravaged by a Thumper.", "Got thumped by a Thumper.", "Learned that Thumpers don't play drums.", "Tried to thump a Thumper.", "Thought 'Thumper' was a dance move.", "Played patty-cake with a Thumper.", "Discovered the Thumper's seismic activity.", "Mistook a Thumper for a friendly bunny.", "Learned that Thumpers don't do high-fives.", "Felt the Thumper's ground-shaking greeting." }, 
				AdvancedCauseOfDeath.Enemy_MaskedPlayer_Wear => new string[10] { "Nobody cared who they were until they put on the Mask.", "Donned the Mask.", "Learned the Mask comes with strings attached.", "Found out the Mask wasn't just for show.", "Wore the Mask, couldn't handle the role.", "Discovered the Mask's fatal charm.", "Tried to live a double life with the Mask.", "Put on the Mask and exited stage left forever.", "The Mask brought the curtains down on them.", "The Mask's embrace was a tad too tight." }, 
				AdvancedCauseOfDeath.Enemy_MaskedPlayer_Victim => new string[10] { "Became a tragedy at the hands of the Mask.", "Was killed by a Masked coworker.", "Caught in the Mask's lethal performance.", "Fell victim to the Mask's deadly allure.", "Crossed paths with the Mask, and it was curtains.", "Unmasked the Mask's deadly secret.", "Learned that the Mask doesn't play favorites.", "Was the final act in the Mask's play.", "Tried to unmask a killer. It didn't go well.", "Found out the Mask was no mere prop." }, 
				AdvancedCauseOfDeath.Enemy_Nutcracker_Kicked => new string[10] { "Got their nuts cracked by a Nutcracker.", "Was kicked to death by a Nutcracker.", "Learned that Nutcrackers have a mean kick.", "Got a Nutcracker's footloose finale.", "Discovered that Nutcrackers don't dance ballet.", "Played soccer with a Nutcracker. Scored an own goal.", "Thought Nutcrackers only cracked nuts. Was wrong.", "Received the Nutcracker's signature move.", "Had a cracking good time, in the worst way.", "Tested the Nutcracker's kick. It passed." }, 
				AdvancedCauseOfDeath.Enemy_Nutcracker_Shot => new string[10] { "Was at the wrong end of a 21-gun salute.", "Got shot by a Nutcracker.", "Learned that Nutcrackers are sharpshooters.", "Caught a Nutcracker's bullet with their teeth.", "Faced the Nutcracker's firing squad.", "Discovered that Nutcrackers have perfect aim.", "Got a front-row seat to the Nutcracker's gun show.", "Tried to dodge a Nutcracker's bullet. Tried.", "Learned that Nutcrackers don't shoot blanks.", "Was the target of the Nutcracker's wrath." }, 
				AdvancedCauseOfDeath.Player_Jetpack_Gravity => new string[10] { "Flew too close to the sun.", "Ran out of fuel.", "Misjudged their jetpack's altitude limit.", "Tried to touch the sky, kissed the ground instead.", "Found out that what goes up doesn't always come down gently.", "Learned that jetpacks and gravity don't mix.", "Took a nosedive into the law of gravity.", "Ignored their jetpack's low fuel warning.", "Tried to outfly gravity. Gravity won.", "Jetpacked straight into an unexpected landing." }, 
				AdvancedCauseOfDeath.Player_Jetpack_Blast => new string[10] { "Turned into a firework.", "Got blown up by bad piloting.", "Flew high, then went out with a bang.", "Learned that jetpacks can be volatile.", "Took a jetpack joyride to a fiery end.", "Ignited a jetpack-fueled explosion.", "Had a blast-off that turned into a blast.", "Learned to fly, then learned to explode.", "Thought jetpack flame was just for show.", "Missed the jetpack's user manual page on explosions." }, 
				AdvancedCauseOfDeath.Player_Murder_Melee => new string[10] { "Was the victim of a murder.", "Got murdered.", "Was bludgeoned to death by a coworker.", "Felt the final hit of workplace violence.", "Discovered the deadly side of office politics.", "Learned that some coworkers are cutthroat, literally.", "Was on the receiving end of a killer punchline.", "Found out that the pen can be mightier than the sword.", "Took team building exercises to a fatal level.", "Learned that 'backstabber' is sometimes literal." }, 
				AdvancedCauseOfDeath.Player_Murder_Shotgun => new string[10] { "Was the victim of a murder.", "Got murdered.", "Was shot to death by a coworker.", "Learned that shotguns are not for conflict resolution.", "Was at the business end of office politics.", "Discovered that some meetings are final.", "Faced the ultimate 'you're fired' scenario.", "Found out the conference room was a kill zone.", "Took a shotgun shell seminar.", "Received a lethal lesson in shotgun diplomacy." }, 
				AdvancedCauseOfDeath.Player_Quicksand => new string[10] { "Got stuck in quicksand.", "Drowned in quicksand", "Couldn't outpace the quicksand.", "Found out that quicksand isn't a spa treatment.", "Played in the sand, stayed forever.", "Mistook quicksand for a mud bath.", "Learned that quicksand plays for keeps.", "Took a quicksand pit stop, permanently.", "Tried to quickstep over quicksand.", "Discovered that quicksand doesn't come with an escape key." }, 
				AdvancedCauseOfDeath.Player_StunGrenade => new string[10] { "Was the victim of a murder.", "Got a shocking end from a stun grenade.", "Learned that stun grenades can be stunningly lethal.", "Was shocked into the hereafter.", "Had a stunningly brief encounter with a grenade.", "Discovered the electrifying truth about stun grenades.", "Was left stunned... forever.", "Got a hair-raising, life-ending jolt.", "Found out that some shocks are final.", "Received a stunning exit cue." }, 
				AdvancedCauseOfDeath.Other_DepositItemsDesk => new string[10] { "Received a demotion.", "Was put on disciplinary leave.", "Forgot their employee ID and couldn't get their items.", "Tried to deposit a live grenade.", "Mistakenly deposited their pet hamster instead of their items.", "Got into a fight with the Deposit Items Desk attendant.", "Tripped and fell into the Deposit Items Desk conveyor belt.", "Was eaten by a Grue while waiting in line.", "Discovered that their items were already deposited in their inventory.", "Realized that they didn't actually have any items to deposit." }, 
				AdvancedCauseOfDeath.Other_Dropship => new string[10] { "Was crushed by the Item Dropship.", "Couldn't wait for their items and tried to catch the Dropship.", "Got too impatient for their items and shot down the Dropship.", "Was using the Dropship as a personal trampoline.", "Tried to ride the Dropship like a surfboard.", "Challenged the Dropship to a game of chicken.", "Forgot to get out of the way of the Dropship.", "Was distracted by a butterfly and walked into the Dropship's path.", "Was sleepwalking and wandered into the Dropship's landing zone.", "Was trying to steal the Dropship and sell it on the black market." }, 
				AdvancedCauseOfDeath.Other_Landmine => new string[10] { "Stepped on a landmine.", "Mistook a landmine for a lost contact lens.", "Thought a landmine was a new type of mushroom and tried to eat it.", "Was using a landmine as a doorstop.", "Tried to defuse a landmine with a screwdriver.", "Kicked a landmine like a soccer ball.", "Was dancing on a landmine and forgot to stop.", "Was sleepwalking and stepped on a landmine.", "Was trying to collect landmines to build a fort.", "Was using a landmine as a paperweight." }, 
				AdvancedCauseOfDeath.Other_Turret => new string[10] { "Got shot by a turret.", "Challenged a turret to a staring contest and lost.", "Tried to pet a turret.", "Thought a turret was a new type of vending machine.", "Was using a turret as a hat rack.", "Tried to dance with a turret.", "Was sleepwalking and walked into a turret's line of fire.", "Was trying to steal a turret and sell it on the black market.", "Was using a turret as a target for archery practice.", "Was trying to communicate with a turret using Morse code." }, 
				AdvancedCauseOfDeath.Other_Lightning => new string[10] { "Was struck by lightning.", "Was flying a kite in a thunderstorm.", "Was taking a bath during a lightning storm.", "Was holding a metal rod during a lightning storm.", "Was standing under a tree during a lightning storm.", "Was wearing a tinfoil hat during a lightning storm.", "Was trying to catch lightning in a bottle.", "Was using a lightning rod as a selfie stick.", "Was trying to summon Thor with a homemade lightning rod.", "Was dancing on a hilltop during a lightning storm." }, 
				_ => new string[10] { "Most sincerely dead.", "Died somehow.", "Passed away under mysterious circumstances.", "Left this world in an unspecified manner.", "Ceased living in an indeterminate fashion.", "Reached an uncertain end.", "Met their demise through unknown means.", "Expired due to reasons yet to be determined.", "Shuffled off this mortal coil in a vague way.", "Concluded their life's story with an enigmatic ellipsis." }, 
			};
		}

		internal static void SetCauseOfDeath(PlayerControllerB playerControllerB, object enemy_BaboonHawk)
		{
			throw new NotImplementedException();
		}
	}
	internal enum AdvancedCauseOfDeath
	{
		Unknown,
		Bludgeoning,
		Gravity,
		Blast,
		Strangulation,
		Suffocation,
		Mauling,
		Gunshots,
		Crushing,
		Drowning,
		Abandoned,
		Electrocution,
		Kicking,
		Enemy_BaboonHawk,
		Enemy_Bracken,
		Enemy_CircuitBees,
		Enemy_CoilHead,
		Enemy_EarthLeviathan,
		Enemy_EyelessDog,
		Enemy_ForestGiant,
		Enemy_GhostGirl,
		Enemy_Hygrodere,
		Enemy_Jester,
		Enemy_SnareFlea,
		Enemy_SporeLizard,
		Enemy_HoarderBug,
		Enemy_Thumper,
		Enemy_BunkerSpider,
		Enemy_MaskedPlayer_Wear,
		Enemy_MaskedPlayer_Victim,
		Enemy_Nutcracker_Kicked,
		Enemy_Nutcracker_Shot,
		Player_Jetpack_Gravity,
		Player_Jetpack_Blast,
		Player_Quicksand,
		Player_Murder_Melee,
		Player_Murder_Shotgun,
		Player_StunGrenade,
		Other_Landmine,
		Other_Turret,
		Other_Lightning,
		Other_DepositItemsDesk,
		Other_Dropship
	}
	internal class DeathBroadcaster
	{
		private const string SIGNATURE_DEATH = "com.anythinggoesgit.moredeathnotes.death";

		public static void Initialize()
		{
			if (Plugin.Instance.IsLCAPIPresent)
			{
				DeathBroadcasterLCAPI.Initialize();
			}
			else
			{
				Plugin.Instance.PluginLogger.LogInfo((object)"LC_API is not present! Skipping registration...");
			}
		}

		public static void BroadcastCauseOfDeath(int playerId, AdvancedCauseOfDeath causeOfDeath)
		{
			AttemptBroadcast(BuildDataCauseOfDeath(playerId, causeOfDeath), "com.anythinggoesgit.moredeathnotes.death");
		}

		private static string BuildDataCauseOfDeath(int playerId, AdvancedCauseOfDeath causeOfDeath)
		{
			string text = playerId.ToString();
			int num = (int)causeOfDeath;
			return text + "|" + num;
		}

		private static void AttemptBroadcast(string data, string signature)
		{
			if (Plugin.Instance.IsLCAPIPresent)
			{
				DeathBroadcasterLCAPI.AttemptBroadcast(data, signature);
			}
			else
			{
				Plugin.Instance.PluginLogger.LogInfo((object)"LC_API is not present! Skipping broadcast...");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "MoreDeathNotes";

		public const string PLUGIN_NAME = "MoreDeathNotes";

		public const string PLUGIN_VERSION = "1.4.0";

		public const string PLUGIN_GUID = "com.anythinggoesgit.moredeathnotes";
	}
	[BepInPlugin("com.anythinggoesgit.moredeathnotes", "MoreDeathNotes", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static readonly Random RANDOM = new Random();

		public ManualLogSource PluginLogger;

		public PluginConfig PluginConfig;

		public bool IsLCAPIPresent;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			new Harmony("com.anythinggoesgit.moredeathnotes").PatchAll();
			PluginLogger.LogInfo((object)"Plugin MoreDeathNotes (com.anythinggoesgit.moredeathnotes) is loaded!");
			LoadConfig();
			QueryLCAPI();
			DeathBroadcaster.Initialize();
		}

		private void QueryLCAPI()
		{
			PluginLogger.LogInfo((object)"Checking for LC_API...");
			if (Chainloader.PluginInfos.ContainsKey("LC_API"))
			{
				Chainloader.PluginInfos.TryGetValue("LC_API", out var value);
				if (value == null)
				{
					PluginLogger.LogError((object)"Detected LC_API, but could not get plugin info!");
					IsLCAPIPresent = false;
				}
				else
				{
					PluginLogger.LogInfo((object)("LCAPI is present! " + value.Metadata.GUID + ":" + value.Metadata.Version));
					IsLCAPIPresent = true;
				}
			}
			else
			{
				PluginLogger.LogInfo((object)"LCAPI is not present.");
				IsLCAPIPresent = false;
			}
		}

		private void LoadConfig()
		{
			PluginConfig = new PluginConfig();
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
		}
	}
	public class PluginConfig
	{
		private ConfigEntry<bool> DisplayCauseOfDeath;

		private ConfigEntry<bool> SeriousDeathMessages;

		private ConfigEntry<bool> DisplayFunnyNotes;

		private ConfigEntry<bool> DeathReplacesNotes;

		public void BindConfig(ConfigFile _config)
		{
			DisplayCauseOfDeath = _config.Bind<bool>("General", "DisplayCauseOfDeath", true, "Display the cause of death in the player notes.");
			SeriousDeathMessages = _config.Bind<bool>("General", "SeriousDeathMessages", false, "Cause of death messages are more to-the-point.");
			DisplayFunnyNotes = _config.Bind<bool>("General", "DisplayFunnyNotes", true, "Display a random note when the player has no notes.");
			DeathReplacesNotes = _config.Bind<bool>("General", "DeathReplacesNotes", true, "True to replace notes when the player dies, false to append.");
		}

		public bool ShouldDisplayCauseOfDeath()
		{
			return DisplayCauseOfDeath.Value;
		}

		public bool ShouldUseSeriousDeathMessages()
		{
			return SeriousDeathMessages.Value;
		}

		public bool ShouldDisplayFunnyNotes()
		{
			return DisplayFunnyNotes.Value;
		}

		public bool ShouldDeathReplaceNotes()
		{
			return DeathReplacesNotes.Value;
		}
	}
}
namespace Coroner.Patch
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch("KillPlayer")]
	internal class PlayerControllerBKillPlayerPatch
	{
		public static void Prefix(PlayerControllerB __instance, ref CauseOfDeath causeOfDeath)
		{
			try
			{
				if ((int)causeOfDeath == 300)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player died from item dropship! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Other_Dropship);
					causeOfDeath = (CauseOfDeath)8;
				}
				else if (__instance.isSinking && (int)causeOfDeath == 5)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player died of suffociation while sinking in quicksand! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Quicksand);
				}
				else if ((int)causeOfDeath != 3)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is dying! No cause of death registered in hook...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in PlayerControllerBKillPlayerPatch.Prefix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(DepositItemsDesk))]
	[HarmonyPatch("AnimationGrabPlayer")]
	internal class DepositItemsDeskAnimationGrabPlayerPatch
	{
		public static void Postfix(int playerID)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after tentacle devouring...");
				PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerID];
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is dying! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(playerController, AdvancedCauseOfDeath.Other_DepositItemsDesk);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in DepositItemsDeskAnimationGrabPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	[HarmonyPatch("killPlayerAnimation")]
	internal class JesterAIKillPlayerAnimationPatch
	{
		public static void Postfix(int playerId)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after Jester mauling...");
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
					return;
				}
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_Jester);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in JesterAIKillPlayerAnimationPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(SandWormAI))]
	[HarmonyPatch("EatPlayer")]
	internal class SandWormAIEatPlayerPatch
	{
		public static void Postfix(PlayerControllerB playerScript)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after Sand Worm devouring...");
				if ((Object)(object)playerScript == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
					return;
				}
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(playerScript, AdvancedCauseOfDeath.Enemy_EarthLeviathan);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in SandWormAIEatPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(RedLocustBees))]
	[HarmonyPatch("BeeKillPlayerOnLocalClient")]
	internal class RedLocustBeesBeeKillPlayerOnLocalClientPatch
	{
		public static void Postfix(int playerId)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after Circuit Bee electrocution...");
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (val.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_CircuitBees);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in RedLocustBeesBeeKillPlayerOnLocalClientPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(DressGirlAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class DressGirlAIOnCollideWithPlayerPatch
	{
		public static void Postfix(DressGirlAI __instance)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Processing Ghost Girl player collision...");
				if ((Object)(object)__instance.hauntingPlayer == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after collision!");
				}
				else if (__instance.hauntingPlayer.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(__instance.hauntingPlayer, AdvancedCauseOfDeath.Enemy_GhostGirl);
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in DressGirlAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	[HarmonyPatch("killAnimation")]
	internal class FlowermanAIKillAnimationPatch
	{
		public static void Postfix(FlowermanAI __instance)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after Bracken snapping neck...");
				if ((Object)(object)((EnemyAI)__instance).inSpecialAnimationWithPlayer == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after snapping neck!");
					return;
				}
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(((EnemyAI)__instance).inSpecialAnimationWithPlayer, AdvancedCauseOfDeath.Enemy_Bracken);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in FlowermanAIKillAnimationPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(ForestGiantAI))]
	[HarmonyPatch("EatPlayerAnimation")]
	internal class ForestGiantAIEatPlayerAnimationPatch
	{
		public static void Postfix(PlayerControllerB playerBeingEaten)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after Forest Giant devouring...");
				if ((Object)(object)playerBeingEaten == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
					return;
				}
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(playerBeingEaten, AdvancedCauseOfDeath.Enemy_ForestGiant);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in ForestGiantAIEatPlayerAnimationPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(MouthDogAI))]
	[HarmonyPatch("KillPlayer")]
	internal class MouthDogAIKillPlayerPatch
	{
		public static void Postfix(int playerId)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Accessing state after dog devouring...");
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerId];
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
					return;
				}
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_EyelessDog);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in MouthDogAIKillPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(CentipedeAI))]
	[HarmonyPatch("DamagePlayerOnIntervals")]
	internal class CentipedeAIDamagePlayerOnIntervalsPatch
	{
		public static void Postfix(CentipedeAI __instance)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Invalid comparison between Unknown and I4
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Snare Flea damage...");
				if ((Object)(object)__instance.clingingToPlayer == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player being clung to!");
				}
				else if (__instance.clingingToPlayer.isPlayerDead && (int)__instance.clingingToPlayer.causeOfDeath == 5)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(__instance.clingingToPlayer, AdvancedCauseOfDeath.Enemy_SnareFlea);
				}
				else if (__instance.clingingToPlayer.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player somehow died while attacked by Snare Flea! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in CentipedeAIDamagePlayerOnIntervalsPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(BaboonBirdAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class BaboonBirdAIOnCollideWithPlayerPatch
	{
		public static void Postfix(Collider other)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Baboon Hawk damage...");
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (component.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_BaboonHawk);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in BaboonBirdAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch("DamagePlayerFromOtherClientClientRpc")]
	internal class PlayerControllerBDamagePlayerFromOtherClientClientRpcPatch
	{
		public static void Postfix(PlayerControllerB __instance)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Invalid comparison between Unknown and I4
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Invalid comparison between Unknown and I4
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Invalid comparison between Unknown and I4
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling friendly fire damage...");
				if ((Object)(object)__instance == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access victim after death!");
				}
				else if (__instance.isPlayerDead)
				{
					if ((int)__instance.causeOfDeath == 1)
					{
						Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
						AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Murder_Melee);
					}
					else if ((int)__instance.causeOfDeath == 6)
					{
						Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
						AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Murder_Melee);
					}
					else if ((int)__instance.causeOfDeath == 7)
					{
						Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
						AdvancedDeathTracker.SetCauseOfDeath(__instance, AdvancedCauseOfDeath.Player_Murder_Shotgun);
					}
					else
					{
						Plugin.Instance.PluginLogger.LogWarning((object)("Player was killed by someone else but we don't know how! " + ((object)(CauseOfDeath)(ref __instance.causeOfDeath)).ToString()));
					}
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in PlayerControllerBDamagePlayerFromOtherClientClientRpcPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(PufferAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class PufferAIOnCollideWithPlayerPatch
	{
		public static void Postfix(Collider other)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Spore Lizard damage...");
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (component.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_SporeLizard);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in PufferAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(SpringManAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class SpringManAIOnCollideWithPlayerPatch
	{
		public static void Postfix(Collider other)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Coil Head damage...");
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (component.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_CoilHead);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in SpringManAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(BlobAI))]
	[HarmonyPatch("SlimeKillPlayerEffectServerRpc")]
	internal class BlobAISlimeKillPlayerEffectServerRpcPatch
	{
		public static void Postfix(int playerKilled)
		{
			try
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerKilled];
				if ((Object)(object)val == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (val.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(val, AdvancedCauseOfDeath.Enemy_Hygrodere);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in BlobAISlimeKillPlayerEffectServerRpcPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class HoarderBugAIOnCollideWithPlayerPatch
	{
		public static void Postfix(Collider other)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Hoarder Bug damage...");
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (component.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_HoarderBug);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in HoarderBugAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(CrawlerAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class CrawlerAIOnCollideWithPlayerPatch
	{
		public static void Postfix(Collider other)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Thumper damage...");
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (component.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_Thumper);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in CrawlerAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(SandSpiderAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class SandSpiderAIOnCollideWithPlayerPatch
	{
		public static void Postfix(Collider other)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling Bunker Spider damage...");
				PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (component.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(component, AdvancedCauseOfDeath.Enemy_BunkerSpider);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in SandSpiderAIOnCollideWithPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(NutcrackerEnemyAI))]
	[HarmonyPatch("LegKickPlayer")]
	internal class NutcrackerEnemyAILegKickPlayerPatch
	{
		public static void Postfix(int playerId)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Nutcracker kicked a player to death!");
				PlayerControllerB playerController = StartOfRound.Instance.allPlayerScripts[playerId];
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is dying! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(playerController, AdvancedCauseOfDeath.Enemy_Nutcracker_Kicked);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in NutcrackerEnemyAILegKickPlayerPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	[HarmonyPatch("ShootGun")]
	internal class ShotgunItemShootGunPatch
	{
		public static void Postfix(ShotgunItem __instance)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Invalid comparison between Unknown and I4
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Handling shotgun shot...");
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if ((Object)(object)localPlayerController == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access local player after shotgun shot!");
				}
				else if (localPlayerController.isPlayerDead && (int)localPlayerController.causeOfDeath == 7)
				{
					if (((GrabbableObject)__instance).isHeldByEnemy)
					{
						Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
						AdvancedDeathTracker.SetCauseOfDeath(localPlayerController, AdvancedCauseOfDeath.Enemy_Nutcracker_Shot);
					}
					else
					{
						Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
						AdvancedDeathTracker.SetCauseOfDeath(localPlayerController, AdvancedCauseOfDeath.Player_Murder_Shotgun);
					}
				}
				else if (localPlayerController.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)("Player died while attacked by shotgun? Skipping... " + ((object)(CauseOfDeath)(ref localPlayerController.causeOfDeath)).ToString()));
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in ShotgunItemShootGunPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(MaskedPlayerEnemy))]
	[HarmonyPatch("killAnimation")]
	internal class MaskedPlayerEnemykillAnimationPatch
	{
		public static void Postfix(MaskedPlayerEnemy __instance)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Masked Player killed someone...");
				PlayerControllerB inSpecialAnimationWithPlayer = ((EnemyAI)__instance).inSpecialAnimationWithPlayer;
				if ((Object)(object)inSpecialAnimationWithPlayer == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
					return;
				}
				Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
				AdvancedDeathTracker.SetCauseOfDeath(inSpecialAnimationWithPlayer, AdvancedCauseOfDeath.Enemy_MaskedPlayer_Victim);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in MaskedPlayerEnemykillAnimationPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(HauntedMaskItem))]
	[HarmonyPatch("FinishAttaching")]
	internal class HauntedMaskItemFinishAttachingPatch
	{
		public static void Postfix(HauntedMaskItem __instance)
		{
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Masked Player killed someone...");
				PlayerControllerB value = Traverse.Create((object)__instance).Field("previousPlayerHeldBy").GetValue<PlayerControllerB>();
				if ((Object)(object)value == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogWarning((object)"Could not access player after death!");
				}
				else if (value.isPlayerDead)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(value, AdvancedCauseOfDeath.Enemy_MaskedPlayer_Wear);
				}
				else
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is somehow still alive! Skipping...");
				}
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in HauntedMaskItemFinishAttachingPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(ExtensionLadderItem))]
	[HarmonyPatch("StartLadderAnimation")]
	internal class ExtensionLadderItemStartLadderAnimationPatch
	{
		public static void Postfix(ExtensionLadderItem __instance)
		{
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Extension ladder started animation! Modifying kill trigger...");
				GameObject gameObject = ((Component)__instance).gameObject;
				if ((Object)(object)gameObject == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch GameObject from ExtensionLadderItem.");
				}
				Transform obj = gameObject.transform.Find("AnimContainer/MeshContainer/LadderMeshContainer/BaseLadder/LadderSecondPart/KillTrigger");
				if ((Object)(object)obj == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch KillTrigger Transform from ExtensionLadderItem.");
				}
				GameObject gameObject2 = ((Component)obj).gameObject;
				if ((Object)(object)gameObject2 == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch KillTrigger GameObject from ExtensionLadderItem.");
				}
				KillLocalPlayer component = gameObject2.GetComponent<KillLocalPlayer>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch KillLocalPlayer from KillTrigger GameObject.");
				}
				component.causeOfDeath = (CauseOfDeath)8;
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in ExtensionLadderItemStartLadderAnimationPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(ItemDropship))]
	[HarmonyPatch("Start")]
	internal class ItemDropshipStartPatch
	{
		public static void Postfix(ItemDropship __instance)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Item dropship spawned! Modifying kill trigger...");
				GameObject gameObject = ((Component)__instance).gameObject;
				if ((Object)(object)gameObject == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch GameObject from ItemDropship.");
				}
				Transform obj = gameObject.transform.Find("ItemShip/KillTrigger");
				if ((Object)(object)obj == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch KillTrigger Transform from ItemDropship.");
				}
				GameObject gameObject2 = ((Component)obj).gameObject;
				if ((Object)(object)gameObject2 == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch KillTrigger GameObject from ItemDropship.");
				}
				KillLocalPlayer component = gameObject2.GetComponent<KillLocalPlayer>();
				if ((Object)(object)component == (Object)null)
				{
					Plugin.Instance.PluginLogger.LogError((object)"Could not fetch KillLocalPlayer from KillTrigger GameObject.");
				}
				component.causeOfDeath = (CauseOfDeath)300;
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in ItemDropshipStartPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}
	}
	[HarmonyPatch(typeof(Turret))]
	[HarmonyPatch("Update")]
	public class TurretUpdatePatch
	{
		public static void Postfix(Turret __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			if ((int)__instance.turretMode == 2)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				if (localPlayerController.isPlayerDead && (int)localPlayerController.causeOfDeath == 7)
				{
					Plugin.Instance.PluginLogger.LogDebug((object)"Player is now dead! Setting special cause of death...");
					AdvancedDeathTracker.SetCauseOfDeath(localPlayerController, AdvancedCauseOfDeath.Other_Turret);
				}
			}
		}
	}
	[HarmonyPatch(typeof(Landmine))]
	[HarmonyPatch("SpawnExplosion")]
	public class LandmineSpawnExplosionPatch
	{
		private const string KILL_PLAYER_SIGNATURE = "Void KillPlayer(UnityEngine.Vector3, Boolean, CauseOfDeath, Int32)";

		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase method)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			List<CodeInstruction> list2 = BuildInstructionsToInsert(method);
			if (list2 == null)
			{
				Plugin.Instance.PluginLogger.LogError((object)"Could not build instructions to insert in LandmineSpawnExplosionPatch! Safely aborting...");
				return instructions;
			}
			int num = -1;
			for (int i = 0; i < list.Count; i++)
			{
				CodeInstruction val = list[i];
				if (val.opcode == OpCodes.Callvirt && val.operand.ToString() == "Void KillPlayer(UnityEngine.Vector3, Boolean, CauseOfDeath, Int32)")
				{
					num = i;
					break;
				}
			}
			if (num == -1)
			{
				Plugin.Instance.PluginLogger.LogError((object)"Could not find PlayerControllerB.KillPlayer call in LandmineSpawnExplosionPatch! Safely aborting...");
				return instructions;
			}
			Plugin.Instance.PluginLogger.LogInfo((object)"Injecting patch into Landmine.SpawnExplosion...");
			list.InsertRange(num, list2);
			Plugin.Instance.PluginLogger.LogInfo((object)"Done.");
			return list;
		}

		private static List<CodeInstruction> BuildInstructionsToInsert(MethodBase method)
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>();
			int num = 2;
			IList<LocalVariableInfo> localVariables = method.GetMethodBody().LocalVariables;
			LocalVariableInfo localVariableInfo = null;
			for (int i = 0; i < localVariables.Count; i++)
			{
				LocalVariableInfo localVariableInfo2 = localVariables[i];
				if (localVariableInfo2.LocalType == typeof(PlayerControllerB))
				{
					if (localVariableInfo != null)
					{
						Plugin.Instance.PluginLogger.LogError((object)"Found multiple PlayerControllerB local variables in LandmineSpawnExplosionPatch!");
						return null;
					}
					localVariableInfo = localVariableInfo2;
					break;
				}
			}
			list.Add(new CodeInstruction(OpCodes.Ldloc_S, (object)localVariableInfo.LocalIndex));
			list.Add(new CodeInstruction(OpCodes.Ldarg, (object)num));
			list.Add(new CodeInstruction(OpCodes.Call, (object)typeof(LandmineSpawnExplosionPatch).GetMethod("RewriteCauseOfDeath")));
			return list;
		}

		public static void RewriteCauseOfDeath(PlayerControllerB targetPlayer, float killRange)
		{
			AdvancedCauseOfDeath causeOfDeath = AdvancedCauseOfDeath.Blast;
			if (killRange == 5f)
			{
				causeOfDeath = AdvancedCauseOfDeath.Player_Jetpack_Blast;
			}
			else if (killRange == 5.7f)
			{
				causeOfDeath = AdvancedCauseOfDeath.Other_Landmine;
			}
			else if (killRange == 2.4f)
			{
				causeOfDeath = AdvancedCauseOfDeath.Other_Lightning;
			}
			AdvancedDeathTracker.SetCauseOfDeath(targetPlayer, causeOfDeath);
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	[HarmonyPatch("FillEndGameStats")]
	internal class HUDManagerFillEndGameStatsPatch
	{
		public static void Postfix(HUDManager __instance)
		{
			try
			{
				OverridePerformanceReport(__instance);
			}
			catch (Exception ex)
			{
				Plugin.Instance.PluginLogger.LogError((object)("Error in HUDManagerFillEndGameStatsPatch.Postfix: " + ex));
				Plugin.Instance.PluginLogger.LogError((object)ex.StackTrace);
			}
		}

		private static Random BuildSyncedRandom(HUDManager __instance)
		{
			int randomMapSeed = StartOfRound.Instance.randomMapSeed;
			Plugin.Instance.PluginLogger.LogDebug((object)("Syncing randomization to map seed: '" + randomMapSeed + "'"));
			return new Random(randomMapSeed);
		}

		private static void OverridePerformanceReport(HUDManager __instance)
		{
			Plugin.Instance.PluginLogger.LogDebug((object)"Applying Coroner patches to player notes...");
			Random random = BuildSyncedRandom(__instance);
			for (int i = 0; i < __instance.statsUIElements.playerNotesText.Length; i++)
			{
				PlayerControllerB val = __instance.playersManager.allPlayerScripts[i];
				if (!val.disconnectedMidGame && !val.isPlayerDead && !val.isPlayerControlled)
				{
					Plugin.Instance.PluginLogger.LogInfo((object)("Player " + i + " is not controlled by a player. Skipping..."));
					continue;
				}
				TextMeshProUGUI val2 = __instance.statsUIElements.playerNotesText[i];
				if (val.isPlayerDead)
				{
					if (Plugin.Instance.PluginConfig.ShouldDisplayCauseOfDeath())
					{
						if (Plugin.Instance.PluginConfig.ShouldDeathReplaceNotes())
						{
							Plugin.Instance.PluginLogger.LogInfo((object)("[REPORT] Player " + i + " is dead! Replacing notes with Cause of Death..."));
							((TMP_Text)val2).text = "Cause of Death: \n";
						}
						else
						{
							Plugin.Instance.PluginLogger.LogInfo((object)("[REPORT] Player " + i + " is dead! Appending notes with Cause of Death..."));
						}
						AdvancedCauseOfDeath causeOfDeath = AdvancedDeathTracker.GetCauseOfDeath(val);
						string text = "* " + AdvancedDeathTracker.StringifyCauseOfDeath(causeOfDeath, random) + "\n";
						((TMP_Text)val2).text = ((TMP_Text)val2).text + text;
					}
					else
					{
						Plugin.Instance.PluginLogger.LogInfo((object)("[REPORT] Player " + i + " is dead, but Config says leave it be..."));
					}
				}
				else if (Plugin.Instance.PluginConfig.ShouldDisplayFunnyNotes())
				{
					Plugin.Instance.PluginLogger.LogInfo((object)("[REPORT] Player " + i + " has no notes! Injecting something funny..."));
					string text2 = "* " + AdvancedDeathTracker.StringifyCauseOfDeath(null, random) + "\n";
					((TMP_Text)val2).text = ((TMP_Text)val2).text + text2;
					((TMP_Text)val2).text = "Notes: \n";
					((TMP_Text)val2).text = ((TMP_Text)val2).text + text2;
				}
				else
				{
					Plugin.Instance.PluginLogger.LogInfo((object)("[REPORT] Player " + i + " has no notes, but Config says leave it be..."));
				}
			}
			AdvancedDeathTracker.ClearDeathTracker();
		}
	}
}
namespace Coroner.LCAPI
{
	internal class DeathBroadcasterLCAPI
	{
		private const string SIGNATURE_DEATH = "com.anythinggoesgit.moredeathnotes.death";

		public static void Initialize()
		{
			Plugin.Instance.PluginLogger.LogDebug((object)"Initializing DeathBroadcaster...");
			if (Plugin.Instance.IsLCAPIPresent)
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"LC_API is present! Registering signature...");
				Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, new Action<string, string>(OnBroadcastString));
			}
			else
			{
				Plugin.Instance.PluginLogger.LogError((object)"LC_API is not present! Why did you try to register the DeathBroadcaster?");
			}
		}

		private static void OnBroadcastString(string data, string signature)
		{
			if (signature == "com.anythinggoesgit.moredeathnotes.death")
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"Broadcast has been received from LC_API!");
				string[] array = data.Split('|');
				int playerIndex = int.Parse(array[0]);
				AdvancedCauseOfDeath advancedCauseOfDeath = (AdvancedCauseOfDeath)int.Parse(array[1]);
				Plugin.Instance.PluginLogger.LogDebug((object)("Player " + playerIndex + " died of " + AdvancedDeathTracker.StringifyCauseOfDeath((AdvancedCauseOfDeath?)advancedCauseOfDeath)));
				AdvancedDeathTracker.SetCauseOfDeath(playerIndex, advancedCauseOfDeath, broadcast: false);
			}
		}

		public static void AttemptBroadcast(string data, string signature)
		{
			if (Plugin.Instance.IsLCAPIPresent)
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"LC_API is present! Broadcasting...");
				Networking.Broadcast(data, signature);
			}
			else
			{
				Plugin.Instance.PluginLogger.LogDebug((object)"LC_API is not present! Skipping broadcast...");
			}
		}
	}
}