Decompiled source of KillIndicatorFix v0.1.6

KillIndicatorFix.dll

Decompiled 4 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using API;
using Agents;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Enemies;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using KillIndicatorFix.BepInEx;
using KillIndicatorFix.Patches;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
using UnityEngine.Analytics;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("KillIndicatorFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a713a64d1323e013d952ed587cc3e798e9167afe")]
[assembly: AssemblyProduct("KillIndicatorFix")]
[assembly: AssemblyTitle("KillIndicatorFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
internal static class BitHelper
{
	public const int SizeOfHalf = 2;

	public const int SizeOfVector3 = 12;

	public const int SizeOfQuaternion = 13;

	public const int SizeOfHalfVector3 = 6;

	public const int SizeOfHalfQuaternion = 7;

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static uint RotateLeft(uint value, int offset)
	{
		return (value << offset) | (value >> 32 - offset);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static uint RotateRight(uint value, int offset)
	{
		return (value >> offset) | (value << 32 - offset);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static long ReverseEndianness(long value)
	{
		return (long)ReverseEndianness((ulong)value);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static int ReverseEndianness(int value)
	{
		return (int)ReverseEndianness((uint)value);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static short ReverseEndianness(short value)
	{
		return (short)ReverseEndianness((ushort)value);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static ushort ReverseEndianness(ushort value)
	{
		return (ushort)((value >> 8) + (value << 8));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static uint ReverseEndianness(uint value)
	{
		return RotateRight(value & 0xFF00FFu, 8) + RotateLeft(value & 0xFF00FF00u, 8);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private static ulong ReverseEndianness(ulong value)
	{
		return ((ulong)ReverseEndianness((uint)value) << 32) + ReverseEndianness((uint)(value >> 32));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private unsafe static void _WriteBytes(byte* source, int size, byte[] destination, ref int index)
	{
		int num = 0;
		while (num < size)
		{
			destination[index++] = source[num++];
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(byte value, byte[] destination, ref int index)
	{
		destination[index++] = value;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(bool value, byte[] destination, ref int index)
	{
		destination[index++] = (value ? ((byte)1) : ((byte)0));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(ulong value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 8, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(uint value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 4, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(ushort value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 2, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(long value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 8, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(int value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 4, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(short value, byte[] destination, ref int index)
	{
		if (!BitConverter.IsLittleEndian)
		{
			value = ReverseEndianness(value);
		}
		_WriteBytes((byte*)(&value), 2, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static void WriteBytes(float value, byte[] destination, ref int index)
	{
		int value2 = *(int*)(&value);
		if (!BitConverter.IsLittleEndian)
		{
			value2 = ReverseEndianness(value2);
		}
		_WriteBytes((byte*)(&value2), 4, destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(string value, byte[] destination, ref int index)
	{
		byte[] bytes = Encoding.UTF8.GetBytes(value);
		WriteBytes((ushort)bytes.Length, destination, ref index);
		Array.Copy(bytes, 0, destination, index, bytes.Length);
		index += bytes.Length;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(byte[] buffer, byte[] destination, ref int index)
	{
		WriteBytes((ushort)buffer.Length, destination, ref index);
		Array.Copy(buffer, 0, destination, index, buffer.Length);
		index += buffer.Length;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteHalf(float value, byte[] destination, ref int index)
	{
		WriteBytes(FloatToHalf(value), destination, ref index);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private unsafe static uint AsUInt(float x)
	{
		return *(uint*)(&x);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	private unsafe static float AsFloat(uint x)
	{
		return *(float*)(&x);
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static float HalfToFloat(ushort x)
	{
		int num = (x & 0x7C00) >> 10;
		int num2 = (x & 0x3FF) << 13;
		int num3 = (int)(AsUInt(num2) >> 23);
		return AsFloat((uint)(((x & 0x8000) << 16) | (Convert.ToInt32(num != 0) * ((num + 112 << 23) | num2)) | ((Convert.ToInt32(num == 0) & Convert.ToInt32(num2 != 0)) * ((num3 - 37 << 23) | ((num2 << 150 - num3) & 0x7FE000)))));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static ushort FloatToHalf(float x)
	{
		uint num = AsUInt(x) + 4096;
		uint num2 = (num & 0x7F800000) >> 23;
		uint num3 = num & 0x7FFFFFu;
		return (ushort)(((num & 0x80000000u) >> 16) | (Convert.ToInt32(num2 > 112) * (((num2 - 112 << 10) & 0x7C00) | (num3 >> 13))) | ((Convert.ToInt32(num2 < 113) & Convert.ToInt32(num2 > 101)) * ((8384512 + num3 >> (int)(125 - num2)) + 1 >> 1)) | (Convert.ToUInt32(num2 > 143) * 32767));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static byte ReadByte(byte[] source, ref int index)
	{
		return source[index++];
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static bool ReadBool(byte[] source, ref int index)
	{
		return source[index++] != 0;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static ulong ReadULong(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* num = ptr + index;
			index += 8;
			ulong num2 = *(ulong*)num;
			if (!BitConverter.IsLittleEndian)
			{
				num2 = ReverseEndianness(num2);
			}
			return num2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static long ReadLong(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* num = ptr + index;
			index += 8;
			long num2 = *(long*)num;
			if (!BitConverter.IsLittleEndian)
			{
				num2 = ReverseEndianness(num2);
			}
			return num2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static uint ReadUInt(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* num = ptr + index;
			index += 4;
			uint num2 = *(uint*)num;
			if (!BitConverter.IsLittleEndian)
			{
				num2 = ReverseEndianness(num2);
			}
			return num2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static int ReadInt(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* num = ptr + index;
			index += 4;
			int num2 = *(int*)num;
			if (!BitConverter.IsLittleEndian)
			{
				num2 = ReverseEndianness(num2);
			}
			return num2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static ushort ReadUShort(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* num = ptr + index;
			index += 2;
			ushort num2 = *(ushort*)num;
			if (!BitConverter.IsLittleEndian)
			{
				num2 = ReverseEndianness(num2);
			}
			return num2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static short ReadShort(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* num = ptr + index;
			index += 2;
			short num2 = *(short*)num;
			if (!BitConverter.IsLittleEndian)
			{
				num2 = ReverseEndianness(num2);
			}
			return num2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static float ReadHalf(byte[] source, ref int index)
	{
		return HalfToFloat(ReadUShort(source, ref index));
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public unsafe static float ReadFloat(byte[] source, ref int index)
	{
		fixed (byte* ptr = source)
		{
			byte* ptr2 = ptr + index;
			index += 4;
			if (!BitConverter.IsLittleEndian)
			{
				int num = ReverseEndianness(*(int*)ptr2);
				return *(float*)(&num);
			}
			return *(float*)ptr2;
		}
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static string ReadString(byte[] source, ref int index)
	{
		int num = ReadUShort(source, ref index);
		string @string = Encoding.UTF8.GetString(source, index, num);
		index += num;
		return @string;
	}

	[MethodImpl(MethodImplOptions.AggressiveInlining)]
	public static void WriteBytes(Vector3 value, byte[] destination, ref int index)
	{
		//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
		WriteBytes(value.x, destination, ref index);
		WriteBytes(value.y, destination, ref index);
		WriteBytes(value.z, destination, ref index);
	}

	public static void WriteBytes(Quaternion value, byte[] destination, ref int index)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		float num = value.x;
		byte b = 0;
		if (value.y > num)
		{
			num = value.y;
			b = 1;
		}
		if (value.z > num)
		{
			num = value.z;
			b = 2;
		}
		if (value.w > num)
		{
			num = value.w;
			b = 3;
		}
		WriteBytes(b, destination, ref index);
		switch (b)
		{
		case 0:
			if (value.x >= 0f)
			{
				WriteBytes(value.y, destination, ref index);
				WriteBytes(value.z, destination, ref index);
				WriteBytes(value.w, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.y, destination, ref index);
				WriteBytes(0f - value.z, destination, ref index);
				WriteBytes(0f - value.w, destination, ref index);
			}
			break;
		case 1:
			if (value.y >= 0f)
			{
				WriteBytes(value.x, destination, ref index);
				WriteBytes(value.z, destination, ref index);
				WriteBytes(value.w, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.x, destination, ref index);
				WriteBytes(0f - value.z, destination, ref index);
				WriteBytes(0f - value.w, destination, ref index);
			}
			break;
		case 2:
			if (value.z >= 0f)
			{
				WriteBytes(value.x, destination, ref index);
				WriteBytes(value.y, destination, ref index);
				WriteBytes(value.w, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.x, destination, ref index);
				WriteBytes(0f - value.y, destination, ref index);
				WriteBytes(0f - value.w, destination, ref index);
			}
			break;
		case 3:
			if (value.w >= 0f)
			{
				WriteBytes(value.x, destination, ref index);
				WriteBytes(value.y, destination, ref index);
				WriteBytes(value.z, destination, ref index);
			}
			else
			{
				WriteBytes(0f - value.x, destination, ref index);
				WriteBytes(0f - value.y, destination, ref index);
				WriteBytes(0f - value.z, destination, ref index);
			}
			break;
		}
	}

	public static Vector3 ReadVector3(byte[] source, ref int index)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(ReadFloat(source, ref index), ReadFloat(source, ref index), ReadFloat(source, ref index));
	}

	public static Quaternion ReadQuaternion(byte[] source, ref int index)
	{
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		byte b = ReadByte(source, ref index);
		float num = 0f;
		float num2 = 0f;
		float num3 = 0f;
		float num4 = 0f;
		switch (b)
		{
		case 0:
			num2 = ReadFloat(source, ref index);
			num3 = ReadFloat(source, ref index);
			num4 = ReadFloat(source, ref index);
			num = Mathf.Sqrt(1f - num2 * num2 - num3 * num3 - num4 * num4);
			break;
		case 1:
			num = ReadFloat(source, ref index);
			num3 = ReadFloat(source, ref index);
			num4 = ReadFloat(source, ref index);
			num2 = Mathf.Sqrt(1f - num * num - num3 * num3 - num4 * num4);
			break;
		case 2:
			num = ReadFloat(source, ref index);
			num2 = ReadFloat(source, ref index);
			num4 = ReadFloat(source, ref index);
			num3 = Mathf.Sqrt(1f - num * num - num2 * num2 - num4 * num4);
			break;
		case 3:
			num = ReadFloat(source, ref index);
			num2 = ReadFloat(source, ref index);
			num3 = ReadFloat(source, ref index);
			num4 = Mathf.Sqrt(1f - num * num - num2 * num2 - num3 * num3);
			break;
		}
		return new Quaternion(num, num2, num3, num4);
	}

	public static void WriteHalf(Vector3 value, byte[] destination, ref int index)
	{
		//IL_0000: 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_001a: Unknown result type (might be due to invalid IL or missing references)
		WriteHalf(value.x, destination, ref index);
		WriteHalf(value.y, destination, ref index);
		WriteHalf(value.z, destination, ref index);
	}

	public static void WriteHalf(Quaternion value, byte[] destination, ref int index)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0161: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		float num = value.x;
		byte b = 0;
		if (value.y > num)
		{
			num = value.y;
			b = 1;
		}
		if (value.z > num)
		{
			num = value.z;
			b = 2;
		}
		if (value.w > num)
		{
			num = value.w;
			b = 3;
		}
		WriteBytes(b, destination, ref index);
		switch (b)
		{
		case 0:
			if (value.x >= 0f)
			{
				WriteHalf(value.y, destination, ref index);
				WriteHalf(value.z, destination, ref index);
				WriteHalf(value.w, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.y, destination, ref index);
				WriteHalf(0f - value.z, destination, ref index);
				WriteHalf(0f - value.w, destination, ref index);
			}
			break;
		case 1:
			if (value.y >= 0f)
			{
				WriteHalf(value.x, destination, ref index);
				WriteHalf(value.z, destination, ref index);
				WriteHalf(value.w, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.x, destination, ref index);
				WriteHalf(0f - value.z, destination, ref index);
				WriteHalf(0f - value.w, destination, ref index);
			}
			break;
		case 2:
			if (value.z >= 0f)
			{
				WriteHalf(value.x, destination, ref index);
				WriteHalf(value.y, destination, ref index);
				WriteHalf(value.w, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.x, destination, ref index);
				WriteHalf(0f - value.y, destination, ref index);
				WriteHalf(0f - value.w, destination, ref index);
			}
			break;
		case 3:
			if (value.w >= 0f)
			{
				WriteHalf(value.x, destination, ref index);
				WriteHalf(value.y, destination, ref index);
				WriteHalf(value.z, destination, ref index);
			}
			else
			{
				WriteHalf(0f - value.x, destination, ref index);
				WriteHalf(0f - value.y, destination, ref index);
				WriteHalf(0f - value.z, destination, ref index);
			}
			break;
		}
	}

	public static Vector3 ReadHalfVector3(byte[] source, ref int index)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		return new Vector3(ReadHalf(source, ref index), ReadHalf(source, ref index), ReadHalf(source, ref index));
	}

	public static Quaternion ReadHalfQuaternion(byte[] source, ref int index)
	{
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		byte b = ReadByte(source, ref index);
		float num = 0f;
		float num2 = 0f;
		float num3 = 0f;
		float num4 = 0f;
		switch (b)
		{
		case 0:
			num2 = ReadHalf(source, ref index);
			num3 = ReadHalf(source, ref index);
			num4 = ReadHalf(source, ref index);
			num = Mathf.Sqrt(1f - num2 * num2 - num3 * num3 - num4 * num4);
			break;
		case 1:
			num = ReadHalf(source, ref index);
			num3 = ReadHalf(source, ref index);
			num4 = ReadHalf(source, ref index);
			num2 = Mathf.Sqrt(1f - num * num - num3 * num3 - num4 * num4);
			break;
		case 2:
			num = ReadHalf(source, ref index);
			num2 = ReadHalf(source, ref index);
			num4 = ReadHalf(source, ref index);
			num3 = Mathf.Sqrt(1f - num * num - num2 * num2 - num4 * num4);
			break;
		case 3:
			num = ReadHalf(source, ref index);
			num2 = ReadHalf(source, ref index);
			num3 = ReadHalf(source, ref index);
			num4 = Mathf.Sqrt(1f - num * num - num2 * num2 - num3 * num3);
			break;
		}
		return new Quaternion(num, num2, num3, num4);
	}
}
namespace API
{
	internal static class APILogger
	{
		private static readonly ManualLogSource logger;

		static APILogger()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Expected O, but got Unknown
			logger = new ManualLogSource("Rand-API");
			Logger.Sources.Add((ILogSource)(object)logger);
		}

		private static string Format(string module, object msg)
		{
			return $"[{module}]: {msg}";
		}

		public static void Info(string module, object data)
		{
			logger.LogMessage((object)Format(module, data));
		}

		public static void Verbose(string module, object data)
		{
		}

		public static void Log(object data)
		{
			logger.LogDebug((object)Format("KillIndicatorFix", data));
		}

		public static void Debug(object data)
		{
			if (ConfigManager.Debug)
			{
				Log(data);
			}
		}

		public static void Warn(object data)
		{
			logger.LogWarning((object)Format("KillIndicatorFix", data));
		}

		public static void Error(object data)
		{
			logger.LogError((object)Format("KillIndicatorFix", data));
		}
	}
}
namespace KillIndicatorFix
{
	internal static class Utils
	{
		public const BindingFlags AnyBindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
	}
	public static class Kill
	{
		public static Action<EnemyAgent, ItemEquippable, long>? OnKillIndicator;

		private static void RegisterMethods(Type t)
		{
			foreach (MethodInfo item in from m in t.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)
				where m.GetCustomAttribute<OnKillIndicator>() != null
				select m)
			{
				if (item.IsStatic)
				{
					try
					{
						string value = "OnKillIndicator";
						if (item.GetCustomAttribute<OnKillIndicator>() != null)
						{
							value = "OnKillIndicator";
							OnKillIndicator = (Action<EnemyAgent, ItemEquippable, long>)Delegate.Combine(OnKillIndicator, (Action<EnemyAgent, ItemEquippable, long>)item.CreateDelegate(typeof(Action<EnemyAgent, ItemEquippable, long>)));
						}
						APILogger.Debug($"Registered {value}: '{t.FullName}.{item.Name}'");
					}
					catch (Exception value2)
					{
						APILogger.Error($"Failed to register method: {value2}");
					}
				}
				else
				{
					APILogger.Error($"KillIndicatorFix attributes can only be applied to static methods. '{item}' is not static.");
				}
			}
		}

		public static void RegisterAll()
		{
			Type[] types = Assembly.GetCallingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				RegisterMethods(types[i]);
			}
		}

		public static void RegisterAll(Type type)
		{
			Type[] nestedTypes = type.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			foreach (Type obj in nestedTypes)
			{
				RegisterMethods(obj);
				RegisterAll(obj);
			}
		}

		internal static void TriggerOnKillIndicator(EnemyAgent enemy, ItemEquippable item, long delay)
		{
			try
			{
				OnKillIndicator?.Invoke(enemy, item, delay);
			}
			catch (Exception value)
			{
				APILogger.Error($"TriggerOnKillIndicator: {value}");
			}
		}

		public static void TagEnemy(EnemyAgent enemy, ItemEquippable? item = null, Vector3? localHitPosition = null)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			int instanceID = ((Object)enemy).GetInstanceID();
			long timestamp = ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
			if (!localHitPosition.HasValue)
			{
				localHitPosition = ((!KillIndicatorFix.Patches.Kill.taggedEnemies.ContainsKey(instanceID)) ? new Vector3?(((Agent)enemy).EyePosition - ((Component)enemy).transform.position) : new Vector3?(KillIndicatorFix.Patches.Kill.taggedEnemies[instanceID].localHitPosition));
			}
			if ((Object)(object)item == (Object)null)
			{
				item = PlayerManager.GetLocalPlayerAgent().Inventory.WieldedItem;
			}
			KillIndicatorFix.Patches.Kill.Tag value = new KillIndicatorFix.Patches.Kill.Tag(timestamp, localHitPosition.Value, item);
			if (KillIndicatorFix.Patches.Kill.taggedEnemies.ContainsKey(instanceID))
			{
				KillIndicatorFix.Patches.Kill.taggedEnemies[instanceID] = value;
			}
			else
			{
				KillIndicatorFix.Patches.Kill.taggedEnemies.Add(instanceID, value);
			}
		}
	}
	[AttributeUsage(AttributeTargets.Method)]
	public class OnKillIndicator : Attribute
	{
	}
}
namespace KillIndicatorFix.Patches
{
	[HarmonyPatch(typeof(GameDataInit))]
	internal class GameDataInit_Patches
	{
		[HarmonyPatch("Initialize")]
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		public static void Initialize_Postfix()
		{
			Analytics.enabled = false;
		}
	}
	[HarmonyPatch]
	internal static class Kill
	{
		public struct Tag
		{
			public long timestamp;

			public Vector3 localHitPosition;

			public ItemEquippable item;

			public Tag(long timestamp, Vector3 localHitPosition, ItemEquippable item)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				this.timestamp = timestamp;
				this.localHitPosition = localHitPosition;
				this.item = item;
			}
		}

		public static Dictionary<int, Tag> taggedEnemies = new Dictionary<int, Tag>();

		internal static bool sentryShot = false;

		public static void OnRundownStart()
		{
			APILogger.Debug("OnRundownStart => Reset Trackers and Markers.");
			taggedEnemies.Clear();
		}

		[HarmonyPatch(typeof(EnemyBehaviour), "ChangeState", new Type[] { typeof(EB_States) })]
		[HarmonyPrefix]
		public static void OnDead(EnemyBehaviour __instance, EB_States state)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: 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_0014: Invalid comparison between Unknown and I4
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			if (SNet.IsMaster || __instance.m_currentStateName == state || (int)state != 19)
			{
				return;
			}
			APILogger.Debug("EnemyAppearance.OnDead");
			try
			{
				EnemyAgent enemyAgent = __instance.m_ai.m_enemyAgent;
				int instanceID = ((Object)enemyAgent).GetInstanceID();
				long num = ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
				if (!taggedEnemies.ContainsKey(instanceID))
				{
					return;
				}
				Tag tag = taggedEnemies[instanceID];
				if (tag.timestamp <= num)
				{
					APILogger.Debug($"Received kill update {num - tag.timestamp} milliseconds after tag.");
				}
				else
				{
					APILogger.Debug("Received kill update for enemy that was tagged in the future? Possibly long overflow...");
				}
				if (tag.timestamp <= num && num - tag.timestamp < ConfigManager.TagBufferPeriod)
				{
					if (!enemyAgent.Damage.DeathIndicatorShown)
					{
						APILogger.Debug("Client side marker was not shown, showing server side one.");
						KillIndicatorFix.Kill.TriggerOnKillIndicator(enemyAgent, tag.item, num - tag.timestamp);
						CrosshairGuiLayer crosshairLayer = GuiManager.CrosshairLayer;
						if (crosshairLayer != null)
						{
							crosshairLayer.ShowDeathIndicator(((Component)enemyAgent).transform.position + tag.localHitPosition);
						}
						enemyAgent.Damage.DeathIndicatorShown = true;
					}
					else
					{
						APILogger.Debug("Client side marker was shown, not showing server side one.");
					}
				}
				else
				{
					APILogger.Debug("Client was no longer interested in this enemy, marker will not be shown.");
				}
				taggedEnemies.Remove(instanceID);
			}
			catch
			{
				APILogger.Debug("Something went wrong.");
			}
		}

		[HarmonyPatch(typeof(SentryGunInstance_Firing_Bullets), "FireBullet")]
		[HarmonyPrefix]
		private static void Prefix_SentryGunFiringBullet(SentryGunInstance_Firing_Bullets __instance, bool doDamage, bool targetIsTagged)
		{
			if (doDamage)
			{
				sentryShot = true;
			}
		}

		[HarmonyPatch(typeof(SentryGunInstance_Firing_Bullets), "FireBullet")]
		[HarmonyPostfix]
		private static void Postfix_SentryGunFiringBullet()
		{
			sentryShot = false;
		}

		[HarmonyPatch(typeof(SentryGunInstance_Firing_Bullets), "UpdateFireShotgunSemi")]
		[HarmonyPrefix]
		private static void Prefix_ShotgunSentryFiring(SentryGunInstance_Firing_Bullets __instance, bool isMaster, bool targetIsTagged)
		{
			if (isMaster)
			{
				sentryShot = true;
			}
		}

		[HarmonyPatch(typeof(SentryGunInstance_Firing_Bullets), "UpdateFireShotgunSemi")]
		[HarmonyPostfix]
		private static void Postfix_ShotgunSentryFiring()
		{
			sentryShot = false;
		}

		[HarmonyPatch(typeof(Dam_EnemyDamageLimb), "BulletDamage")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		public static void EnemyLimb_BulletDamage(Dam_EnemyDamageLimb __instance, float dam, Agent sourceAgent, Vector3 position, Vector3 direction, Vector3 normal, bool allowDirectionalBonus, float staggerMulti, float precisionMulti)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			if (!SNet.IsMaster || !sentryShot)
			{
				return;
			}
			PlayerAgent val = ((Il2CppObjectBase)sourceAgent).TryCast<PlayerAgent>();
			if ((Object)(object)val == (Object)null)
			{
				APILogger.Debug($"Could not find PlayerAgent, damage was done by agent of type: {sourceAgent.m_type}.");
			}
			else if (!val.Owner.IsBot && !sourceAgent.IsLocallyOwned)
			{
				Dam_EnemyDamageBase @base = __instance.m_base;
				EnemyAgent owner = @base.Owner;
				float num = dam;
				if (!@base.IsImortal)
				{
					num = __instance.ApplyWeakspotAndArmorModifiers(dam, precisionMulti);
					num = __instance.ApplyDamageFromBehindBonus(num, position, direction, 1f);
					bool willDie = ((Dam_SyncedDamageBase)@base).WillDamageKill(num);
					Network.SendHitIndicator((Agent)(object)owner, (byte)__instance.m_limbID, val, num > dam, willDie, position, __instance.m_armorDamageMulti < 1f);
				}
				else
				{
					Network.SendHitIndicator((Agent)(object)owner, (byte)__instance.m_limbID, val, num > dam, willDie: false, position, hitArmor: true);
				}
			}
		}

		[HarmonyPatch(typeof(Dam_PlayerDamageBase), "ReceiveBulletDamage")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		public static void Player_BulletDamage(Dam_PlayerDamageBase __instance, pBulletDamageData data)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			Agent val = default(Agent);
			if (!SNet.IsMaster || !((pAgent)(ref data.source)).TryGet(ref val) || !sentryShot)
			{
				return;
			}
			PlayerAgent val2 = ((Il2CppObjectBase)val).TryCast<PlayerAgent>();
			if ((Object)(object)val2 == (Object)null)
			{
				APILogger.Debug($"Could not find PlayerAgent, damage was done by agent of type: {val.m_type}.");
			}
			else if (!val2.Owner.IsBot && !val.IsLocallyOwned)
			{
				PlayerAgent owner = __instance.Owner;
				if ((Object)(object)owner != (Object)(object)val2)
				{
					Network.SendHitIndicator((Agent)(object)owner, 0, val2, hitWeakspot: false, willDie: false, Vector3.zero);
				}
			}
		}

		[HarmonyPatch(typeof(Dam_EnemyDamageBase), "BulletDamage")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		public static void BulletDamage(Dam_EnemyDamageBase __instance, float dam, Agent sourceAgent, Vector3 position, Vector3 direction, bool allowDirectionalBonus, int limbID, float precisionMulti)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (SNet.IsMaster)
			{
				return;
			}
			PlayerAgent val = ((Il2CppObjectBase)sourceAgent).TryCast<PlayerAgent>();
			if ((Object)(object)val == (Object)null)
			{
				APILogger.Debug($"Could not find PlayerAgent, damage was done by agent of type: {sourceAgent.m_type}.");
			}
			else if (!val.Owner.IsBot)
			{
				EnemyAgent owner = __instance.Owner;
				int instanceID = ((Object)owner).GetInstanceID();
				long timestamp = ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
				float num = AgentModifierManager.ApplyModifier((Agent)(object)owner, (AgentModifier)7, Mathf.Clamp(dam, 0f, ((Dam_SyncedDamageBase)__instance).HealthMax));
				((Dam_SyncedDamageBase)__instance).Health = ((Dam_SyncedDamageBase)__instance).Health - num;
				Vector3 localHitPosition = position - ((Component)owner).transform.position;
				Tag value = new Tag(timestamp, localHitPosition, val.Inventory.WieldedItem);
				if (taggedEnemies.ContainsKey(instanceID))
				{
					taggedEnemies[instanceID] = value;
				}
				else
				{
					taggedEnemies.Add(instanceID, value);
				}
				APILogger.Debug($"{num} Bullet Damage done by {val.PlayerName}. IsBot: {val.Owner.IsBot}");
				APILogger.Debug($"Tracked current HP: {((Dam_SyncedDamageBase)__instance).Health}, [{((Object)owner).GetInstanceID()}]");
			}
		}

		[HarmonyPatch(typeof(Dam_EnemyDamageBase), "MeleeDamage")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		public static void MeleeDamage(Dam_EnemyDamageBase __instance, float dam, Agent sourceAgent, Vector3 position, Vector3 direction, int limbID, float staggerMulti, float precisionMulti, float sleeperMulti, bool skipLimbDestruction, DamageNoiseLevel damageNoiseLevel)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			if (SNet.IsMaster)
			{
				return;
			}
			PlayerAgent val = ((Il2CppObjectBase)sourceAgent).TryCast<PlayerAgent>();
			if ((Object)(object)val == (Object)null)
			{
				APILogger.Debug($"Could not find PlayerAgent, damage was done by agent of type: {sourceAgent.m_type}.");
			}
			else if (!val.Owner.IsBot)
			{
				EnemyAgent owner = __instance.Owner;
				int instanceID = ((Object)owner).GetInstanceID();
				long timestamp = ((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
				float num = AgentModifierManager.ApplyModifier((Agent)(object)owner, (AgentModifier)6, Mathf.Clamp(dam, 0f, ((Dam_SyncedDamageBase)__instance).DamageMax));
				if ((int)__instance.Owner.Locomotion.CurrentStateEnum == 14)
				{
					num *= sleeperMulti;
				}
				((Dam_SyncedDamageBase)__instance).Health = ((Dam_SyncedDamageBase)__instance).Health - num;
				Vector3 localHitPosition = position - ((Component)owner).transform.position;
				Tag value = new Tag(timestamp, localHitPosition, val.Inventory.WieldedItem);
				if (taggedEnemies.ContainsKey(instanceID))
				{
					taggedEnemies[instanceID] = value;
				}
				else
				{
					taggedEnemies.Add(instanceID, value);
				}
				APILogger.Debug($"Melee Damage: {num}");
				APILogger.Debug($"Tracked current HP: {((Dam_SyncedDamageBase)__instance).Health}, [{((Object)owner).GetInstanceID()}]");
			}
		}

		[HarmonyPatch(typeof(Dam_EnemyDamageLimb), "ShowHitIndicator")]
		[HarmonyPrefix]
		public static void ShowDeathIndicator(Dam_EnemyDamageLimb __instance, bool hitWeakspot, bool willDie, Vector3 position, bool hitArmor)
		{
			EnemyAgent owner = __instance.m_base.Owner;
			((Object)owner).GetInstanceID();
			((DateTimeOffset)DateTime.Now).ToUnixTimeMilliseconds();
			if (willDie && !__instance.m_base.DeathIndicatorShown)
			{
				PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
				ItemEquippable item = localPlayerAgent.Inventory.WieldedItem;
				BackpackItem val = default(BackpackItem);
				if (sentryShot && PlayerBackpackManager.TryGetItem(localPlayerAgent.Owner, (InventorySlot)3, ref val))
				{
					item = ((Il2CppObjectBase)val.Instance).Cast<ItemEquippable>();
				}
				KillIndicatorFix.Kill.TriggerOnKillIndicator(owner, item, 0L);
			}
		}
	}
	[HarmonyPatch]
	internal static class Network
	{
		private static byte msgtype = 173;

		private static uint magickey = 10992881u;

		private static ushort repKey = 65531;

		public static void SendHitIndicator(Agent target, byte limbID, PlayerAgent player, bool hitWeakspot, bool willDie, Vector3 position, bool hitArmor = false)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			if (SNet.IsMaster && !((Object)(object)player == (Object)(object)PlayerManager.GetLocalPlayerAgent()) && !player.Owner.IsBot)
			{
				SNet_ChannelType val = (SNet_ChannelType)0;
				SNet_SendGroup val2 = default(SNet_SendGroup);
				SNet_SendQuality val3 = default(SNet_SendQuality);
				int num = default(int);
				SNet.GetSendSettings(ref val, ref val2, ref val3, ref num);
				List<SNet_Player> val4 = new List<SNet_Player>(1);
				val4.Add(player.Owner);
				int index = 0;
				byte[] array = new byte[23];
				BitHelper.WriteBytes(repKey, array, ref index);
				BitHelper.WriteBytes(magickey, array, ref index);
				BitHelper.WriteBytes(msgtype, array, ref index);
				BitHelper.WriteBytes(12, array, ref index);
				BitHelper.WriteBytes((ushort)(target.m_replicator.Key + 1), array, ref index);
				BitHelper.WriteBytes(limbID, array, ref index);
				BitHelper.WriteBytes(hitWeakspot, array, ref index);
				BitHelper.WriteBytes(willDie, array, ref index);
				BitHelper.WriteHalf(position, array, ref index);
				BitHelper.WriteBytes(hitArmor, array, ref index);
				SNet.Core.SendBytes(Il2CppStructArray<byte>.op_Implicit(array), val3, num, val4);
				APILogger.Debug("Sent hit marker to " + player.PlayerName);
			}
		}

		[HarmonyPatch(typeof(SNet_Replication), "RecieveBytes")]
		[HarmonyWrapSafe]
		[HarmonyPrefix]
		private static bool RecieveBytes_Prefix(Il2CppStructArray<byte> bytes, uint size, ulong messagerID)
		{
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			if (size < 12)
			{
				return true;
			}
			ushort num = BitConverter.ToUInt16(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)bytes), 0);
			if (repKey == num)
			{
				if (BitConverter.ToUInt32(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)bytes), 2) != magickey)
				{
					APILogger.Debug("[Networking] Magic key is incorrect.");
					return true;
				}
				byte b = ((Il2CppArrayBase<byte>)(object)bytes)[6];
				if (b != msgtype)
				{
					APILogger.Debug($"[Networking] msg type is incorrect. {b} {msgtype}");
					return true;
				}
				int num2 = BitConverter.ToInt32(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)bytes), 7);
				byte[] array = new byte[num2];
				Array.Copy(Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)bytes), 11, array, 0, num2);
				int index = 0;
				ushort keyPlusOne = BitHelper.ReadUShort(array, ref index);
				byte b2 = BitHelper.ReadByte(array, ref index);
				bool flag = BitHelper.ReadBool(array, ref index);
				bool flag2 = BitHelper.ReadBool(array, ref index);
				Vector3 val = BitHelper.ReadHalfVector3(array, ref index);
				bool flag3 = BitHelper.ReadBool(array, ref index);
				pReplicator pRep = default(pReplicator);
				pRep.keyPlusOne = keyPlusOne;
				pAgent val2 = default(pAgent);
				val2.pRep = pRep;
				Agent val3 = default(Agent);
				((pAgent)(ref val2)).TryGet(ref val3);
				EnemyAgent val4 = ((Il2CppObjectBase)val3).TryCast<EnemyAgent>();
				if ((Object)(object)val4 != (Object)null)
				{
					APILogger.Debug("Received hit indicator for enemy.");
					Dam_EnemyDamageLimb obj = ((Il2CppArrayBase<Dam_EnemyDamageLimb>)(object)val4.Damage.DamageLimbs)[(int)b2];
					Kill.sentryShot = true;
					obj.ShowHitIndicator(flag, flag2, val, flag3);
					Kill.sentryShot = false;
					return false;
				}
				if ((Object)(object)((Il2CppObjectBase)val3).TryCast<PlayerAgent>() != (Object)null)
				{
					APILogger.Debug("Received hit indicator for player.");
					GuiManager.CrosshairLayer.PopFriendlyTarget();
					return false;
				}
				APILogger.Debug("Received hit indicator packet but could not get player / enemy agent. This should not happen.");
				return false;
			}
			return true;
		}
	}
}
namespace KillIndicatorFix.BepInEx
{
	public static class ConfigManager
	{
		private static ConfigEntry<bool> debug;

		private static ConfigEntry<int> tagBufferPeriod;

		public static bool Debug => debug.Value;

		public static int TagBufferPeriod => tagBufferPeriod.Value;

		static ConfigManager()
		{
			//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)
			ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "KillIndicatorFix.cfg"), true);
			debug = val.Bind<bool>("Debug", "enable", false, "Enables debug messages when true.");
			tagBufferPeriod = val.Bind<int>("Settings", "TagBufferPeriod", 1000, "Indicates a lee-way period in milliseconds where a kill indicator will still be shown for a given enemy long after it has been tagged (shot at).");
		}
	}
	[BepInPlugin("randomuserhi.KillIndicatorFix", "KillIndicatorFix", "0.1.4")]
	internal class Entry : BasePlugin
	{
		private Harmony? harmony;

		public override void Load()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			APILogger.Debug("Loaded KillIndicatorFix 0.1.4");
			harmony = new Harmony("randomuserhi.KillIndicatorFix");
			harmony.PatchAll();
			APILogger.Debug("Debug is " + (ConfigManager.Debug ? "Enabled" : "Disabled"));
			RundownManager.OnExpeditionGameplayStarted += Action.op_Implicit((Action)KillIndicatorFix.Patches.Kill.OnRundownStart);
		}
	}
	public static class Module
	{
		public const string GUID = "randomuserhi.KillIndicatorFix";

		public const string Name = "KillIndicatorFix";

		public const string Version = "0.1.4";
	}
}