Decompiled source of BloodyPoint v2.0.5

BloodyPoints.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
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 BloodyPoints.Command;
using BloodyPoints.DB;
using BloodyPoints.Helpers;
using HarmonyLib;
using Il2CppSystem;
using ProjectM;
using ProjectM.Network;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using VampireCommandFramework;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BloodyPoints")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Mod so that personal or global waypoints can be created.")]
[assembly: AssemblyFileVersion("2.0.5.0")]
[assembly: AssemblyInformationalVersion("2.0.5+1.Branch.master.Sha.8f2fcf6648f04bba037eb95269f295cbd890f11c")]
[assembly: AssemblyProduct("BloodyPoints")]
[assembly: AssemblyTitle("BloodyPoints")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.5.0")]
[module: UnverifiableCode]
namespace BloodyPoints
{
	[BepInPlugin("BloodyPoints", "BloodyPoints", "2.0.5")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[Reloadable]
	public class Plugin : BasePlugin, IRunOnInitialized
	{
		public static Harmony harmony;

		public static readonly string ConfigPath = Path.Combine(Paths.ConfigPath, "BloodyPoints");

		public static readonly string WaypointsJson = Path.Combine(ConfigPath, "waypoints.json");

		public static readonly string GlobalWaypointsJson = Path.Combine(ConfigPath, "global_waypoints.json");

		public static readonly string TotalWaypointsJson = Path.Combine(ConfigPath, "total_waypoints.json");

		private static ConfigEntry<int> WaypointLimit;

		public static Logger Logger;

		public static SystemsCore SystemsCore;

		internal static Plugin Instance { get; private set; }

		public static ConfigEntry<bool> InCombat { get; private set; }

		public static ConfigEntry<bool> DraculaRoom { get; private set; }

		public static ConfigEntry<int> CoolDown { get; private set; }

		public static ConfigEntry<bool> Cost { get; private set; }

		public static ConfigEntry<string> PrefabName { get; private set; }

		public static ConfigEntry<int> PrefabGUID { get; private set; }

		public static ConfigEntry<int> Amount { get; private set; }

		public static ConfigEntry<bool> TeleportPlayer { get; private set; }

		public static ConfigEntry<bool> RequestTeleportPlayer { get; private set; }

		public override void Load()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Expected O, but got Unknown
			Instance = this;
			Logger = new Logger(((BasePlugin)this).Log);
			CommandRegistry.RegisterCommandType(typeof(Bloodypoint));
			harmony = new Harmony("BloodyPoints");
			harmony.PatchAll(Assembly.GetExecutingAssembly());
			EventsHandlerSystem.OnInitialize += new OnGameDataInitializedEventHandler(GameDataOnInitialize);
			EventsHandlerSystem.OnDestroy += new OnGameDataDestroyedEventHandler(GameDataOnDestroy);
			EventsHandlerSystem.OnSaveWorld += new SaveWorldEventHandler(SaveWorldInvoke);
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val;
			if (!Core.IsServer)
			{
				ManualLogSource log = ((BasePlugin)this).Log;
				val = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BloodyPoints");
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is only for server!");
				}
				log.LogInfo(val);
				return;
			}
			InitConfig();
			ManualLogSource log2 = ((BasePlugin)this).Log;
			val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BloodyPoints");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
			}
			log2.LogInfo(val);
		}

		private void SaveWorldInvoke()
		{
			Bloodypoint.SaveWaypoints();
		}

		private void GameDataOnDestroy()
		{
		}

		private void GameDataOnInitialize(World world)
		{
			SystemsCore = Core.SystemsCore;
			Initialize();
			Bloodypoint.LoadWaypoints();
			if (TeleportPlayer.Value)
			{
				CommandRegistry.RegisterCommandType(typeof(TTPCommands));
			}
		}

		public void InitConfig()
		{
			WaypointLimit = ((BasePlugin)this).Config.Bind<int>("Config", "Waypoint Limit", 1, "Set a waypoint limit per user.");
			InCombat = ((BasePlugin)this).Config.Bind<bool>("Config", "In Combat", true, "Allows tp to be used when a player is in combat");
			DraculaRoom = ((BasePlugin)this).Config.Bind<bool>("Config", "Dracula Room", false, "Allows you to create waypoints or tp from Dracula's room");
			CoolDown = ((BasePlugin)this).Config.Bind<int>("Config", "CoolDown", 20, "Time in seconds for teleportation to cooldown");
			Cost = ((BasePlugin)this).Config.Bind<bool>("Config", "Cost", true, "Activate cost to make tp");
			PrefabName = ((BasePlugin)this).Config.Bind<string>("Config", "PrefabName", "Blood Essence", "PrefabGUID that the player will have to have in the inventory to make tp");
			PrefabGUID = ((BasePlugin)this).Config.Bind<int>("Config", "PrefabGUID", 862477668, "PrefabGUID that the player will have to have in the inventory to make tp");
			Amount = ((BasePlugin)this).Config.Bind<int>("Config", "Amount", 20, "Amount of PrefabGUID needed to make tp");
			TeleportPlayer = ((BasePlugin)this).Config.Bind<bool>("Config", "TeleporPlayer", true, "Enable players to tp another player");
			RequestTeleportPlayer = ((BasePlugin)this).Config.Bind<bool>("Config", "RequestTeleportPlayer", true, "Activate that players must accept a tp from another player who wants to tp their position.");
			if (!Directory.Exists(ConfigPath))
			{
				Directory.CreateDirectory(ConfigPath);
			}
		}

		public static void Initialize()
		{
			Bloodypoint.WaypointLimit = WaypointLimit.Value;
			Bloodypoint.DraculaRoom = DraculaRoom.Value;
		}

		public override bool Unload()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			CommandRegistry.UnregisterAssembly();
			Bloodypoint.SaveWaypoints();
			((BasePlugin)this).Config.Clear();
			harmony.UnpatchSelf();
			EventsHandlerSystem.OnInitialize -= new OnGameDataInitializedEventHandler(GameDataOnInitialize);
			EventsHandlerSystem.OnDestroy -= new OnGameDataDestroyedEventHandler(GameDataOnDestroy);
			EventsHandlerSystem.OnSaveWorld -= new SaveWorldEventHandler(SaveWorldInvoke);
			return true;
		}

		public void OnGameInitialized()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BloodyPoints";

		public const string PLUGIN_NAME = "BloodyPoints";

		public const string PLUGIN_VERSION = "2.0.5";
	}
}
namespace BloodyPoints.Helpers
{
	internal class Helper
	{
		public static EntityManager entityManager = VWorld.Server.EntityManager;

		public static bool IsPlayerInCombat(Entity player)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!BuffUtility.HasBuff(entityManager, player, PrefabIdentifier.op_Implicit(Database.Buff.InCombat)))
			{
				return BuffUtility.HasBuff(entityManager, player, PrefabIdentifier.op_Implicit(Database.Buff.InCombat_PvP));
			}
			return true;
		}

		public static void TeleportTo(Entity userEntity, Entity characterEntity, float3 position)
		{
			//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_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_002e: 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)
			//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_0041: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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)
			Entity val = ((EntityManager)(ref entityManager)).CreateEntity((ComponentType[])(object)new ComponentType[2]
			{
				ComponentType.ReadWrite<FromCharacter>(),
				ComponentType.ReadWrite<PlayerTeleportDebugEvent>()
			});
			((EntityManager)(ref entityManager)).SetComponentData<FromCharacter>(val, new FromCharacter
			{
				User = userEntity,
				Character = characterEntity
			});
			((EntityManager)(ref entityManager)).SetComponentData<PlayerTeleportDebugEvent>(val, new PlayerTeleportDebugEvent
			{
				Position = new float3(position.x, position.y, position.z),
				Target = (TeleportTarget)0
			});
		}

		public static bool checkDracualaRoom(WaypointData wp)
		{
			if ((wp.X == 18f || wp.X == 19f) && wp.Y == 16f)
			{
				return true;
			}
			if ((wp.Y == 1f || wp.Y == 2f) && wp.X == 24f)
			{
				return true;
			}
			return false;
		}

		public static bool DontMove(Entity userEntity, Entity charEntity)
		{
			return true;
		}

		public static bool CaMove(Entity charEntity)
		{
			return true;
		}
	}
}
namespace BloodyPoints.DB
{
	public class Database
	{
		public static class Buff
		{
			public static PrefabGUID InCombat = Prefabs.Buff_InCombat;

			public static PrefabGUID InCombat_PvP = Prefabs.Buff_InCombat_PvPVampire;
		}

		public static JsonSerializerOptions JSON_options = new JsonSerializerOptions
		{
			WriteIndented = false,
			IncludeFields = false
		};

		public static JsonSerializerOptions Pretty_JSON_options = new JsonSerializerOptions
		{
			WriteIndented = true,
			IncludeFields = true
		};

		public static List<WaypointData> globalWaypoint { get; set; }

		public static List<WaypointData> waypoints { get; set; }

		public static Dictionary<ulong, int> waypoints_owned { get; set; }

		public static Dictionary<ulong, DateTime> UsersCooldown { get; set; } = new Dictionary<ulong, DateTime>();


		internal static bool TryCoolDownTP(ulong steamid, out double diffInSeconds)
		{
			if (UsersCooldown.TryGetValue(steamid, out var value))
			{
				diffInSeconds = (DateTime.Now - value).TotalSeconds;
				if (diffInSeconds >= (double)Plugin.CoolDown.Value)
				{
					diffInSeconds = 0.0;
					UsersCooldown[steamid] = DateTime.Now;
					return true;
				}
				return false;
			}
			diffInSeconds = 0.0;
			UsersCooldown[steamid] = DateTime.Now;
			return true;
		}
	}
	public class WaypointData
	{
		public string Name { get; set; }

		public ulong Owner { get; set; }

		public float X { get; set; }

		public float Y { get; set; }

		public float Z { get; set; }

		public WaypointData(string name, ulong owner, float x, float y, float z)
		{
			Name = name;
			Owner = owner;
			X = x;
			Y = y;
			Z = z;
		}

		public float3 getLocation()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			return new float3(X, Y, Z);
		}
	}
}
namespace BloodyPoints.Command
{
	[CommandGroup("bloodypoint", "blp")]
	internal class Bloodypoint
	{
		public static int WaypointLimit = 3;

		public static bool DraculaRoom = false;

		private static EntityManager entityManager = VWorld.Server.EntityManager;

		[Command("teleport", "tp", "<Name>", "Teleports you to the specific waypoint.", null, false)]
		public static void WaypoinCommand(ChatCommandContext ctx, string name)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0089: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			Entity PlayerEntity = ctx.Event.SenderCharacterEntity;
			ulong SteamID = ctx.Event.User.PlatformId;
			Users users = GameData.Users;
			User user = ctx.Event.User;
			UserModel userByCharacterName = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
			if (!DraculaRoom)
			{
				LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(ctx.Event.SenderCharacterEntity);
				float3 position = ((LocalToWorld)(ref componentData)).Position;
				if (Helper.checkDracualaRoom(new WaypointData("test", 12345678901234567890uL, position.x, position.y, position.z)))
				{
					throw ctx.Error("You can't teleport from Dracula's room!");
				}
			}
			if (Plugin.InCombat.Value && Helper.IsPlayerInCombat(PlayerEntity))
			{
				throw ctx.Error("Unable to use waypoint! You're in combat!");
			}
			WaypointData wp = Database.globalWaypoint.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower());
			if (wp != null)
			{
				if (!DraculaRoom && Helper.checkDracualaRoom(wp))
				{
					throw ctx.Error("You can't teleport to Dracula's room!");
				}
				if (!Database.TryCoolDownTP(SteamID, out var diffInSeconds))
				{
					throw ctx.Error("Unable to use waypoint! You must wait " + FontColorChatSystem.Green((Plugin.CoolDown.Value - Convert.ToInt32(diffInSeconds)).ToString()) + " seconds for your next tp!");
				}
				if (Plugin.Cost.Value)
				{
					if (!TTPCommands.RetriveItemsFromInventory(userByCharacterName, out var message))
					{
						throw ctx.Error(message);
					}
					BuffSystem.BuffPlayer(userByCharacterName.Character.Entity, ctx.Event.SenderUserEntity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					Helper.DontMove(ctx.Event.SenderUserEntity, ctx.Event.SenderCharacterEntity);
					CoroutineHandler.StartGenericCoroutine((Action)delegate
					{
						//IL_000b: 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_001c: 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)
						Helper.TeleportTo(ctx.Event.SenderUserEntity, PlayerEntity, wp.getLocation());
						Helper.CaMove(ctx.Event.SenderCharacterEntity);
					}, 5f);
				}
				else
				{
					Helper.TeleportTo(ctx.Event.SenderUserEntity, PlayerEntity, wp.getLocation());
				}
				return;
			}
			wp = Database.waypoints.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower() && waypoint.Owner == SteamID);
			if (wp != null)
			{
				if (!DraculaRoom && Helper.checkDracualaRoom(wp))
				{
					throw ctx.Error("You can't teleport to Dracula's room!");
				}
				if (!Database.TryCoolDownTP(SteamID, out var diffInSeconds2))
				{
					throw ctx.Error("Unable to use waypoint! You must wait " + FontColorChatSystem.Green((Plugin.CoolDown.Value - Convert.ToInt32(diffInSeconds2)).ToString()) + " seconds for your next tp!");
				}
				if (Plugin.Cost.Value)
				{
					if (!TTPCommands.RetriveItemsFromInventory(userByCharacterName, out var message2))
					{
						throw ctx.Error(message2);
					}
					BuffSystem.BuffPlayer(ctx.Event.SenderCharacterEntity, ctx.Event.SenderUserEntity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					CoroutineHandler.StartGenericCoroutine((Action)delegate
					{
						//IL_000b: 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_001c: Unknown result type (might be due to invalid IL or missing references)
						Helper.TeleportTo(ctx.Event.SenderUserEntity, PlayerEntity, wp.getLocation());
					}, 5f);
				}
				else
				{
					Action obj = delegate
					{
						//IL_000b: 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_001c: Unknown result type (might be due to invalid IL or missing references)
						Helper.TeleportTo(ctx.Event.SenderUserEntity, PlayerEntity, wp.getLocation());
					};
					BuffSystem.BuffPlayer(ctx.Event.SenderCharacterEntity, ctx.Event.SenderUserEntity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					CoroutineHandler.StartGenericCoroutine(obj, 5f);
				}
				return;
			}
			throw ctx.Error("Cant find Teleport name " + name + "!");
		}

		[Command("teleportplayer", "tpp", "<Name> <PlayerName>", "Teleports player to the specific waypoint. If we type \"all\" instead of the player's name it will teleport all online players to the specified point.", null, true)]
		public static void WaypointPlayerCommand(ChatCommandContext ctx, string name, string PlayerName)
		{
			//IL_001f: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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)
			//IL_0040: 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_004c: 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_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: 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_010d: 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_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: 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_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0217: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			if (!DraculaRoom)
			{
				LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(ctx.Event.SenderCharacterEntity);
				float3 position = ((LocalToWorld)(ref componentData)).Position;
				if (Helper.checkDracualaRoom(new WaypointData("test", 12345678901234567890uL, position.x, position.y, position.z)))
				{
					throw ctx.Error("You can't teleport from Dracula's room!");
				}
			}
			if (PlayerName == "all")
			{
				Entity val = default(Entity);
				foreach (UserModel item in GameData.Users.Online)
				{
					Entity entity = item.Character.Entity;
					ulong SteamID2 = ctx.Event.User.PlatformId;
					if (Plugin.InCombat.Value && Helper.IsPlayerInCombat(entity))
					{
						throw ctx.Error("Unable to use waypoint! " + item.CharacterName + " in combat!");
					}
					Users users = GameData.Users;
					User user = ctx.Event.User;
					users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
					if (BuffUtility.TryGetBuff(Core.SystemsCore.EntityManager, item.Character.Entity, PrefabIdentifier.op_Implicit(Prefabs.AB_Shapeshift_Bat_TakeFlight_Buff), ref val))
					{
						throw ctx.Error("You cannot create a waypoint while flying");
					}
					WaypointData waypointData = Database.globalWaypoint.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower());
					if (waypointData != null)
					{
						if (DraculaRoom || !Helper.checkDracualaRoom(waypointData))
						{
							Helper.TeleportTo(ctx.Event.SenderUserEntity, entity, waypointData.getLocation());
							break;
						}
						throw ctx.Error("You can't teleport to Dracula's room!");
					}
					waypointData = Database.waypoints.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower() && waypoint.Owner == SteamID2);
					if (waypointData != null)
					{
						if (DraculaRoom || !Helper.checkDracualaRoom(waypointData))
						{
							Helper.TeleportTo(ctx.Event.SenderUserEntity, entity, waypointData.getLocation());
							break;
						}
						throw ctx.Error("You can't teleport to Dracula's room!");
					}
				}
				return;
			}
			UserModel userByCharacterName = GameData.Users.GetUserByCharacterName(PlayerName);
			Entity entity2 = userByCharacterName.Character.Entity;
			ulong SteamID = ctx.Event.User.PlatformId;
			if (Plugin.InCombat.Value && Helper.IsPlayerInCombat(entity2))
			{
				throw ctx.Error("Unable to use waypoint! " + userByCharacterName.CharacterName + " in combat!");
			}
			Entity val2 = default(Entity);
			if (BuffUtility.TryGetBuff(Core.SystemsCore.EntityManager, userByCharacterName.Character.Entity, PrefabIdentifier.op_Implicit(Prefabs.AB_Shapeshift_Bat_TakeFlight_Buff), ref val2))
			{
				throw ctx.Error("You cannot create a waypoint while flying");
			}
			_ = name + "_" + SteamID;
			WaypointData waypointData2 = Database.globalWaypoint.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower() && waypoint.Owner == SteamID);
			if (waypointData2 != null)
			{
				if (!DraculaRoom && Helper.checkDracualaRoom(waypointData2))
				{
					throw ctx.Error("You can't teleport to Dracula's room!");
				}
				Helper.TeleportTo(ctx.Event.SenderUserEntity, entity2, waypointData2.getLocation());
				return;
			}
			waypointData2 = Database.waypoints.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower() && waypoint.Owner == SteamID);
			if (waypointData2 != null)
			{
				if (!DraculaRoom && Helper.checkDracualaRoom(waypointData2))
				{
					throw ctx.Error("You can't teleport to Dracula's room!");
				}
				Helper.TeleportTo(ctx.Event.SenderUserEntity, entity2, waypointData2.getLocation());
			}
		}

		[Command("waypoint", "wp", "<Name>", "Creates the specified personal waypoint", null, false)]
		public static void WaypointSetCommand(ChatCommandContext ctx, string name)
		{
			//IL_0014: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			ulong SteamID = ctx.Event.User.PlatformId;
			Users users = GameData.Users;
			User user = ctx.Event.User;
			UserModel userByCharacterName = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
			Entity val = default(Entity);
			if (BuffUtility.TryGetBuff(Core.SystemsCore.EntityManager, userByCharacterName.Character.Entity, PrefabIdentifier.op_Implicit(Prefabs.AB_Shapeshift_Bat_TakeFlight_Buff), ref val))
			{
				throw ctx.Error("You cannot create a waypoint while flying");
			}
			if (Database.waypoints_owned.TryGetValue(SteamID, out var value) && !ctx.Event.User.IsAdmin && value >= WaypointLimit && value >= WaypointLimit)
			{
				throw ctx.Error("You already have reached your total waypoint limit.");
			}
			if (Database.globalWaypoint.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower()) != null)
			{
				throw ctx.Error("A global waypoint with the \"" + name + "\" name existed. Please rename your waypoint.");
			}
			if (Database.waypoints.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower() && waypoint.Owner == SteamID) != null)
			{
				throw ctx.Error("You already have a waypoint with the same name.");
			}
			LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(ctx.Event.SenderCharacterEntity);
			float3 position = ((LocalToWorld)(ref componentData)).Position;
			if (!DraculaRoom && Helper.checkDracualaRoom(new WaypointData("test", 123456789123456789uL, position.x, position.y, position.z)))
			{
				throw ctx.Error("You can't create a waypoint in Dracula's room!");
			}
			float3 location = default(float3);
			((float3)(ref location))..ctor(position.x, position.y, position.z);
			AddWaypoint(SteamID, location, name, isGlobal: false);
			ctx.Reply("Successfully added Waypoint.");
		}

		[Command("waypointglobal", "wpg", "<Name>", "Creates the specified global waypoint", null, true)]
		public static void WaypointSetGlobalCommand(ChatCommandContext ctx, string name)
		{
			//IL_0018: 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_0036: 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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			Users users = GameData.Users;
			User user = ctx.Event.User;
			UserModel userByCharacterName = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
			Entity val = default(Entity);
			if (BuffUtility.TryGetBuff(Core.SystemsCore.EntityManager, userByCharacterName.Character.Entity, PrefabIdentifier.op_Implicit(Prefabs.AB_Shapeshift_Bat_TakeFlight_Buff), ref val))
			{
				throw ctx.Error("You cannot create a waypoint while flying");
			}
			ulong platformId = ctx.Event.User.PlatformId;
			_ = name + "_" + platformId;
			if (Database.globalWaypoint.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower()) != null)
			{
				throw ctx.Error("A global waypoint with the \"" + name + "\" name existed. Please rename your waypoint.");
			}
			if (Database.waypoints.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower()) != null)
			{
				throw ctx.Error("Already have a personal waypoint with the same name.");
			}
			LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(ctx.Event.SenderCharacterEntity);
			float3 position = ((LocalToWorld)(ref componentData)).Position;
			if (!DraculaRoom && Helper.checkDracualaRoom(new WaypointData("test", 123456789123456789uL, position.x, position.y, position.z)))
			{
				throw ctx.Error("You can't create a waypoint in Dracula's room!");
			}
			float3 location = default(float3);
			((float3)(ref location))..ctor(position.x, position.y, position.z);
			AddWaypoint(platformId, location, name, isGlobal: true);
			ctx.Reply("Successfully added Global Waypoint.");
		}

		[Command("waypointremoveglobal", "wpgr", "<Name>", "Removes the specified global waypoint", null, true)]
		public static void WaypointremoveGlobalCommand(ChatCommandContext ctx, string name)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			ulong platformId = ctx.Event.User.PlatformId;
			WaypointData waypointData = Database.globalWaypoint.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower());
			if (waypointData != null)
			{
				RemoveWaypoint(platformId, name, waypointData, global: true);
				ctx.Reply("Successfully removed Waypoint.");
				return;
			}
			throw ctx.Error("There is no global waypoint with the name \"" + name + "\".");
		}

		[Command("waypointremove", "wpr", "<Name>", "Removes the specified personal waypoint", null, false)]
		public static void WaypointRemoveCommand(ChatCommandContext ctx, string name)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			ulong SteamID = ctx.Event.User.PlatformId;
			_ = name + "_" + SteamID;
			WaypointData waypointData = Database.waypoints.FirstOrDefault((WaypointData waypoint) => waypoint.Name.ToLower() == name.ToLower() && waypoint.Owner == SteamID);
			if (waypointData != null)
			{
				RemoveWaypoint(SteamID, name, waypointData, global: false);
				ctx.Reply("Successfully removed Waypoint.");
				return;
			}
			throw ctx.Error("There is no waypoint with the name \"" + name + "\".");
		}

		[Command("list", "l", "", "Lists waypoints available to you", null, false)]
		public static void WaypointCommand(ChatCommandContext ctx)
		{
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			foreach (WaypointData item in Database.globalWaypoint)
			{
				ctx.Reply(" - <color=#ffff00>[<color=#00dd00>Global</color>] " + item.Name + "</color>");
				num++;
			}
			foreach (WaypointData item2 in Database.waypoints.Where((WaypointData x) => x.Owner == ctx.Event.User.PlatformId))
			{
				ctx.Reply($" - <color=#ffff00>[<color=#00dd00>{ctx.Event.User.CharacterName}</color>] {item2.Name}</color>");
				num++;
			}
			if (num == 0)
			{
				throw ctx.Error("No waypoint available.");
			}
		}

		public static void AddWaypoint(ulong owner, float3 location, string name, bool isGlobal)
		{
			//IL_0002: 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_000e: Unknown result type (might be due to invalid IL or missing references)
			WaypointData item = new WaypointData(name, owner, location.x, location.y, location.z);
			if (isGlobal)
			{
				Database.globalWaypoint.Add(item);
			}
			else
			{
				Database.waypoints.Add(item);
			}
			if (!isGlobal && Database.waypoints_owned.TryGetValue(owner, out var value))
			{
				Database.waypoints_owned[owner] = value + 1;
			}
			else
			{
				Database.waypoints_owned[owner] = 1;
			}
		}

		public static void RemoveWaypoint(ulong owner, string name, WaypointData waypointData, bool global)
		{
			if (global)
			{
				Database.globalWaypoint.Remove(waypointData);
				return;
			}
			Database.waypoints_owned[owner]--;
			if (Database.waypoints_owned[owner] < 0)
			{
				Database.waypoints_owned[owner] = 0;
			}
			Database.waypoints.Remove(waypointData);
		}

		public static void LoadWaypoints()
		{
			if (!File.Exists(Plugin.WaypointsJson))
			{
				File.WriteAllText(Plugin.WaypointsJson, "[]");
			}
			string json = File.ReadAllText(Plugin.WaypointsJson);
			try
			{
				Database.waypoints = JsonSerializer.Deserialize<List<WaypointData>>(json);
				Plugin.Logger.LogWarning("Waypoints DB Populated");
			}
			catch
			{
				Database.waypoints = new List<WaypointData>();
				Plugin.Logger.LogWarning("Waypoints DB Created");
			}
			if (!File.Exists(Plugin.GlobalWaypointsJson))
			{
				File.WriteAllText(Plugin.GlobalWaypointsJson, "[]");
			}
			json = File.ReadAllText(Plugin.GlobalWaypointsJson);
			try
			{
				Database.globalWaypoint = JsonSerializer.Deserialize<List<WaypointData>>(json);
				Plugin.Logger.LogWarning("GlobalWaypoints DB Populated");
			}
			catch
			{
				Database.globalWaypoint = new List<WaypointData>();
				Plugin.Logger.LogWarning("GlobalWaypoints DB Created");
			}
			if (!File.Exists(Plugin.TotalWaypointsJson))
			{
				File.WriteAllText(Plugin.TotalWaypointsJson, "[]");
			}
			json = File.ReadAllText(Plugin.TotalWaypointsJson);
			try
			{
				Database.waypoints_owned = JsonSerializer.Deserialize<Dictionary<ulong, int>>(json);
				Plugin.Logger.LogWarning("TotalWaypoints DB Populated");
			}
			catch
			{
				Database.waypoints_owned = new Dictionary<ulong, int>();
				Plugin.Logger.LogWarning("TotalWaypoints DB Created");
			}
		}

		public static void SaveWaypoints()
		{
			File.WriteAllText(Plugin.WaypointsJson, JsonSerializer.Serialize(Database.waypoints));
			File.WriteAllText(Plugin.GlobalWaypointsJson, JsonSerializer.Serialize(Database.globalWaypoint));
			File.WriteAllText(Plugin.TotalWaypointsJson, JsonSerializer.Serialize(Database.waypoints_owned));
		}
	}
	[CommandGroup("bloodypoint", "blp")]
	internal class TTPCommands
	{
		private static Dictionary<string, string> TeleportsRequest = new Dictionary<string, string>();

		[Command("teleportoplayer", "tlp", "<PlayerName>", "Teleports you to the specific player.", null, false)]
		public static void TeleportToPlayerCommand(ChatCommandContext ctx, string name)
		{
			//IL_0036: 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_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				UserModel Target = GameData.Users.GetUserByCharacterName(name);
				Users users = GameData.Users;
				User user = ctx.User;
				UserModel Owner = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
				if (Plugin.RequestTeleportPlayer.Value)
				{
					if (!RequestTeleportToPlayer(Owner, Target, out var message))
					{
						throw ctx.Error(message);
					}
					ctx.Reply(message);
				}
				else if (Plugin.Cost.Value)
				{
					if (!RetriveItemsFromInventory(Owner, out var message2))
					{
						throw ctx.Error(message2);
					}
					Action obj = delegate
					{
						//IL_0005: 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_0018: 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_0022: Unknown result type (might be due to invalid IL or missing references)
						//IL_0025: Unknown result type (might be due to invalid IL or missing references)
						//IL_002a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0031: 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_0046: Unknown result type (might be due to invalid IL or missing references)
						EntityManager entityManager2 = Plugin.SystemsCore.EntityManager;
						LocalToWorld componentData2 = ((EntityManager)(ref entityManager2)).GetComponentData<LocalToWorld>(Target.Character.Entity);
						float3 position2 = ((LocalToWorld)(ref componentData2)).Position;
						Helper.TeleportTo(((EntityModel)Owner).Entity, Owner.Character.Entity, position2);
						ctx.Reply("Successfully teleport the " + FontColorChatSystem.White(name ?? "") + " player to your position.");
					};
					BuffSystem.BuffPlayer(Owner.Character.Entity, ((EntityModel)Owner).Entity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					CoroutineHandler.StartGenericCoroutine(obj, 5f);
				}
				else
				{
					Action obj2 = delegate
					{
						//IL_0005: 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_0018: 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_0022: Unknown result type (might be due to invalid IL or missing references)
						//IL_0025: Unknown result type (might be due to invalid IL or missing references)
						//IL_002a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0031: 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_0046: Unknown result type (might be due to invalid IL or missing references)
						EntityManager entityManager = Plugin.SystemsCore.EntityManager;
						LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(Target.Character.Entity);
						float3 position = ((LocalToWorld)(ref componentData)).Position;
						Helper.TeleportTo(((EntityModel)Owner).Entity, Owner.Character.Entity, position);
						ctx.Reply("Successfully teleport the " + FontColorChatSystem.White(name ?? "") + " player to your position.");
					};
					BuffSystem.BuffPlayer(Owner.Character.Entity, ((EntityModel)Owner).Entity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					CoroutineHandler.StartGenericCoroutine(obj2, 5f);
				}
			}
			catch (Exception ex)
			{
				throw ctx.Error(ex.Message);
			}
		}

		[Command("teleportaccept", "tla", "<PlayerName>", "Accept teleport request from a player.", null, false)]
		public static void AceptTeleportCommand(ChatCommandContext ctx, string name)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Users users = GameData.Users;
				User user = ctx.User;
				UserModel Target = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
				UserModel Owner = GameData.Users.GetUserByCharacterName(name);
				if (!TeleportsRequest.TryGetValue(Owner.CharacterName, out var value) && value != Target.CharacterName)
				{
					throw ctx.Error("You do not have any teleport requests from " + FontColorChatSystem.White(name ?? ""));
				}
				if (Plugin.Cost.Value)
				{
					if (!RetriveItemsFromInventory(Owner, out var message))
					{
						throw ctx.Error(message);
					}
					Action obj = delegate
					{
						//IL_0005: 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_0018: 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_0022: Unknown result type (might be due to invalid IL or missing references)
						//IL_0025: Unknown result type (might be due to invalid IL or missing references)
						//IL_002a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0031: 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_0046: Unknown result type (might be due to invalid IL or missing references)
						EntityManager entityManager2 = Plugin.SystemsCore.EntityManager;
						LocalToWorld componentData2 = ((EntityManager)(ref entityManager2)).GetComponentData<LocalToWorld>(Target.Character.Entity);
						float3 position2 = ((LocalToWorld)(ref componentData2)).Position;
						Helper.TeleportTo(((EntityModel)Owner).Entity, Owner.Character.Entity, position2);
						ctx.Reply("Successfully teleport the " + FontColorChatSystem.White(name ?? "") + " player to your position.");
					};
					BuffSystem.BuffPlayer(Owner.Character.Entity, ((EntityModel)Owner).Entity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					BuffSystem.BuffPlayer(Target.Character.Entity, ((EntityModel)Target).Entity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					CoroutineHandler.StartGenericCoroutine(obj, 5f);
				}
				else
				{
					Action obj2 = delegate
					{
						//IL_0005: 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_0018: 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_0022: Unknown result type (might be due to invalid IL or missing references)
						//IL_0025: Unknown result type (might be due to invalid IL or missing references)
						//IL_002a: Unknown result type (might be due to invalid IL or missing references)
						//IL_0031: 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_0046: Unknown result type (might be due to invalid IL or missing references)
						EntityManager entityManager = Plugin.SystemsCore.EntityManager;
						LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(Target.Character.Entity);
						float3 position = ((LocalToWorld)(ref componentData)).Position;
						Helper.TeleportTo(((EntityModel)Owner).Entity, Owner.Character.Entity, position);
						ctx.Reply("Successfully teleport the " + FontColorChatSystem.White(name ?? "") + " player to your position.");
					};
					BuffSystem.BuffPlayer(Owner.Character.Entity, ((EntityModel)Owner).Entity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					BuffSystem.BuffPlayer(Target.Character.Entity, ((EntityModel)Target).Entity, Prefabs.Buff_Vampire_Dracula_BloodCurse, 5, false);
					CoroutineHandler.StartGenericCoroutine(obj2, 5f);
				}
			}
			catch (Exception ex)
			{
				throw ctx.Error(ex.Message);
			}
		}

		[Command("cast", null, null, "Used for debugging", null, true)]
		public static void CastCommand(ChatCommandContext ctx, int intprefabGuid)
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0048: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: 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_006d: 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_007f: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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)
			PrefabGUID abilityGroup = default(PrefabGUID);
			((PrefabGUID)(ref abilityGroup))..ctor(intprefabGuid);
			Users users = GameData.Users;
			User user = ctx.Event.User;
			UserModel userByCharacterName = users.GetUserByCharacterName(((FixedString64Bytes)(ref user.CharacterName)).Value);
			EntityManager entityManager = VWorld.Server.EntityManager;
			FromCharacter componentData = ((EntityManager)(ref entityManager)).GetComponentData<FromCharacter>(((EntityModel)userByCharacterName).Entity);
			CastAbilityServerDebugEvent val = default(CastAbilityServerDebugEvent);
			val.AbilityGroup = abilityGroup;
			val.AimPosition = new Nullable_Unboxed<float3>(ECSExtensions.Read<EntityInput>(((EntityModel)userByCharacterName).Entity).AimPosition);
			val.Who = ECSExtensions.Read<NetworkId>(ctx.Event.SenderCharacterEntity);
			CastAbilityServerDebugEvent val2 = val;
			Plugin.SystemsCore.DebugEventsSystem.CastAbilityServerDebugEvent(ECSExtensions.Read<User>(ctx.Event.SenderUserEntity).Index, ref val2, ref componentData);
		}

		internal static bool RequestTeleport(UserModel playerRequest, UserModel playerTarget, out string message)
		{
			//IL_0075: 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)
			if (TeleportsRequest.TryGetValue(playerRequest.CharacterName, out var value))
			{
				if (value == playerTarget.CharacterName)
				{
					message = "You already have an active request for the player " + FontColorChatSystem.White(playerTarget.CharacterName ?? "") + ".";
					return false;
				}
				TeleportsRequest.Remove(playerRequest.CharacterName);
			}
			TeleportsRequest.Add(playerRequest.CharacterName, playerTarget.CharacterName);
			ServerChatUtils.SendSystemMessageToClient(Plugin.SystemsCore.EntityManager, ((EntityModel)playerTarget).Internals.User.Value, FontColorChatSystem.White(playerRequest.CharacterName ?? "") + " has asked you to teleport to your position. If you want to accept it write " + FontColorChatSystem.White(".blp tla " + playerRequest.CharacterName));
			message = "The teleport request has been successfully sent to player " + FontColorChatSystem.White(playerTarget.CharacterName ?? "");
			return true;
		}

		internal static bool RequestTeleportToPlayer(UserModel playerRequest, UserModel playerTarget, out string message)
		{
			try
			{
				if (RequestTeleport(playerRequest, playerTarget, out var message2))
				{
					message = message2;
					return true;
				}
				message = message2;
				return false;
			}
			catch (Exception ex)
			{
				message = ex.Message;
				return false;
			}
		}

		internal static bool RetriveItemsFromInventory(UserModel playerRequest, out string message)
		{
			//IL_000f: 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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: 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_00c3: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: 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_00f0: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ItemModel prefabById = GameData.Items.GetPrefabById(new PrefabGUID(Plugin.PrefabGUID.Value));
				Entity entity = playerRequest.Character.Entity;
				int inventorySize = InventoryUtilities.GetInventorySize(Plugin.SystemsCore.EntityManager, entity);
				_ = Plugin.SystemsCore.GameDataSystem;
				int num = Plugin.Amount.Value;
				InventoryBuffer val = default(InventoryBuffer);
				for (int i = 0; i < inventorySize; i++)
				{
					if (!InventoryUtilities.TryGetItemAtSlot(Plugin.SystemsCore.EntityManager, entity, i, ref val))
					{
						continue;
					}
					ItemModel prefabById2 = GameData.Items.GetPrefabById(val.ItemType);
					if (prefabById2 != null && prefabById2.PrefabName == prefabById.PrefabName)
					{
						if (val.Amount >= num)
						{
							InventoryUtilitiesServer.TryRemoveItemAtIndex(Plugin.SystemsCore.EntityManager, entity, val.ItemType, num, i, false);
							num = 0;
							break;
						}
						if (val.Amount < num)
						{
							InventoryUtilitiesServer.TryRemoveItemAtIndex(Plugin.SystemsCore.EntityManager, entity, val.ItemType, val.Amount, i, true);
							num -= val.Amount;
						}
						if (num == 0)
						{
							break;
						}
					}
				}
				if (num > 0)
				{
					message = "You do not have the necessary amount of " + Plugin.PrefabName.Value + " in your inventory to perform this action";
					AdditemToInventory(playerRequest.CharacterName, ((EntityModel)prefabById).PrefabGUID, Plugin.Amount.Value - num);
					return false;
				}
				message = "";
				return true;
			}
			catch (Exception ex)
			{
				message = ex.Message;
				return false;
			}
		}

		public static bool AdditemToInventory(string characterName, PrefabGUID prefabGUID, int quantity)
		{
			//IL_000d: 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)
			try
			{
				UserModel userByCharacterName = GameData.Users.GetUserByCharacterName(characterName);
				Entity val = default(Entity);
				if (!UserModelMethods.TryGiveItem(userByCharacterName, prefabGUID, quantity, ref val))
				{
					UserModelMethods.DropItemNearby(userByCharacterName, prefabGUID, quantity);
				}
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Logger.LogError("Error " + ex.Message);
				return false;
			}
		}
	}
}