Decompiled source of BulletsDieWithYou v1.0.0

BulletsDieWithYou.dll

Decompiled a month 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(8, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(/*Could not decode attribute arguments.*/)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("Systems.R00t.BulletsDie", "Bullets Die With You", "1.0.0")]
[BepInProcess("Rounds.exe")]
[HarmonyPatch]
public class Patch : BaseUnityPlugin
{
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class StoreShotBullets : Object
	{
		public static Dictionary<Player, List<GameObject>> Bullets = new Dictionary<Player, List<GameObject>>();

		public static void Prefix(Gun __instance, GameObject bullet)
		{
			if (!Bullets.ContainsKey(__instance.player))
			{
				Bullets[__instance.player] = new List<GameObject>();
			}
			Bullets[__instance.player].Add(bullet);
		}
	}

	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public class ResegterKillBullets : Object
	{
		public static void Prefix(PlayerManager __instance)
		{
			__instance.AddPlayerDiedAction((Action<Player, int>)KillBullets);
		}
	}

	private const string ModId = "Systems.R00t.BulletsDie";

	private const string ModName = "Bullets Die With You";

	public const string Version = "1.0.0";

	private void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("Systems.R00t.BulletsDie").PatchAll();
	}

	public static void KillBullets(Player player, int deadCount)
	{
		if (!StoreShotBullets.Bullets.ContainsKey(player))
		{
			return;
		}
		int count = StoreShotBullets.Bullets[player].Count;
		for (int i = 0; i < count; i++)
		{
			if ((Object)(object)StoreShotBullets.Bullets[player][i] != (Object)null)
			{
				PhotonNetwork.Destroy(StoreShotBullets.Bullets[player][i]);
			}
		}
		StoreShotBullets.Bullets[player].Clear();
	}
}