Decompiled source of Gator Bounty v1.0.1

GatorBounty.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Bloodstone.API;
using Bloody.Core;
using Bloody.Core.API.v1;
using Bloody.Core.GameData.v1;
using Bloody.Core.Helper.v1;
using Bloody.Core.Methods;
using Bloody.Core.Models.v1;
using Bloody.Core.Models.v1.Base;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Gameplay.Clan;
using ProjectM.Network;
using ProjectM.Scripting;
using ProjectM.Terrain;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using UnityEngine;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GatorBounty")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Gator's Bounty Mod for VRising")]
[assembly: AssemblyFileVersion("0.1.10.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e")]
[assembly: AssemblyProduct("GatorBounty")]
[assembly: AssemblyTitle("GatorBounty")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.10.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;
		}
	}
}
internal static class ECSExtensions
{
	internal static void With<T>(this Entity entity, ActionRef<T> action) where T : struct
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		T val = entity.RW<T>();
		action.Invoke(ref val);
		EntityManager entityManager = VWorld.Game.EntityManager;
		((EntityManager)(ref entityManager)).SetComponentData<T>(entity, val);
	}

	internal static bool Has<T>(this Entity entity) where T : struct
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		int num = TypeIndex.op_Implicit(TypeManager.GetTypeIndex(Il2CppType.Of<T>()));
		EntityManager entityManager = VWorld.Game.EntityManager;
		return ((EntityManager)(ref entityManager)).HasComponentRaw(entity, TypeIndex.op_Implicit(num));
	}

	internal static bool Has<T>(this Entity entity, out T value) where T : struct
	{
		//IL_0001: 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)
		if (entity.Has<T>())
		{
			value = entity.Read<T>();
			return true;
		}
		value = default(T);
		return false;
	}

	internal unsafe static T RW<T>(this Entity entity) where T : struct
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		int num = TypeIndex.op_Implicit(TypeManager.GetTypeIndex(Il2CppType.Of<T>()));
		EntityManager entityManager = VWorld.Game.EntityManager;
		T* componentDataRawRW = (T*)((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, TypeIndex.op_Implicit(num));
		if (componentDataRawRW == null)
		{
			throw new InvalidOperationException($"Failure to access ReadWrite <{typeof(T).Name}> typeIndex({num}) on entity({entity}).");
		}
		return *componentDataRawRW;
	}

	internal unsafe static T Read<T>(this Entity entity) where T : struct
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		int num = TypeIndex.op_Implicit(TypeManager.GetTypeIndex(Il2CppType.Of<T>()));
		EntityManager entityManager = VWorld.Game.EntityManager;
		T* componentDataRawRO = (T*)((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, TypeIndex.op_Implicit(num));
		if (componentDataRawRO == null)
		{
			throw new InvalidOperationException($"Failure to access ReadOnly <{typeof(T).Name}> typeIndex({num}) on entity({entity}).");
		}
		return *componentDataRawRO;
	}
}
namespace GatorBounty
{
	public class Commands
	{
		[Command("gatorbounty list", "gb list", null, null, null, false)]
		public void bountyListCommand(ChatCommandContext ctx)
		{
			int num = 10;
			int num2 = 5;
			DataStore.PlayerStatistics[] array = (from k in DataStore.PlayerDatas.Values
				where k.CurrentStreak >= 7
				orderby k.CurrentStreak descending
				select k).ToArray();
			DataStore.PlayerBounty[] array2 = DataStore.PlayerBounties.Values.OrderByDescending((DataStore.PlayerBounty b) => b.bountyPrice).ToArray();
			List<BountyList> list = new List<BountyList>();
			List<BountyList> list2 = new List<BountyList>();
			for (int i = 0; i < array.Length; i++)
			{
				list.Add(new BountyList(array[i].SteamId, array[i].LastName, array[i].CurrentStreak, 0));
			}
			for (int j = 0; j < array2.Length; j++)
			{
				list2.Add(new BountyList(array2[j].SteamId, array2[j].LastName, 0, array2[j].bountyPrice));
			}
			BountyList[] array3 = (from p in list.Concat(list2)
				group p by p.SteamId into g
				select new BountyList(g.Key, g.First().LastName, g.Sum((BountyList p) => p.CurrentStreak), g.Sum((BountyList p) => p.BountyPrice)) into g
				orderby g.CurrentStreak * int.Parse(Settings.bountyKillValue) + g.BountyPrice descending
				select g).ToArray();
			num2 = ((num2 > array3.Length) ? array3.Length : num2);
			num = ((num > array3.Length) ? array3.Length : num);
			StringBuilder stringBuilder = new StringBuilder();
			StringBuilder stringBuilder2 = stringBuilder;
			StringBuilder stringBuilder3 = stringBuilder2;
			StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(55, 1, stringBuilder2);
			handler.AppendFormatted(Markup.Prefix);
			handler.AppendLiteral(" <size=18><color=blue><u>Bounty List</u></color></size>");
			stringBuilder3.AppendLine(ref handler);
			Func<BountyList, string> func = (BountyList k) => $"{Markup.Highlight(k.LastName)} \t<color={"#dda"}> Price: {k.CurrentStreak * 50 + k.BountyPrice}</color>";
			for (int l = 0; l < array3.Length; l += 5)
			{
				StringBuilder stringBuilder4 = new StringBuilder();
				stringBuilder4.AppendLine(" ");
				for (int m = l; m < l + 5 && m < array3.Length; m++)
				{
					BountyList arg = array3[m];
					stringBuilder2 = stringBuilder4;
					StringBuilder stringBuilder5 = stringBuilder2;
					handler = new StringBuilder.AppendInterpolatedStringHandler(2, 2, stringBuilder2);
					handler.AppendFormatted(m + 1);
					handler.AppendLiteral(". ");
					handler.AppendFormatted(func(arg));
					stringBuilder5.AppendLine(ref handler);
				}
				ctx.Reply(stringBuilder4.ToString());
			}
		}

		[Command("gatorbounty add", "gb add", null, null, null, false)]
		public static void bountyAddCommand(ChatCommandContext ctx, string playerName, int amount)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			UserModel userByCharacterName = GameData.Users.GetUserByCharacterName(playerName);
			Users users = GameData.Users;
			User user = ctx.User;
			UserModel userByCharacterName2 = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
			if (userByCharacterName == null)
			{
				Plugin.Logger.LogDebug((object)"Player was not found");
				ctx.Reply("Player does not exist.");
			}
			else if (amount < int.Parse(Settings.bountyAnnounceValueReward))
			{
				ctx.Reply("Bounty value must be atleast " + Settings.bountyAnnounceValueReward);
			}
			else
			{
				int num = DataStore.handleBountyAddition(userByCharacterName2, userByCharacterName, amount);
				if (num == -1)
				{
					ctx.Reply("You don't have enough " + Settings.bountyCurrencyName + "!");
				}
			}
			int bounty = DataStore.getBounty(userByCharacterName.PlatformId);
			if (bounty >= int.Parse(Settings.bountyMapValueReward))
			{
				VampireDownedHook.AddIcon(((EntityModel)userByCharacterName).Entity);
			}
		}

		[Command("gatorbounty remove", "gb remove", null, null, null, true)]
		public static void bountyRemoveIcons(ChatCommandContext ctx)
		{
			VampireDownedHook.RemoveAllIcons();
		}
	}
	public class BountyList
	{
		public ulong SteamId;

		public string LastName;

		public int CurrentStreak;

		public int BountyPrice;

		public BountyList(ulong SteamId, string LastName, int CurrentStreak, int bountyPrice)
		{
			this.SteamId = SteamId;
			this.LastName = LastName;
			this.CurrentStreak = CurrentStreak;
			BountyPrice = bountyPrice;
		}

		public int getTotalBounty()
		{
			int num = CurrentStreak * int.Parse(Settings.bountyKillValue);
			return num + BountyPrice;
		}
	}
	internal static class Core
	{
		private static MonoBehaviour monoBehaviour;

		public static bool hasInitialized;

		public static World Server { get; } = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?");


		public static EntityManager EntityManager { get; } = Server.EntityManager;


		public static ChunkObjectManager ChunkObjectManager { get; } = Server.GetExistingSystemManaged<ChunkObjectManager>();


		public static PrefabCollectionSystem PrefabCollection { get; } = Server.GetExistingSystemManaged<PrefabCollectionSystem>();


		public static ServerGameSettingsSystem ServerGameSettingsSystem { get; internal set; }

		public static ServerScriptMapper ServerScriptMapper { get; internal set; }

		public static ServerGameManager ServerGameManager => ServerScriptMapper.GetServerGameManager();

		public static double ServerTime => ServerGameManager.ServerTime;

		public static void LogException(Exception e, [CallerMemberName] string caller = null)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 5, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failure in ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(caller);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nMessage: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Inner:");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.Message);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n\nStack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace);
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nInner Stack: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.StackTrace);
			}
			logger.LogError(val);
		}

		public static void Initialize()
		{
			if (!hasInitialized)
			{
				ServerGameSettingsSystem = Server.GetExistingSystemManaged<ServerGameSettingsSystem>();
				ServerScriptMapper = Server.GetExistingSystemManaged<ServerScriptMapper>();
				string text = Dns.GetHostAddresses(Dns.GetHostName()).FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString();
				Plugin.Logger.LogError((object)("Server IP: " + text));
				Plugin.Logger.LogInfo((object)"GatorBounty initialized");
				hasInitialized = true;
			}
		}

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					return current;
				}
			}
			return null;
		}
	}
	public class DataStore
	{
		public record struct PlayerStatistics(ulong SteamId, string LastName, int Kills, int Deaths, int CurrentStreak, int HighestStreak, string LastClanName, int CurrentLevel, int MaxLevel)
		{
			public string FormattedName
			{
				get
				{
					string text = Markup.Highlight(LastName);
					return text ?? "";
				}
			}

			private static string SafeCSVName(string s)
			{
				return s.Replace(",", "");
			}

			public string ToCsv()
			{
				return $"{SteamId},{SafeCSVName(LastName)},{Kills},{Deaths},{CurrentStreak},{HighestStreak},{SafeCSVName(LastClanName)},{CurrentLevel},{MaxLevel}";
			}

			public static PlayerStatistics Parse(string csv)
			{
				string[] array = csv.Split(',');
				PlayerStatistics result = default(PlayerStatistics);
				result.SteamId = ulong.Parse(array[0]);
				result.LastName = array[1];
				result.Kills = int.Parse(array[2]);
				result.Deaths = int.Parse(array[3]);
				result.CurrentStreak = int.Parse(array[4]);
				result.HighestStreak = int.Parse(array[5]);
				result.LastClanName = ((array.Length > 6) ? array[6] : "");
				result.CurrentLevel = ((array.Length > 7) ? int.Parse(array[7]) : (-1));
				result.MaxLevel = ((array.Length > 8) ? int.Parse(array[8]) : (-1));
				return result;
			}
		}

		public record struct PlayerBounty(ulong SteamId, string LastName, int bountyPrice)
		{
			public string FormattedNameBounty
			{
				get
				{
					string text = Markup.Highlight(LastName);
					return text ?? "";
				}
			}

			private static string SafeCSVNameBounty(string s)
			{
				return s.Replace(",", "");
			}

			public string ToCsv()
			{
				return $"{SteamId},{SafeCSVNameBounty(LastName)},{bountyPrice}";
			}

			public static PlayerBounty Parse(string csv)
			{
				string[] array = csv.Split(',');
				PlayerBounty result = default(PlayerBounty);
				result.SteamId = ulong.Parse(array[0]);
				result.LastName = array[1];
				result.bountyPrice = int.Parse(array[2]);
				return result;
			}
		}

		public static int lostStreakBounty;

		public static Dictionary<ulong, PlayerBounty> PlayerBounties = new Dictionary<ulong, PlayerBounty>();

		public static Dictionary<ulong, PlayerStatistics> PlayerDatas = new Dictionary<ulong, PlayerStatistics>();

		private const string STATS_FILE_NAME = "stats.v1.csv";

		private const string STATS_FILE_PATH = "BepInEx/config/Killfeed/stats.v1.csv";

		private const string BOUNTY_FILE_NAME = "bounty.v1.csv";

		private const string BOUNTY_FILE_PATH = "BepInEx/config/GatorBounty/bounty.v1.csv";

		public static void WriteToDisk()
		{
			string directoryName = Path.GetDirectoryName("BepInEx/config/GatorBounty/bounty.v1.csv");
			if (!Directory.Exists(directoryName))
			{
				Directory.CreateDirectory(directoryName);
			}
			using StreamWriter streamWriter = new StreamWriter("BepInEx/config/GatorBounty/bounty.v1.csv", append: false);
			foreach (PlayerBounty value in PlayerBounties.Values)
			{
				streamWriter.WriteLine(value.ToCsv());
			}
		}

		public static void LoadFromDisk()
		{
			LoadPlayerBountyData();
			LoadPlayerData();
		}

		private static void LoadPlayerBountyData()
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			if (!File.Exists("BepInEx/config/GatorBounty/bounty.v1.csv"))
			{
				return;
			}
			using StreamReader streamReader = new StreamReader("BepInEx/config/GatorBounty/bounty.v1.csv");
			bool flag = default(bool);
			while (!streamReader.EndOfStream)
			{
				string text = streamReader.ReadLine();
				if (string.IsNullOrWhiteSpace(text))
				{
					continue;
				}
				try
				{
					PlayerBounty playerBounty = PlayerBounty.Parse(text);
					if (PlayerBounties.TryGetValue(playerBounty.SteamId, out var value))
					{
						ManualLogSource logger = Plugin.Logger;
						BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(54, 2, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Duplicate player bounty data found, overwriting ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<PlayerBounty>(value);
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" with ");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<PlayerBounty>(playerBounty);
						}
						logger.LogWarning(val);
					}
					PlayerBounties[playerBounty.SteamId] = playerBounty;
				}
				catch (Exception)
				{
					ManualLogSource logger2 = Plugin.Logger;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to parse player bounty line: \"");
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\"");
					}
					logger2.LogError(val2);
				}
			}
		}

		private static void LoadPlayerData()
		{
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			if (!File.Exists("BepInEx/config/Killfeed/stats.v1.csv"))
			{
				return;
			}
			using StreamReader streamReader = new StreamReader("BepInEx/config/Killfeed/stats.v1.csv");
			bool flag = default(bool);
			while (!streamReader.EndOfStream)
			{
				string text = streamReader.ReadLine();
				if (string.IsNullOrWhiteSpace(text))
				{
					continue;
				}
				try
				{
					PlayerStatistics value = PlayerStatistics.Parse(text);
					PlayerDatas[value.SteamId] = value;
				}
				catch (Exception)
				{
					ManualLogSource logger = Plugin.Logger;
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to parse player line: \"");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\"");
					}
					logger.LogError(val);
				}
			}
		}

		public static int handleBountyAddition(UserModel user, UserModel player, int bountyPrice)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0035: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			User val = ((EntityModel)player).Entity.Read<User>();
			searchTotalPrefabsInInventory(user, new PrefabGUID(int.Parse(Settings.bountyCurrency)), out var total);
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(0, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(total);
			}
			logger.LogError(val2);
			if (total >= bountyPrice)
			{
				getPrefabFromInventory(user, new PrefabGUID(int.Parse(Settings.bountyCurrency)), bountyPrice);
				PlayerBounty bounty = UpsertName(val.PlatformId, ((object)(FixedString64Bytes)(ref val.CharacterName)).ToString(), bountyPrice);
				AnnounceBounty(bounty);
				WriteToDisk();
				return 0;
			}
			return -1;
			static PlayerBounty UpsertName(ulong steamID, string name, int bountyPrice)
			{
				if (PlayerBounties.TryGetValue(steamID, out var value))
				{
					value.SteamId = steamID;
					value.LastName = name;
					value.bountyPrice += bountyPrice;
					PlayerBounties[steamID] = value;
				}
				else
				{
					PlayerBounties[steamID] = new PlayerBounty
					{
						SteamId = steamID,
						LastName = name,
						bountyPrice = bountyPrice
					};
				}
				return PlayerBounties[steamID];
			}
		}

		public static void DeleteLineFromBountyFile(ulong steamId)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Expected O, but got Unknown
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			bool flag = default(bool);
			if (!File.Exists("BepInEx/config/GatorBounty/bounty.v1.csv"))
			{
				ManualLogSource logger = Plugin.Logger;
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Bounty file not found: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BepInEx/config/GatorBounty/bounty.v1.csv");
				}
				logger.LogError(val);
				return;
			}
			List<string> list = File.ReadAllLines("BepInEx/config/GatorBounty/bounty.v1.csv").ToList();
			string text = list.FirstOrDefault(delegate(string line)
			{
				string[] array = line.Split(',');
				ulong result;
				return array.Length != 0 && ulong.TryParse(array[0], out result) && result == steamId;
			});
			if (text != null)
			{
				list.Remove(text);
				ManualLogSource logger2 = Plugin.Logger;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Removed line: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text);
				}
				logger2.LogInfo(val2);
				File.WriteAllLines("BepInEx/config/GatorBounty/bounty.v1.csv", list);
				ManualLogSource logger3 = Plugin.Logger;
				val2 = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Updated file written to: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("BepInEx/config/GatorBounty/bounty.v1.csv");
				}
				logger3.LogInfo(val2);
			}
			else
			{
				ManualLogSource logger4 = Plugin.Logger;
				BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("No line found with SteamId: ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<ulong>(steamId);
				}
				logger4.LogWarning(val3);
			}
		}

		public static void handleBountyDeath(User player)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			PlayerDatas.TryGetValue(player.PlatformId, out var value);
			lostStreakBounty = value.CurrentStreak;
			DeleteLineFromBountyFile(player.PlatformId);
			PlayerBounties.Remove(player.PlatformId);
			LoadFromDisk();
		}

		private static void AnnounceBounty(PlayerBounty bounty)
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			if (Settings.AnnounceBounty)
			{
				string formattedNameBounty = bounty.FormattedNameBounty;
				string text = $"Someone has put a bounty of <color=red>{bounty.bountyPrice} {Settings.bountyCurrencyName}</color> on <color=white>{formattedNameBounty}'s</color> head!";
				ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, Markup.Prefix + text);
			}
		}

		public static int getStreak(ulong steamId)
		{
			if (PlayerDatas.TryGetValue(steamId, out var value))
			{
				return value.CurrentStreak;
			}
			return 0;
		}

		public static int getBounty(ulong steamId)
		{
			if (PlayerBounties.TryGetValue(steamId, out var value))
			{
				return value.bountyPrice;
			}
			return 0;
		}

		public static bool searchTotalPrefabsInInventory(UserModel player, PrefabGUID prefabCurrencyGUID, out int total)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			total = 0;
			try
			{
				Entity entity = player.Character.Entity;
				total = InventoryUtilities.GetItemAmount(Core.EntityManager, entity, prefabCurrencyGUID, default(Nullable_Unboxed<int>));
				if (total >= 0)
				{
					return true;
				}
				return false;
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(7, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				logger.LogError(val);
				return false;
			}
		}

		public static bool getPrefabFromInventory(UserModel player, PrefabGUID prefabGUID, int quantity)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			//IL_0007: 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_0019: 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)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ItemModel prefabById = GameData.Items.GetPrefabById(prefabGUID);
				Entity entity = player.Character.Entity;
				if (InventoryUtilitiesServer.TryRemoveItem(Core.EntityManager, entity, ((EntityModel)prefabById).PrefabGUID, quantity))
				{
					return true;
				}
				return false;
			}
			catch (Exception ex)
			{
				ManualLogSource logger = Plugin.Logger;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(6, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Error ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
				}
				logger.LogError(val);
				return false;
			}
		}
	}
	internal static class Helper
	{
		public static AdminAuthSystem adminAuthSystem = Core.Server.GetExistingSystemManaged<AdminAuthSystem>();

		public static ClanSystem_Server clanSystem = Core.Server.GetExistingSystemManaged<ClanSystem_Server>();

		public static EntityCommandBufferSystem entityCommandBufferSystem = Core.Server.GetExistingSystemManaged<EntityCommandBufferSystem>();

		public static NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0019: 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_001c: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions val = (EntityQueryOptions)0;
			if (includeAll)
			{
				val = (EntityQueryOptions)(val | 0xC3);
			}
			if (includeDisabled)
			{
				val = (EntityQueryOptions)(val | 2);
			}
			if (includeSpawn)
			{
				val = (EntityQueryOptions)(val | 0x40);
			}
			if (includePrefab)
			{
				val = (EntityQueryOptions)(val | 1);
			}
			if (includeDestroyed)
			{
				val = (EntityQueryOptions)(val | 0x80);
			}
			EntityQueryDesc val2 = new EntityQueryDesc();
			val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0)
			});
			val2.Options = val;
			EntityQueryDesc val3 = val2;
			EntityManager entityManager = Core.EntityManager;
			EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val3 });
			return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}

		public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0019: 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_001c: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			EntityQueryOptions val = (EntityQueryOptions)0;
			if (includeAll)
			{
				val = (EntityQueryOptions)(val | 0xC3);
			}
			if (includeDisabled)
			{
				val = (EntityQueryOptions)(val | 2);
			}
			if (includeSpawn)
			{
				val = (EntityQueryOptions)(val | 0x40);
			}
			if (includePrefab)
			{
				val = (EntityQueryOptions)(val | 1);
			}
			if (includeDestroyed)
			{
				val = (EntityQueryOptions)(val | 0x80);
			}
			EntityQueryDesc val2 = new EntityQueryDesc();
			val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2]
			{
				new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0),
				new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0)
			});
			val2.Options = val;
			EntityQueryDesc val3 = val2;
			EntityManager entityManager = Core.EntityManager;
			EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val3 });
			return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
		}
	}
	internal static class Markup
	{
		public const string HighlightColor = "#def";

		public const string SecondaryColor = "#dda";

		public static string Prefix = Format.Bold(Format.Color("[GB] ", "#ed1"));

		public static string Highlight(int i)
		{
			return Highlight(i.ToString());
		}

		public static string Highlight(string s)
		{
			return Format.Color(Format.Bold(s), "#def");
		}

		public static string Secondary(int i)
		{
			return Secondary(i.ToString());
		}

		public static string Secondary(string s)
		{
			return Format.Color(Format.Bold(s), "#dda");
		}
	}
	[BepInPlugin("GatorBounty", "GatorBounty", "0.1.10")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[Reloadable]
	public class Plugin : BasePlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static OnGameDataInitializedEventHandler <0>__GameDataOnInitialize;
		}

		private Harmony _harmony;

		public static ManualLogSource Logger;

		private static readonly HttpClient httpClient = new HttpClient();

		internal static Plugin Instance { get; private set; }

		public override void Load()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			Logger = ((BasePlugin)this).Log;
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("GatorBounty");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("0.1.10");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val);
			Instance = this;
			_harmony = new Harmony("GatorBounty");
			_harmony.PatchAll(Assembly.GetExecutingAssembly());
			CommandRegistry.RegisterAll();
			Settings.Initialize(((BasePlugin)this).Config);
			DataStore.LoadFromDisk();
			object obj = <>O.<0>__GameDataOnInitialize;
			if (obj == null)
			{
				OnGameDataInitializedEventHandler val2 = GameDataOnInitialize;
				<>O.<0>__GameDataOnInitialize = val2;
				obj = (object)val2;
			}
			EventsHandlerSystem.OnInitialize += (OnGameDataInitializedEventHandler)obj;
		}

		public override bool Unload()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__GameDataOnInitialize;
			if (obj == null)
			{
				OnGameDataInitializedEventHandler val = GameDataOnInitialize;
				<>O.<0>__GameDataOnInitialize = val;
				obj = (object)val;
			}
			EventsHandlerSystem.OnInitialize -= (OnGameDataInitializedEventHandler)obj;
			CommandRegistry.UnregisterAssembly();
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			return true;
		}

		private static void GameDataOnInitialize(World world)
		{
			Core.Initialize();
		}

		private static World GetWorld(string name)
		{
			Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator();
			while (enumerator.MoveNext())
			{
				World current = enumerator.Current;
				if (current.Name == name)
				{
					return current;
				}
			}
			return null;
		}
	}
	internal class Settings
	{
		internal static bool AnnounceBounty { get; private set; }

		internal static string bountyCurrency { get; private set; }

		internal static string bountyCurrencyName { get; private set; }

		internal static string bountyAnnounceValueKill { get; private set; }

		internal static string bountyAnnounceValueReward { get; private set; }

		internal static string bountyMapValueKill { get; private set; }

		internal static string bountyMapValueReward { get; private set; }

		internal static string bountyKillValue { get; private set; }

		internal static void Initialize(ConfigFile config)
		{
			AnnounceBounty = config.Bind<bool>("General", "AnnounceBounty", true, "Announce bounties in chat").Value;
			bountyCurrency = config.Bind<string>("General", "bountyCurrency", "576389135", "Prefab GUID for the currency for bounty system").Value;
			bountyCurrencyName = config.Bind<string>("General", "bountyCurrencyName", "Greater Stygian Shards", "Name of currency for bounty system").Value;
			bountyKillValue = config.Bind<string>("General", "bountyKillValue", "50", "How much each kill is worth towards bounty").Value;
			bountyAnnounceValueKill = config.Bind<string>("General", "bountyAnnounceValueKill", "7", "Killstreak size for bounty to start").Value;
			bountyMapValueKill = config.Bind<string>("General", "bountyMapValueKill", "12", "Killstreak size for bounty map icon to start").Value;
			bountyAnnounceValueReward = config.Bind<string>("General", "bountyAnnounceValueReward", "500", "Bounty price amount for bounty to start").Value;
			bountyMapValueReward = config.Bind<string>("General", "bountyMapValueReward", "1000", "Bounty price amount for bounty map icon to start").Value;
		}
	}
	[HarmonyPatch(typeof(VampireDownedServerEventSystem), "OnUpdate")]
	public class VampireDownedHook
	{
		private Entity icontEntity;

		private static Entity mapIconProxyPrefab;

		public static PrefabGUID mapIconPrefab = new PrefabGUID(1501929529);

		public static EntityQuery mapIconProxyQuery;

		public static void Prefix(VampireDownedServerEventSystem __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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)
			EntityQuery _query_1174204813_ = __instance.__query_1174204813_0;
			Enumerator<Entity> enumerator = ((EntityQuery)(ref _query_1174204813_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				ProcessVampireDowned(current);
			}
		}

		private static void ProcessVampireDowned(Entity entity)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Expected O, but got Unknown
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_00de: 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_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_021e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Expected O, but got Unknown
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0325: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_0349: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_038e: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0433: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			Entity val = default(Entity);
			if (!VampireDownedServerEventSystem.TryFindRootOwner(entity, 1, VWorld.Server.EntityManager, ref val))
			{
				Plugin.Logger.LogMessage((object)"Couldn't get victim entity");
				return;
			}
			VampireDownedBuff val2 = entity.Read<VampireDownedBuff>();
			Entity val3 = default(Entity);
			if (!VampireDownedServerEventSystem.TryFindRootOwner(val2.Source, 1, VWorld.Server.EntityManager, ref val3))
			{
				Plugin.Logger.LogMessage((object)"Couldn't get victim entity");
				return;
			}
			PlayerCharacter val4 = val.Read<PlayerCharacter>();
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExMessageLogInterpolatedStringHandler val5 = new BepInExMessageLogInterpolatedStringHandler(10, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<FixedString64Bytes>(val4.Name);
				((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" is victim");
			}
			logger.LogMessage(val5);
			BepInExInfoLogInterpolatedStringHandler val6;
			if (val3.Has<UnitLevel>())
			{
				ManualLogSource logger2 = Plugin.Logger;
				val6 = new BepInExInfoLogInterpolatedStringHandler(46, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<FixedString64Bytes>(val4.Name);
					((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" was killed by a unit. [Not currently tracked]");
				}
				logger2.LogInfo(val6);
				return;
			}
			if (!val3.Has<PlayerCharacter>())
			{
				ManualLogSource logger3 = Plugin.Logger;
				BepInExWarningLogInterpolatedStringHandler val7 = new BepInExWarningLogInterpolatedStringHandler(121, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("Killer could not be identified for ");
					((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<FixedString64Bytes>(val4.Name);
					((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(", if you know how to reproduce this please contact deca on discord or report on github");
				}
				logger3.LogWarning(val7);
				return;
			}
			PlayerCharacter val8 = val3.Read<PlayerCharacter>();
			if (val8.UserEntity == val4.UserEntity)
			{
				ManualLogSource logger4 = Plugin.Logger;
				val6 = new BepInExInfoLogInterpolatedStringHandler(43, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<FixedString64Bytes>(val4.Name);
					((BepInExLogInterpolatedStringHandler)val6).AppendLiteral(" killed themselves. [Not currently tracked]");
				}
				logger4.LogInfo(val6);
				return;
			}
			PlayerCharacter val9 = val3.Read<PlayerCharacter>();
			User val10 = val9.UserEntity.Read<User>();
			PlayerCharacter val11 = val.Read<PlayerCharacter>();
			User val12 = val11.UserEntity.Read<User>();
			int streak = DataStore.getStreak(val10.PlatformId);
			int streak2 = DataStore.getStreak(val12.PlatformId);
			ManualLogSource logger5 = Plugin.Logger;
			val6 = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("LostStreak: ");
				((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<int>(streak2);
			}
			logger5.LogInfo(val6);
			int bounty = DataStore.getBounty(val12.PlatformId);
			int num = streak2 * int.Parse(Settings.bountyKillValue);
			int num2 = streak * int.Parse(Settings.bountyKillValue);
			num += bounty;
			num2 += bounty;
			DataStore.LoadFromDisk();
			if (DataStore.getStreak(val10.PlatformId) == int.Parse(Settings.bountyAnnounceValueKill))
			{
				ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, $"<color=red>{val8.Name}</color> now has a killstreak bounty on their head! Current bounty price: <color=white>{num2} {Settings.bountyCurrencyName}</color>");
			}
			if (DataStore.getStreak(val10.PlatformId) == int.Parse(Settings.bountyMapValueKill))
			{
				ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, $"<color=red>{val8.Name}</color> is now marked on the map. Happy hunting!");
				AddIcon(val3);
			}
			if (streak2 >= int.Parse(Settings.bountyAnnounceValueKill) || num >= int.Parse(Settings.bountyAnnounceValueReward))
			{
				ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, $"<color=green>{val8.Name}</color> has claimed the <color=white>{num} {Settings.bountyCurrencyName}</color> bounty on <color=red>{val4.Name}</color>'s head!");
				UserModel userByCharacterName = GameData.Users.GetUserByCharacterName(((object)(FixedString64Bytes)(ref val8.Name)).ToString());
				PrefabGUID val13 = default(PrefabGUID);
				((PrefabGUID)(ref val13))..ctor(int.Parse(Settings.bountyCurrency));
				UserModelMethods.DropItemNearby(userByCharacterName, val13, num);
				DataStore.handleBountyDeath(val12);
			}
			RemoveIcon(val);
		}

		public static void AddIcon(Entity player)
		{
			//IL_0001: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected O, but got Unknown
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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)
			CleanIcons(player);
			if (!Core.PrefabCollection._PrefabGuidToEntityMap.TryGetValue(mapIconPrefab, ref mapIconProxyPrefab))
			{
				Plugin.Logger.LogError((object)"Failed to find MapIcon_ProxyObject_POI_Unknown Prefab entity");
			}
			EntityManager entityManager = Core.EntityManager;
			Entity val = ((EntityManager)(ref entityManager)).Instantiate(mapIconProxyPrefab);
			ECSExtensions.Add<MapIconTargetEntity>(val);
			ECSExtensions.Add<AttachMapIconsToEntity>(val);
			MapIconTargetEntity val2 = default(MapIconTargetEntity);
			val2.TargetEntity = NetworkedEntity.op_Implicit(player.Read<Entity>());
			val2.TargetNetworkId = player.Read<NetworkId>();
			ECSExtensions.Write<MapIconTargetEntity>(val, val2);
			ECSExtensions.Remove<SyncToUserBitMask>(val);
			ECSExtensions.Remove<SyncToUserBuffer>(val);
			ECSExtensions.Remove<OnlySyncToUsersTag>(val);
			entityManager = Core.EntityManager;
			DynamicBuffer<AttachMapIconsToEntity> buffer = ((EntityManager)(ref entityManager)).GetBuffer<AttachMapIconsToEntity>(val, false);
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AttachMITE: ");
				((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<DynamicBuffer<AttachMapIconsToEntity>>(buffer);
			}
			logger.LogInfo(val3);
			buffer.Clear();
			buffer.Add(new AttachMapIconsToEntity
			{
				Prefab = mapIconPrefab
			});
		}

		public static bool RemoveIcon(Entity player)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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)
			//IL_0021: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_0094: 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)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Expected O, but got Unknown
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Expected O, but got Unknown
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036b: Expected O, but got Unknown
			//IL_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Expected O, but got Unknown
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a8: Expected O, but got Unknown
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Expected O, but got Unknown
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0465: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_0592: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_0485: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Expected O, but got Unknown
			//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f9: Expected O, but got Unknown
			//IL_0516: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("REMOVING ICONS");
			}
			logger.LogInfo(val);
			if (!Core.PrefabCollection._PrefabGuidToEntityMap.TryGetValue(mapIconPrefab, ref mapIconProxyPrefab))
			{
				Plugin.Logger.LogError((object)"Failed to find MapIcon_ProxyObject_POI_Unknown Prefab entity");
			}
			EntityManager entityManager = Core.EntityManager;
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val2 = new EntityQueryDesc();
			val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<AttachMapIconsToEntity>() });
			val2.Options = (EntityQueryOptions)2;
			array[0] = val2;
			mapIconProxyQuery = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
			UserModel val3 = GameData.Users.All.FirstOrDefault();
			Entity entity = ((EntityModel)val3).Entity;
			NativeArray<Entity> val4 = ((EntityQuery)(ref mapIconProxyQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			Enumerator<Entity> enumerator = val4.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				PrefabGUID val5 = current.Read<PrefabGUID>();
				if (((PrefabGUID)(ref val5)).Equals(mapIconPrefab))
				{
					ManualLogSource logger2 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("NetworkID: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NetworkId>(current.Read<MapIconTargetEntity>().TargetNetworkId);
					}
					logger2.LogInfo(val);
					ManualLogSource logger3 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Players: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NetworkId>(player.Read<NetworkId>());
					}
					logger3.LogInfo(val);
					ManualLogSource logger4 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("NetworkID: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(current.Read<MapIconTargetEntity>().TargetNetworkId == player.Read<NetworkId>());
					}
					logger4.LogInfo(val);
					ManualLogSource logger5 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("TargetEntity: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(current.Read<MapIconTargetEntity>().TargetEntity._Entity);
					}
					logger5.LogInfo(val);
					ManualLogSource logger6 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Players: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(player.Read<Entity>());
					}
					logger6.LogInfo(val);
					ManualLogSource logger7 = Plugin.Logger;
					val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("TargetEntity: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(current.Read<MapIconTargetEntity>().TargetEntity._Entity == player.Read<PlayerCharacter>().UserEntity);
					}
					logger7.LogInfo(val);
				}
			}
			IEnumerable<Entity> enumerable = ((IEnumerable<Entity>)val4.ToArray()).Where(delegate(Entity x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//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)
				//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_001d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				int result;
				if (x.Has<PrefabGUID>())
				{
					PrefabGUID val6 = x.Read<PrefabGUID>();
					if (((PrefabGUID)(ref val6)).Equals(mapIconPrefab))
					{
						result = ((x.Read<MapIconTargetEntity>().TargetEntity._Entity == player.Read<PlayerCharacter>().UserEntity) ? 1 : 0);
						goto IL_0045;
					}
				}
				result = 0;
				goto IL_0045;
				IL_0045:
				return (byte)result != 0;
			});
			ManualLogSource logger8 = Plugin.Logger;
			val = new BepInExInfoLogInterpolatedStringHandler(7, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Array: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<IEnumerable<Entity>>(enumerable);
			}
			logger8.LogInfo(val);
			val4.Dispose();
			foreach (Entity item in enumerable)
			{
				ManualLogSource logger9 = Plugin.Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("icontodestroy exists: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(ECSExtensions.Exists(item));
				}
				logger9.LogInfo(val);
				ManualLogSource logger10 = Plugin.Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("icontodestroy targetEntity: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NetworkedEntity>(item.Read<MapIconTargetEntity>().TargetEntity);
				}
				logger10.LogInfo(val);
				ManualLogSource logger11 = Plugin.Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("icontodestroy network ID: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NetworkId>(item.Read<MapIconTargetEntity>().TargetNetworkId);
				}
				logger11.LogInfo(val);
				if (item == Entity.Null)
				{
					Plugin.Logger.LogInfo((object)"IconToDestroy is null");
					return false;
				}
				if (item.Has<AttachedBuffer>())
				{
					Plugin.Logger.LogInfo((object)"Has Attached Buffer");
					entityManager = Core.EntityManager;
					DynamicBuffer<AttachedBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<AttachedBuffer>(item, false);
					for (int i = 0; i < buffer.Length; i++)
					{
						Entity entity2 = buffer[i].Entity;
						ManualLogSource logger12 = Plugin.Logger;
						val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(entity2);
						}
						logger12.LogInfo(val);
						if (!(entity2 == Entity.Null))
						{
							ECSExtensions.Remove<Attached>(entity2);
							ECSExtensions.Remove<MapIconTargetEntity>(entity2);
							ECSExtensions.Remove<AttachMapIconsToEntity>(entity2);
							ManualLogSource logger13 = Plugin.Logger;
							val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(entity2.Has<MapIconTargetEntity>());
							}
							logger13.LogInfo(val);
							StatChangeUtility.KillOrDestroyEntity(Core.EntityManager, entity2, entity, entity, 0.0, (StatChangeReason)0, true);
						}
					}
				}
				if (item.Has<MapIconTargetEntity>())
				{
					ECSExtensions.Remove<MapIconTargetEntity>(item);
				}
				if (item.Has<AttachMapIconsToEntity>())
				{
					ECSExtensions.Remove<AttachMapIconsToEntity>(item);
				}
				Plugin.Logger.LogInfo((object)"Destroying icon...");
				StatChangeUtility.KillOrDestroyEntity(Core.EntityManager, item, entity, entity, 0.0, (StatChangeReason)0, true);
				Plugin.Logger.LogInfo((object)"Icon Destroyed");
			}
			CleanIcons(player);
			return true;
		}

		public static bool RemoveAllIcons()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
			//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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_022c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0358: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			ManualLogSource logger = Plugin.Logger;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 0, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("REMOVING ICONS");
			}
			logger.LogInfo(val);
			if (!Core.PrefabCollection._PrefabGuidToEntityMap.TryGetValue(mapIconPrefab, ref mapIconProxyPrefab))
			{
				Plugin.Logger.LogError((object)"Failed to find MapIcon_ProxyObject_POI_Unknown Prefab entity");
			}
			EntityManager entityManager = Core.EntityManager;
			EntityQueryDesc[] array = new EntityQueryDesc[1];
			EntityQueryDesc val2 = new EntityQueryDesc();
			val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<AttachMapIconsToEntity>() });
			val2.Options = (EntityQueryOptions)2;
			array[0] = val2;
			mapIconProxyQuery = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array);
			UserModel val3 = GameData.Users.All.FirstOrDefault();
			Entity entity = ((EntityModel)val3).Entity;
			NativeArray<Entity> val4 = ((EntityQuery)(ref mapIconProxyQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
			IEnumerable<Entity> enumerable = ((IEnumerable<Entity>)val4.ToArray()).Where(delegate(Entity x)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//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)
				//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)
				int result;
				if (x.Has<PrefabGUID>())
				{
					PrefabGUID val5 = x.Read<PrefabGUID>();
					result = (((PrefabGUID)(ref val5)).Equals(mapIconPrefab) ? 1 : 0);
				}
				else
				{
					result = 0;
				}
				return (byte)result != 0;
			});
			ManualLogSource logger2 = Plugin.Logger;
			val = new BepInExInfoLogInterpolatedStringHandler(7, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Array: ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<IEnumerable<Entity>>(enumerable);
			}
			logger2.LogInfo(val);
			val4.Dispose();
			foreach (Entity item in enumerable)
			{
				ManualLogSource logger3 = Plugin.Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("icontodestroy targetEntity: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NetworkedEntity>(item.Read<MapIconTargetEntity>().TargetEntity);
				}
				logger3.LogInfo(val);
				ManualLogSource logger4 = Plugin.Logger;
				val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("icontodestroy network ID: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<NetworkId>(item.Read<MapIconTargetEntity>().TargetNetworkId);
				}
				logger4.LogInfo(val);
				if (item == Entity.Null)
				{
					Plugin.Logger.LogInfo((object)"IconToDestroy is null");
					return false;
				}
				if (item.Has<AttachedBuffer>())
				{
					Plugin.Logger.LogInfo((object)"Has Attached Buffer");
					entityManager = Core.EntityManager;
					DynamicBuffer<AttachedBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<AttachedBuffer>(item, false);
					for (int i = 0; i < buffer.Length; i++)
					{
						Entity entity2 = buffer[i].Entity;
						ManualLogSource logger5 = Plugin.Logger;
						val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Entity>(entity2);
						}
						logger5.LogInfo(val);
						if (!(entity2 == Entity.Null))
						{
							ECSExtensions.Remove<Attached>(entity2);
							ECSExtensions.Remove<MapIconTargetEntity>(entity2);
							ECSExtensions.Remove<AttachMapIconsToEntity>(entity2);
							ManualLogSource logger6 = Plugin.Logger;
							val = new BepInExInfoLogInterpolatedStringHandler(0, 1, ref flag);
							if (flag)
							{
								((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(entity2.Has<MapIconTargetEntity>());
							}
							logger6.LogInfo(val);
							StatChangeUtility.KillOrDestroyEntity(Core.EntityManager, entity2, entity, entity, 0.0, (StatChangeReason)0, true);
						}
					}
				}
				if (item.Has<MapIconTargetEntity>())
				{
					ECSExtensions.Remove<MapIconTargetEntity>(item);
				}
				if (item.Has<AttachMapIconsToEntity>())
				{
					ECSExtensions.Remove<AttachMapIconsToEntity>(item);
				}
				Plugin.Logger.LogInfo((object)"Destroying icon...");
				StatChangeUtility.KillOrDestroyEntity(Core.EntityManager, item, entity, entity, 0.0, (StatChangeReason)0, true);
				Plugin.Logger.LogInfo((object)"Icon Destroyed");
			}
			return true;
		}

		public static void CleanIcons(Entity player)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Plugin.Logger.LogInfo((object)"CLEANING ICONS");
			UserModel val = GameData.Users.All.FirstOrDefault();
			Entity entity = ((EntityModel)val).Entity;
			NativeArray<Entity> entitiesByComponentTypes = QueryComponents.GetEntitiesByComponentTypes<MapIconData>((EntityQueryOptions)2, false);
			Enumerator<Entity> enumerator = entitiesByComponentTypes.GetEnumerator();
			while (enumerator.MoveNext())
			{
				Entity current = enumerator.Current;
				PrefabGUID val2 = current.Read<PrefabGUID>();
				if (val2 == mapIconPrefab && (!current.Has<MapIconTargetEntity>() || current.Read<MapIconTargetEntity>().TargetEntity._Entity == player.Read<Entity>()))
				{
					Plugin.Logger.LogInfo((object)"Icon Destroyed CLEAN ICONS");
					StatChangeUtility.KillOrDestroyEntity(Core.EntityManager, current, entity, entity, 0.0, (StatChangeReason)0, true);
				}
			}
			entitiesByComponentTypes.Dispose();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GatorBounty";

		public const string PLUGIN_NAME = "GatorBounty";

		public const string PLUGIN_VERSION = "0.1.10";
	}
}