using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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;
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Poppycars.TBVP.Id", "TargetBounceVisionPatch", "1.0.0")]
[BepInProcess("Rounds.exe")]
public class main : BaseUnityPlugin
{
internal static string modInitials = "TBVP";
internal static BaseUnityPlugin Friend = null;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("com.Poppycars.TBVP.Id");
val.PatchAll();
}
private void Start()
{
Friend = Chainloader.Plugins.First((BaseUnityPlugin plugin) => plugin.Info.Metadata.GUID == "pykess.rounds.plugins.togglefriendlyfire");
}
}
namespace TBVP.Patches
{
[Serializable]
[HarmonyPatch(typeof(BounceEffectRetarget), "FindTarget")]
internal class TargetBouncePatch
{
private static bool Prefix(BounceEffectRetarget __instance, ref Player __result, HitInfo hit)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
__result = null;
Vector2 val = Vector2.op_Implicit(((Component)__instance).transform.position) + hit.normal * 0.1f;
List<Player> list = PlayerManager.instance.players;
Player ownPlayer = ((Component)__instance).gameObject.GetComponentInParent<ProjectileHit>().ownPlayer;
float num = float.PositiveInfinity;
if ((Object)(object)main.Friend != (Object)null)
{
if ((bool)((object)main.Friend).GetType().GetField("disableSelfDamage", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null))
{
list = list.Where((Player player) => player.playerID != ownPlayer.playerID).ToList();
}
if ((bool)((object)main.Friend).GetType().GetField("disableFriendlyFire", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null))
{
list = list.Where((Player player) => player.teamID != ownPlayer.teamID || player.playerID == ownPlayer.playerID).ToList();
}
}
for (int i = 0; i < list.Count; i++)
{
if (!list[i].data.dead)
{
float num2 = Vector2.Distance(val, list[i].data.playerVel.position);
if (PlayerManager.instance.CanSeePlayer(val, list[i]).canSee && num2 < num)
{
num = num2;
__result = list[i];
}
}
}
return false;
}
}
}