using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DeathConfetti")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DeathConfetti")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("518c375d-c486-4208-b523-d06b0ad69787")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DeathConfetti;
[BepInPlugin("K.DeathConfetti", "Death Confetti", "1.0.0.0")]
public class DeathConfettiPlugin : BaseUnityPlugin
{
public const string modGUID = "K.DeathConfetti";
public const string modName = "Death Confetti";
public const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("K.DeathConfetti");
private void Awake()
{
ManualLogSource val = Logger.CreateLogSource("K.DeathConfetti");
val.LogMessage((object)"K.DeathConfetti has loaded succesfully.");
harmony.PatchAll(typeof(DeathConfettiPatch));
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("KillPlayerClientRpc")]
internal class DeathConfettiPatch
{
public static GameObject eggPrefab;
[HarmonyPatch(typeof(Terminal), "Start")]
[HarmonyPostfix]
private static void Init()
{
eggPrefab = StartOfRound.Instance.allItemsList.itemsList[0].spawnPrefab;
for (int i = 0; i < StartOfRound.Instance.allItemsList.itemsList.Count; i++)
{
if (((Object)StartOfRound.Instance.allItemsList.itemsList[i]).name == "EasterEgg")
{
eggPrefab = StartOfRound.Instance.allItemsList.itemsList[i].spawnPrefab;
break;
}
}
}
[HarmonyPostfix]
private static void Postfix(ref PlayerControllerB __instance)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = __instance.thisPlayerBody.position;
GameObject val = Object.Instantiate<GameObject>(eggPrefab, position, Quaternion.identity);
StunGrenadeItem component = val.GetComponent<StunGrenadeItem>();
Transform val2 = ((!((GrabbableObject)component).isInElevator) ? RoundManager.Instance.mapPropsContainer.transform : StartOfRound.Instance.elevatorTransform);
Object.Instantiate<GameObject>(component.stunGrenadeExplosion, val.transform.position, Quaternion.identity, val2);
component.itemAudio.PlayOneShot(component.explodeSFX);
WalkieTalkie.TransmitOneShotAudio(component.itemAudio, component.explodeSFX, 1f);
((GrabbableObject)component).DestroyObjectInHand((PlayerControllerB)null);
}
}