Decompiled source of simpleTP v1.3.2

plugins/PeakTp/com.github.wwshare.peaktp.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Newtonsoft.Json;
using PeakTp.Patches;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("wwshare")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("PEAK 玩家传送面板:玩家搜索、分类、收藏、名称核对、单人/批量传送、Ping 标点与篝火传送。")]
[assembly: AssemblyFileVersion("1.3.2.0")]
[assembly: AssemblyInformationalVersion("1.3.2")]
[assembly: AssemblyProduct("PEAK 玩家传送面板")]
[assembly: AssemblyTitle("com.github.wwshare.peaktp")]
[assembly: AssemblyVersion("1.3.2.0")]
namespace PeakTp
{
	internal sealed class CampfireEntry
	{
		internal string Key;

		internal Campfire Campfire;

		internal string Name;

		internal Vector3 Position;

		internal float Distance;

		internal bool Lit;

		internal string Detail;
	}
	internal static class CampfireRoster
	{
		internal static readonly List<CampfireEntry> Entries = new List<CampfireEntry>();

		private static Campfire[] _cache = (Campfire[])(object)new Campfire[0];

		private static float _nextScanAt = -1f;

		private static int _scanFrame = -1;

		internal static void Tick()
		{
			if (Time.frameCount != _scanFrame)
			{
				_scanFrame = Time.frameCount;
				if (Time.unscaledTime >= _nextScanAt)
				{
					Refresh();
				}
			}
		}

		internal static void RefreshNow()
		{
			_nextScanAt = -1f;
			Refresh();
		}

		internal static CampfireEntry Find(string key)
		{
			if (string.IsNullOrEmpty(key))
			{
				return null;
			}
			for (int i = 0; i < Entries.Count; i++)
			{
				if (string.Equals(Entries[i].Key, key, StringComparison.Ordinal))
				{
					return Entries[i];
				}
			}
			return null;
		}

		internal static Vector3 SafeCenter(Campfire campfire)
		{
			//IL_004c: 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_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0016: 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_002f: 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_003e: 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_0048: 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_0020: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)campfire == (Object)null)
			{
				return Vector3.zero;
			}
			try
			{
				Vector3 val = campfire.Center();
				if (PingMarker.IsFinite(val))
				{
					return val;
				}
			}
			catch
			{
			}
			try
			{
				return ((Component)campfire).transform.position + Vector3.up * 0.5f;
			}
			catch
			{
				return Vector3.zero;
			}
		}

		internal static Vector3 TeleportPosition(CampfireEntry entry, int ring)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0003: 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_0054: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			if (entry == null)
			{
				return Vector3.zero;
			}
			Vector3 val = entry.Position + Vector3.up * 0.85f;
			if (ring <= 0)
			{
				return val;
			}
			float num = (float)ring * 2.39996f;
			float num2 = 0.55f + 0.45f * (float)ring;
			return val + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * num2;
		}

		private static void Refresh()
		{
			//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_0050: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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)
			_nextScanAt = Time.unscaledTime + 3f;
			try
			{
				_cache = Object.FindObjectsByType<Campfire>((FindObjectsSortMode)0);
			}
			catch
			{
				_cache = (Campfire[])(object)new Campfire[0];
			}
			Entries.Clear();
			Character localCharacter = Character.localCharacter;
			Vector3 val = Vector3.zero;
			if ((Object)(object)localCharacter != (Object)null)
			{
				try
				{
					val = ((Component)localCharacter).transform.position;
				}
				catch
				{
				}
			}
			for (int i = 0; i < _cache.Length; i++)
			{
				Campfire val2 = _cache[i];
				if ((Object)(object)val2 == (Object)null)
				{
					continue;
				}
				Vector3 val3 = SafeCenter(val2);
				if (!(val3 == Vector3.zero))
				{
					string text;
					try
					{
						text = val2.GetName();
					}
					catch
					{
						text = string.Empty;
					}
					if (string.IsNullOrEmpty(text))
					{
						text = "篝火";
					}
					bool flag;
					try
					{
						flag = val2.Lit;
					}
					catch
					{
						flag = false;
					}
					float distance = (((Object)(object)localCharacter != (Object)null) ? Vector3.Distance(val, val3) : 0f);
					CampfireEntry campfireEntry = new CampfireEntry
					{
						Key = "cf-" + SafeInstanceId(val2),
						Campfire = val2,
						Name = NameUtil.Clean(text),
						Position = val3,
						Distance = distance,
						Lit = flag
					};
					campfireEntry.Detail = "标记点 · " + (flag ? "燃烧中" : "熄灭") + " · " + distance.ToString("0") + "m";
					Entries.Add(campfireEntry);
				}
			}
			Entries.Sort(Compare);
		}

		private static int Compare(CampfireEntry a, CampfireEntry b)
		{
			int num = a.Distance.CompareTo(b.Distance);
			if (num != 0)
			{
				return num;
			}
			return string.Compare(a.Name, b.Name, StringComparison.OrdinalIgnoreCase);
		}

		private static string SafeInstanceId(Campfire campfire)
		{
			try
			{
				return ((Object)campfire).GetInstanceID().ToString();
			}
			catch
			{
				return "0";
			}
		}
	}
	internal sealed class FavoriteRecord
	{
		public string Id { get; set; }

		public ulong SteamId { get; set; }

		public string PhotonUserId { get; set; }

		public string PhotonName { get; set; }

		public string SteamName { get; set; }

		public string Note { get; set; }

		public string AddedUtc { get; set; }

		public string LastSeenUtc { get; set; }

		internal bool NameMismatch
		{
			get
			{
				if (string.IsNullOrEmpty(PhotonName) || string.IsNullOrEmpty(SteamName))
				{
					return false;
				}
				return !NameUtil.NamesEqual(PhotonName, SteamName);
			}
		}

		internal string DisplayName
		{
			get
			{
				string text = NameUtil.Clean(PhotonName);
				if (text.Length > 0)
				{
					return text;
				}
				string text2 = NameUtil.Clean(SteamName);
				if (text2.Length > 0)
				{
					return text2;
				}
				return "未知玩家";
			}
		}

		internal FavoriteRecord Clone()
		{
			return new FavoriteRecord
			{
				Id = Id,
				SteamId = SteamId,
				PhotonUserId = PhotonUserId,
				PhotonName = PhotonName,
				SteamName = SteamName,
				Note = Note,
				AddedUtc = AddedUtc,
				LastSeenUtc = LastSeenUtc
			};
		}
	}
	internal sealed class FavoritesFile
	{
		public int Version { get; set; }

		public List<FavoriteRecord> Favorites { get; set; }
	}
	internal static class Favorites
	{
		private const int FileVersion = 1;

		private const int MaxRecords = 500;

		private const float SaveDelay = 3f;

		internal static readonly List<FavoriteRecord> Records = new List<FavoriteRecord>();

		private static string _filePath;

		private static bool _loaded;

		private static bool _dirty;

		private static float _nextSaveAt = -1f;

		internal static string FilePath => _filePath ?? string.Empty;

		internal static event Action Changed;

		internal static void Init()
		{
			string text = Path.Combine(Paths.ConfigPath, "com.github.wwshare.peaktp");
			try
			{
				Directory.CreateDirectory(text);
			}
			catch (Exception ex)
			{
				Plugin.LogWarning("无法创建收藏目录 " + text + ":" + ex.Message);
			}
			_filePath = Path.Combine(text, "favorites.json");
			Load();
		}

		internal static void Tick()
		{
			if (_dirty && _nextSaveAt > 0f && Time.unscaledTime >= _nextSaveAt)
			{
				SaveNow();
			}
		}

		internal static bool Contains(PlayerEntry entry)
		{
			return FindFor(entry) != null;
		}

		internal static FavoriteRecord FindFor(PlayerEntry entry)
		{
			if (entry == null)
			{
				return null;
			}
			for (int i = 0; i < Records.Count; i++)
			{
				if (Matches(Records[i], entry))
				{
					return Records[i];
				}
			}
			return null;
		}

		internal static FavoriteRecord FindById(string id)
		{
			if (string.IsNullOrEmpty(id))
			{
				return null;
			}
			for (int i = 0; i < Records.Count; i++)
			{
				if (string.Equals(Records[i].Id, id, StringComparison.Ordinal))
				{
					return Records[i];
				}
			}
			return null;
		}

		internal static bool Toggle(PlayerEntry entry)
		{
			if (entry == null)
			{
				return false;
			}
			FavoriteRecord favoriteRecord = FindFor(entry);
			if (favoriteRecord != null)
			{
				Remove(favoriteRecord);
				return false;
			}
			Add(entry);
			return true;
		}

		internal static bool Remove(FavoriteRecord record)
		{
			if (record == null)
			{
				return false;
			}
			bool num = Records.Remove(record);
			if (num)
			{
				MarkDirty();
				RaiseChanged();
			}
			return num;
		}

		internal static void Add(PlayerEntry entry)
		{
			if (entry == null)
			{
				return;
			}
			FavoriteRecord favoriteRecord = new FavoriteRecord
			{
				Id = BuildId(entry),
				SteamId = entry.SteamId,
				PhotonUserId = (entry.PhotonUserId ?? string.Empty),
				PhotonName = ((entry.PhotonName.Length > 0) ? entry.PhotonName : NameUtil.Clean(entry.RawPhotonName)),
				SteamName = (entry.SteamName ?? string.Empty),
				Note = string.Empty,
				AddedUtc = DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture),
				LastSeenUtc = DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture)
			};
			for (int num = Records.Count - 1; num >= 0; num--)
			{
				if (string.Equals(Records[num].Id, favoriteRecord.Id, StringComparison.Ordinal))
				{
					Records.RemoveAt(num);
				}
			}
			Records.Add(favoriteRecord);
			Trim();
			MarkDirty();
			RaiseChanged();
		}

		internal static void NoteSeen(PlayerEntry entry)
		{
			if (entry == null)
			{
				return;
			}
			FavoriteRecord favoriteRecord = FindFor(entry);
			if (favoriteRecord == null)
			{
				return;
			}
			bool flag = false;
			if (favoriteRecord.SteamId == 0L && entry.SteamId != 0L)
			{
				favoriteRecord.SteamId = entry.SteamId;
				string text = "steam-" + entry.SteamId.ToString(CultureInfo.InvariantCulture);
				if (!string.Equals(favoriteRecord.Id, text, StringComparison.Ordinal))
				{
					favoriteRecord.Id = text;
					flag = true;
				}
			}
			if (!string.IsNullOrEmpty(entry.PhotonUserId) && !string.Equals(favoriteRecord.PhotonUserId, entry.PhotonUserId, StringComparison.Ordinal))
			{
				favoriteRecord.PhotonUserId = entry.PhotonUserId;
				flag = true;
			}
			if (entry.PhotonName.Length > 0 && !string.Equals(NameUtil.Clean(favoriteRecord.PhotonName), entry.PhotonName, StringComparison.Ordinal))
			{
				favoriteRecord.PhotonName = entry.PhotonName;
				flag = true;
			}
			if (entry.SteamName.Length > 0 && !string.Equals(NameUtil.Clean(favoriteRecord.SteamName), entry.SteamName, StringComparison.Ordinal))
			{
				favoriteRecord.SteamName = entry.SteamName;
				flag = true;
			}
			if (flag || string.IsNullOrEmpty(favoriteRecord.LastSeenUtc) || (DateTime.UtcNow - ParseUtc(favoriteRecord.LastSeenUtc)).TotalSeconds > 60.0)
			{
				favoriteRecord.LastSeenUtc = DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture);
				MarkDirty();
			}
		}

		internal static void SaveNow()
		{
			if (!_dirty || string.IsNullOrEmpty(_filePath))
			{
				return;
			}
			_dirty = false;
			_nextSaveAt = -1f;
			try
			{
				FavoritesFile favoritesFile = new FavoritesFile
				{
					Version = 1,
					Favorites = new List<FavoriteRecord>()
				};
				for (int i = 0; i < Records.Count; i++)
				{
					favoritesFile.Favorites.Add(Records[i].Clone());
				}
				string contents = JsonConvert.SerializeObject((object)favoritesFile, (Formatting)1);
				string text = _filePath + ".tmp";
				File.WriteAllText(text, contents, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
				if (File.Exists(_filePath))
				{
					try
					{
						File.Replace(text, _filePath, null);
						return;
					}
					catch
					{
						File.Copy(text, _filePath, overwrite: true);
						File.Delete(text);
						return;
					}
				}
				File.Move(text, _filePath);
			}
			catch (Exception ex)
			{
				_dirty = true;
				_nextSaveAt = Time.unscaledTime + 10f;
				Plugin.LogWarning("保存收藏失败:" + ex.Message);
			}
		}

		private static void Load()
		{
			if (_loaded)
			{
				return;
			}
			_loaded = true;
			if (string.IsNullOrEmpty(_filePath) || !File.Exists(_filePath))
			{
				return;
			}
			try
			{
				FavoritesFile favoritesFile = JsonConvert.DeserializeObject<FavoritesFile>(File.ReadAllText(_filePath, Encoding.UTF8));
				if (favoritesFile == null || favoritesFile.Favorites == null)
				{
					return;
				}
				Records.Clear();
				HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal);
				for (int i = 0; i < favoritesFile.Favorites.Count; i++)
				{
					FavoriteRecord favoriteRecord = favoritesFile.Favorites[i];
					if (favoriteRecord == null)
					{
						continue;
					}
					favoriteRecord.PhotonName = NameUtil.Clean(favoriteRecord.PhotonName);
					favoriteRecord.SteamName = NameUtil.Clean(favoriteRecord.SteamName);
					if (string.IsNullOrEmpty(favoriteRecord.Id))
					{
						favoriteRecord.Id = BuildRecordId(favoriteRecord);
					}
					if (!string.IsNullOrEmpty(favoriteRecord.Id) && hashSet.Add(favoriteRecord.Id))
					{
						if (string.IsNullOrEmpty(favoriteRecord.AddedUtc))
						{
							favoriteRecord.AddedUtc = DateTime.UtcNow.ToString("o", CultureInfo.InvariantCulture);
						}
						Records.Add(favoriteRecord);
					}
				}
				Trim();
			}
			catch (Exception ex)
			{
				Plugin.LogWarning("读取收藏失败,已备份旧文件:" + ex.Message);
				try
				{
					string text = _filePath + ".bad";
					if (File.Exists(text))
					{
						File.Delete(text);
					}
					File.Move(_filePath, text);
				}
				catch
				{
				}
				Records.Clear();
			}
			RaiseChanged();
		}

		private static string BuildRecordId(FavoriteRecord record)
		{
			if (record.SteamId != 0L)
			{
				return "steam-" + record.SteamId.ToString(CultureInfo.InvariantCulture);
			}
			if (!string.IsNullOrWhiteSpace(record.PhotonUserId))
			{
				return "photon-" + PlayerEntry.SanitizeKey(record.PhotonUserId);
			}
			string text = ((!string.IsNullOrEmpty(record.PhotonName)) ? record.PhotonName : record.SteamName);
			if (!string.IsNullOrEmpty(text))
			{
				return "name-" + PlayerEntry.SanitizeKey(NameUtil.Normalize(text));
			}
			return string.Empty;
		}

		private static string BuildId(PlayerEntry entry)
		{
			string text = PlayerEntry.BuildKey(entry.SteamId, entry.PhotonUserId, entry.PhotonName);
			if (text == "unknown")
			{
				text = "name-" + PlayerEntry.SanitizeKey(NameUtil.Normalize(entry.DisplayName));
			}
			return text;
		}

		private static bool Matches(FavoriteRecord record, PlayerEntry entry)
		{
			if (record.SteamId != 0L && entry.SteamId != 0L && record.SteamId == entry.SteamId)
			{
				return true;
			}
			if (!string.IsNullOrEmpty(record.PhotonUserId) && !string.IsNullOrEmpty(entry.PhotonUserId) && string.Equals(record.PhotonUserId, entry.PhotonUserId, StringComparison.Ordinal))
			{
				return true;
			}
			if (record.SteamId == 0L && string.IsNullOrEmpty(record.PhotonUserId) && entry.SteamId == 0L && string.IsNullOrEmpty(entry.PhotonUserId))
			{
				if (!NameUtil.NamesEqual(record.PhotonName, entry.PhotonName))
				{
					return NameUtil.NamesEqual(record.SteamName, entry.PhotonName);
				}
				return true;
			}
			return false;
		}

		private static void Trim()
		{
			if (Records.Count > 500)
			{
				Records.Sort((FavoriteRecord a, FavoriteRecord b) => ParseUtc(b.LastSeenUtc).CompareTo(ParseUtc(a.LastSeenUtc)));
				Records.RemoveRange(500, Records.Count - 500);
				MarkDirty();
			}
		}

		private static DateTime ParseUtc(string value)
		{
			if (!DateTime.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out var result))
			{
				return DateTime.MinValue;
			}
			return result;
		}

		private static void MarkDirty()
		{
			_dirty = true;
			_nextSaveAt = Time.unscaledTime + 3f;
		}

		private static void RaiseChanged()
		{
			Action changed = Favorites.Changed;
			if (changed != null)
			{
				try
				{
					changed();
				}
				catch (Exception ex)
				{
					Plugin.LogWarning("收藏变更回调异常:" + ex.Message);
				}
			}
		}
	}
	internal static class KeyUtil
	{
		private static bool _useLegacy = true;

		private static readonly KeyCode[] CaptureCandidates = BuildCaptureCandidates();

		internal static bool GetKeyDown(KeyCode key)
		{
			//IL_0000: 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_002e: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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)
			if ((int)key == 0)
			{
				return false;
			}
			if (_useLegacy)
			{
				try
				{
					return Input.GetKeyDown(key);
				}
				catch (InvalidOperationException)
				{
					_useLegacy = false;
				}
				catch (Exception)
				{
					return false;
				}
			}
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return false;
			}
			Key val = MapKey(key);
			if ((int)val == 0)
			{
				return false;
			}
			return ((ButtonControl)current[val]).wasPressedThisFrame;
		}

		internal static bool GetKey(KeyCode key)
		{
			//IL_0000: 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_002e: 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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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)
			if ((int)key == 0)
			{
				return false;
			}
			if (_useLegacy)
			{
				try
				{
					return Input.GetKey(key);
				}
				catch (InvalidOperationException)
				{
					_useLegacy = false;
				}
				catch (Exception)
				{
					return false;
				}
			}
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return false;
			}
			Key val = MapKey(key);
			if ((int)val != 0)
			{
				return ((ButtonControl)current[val]).isPressed;
			}
			return false;
		}

		internal static bool AnyKeyDown()
		{
			if (_useLegacy)
			{
				try
				{
					return Input.anyKeyDown;
				}
				catch (InvalidOperationException)
				{
					_useLegacy = false;
				}
				catch (Exception)
				{
					return false;
				}
			}
			Keyboard current = Keyboard.current;
			if (current != null)
			{
				return ((ButtonControl)current.anyKey).wasPressedThisFrame;
			}
			return false;
		}

		internal static bool TryCaptureKey(out KeyCode key)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_0014: 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_001f: Expected I4, but got Unknown
			key = (KeyCode)0;
			for (int i = 0; i < CaptureCandidates.Length; i++)
			{
				KeyCode val = CaptureCandidates[i];
				if ((int)val != 27 && GetKeyDown(val))
				{
					key = (KeyCode)(int)val;
					return true;
				}
			}
			return false;
		}

		internal static bool IsBindable(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected I4, but got Unknown
			if ((int)key == 0 || (int)key == 27)
			{
				return false;
			}
			int num = (int)key;
			if (num > 0)
			{
				return num < 323;
			}
			return false;
		}

		internal unsafe static string Describe(KeyCode key)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected I4, but got Unknown
			return (key - 48) switch
			{
				0 => "0", 
				1 => "1", 
				2 => "2", 
				3 => "3", 
				4 => "4", 
				5 => "5", 
				6 => "6", 
				7 => "7", 
				8 => "8", 
				9 => "9", 
				_ => ((object)(*(KeyCode*)(&key))/*cast due to .constrained prefix*/).ToString(), 
			};
		}

		private static KeyCode[] BuildCaptureCandidates()
		{
			KeyCode[] array = new KeyCode[45];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			KeyCode[] array2 = (KeyCode[])(object)array;
			KeyCode[] array3 = new KeyCode[10];
			RuntimeHelpers.InitializeArray(array3, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			KeyCode[] array4 = (KeyCode[])(object)array3;
			KeyCode[] array5 = (KeyCode[])(object)new KeyCode[26];
			for (int i = 0; i < array5.Length; i++)
			{
				array5[i] = (KeyCode)(97 + i);
			}
			KeyCode[] array6 = (KeyCode[])(object)new KeyCode[array2.Length + array4.Length + array5.Length];
			Array.Copy(array2, 0, array6, 0, array2.Length);
			Array.Copy(array4, 0, array6, array2.Length, array4.Length);
			Array.Copy(array5, 0, array6, array2.Length + array4.Length, array5.Length);
			return array6;
		}

		private unsafe static Key MapKey(KeyCode code)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Invalid comparison between Unknown and I4
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Invalid comparison between Unknown and I4
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0026: 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_0076: Expected I4, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Invalid comparison between Unknown and I4
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Invalid comparison between Unknown and I4
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Invalid comparison between Unknown and I4
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Invalid comparison between Unknown and I4
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			if ((int)code >= 48 && (int)code <= 57)
			{
				return (Key)(50 + (code - 48));
			}
			if ((int)code <= 96)
			{
				if ((int)code == 13)
				{
					return (Key)2;
				}
				if ((int)code == 96)
				{
					return (Key)4;
				}
			}
			else
			{
				switch (code - 256)
				{
				case 0:
					return (Key)84;
				case 1:
					return (Key)85;
				case 2:
					return (Key)86;
				case 3:
					return (Key)87;
				case 4:
					return (Key)88;
				case 5:
					return (Key)89;
				case 6:
					return (Key)90;
				case 7:
					return (Key)91;
				case 8:
					return (Key)92;
				case 9:
					return (Key)93;
				case 10:
					return (Key)82;
				case 11:
					return (Key)78;
				case 12:
					return (Key)79;
				case 13:
					return (Key)81;
				case 14:
					return (Key)80;
				case 15:
					return (Key)77;
				case 16:
					return (Key)83;
				}
				if ((int)code == 300)
				{
					return (Key)73;
				}
				if ((int)code == 316)
				{
					return (Key)74;
				}
			}
			if (Enum.TryParse<Key>(((object)(*(KeyCode*)(&code))/*cast due to .constrained prefix*/).ToString(), ignoreCase: true, out Key result))
			{
				return result;
			}
			return (Key)0;
		}
	}
	internal static class NameUtil
	{
		private const char SectionSign = '§';

		private const string CodeChars = "0123456789abcdefklmnorABCDEFKLMNOR";

		internal static string Clean(string raw)
		{
			if (string.IsNullOrEmpty(raw))
			{
				return string.Empty;
			}
			string text = StripRichText(raw);
			bool flag = text.IndexOf('§') >= 0;
			bool flag2 = LooksLikeAmpersandFormatted(text);
			if (flag || flag2)
			{
				text = StripLegacyCodes(text, flag2);
			}
			text = StripBraceColor(text);
			text = StripLeadingHexColor(text);
			text = RemoveInvisible(text);
			return CollapseWhitespace(text).Trim();
		}

		internal static string Normalize(string raw)
		{
			string text = Clean(raw);
			if (text.Length == 0)
			{
				return string.Empty;
			}
			string text2 = text.ToLowerInvariant();
			StringBuilder stringBuilder = new StringBuilder(text2.Length);
			bool flag = false;
			foreach (char c in text2)
			{
				if (char.IsWhiteSpace(c))
				{
					if (!flag && stringBuilder.Length > 0)
					{
						stringBuilder.Append(' ');
						flag = true;
					}
				}
				else
				{
					flag = false;
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString().Trim();
		}

		internal static bool NamesEqual(string a, string b)
		{
			string text = Normalize(a);
			string text2 = Normalize(b);
			if (text.Length == 0 || text2.Length == 0)
			{
				return false;
			}
			return string.Equals(text, text2, StringComparison.Ordinal);
		}

		internal static bool HasFormatting(string raw)
		{
			if (string.IsNullOrEmpty(raw))
			{
				return false;
			}
			if (raw.IndexOf('<') >= 0 || raw.IndexOf('§') >= 0)
			{
				return true;
			}
			if (!LooksLikeAmpersandFormatted(raw))
			{
				return StripBraceColor(raw) != raw;
			}
			return true;
		}

		internal static bool IsPlaceholderName(string value, ulong steamId)
		{
			if (string.IsNullOrWhiteSpace(value))
			{
				return true;
			}
			string text = value.Trim().Trim('[', ']', '<', '>').Trim();
			if (text.Length == 0)
			{
				return true;
			}
			if (string.Equals(text, "unknown", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "none", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "null", StringComparison.OrdinalIgnoreCase) || string.Equals(text, "[unknown]", StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
			if (steamId != 0L && text.Length >= 15 && ulong.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && result == steamId)
			{
				return true;
			}
			return false;
		}

		private static string StripRichText(string value)
		{
			StringBuilder stringBuilder = new StringBuilder(value.Length);
			int num = 0;
			while (num < value.Length)
			{
				char c = value[num];
				if (c == '<')
				{
					int num2 = value.IndexOf('>', num + 1);
					if (num2 > num + 1)
					{
						num = num2 + 1;
						continue;
					}
				}
				stringBuilder.Append(c);
				num++;
			}
			return stringBuilder.ToString();
		}

		private static bool LooksLikeAmpersandFormatted(string value)
		{
			int num = 0;
			for (int i = 0; i + 1 < value.Length; i++)
			{
				if (value[i] == '&')
				{
					char c = value[i + 1];
					if (c == '#' && IsHexRun(value, i + 2, 6))
					{
						num += 2;
					}
					else if (IsCodeChar(c))
					{
						num++;
					}
				}
			}
			if (num >= 2)
			{
				return true;
			}
			if (!value.EndsWith("&r", StringComparison.OrdinalIgnoreCase))
			{
				return value.EndsWith("&R", StringComparison.Ordinal);
			}
			return true;
		}

		private static string StripLegacyCodes(string value, bool stripAmpersand)
		{
			StringBuilder stringBuilder = new StringBuilder(value.Length);
			int num = 0;
			while (num < value.Length)
			{
				char c = value[num];
				if (c == '§' || (stripAmpersand && c == '&'))
				{
					if (num + 1 < value.Length)
					{
						char c2 = value[num + 1];
						if (c2 == '#' && IsHexRun(value, num + 2, 6))
						{
							num += 8;
							continue;
						}
						if ((c2 == 'x' || c2 == 'X') && IsHexRun(value, num + 2, 6))
						{
							num += 8;
							continue;
						}
						if (IsCodeChar(c2))
						{
							num += 2;
							continue;
						}
					}
					if (c == '§')
					{
						num++;
						continue;
					}
					stringBuilder.Append(c);
					num++;
				}
				else
				{
					stringBuilder.Append(c);
					num++;
				}
			}
			return stringBuilder.ToString();
		}

		private static string StripBraceColor(string value)
		{
			if (value.Length < 8 || value[0] != '{')
			{
				return value;
			}
			int num = value.IndexOf('}', 1);
			if (num < 0)
			{
				return value;
			}
			string text = value.Substring(1, num - 1);
			if (text.Length == 7 && text[0] == '#' && IsHexRun(text, 1, 6))
			{
				return value.Substring(num + 1).TrimStart();
			}
			if (text.Length == 6 && IsHexRun(text, 0, 6))
			{
				return value.Substring(num + 1).TrimStart();
			}
			return value;
		}

		private static string StripLeadingHexColor(string value)
		{
			string text = value;
			if (text.Length > 9 && text[0] == '[' && text[1] == '#' && text.IndexOf(']', 2) == 8 && IsHexRun(text, 2, 6))
			{
				text = text.Substring(9).TrimStart();
			}
			if (text.Length > 7 && text[0] == '#' && IsHexRun(text, 1, 6) && !IsHexChar(text[7]))
			{
				text = text.Substring(7);
				if (text.Length > 0 && (text[0] == ' ' || text[0] == ':' || text[0] == '-' || text[0] == '_'))
				{
					text = text.Substring(1);
				}
				text = text.TrimStart();
			}
			return text;
		}

		private static bool IsHexRun(string value, int start, int count)
		{
			if (start < 0 || start + count > value.Length)
			{
				return false;
			}
			for (int i = start; i < start + count; i++)
			{
				if (!IsHexChar(value[i]))
				{
					return false;
				}
			}
			return true;
		}

		private static bool IsHexChar(char c)
		{
			if ((c < '0' || c > '9') && (c < 'a' || c > 'f'))
			{
				if (c >= 'A')
				{
					return c <= 'F';
				}
				return false;
			}
			return true;
		}

		private static bool IsCodeChar(char c)
		{
			return "0123456789abcdefklmnorABCDEFKLMNOR".IndexOf(c) >= 0;
		}

		private static string RemoveInvisible(string value)
		{
			StringBuilder stringBuilder = new StringBuilder(value.Length);
			foreach (char c in value)
			{
				if (!IsInvisibleChar(c))
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}

		private static bool IsInvisibleChar(char c)
		{
			switch (c)
			{
			case '\u00ad':
			case '\u034f':
			case 'ᅟ':
			case 'ᅠ':
			case '\u180e':
			case '\u200b':
			case '\u200c':
			case '\u200d':
			case '\u200e':
			case '\u200f':
			case '\u202a':
			case '\u202b':
			case '\u202c':
			case '\u202d':
			case '\u202e':
			case '\u2066':
			case '\u2067':
			case '\u2068':
			case '\u2069':
			case '⠀':
			case 'ㅤ':
			case '\ufeff':
			case 'ᅠ':
				return true;
			default:
			{
				UnicodeCategory unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c);
				if (unicodeCategory != UnicodeCategory.Control && unicodeCategory != UnicodeCategory.Format && unicodeCategory != UnicodeCategory.LineSeparator)
				{
					return unicodeCategory == UnicodeCategory.ParagraphSeparator;
				}
				return true;
			}
			}
		}

		private static string CollapseWhitespace(string value)
		{
			StringBuilder stringBuilder = new StringBuilder(value.Length);
			bool flag = false;
			foreach (char c in value)
			{
				if (char.IsWhiteSpace(c))
				{
					if (!flag && stringBuilder.Length > 0)
					{
						stringBuilder.Append(' ');
						flag = true;
					}
				}
				else
				{
					flag = false;
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString();
		}
	}
	internal static class NonHostTeleport
	{
		private sealed class SavedItem
		{
			internal ushort ItemId;

			internal Guid InstanceId;
		}

		private sealed class PendingRestore
		{
			internal PhotonView View;

			internal Character Character;

			internal Player Owner;

			internal Room Room;

			internal readonly List<SavedItem> Items = new List<SavedItem>();

			internal readonly HashSet<int> RequestedViews = new HashSet<int>();

			internal float StartedAt;
		}

		private const float RecoveryTimeoutSeconds = 8f;

		private static readonly Dictionary<int, PendingRestore> Pendings = new Dictionary<int, PendingRestore>();

		internal static bool IsPending(Character character)
		{
			if ((Object)(object)character == (Object)null)
			{
				return false;
			}
			PhotonView val = null;
			try
			{
				val = ((character.refs != null) ? character.refs.view : null);
			}
			catch
			{
			}
			if ((Object)(object)val != (Object)null)
			{
				return Pendings.ContainsKey(val.ViewID);
			}
			return false;
		}

		internal static bool TryTeleport(Character target, PhotonView view, Vector3 position, bool restoreItems)
		{
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			Plugin instance = Plugin.Instance;
			if ((Object)(object)instance == (Object)null || (Object)(object)view == (Object)null || (Object)(object)target == (Object)null)
			{
				return false;
			}
			if (!PhotonNetwork.InRoom)
			{
				Teleporter.SetStatus("传送失败:不在联机房间。");
				return false;
			}
			if (PhotonNetwork.IsMasterClient)
			{
				return false;
			}
			Player owner;
			try
			{
				owner = view.Owner;
			}
			catch
			{
				return false;
			}
			if (owner == null || owner.IsInactive)
			{
				Teleporter.SetStatus("传送失败:目标 Owner 无效或已离线。");
				return false;
			}
			if (target.IsLocal)
			{
				Teleporter.SetStatus("传送失败:目标是本地角色。");
				return false;
			}
			if (Pendings.ContainsKey(view.ViewID))
			{
				return true;
			}
			try
			{
				if (!target.IsRegisteredToPlayer)
				{
					Teleporter.SetStatus("传送失败:目标角色尚未注册(可能正在加载/重生)。");
					return false;
				}
			}
			catch
			{
				return false;
			}
			Player val = null;
			try
			{
				val = target.player;
			}
			catch
			{
			}
			if ((Object)(object)val == (Object)null)
			{
				Teleporter.SetStatus("传送失败:目标玩家数据尚未就绪。");
				return false;
			}
			PendingRestore pendingRestore = new PendingRestore
			{
				View = view,
				Character = target,
				Owner = owner,
				Room = PhotonNetwork.CurrentRoom,
				StartedAt = Time.realtimeSinceStartup
			};
			if (restoreItems && (Object)(object)val != (Object)null)
			{
				for (byte b = 0; b <= 3; b++)
				{
					ItemSlot itemSlot;
					try
					{
						itemSlot = val.GetItemSlot(b);
					}
					catch
					{
						continue;
					}
					if (itemSlot == null || itemSlot.IsEmpty() || (Object)(object)itemSlot.prefab == (Object)null)
					{
						continue;
					}
					bool flag;
					try
					{
						flag = itemSlot.prefab.UIData != null && itemSlot.prefab.UIData.canDrop;
					}
					catch
					{
						flag = false;
					}
					if (flag)
					{
						if (itemSlot.data == null || itemSlot.data.guid == Guid.Empty)
						{
							Teleporter.SetStatus("传送已取消:目标身上有缺少实例 ID 的物品,无法保证物品安全。");
							return false;
						}
						pendingRestore.Items.Add(new SavedItem
						{
							ItemId = itemSlot.prefab.itemID,
							InstanceId = itemSlot.data.guid
						});
					}
				}
			}
			try
			{
				Teleporter.Stabilize(target);
				view.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { position, false, -1 });
				Teleporter.Stabilize(target);
			}
			catch (Exception ex)
			{
				Plugin.LogWarning("非房主传送 RPC 失败:" + ex.Message);
				return false;
			}
			if (pendingRestore.Items.Count > 0)
			{
				Pendings[view.ViewID] = pendingRestore;
				((MonoBehaviour)instance).StartCoroutine(RestoreItems(pendingRestore));
			}
			return true;
		}

		internal static void Reset()
		{
			Pendings.Clear();
		}

		private static IEnumerator RestoreItems(PendingRestore pending)
		{
			try
			{
				yield return (object)new WaitForSecondsRealtime(0.8f);
				while (Time.realtimeSinceStartup - pending.StartedAt < 8f)
				{
					if (!IsCurrent(pending))
					{
						yield break;
					}
					bool flag = true;
					Item[] array = null;
					for (int i = 0; i < pending.Items.Count; i++)
					{
						SavedItem savedItem = pending.Items[i];
						if (HasItem(pending.Character, savedItem))
						{
							continue;
						}
						flag = false;
						if (array == null)
						{
							try
							{
								array = Object.FindObjectsByType<Item>((FindObjectsSortMode)0);
							}
							catch
							{
								array = (Item[])(object)new Item[0];
							}
						}
						PhotonView val = null;
						try
						{
							val = ((pending.Character.refs != null) ? pending.Character.refs.view : null);
						}
						catch
						{
						}
						if ((Object)(object)val == (Object)null)
						{
							yield break;
						}
						foreach (Item val2 in array)
						{
							if ((Object)(object)val2 == (Object)null || (int)val2.itemState != 0 || val2.data == null || val2.itemID != savedItem.ItemId || val2.data.guid != savedItem.InstanceId)
							{
								continue;
							}
							PhotonView photonView = ((MonoBehaviourPun)val2).photonView;
							if (!((Object)(object)photonView == (Object)null) && pending.RequestedViews.Add(photonView.ViewID))
							{
								try
								{
									photonView.RPC("RequestPickup", (RpcTarget)2, new object[1] { val });
								}
								catch
								{
								}
							}
						}
					}
					if (flag)
					{
						yield break;
					}
					yield return (object)new WaitForSecondsRealtime(0.3f);
				}
				Plugin.LogWarning("[传送] 非房主物品回收超时,部分原物品可能仍留在原地。");
			}
			finally
			{
				if (pending != null && (Object)(object)pending.View != (Object)null && Pendings.TryGetValue(pending.View.ViewID, out var value) && value == pending)
				{
					Pendings.Remove(pending.View.ViewID);
				}
			}
		}

		private static bool IsCurrent(PendingRestore pending)
		{
			if (pending == null || (Object)(object)pending.Character == (Object)null || (Object)(object)pending.View == (Object)null)
			{
				return false;
			}
			try
			{
				return PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom == pending.Room && pending.View.Owner == pending.Owner && pending.Owner != null && !pending.Owner.IsInactive && pending.Character.IsRegisteredToPlayer;
			}
			catch
			{
				return false;
			}
		}

		private static bool HasItem(Character character, SavedItem saved)
		{
			Player player;
			try
			{
				player = character.player;
			}
			catch
			{
				return false;
			}
			if ((Object)(object)player == (Object)null)
			{
				return false;
			}
			for (byte b = 0; b <= 3; b++)
			{
				if (Matches(player.GetItemSlot(b), saved))
				{
					return true;
				}
			}
			try
			{
				return Matches(player.GetItemSlot((byte)250), saved);
			}
			catch
			{
				return false;
			}
		}

		private static bool Matches(ItemSlot slot, SavedItem saved)
		{
			if (slot == null || slot.IsEmpty() || (Object)(object)slot.prefab == (Object)null || slot.data == null)
			{
				return false;
			}
			if (slot.prefab.itemID == saved.ItemId)
			{
				return slot.data.guid == saved.InstanceId;
			}
			return false;
		}
	}
	internal static class PingMarker
	{
		internal static bool HasPoint { get; private set; }

		internal static Vector3 Point { get; private set; }

		internal static Vector3 SurfacePoint { get; private set; }

		internal static float CapturedAt { get; private set; }

		internal static int CaptureCount { get; private set; }

		internal static string CoordText => Point.x.ToString("0.0") + ", " + Point.y.ToString("0.0") + ", " + Point.z.ToString("0.0");

		internal static string SurfaceCoordText => SurfacePoint.x.ToString("0.0") + ", " + SurfacePoint.y.ToString("0.0") + ", " + SurfacePoint.z.ToString("0.0");

		internal static string AgeText
		{
			get
			{
				if (!HasPoint)
				{
					return "—";
				}
				float num = Mathf.Max(0f, Time.unscaledTime - CapturedAt);
				if (num < 60f)
				{
					return Mathf.RoundToInt(num) + " 秒前";
				}
				if (num < 3600f)
				{
					return Mathf.RoundToInt(num / 60f) + " 分钟前";
				}
				return Mathf.RoundToInt(num / 3600f) + " 小时前";
			}
		}

		internal static event Action Captured;

		internal static void Set(Vector3 point, Vector3 hitNormal)
		{
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0034: 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_003f: 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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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_0062: 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)
			if (!IsFinite(point) || point == Vector3.zero)
			{
				return;
			}
			Vector3 val = ((((Vector3)(ref hitNormal)).sqrMagnitude > 0.001f) ? ((Vector3)(ref hitNormal)).normalized : Vector3.up);
			Vector3 val2 = point + val * 1.1f + Vector3.up * 0.25f;
			if (!IsFinite(val2))
			{
				val2 = point + Vector3.up * 1.2f;
			}
			SurfacePoint = point;
			Point = val2;
			HasPoint = true;
			CapturedAt = Time.unscaledTime;
			CaptureCount++;
			Plugin.LogInfo("[标点] 已记录位置 (" + CoordText + ")。");
			Action captured = PingMarker.Captured;
			if (captured == null)
			{
				return;
			}
			try
			{
				captured();
			}
			catch (Exception ex)
			{
				Plugin.LogWarning("标点回调异常:" + ex.Message);
			}
		}

		internal static void Clear()
		{
			//IL_0006: 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)
			HasPoint = false;
			Point = Vector3.zero;
			SurfacePoint = Vector3.zero;
			CapturedAt = 0f;
		}

		internal static bool IsFinite(Vector3 value)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!float.IsNaN(value.x) && !float.IsInfinity(value.x) && !float.IsNaN(value.y) && !float.IsInfinity(value.y) && !float.IsNaN(value.z))
			{
				return !float.IsInfinity(value.z);
			}
			return false;
		}
	}
	internal sealed class PlayerEntry
	{
		internal string Key = string.Empty;

		internal ulong SteamId;

		internal string PhotonUserId = string.Empty;

		internal string RawPhotonName = string.Empty;

		internal string PhotonName = string.Empty;

		internal string SteamName = string.Empty;

		internal bool NameMismatch;

		internal Character Character;

		internal Player PhotonPlayer;

		internal int ActorNumber = -1;

		internal bool IsLocal;

		internal bool IsHost;

		internal bool IsDead;

		internal bool IsPassedOut;

		internal bool IsFullyPassedOut;

		internal bool HasCharacter;

		internal bool IsLoading;

		internal bool IsOfflineFavorite;

		internal Color Color = Color.white;

		internal string ColorName = "未知";

		internal float Distance;

		internal Vector3 Position;

		internal string Platform = "未知";

		internal string PlatformFamily = string.Empty;

		internal string DisplayName
		{
			get
			{
				if (PhotonName.Length > 0)
				{
					return PhotonName;
				}
				if (SteamName.Length > 0)
				{
					return SteamName;
				}
				if (ActorNumber > 0)
				{
					return "玩家 #" + ActorNumber.ToString(CultureInfo.InvariantCulture);
				}
				return "未知玩家";
			}
		}

		internal string PreferredName
		{
			get
			{
				if (NameMismatch)
				{
					return DisplayName;
				}
				if (ModConfig.PreferSteamName != null && ModConfig.PreferSteamName.Value && SteamName.Length > 0)
				{
					return SteamName;
				}
				return DisplayName;
			}
		}

		internal string StatusText
		{
			get
			{
				if (!HasCharacter)
				{
					if (!IsLoading)
					{
						return "无角色";
					}
					return "加载中";
				}
				if (IsDead)
				{
					return "死亡";
				}
				if (IsFullyPassedOut)
				{
					return "昏迷";
				}
				if (IsPassedOut)
				{
					return "倒地";
				}
				return "存活";
			}
		}

		internal Color StatusColor
		{
			get
			{
				//IL_0017: 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_0059: 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)
				if (!HasCharacter)
				{
					return new Color(0.65f, 0.67f, 0.72f);
				}
				if (IsDead)
				{
					return new Color(0.95f, 0.35f, 0.32f);
				}
				if (IsFullyPassedOut || IsPassedOut)
				{
					return new Color(0.98f, 0.7f, 0.26f);
				}
				return new Color(0.42f, 0.86f, 0.55f);
			}
		}

		internal string SteamIdText
		{
			get
			{
				if (SteamId == 0L)
				{
					return "—";
				}
				return SteamId.ToString(CultureInfo.InvariantCulture);
			}
		}

		internal string ActorText
		{
			get
			{
				if (ActorNumber <= 0)
				{
					return "#—";
				}
				return "#" + ActorNumber.ToString(CultureInfo.InvariantCulture);
			}
		}

		internal bool CanTeleport
		{
			get
			{
				if (HasCharacter)
				{
					return (Object)(object)Character != (Object)null;
				}
				return false;
			}
		}

		internal bool MatchesQuery(string query)
		{
			if (string.IsNullOrWhiteSpace(query))
			{
				return true;
			}
			string text = NameUtil.Normalize(query);
			if (text.Length == 0)
			{
				return true;
			}
			if (NameUtil.Normalize(DisplayName).IndexOf(text, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			if (NameUtil.Normalize(RawPhotonName).IndexOf(text, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			if (NameUtil.Normalize(SteamName).IndexOf(text, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			if (NameUtil.Normalize(ColorName).IndexOf(text, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			if (NameUtil.Normalize(Platform).IndexOf(text, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			string value = query.Trim();
			if (SteamId != 0L && SteamId.ToString(CultureInfo.InvariantCulture).IndexOf(value, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			if (ActorNumber > 0 && ActorNumber.ToString(CultureInfo.InvariantCulture).IndexOf(value, StringComparison.Ordinal) >= 0)
			{
				return true;
			}
			return false;
		}

		internal static string BuildKey(ulong steamId, string photonUserId, string fallback)
		{
			if (steamId != 0L)
			{
				return "steam-" + steamId.ToString(CultureInfo.InvariantCulture);
			}
			if (!string.IsNullOrWhiteSpace(photonUserId))
			{
				return "photon-" + SanitizeKey(photonUserId);
			}
			if (!string.IsNullOrWhiteSpace(fallback))
			{
				return "name-" + SanitizeKey(NameUtil.Normalize(fallback));
			}
			return "unknown";
		}

		internal static string SanitizeKey(string value)
		{
			if (string.IsNullOrWhiteSpace(value))
			{
				return "unknown";
			}
			StringBuilder stringBuilder = new StringBuilder(value.Length);
			foreach (char c in value)
			{
				stringBuilder.Append(char.IsLetterOrDigit(c) ? c : '_');
			}
			string text = stringBuilder.ToString().Trim('_');
			if (text.Length <= 0)
			{
				return "unknown";
			}
			return text;
		}

		internal static Color FallbackColor(string id)
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			if (!string.IsNullOrEmpty(id))
			{
				for (int i = 0; i < id.Length; i++)
				{
					num = num * 31 + id[i];
				}
			}
			return Color.HSVToRGB((float)((uint)num % 1000u) / 1000f, 0.55f, 0.72f);
		}
	}
	internal static class ColorCategory
	{
		internal sealed class Info
		{
			internal string Name;

			internal string Hex;
		}

		internal static Info Describe(Color color)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			float num2 = default(float);
			float num3 = default(float);
			Color.RGBToHSV(color, ref num, ref num2, ref num3);
			string name;
			if (num3 < 0.16f)
			{
				name = "黑色";
			}
			else if (num2 < 0.12f)
			{
				name = ((num3 > 0.85f) ? "白色" : ((num3 > 0.55f) ? "灰色" : "深灰"));
			}
			else if (num2 < 0.35f && num3 > 0.65f)
			{
				name = "浅灰";
			}
			else
			{
				float num4 = num * 360f;
				name = ((num4 < 16f || num4 >= 340f) ? "红色" : ((num4 < 42f) ? "橙色" : ((num4 < 68f) ? "黄色" : ((num4 < 160f) ? "绿色" : ((num4 < 195f) ? "青色" : ((num4 < 255f) ? "蓝色" : ((!(num4 < 290f)) ? "粉色" : "紫色")))))));
			}
			return new Info
			{
				Name = name,
				Hex = "#" + ColorUtility.ToHtmlStringRGB(color)
			};
		}
	}
	internal static class PlayerRoster
	{
		private const ulong MinimumSteamId64 = 76561197960265728uL;

		internal static readonly List<PlayerEntry> Entries = new List<PlayerEntry>();

		private static readonly List<Character> CharacterBuffer = new List<Character>();

		private static readonly HashSet<int> CharacterSeen = new HashSet<int>();

		private static Character[] _sceneCharacters = (Character[])(object)new Character[0];

		private static float _nextSceneScanAt;

		private static float _nextRefreshAt;

		private static bool _initialized;

		internal static string RoomKey { get; private set; }

		internal static Character LocalCharacter => Character.localCharacter;

		internal static event Action RoomChanged;

		internal static event Action Refreshed;

		internal static void Init()
		{
			RoomKey = ComputeRoomKey();
			_initialized = true;
			Refresh();
		}

		internal static void Tick()
		{
			if (_initialized && Time.unscaledTime >= _nextRefreshAt)
			{
				Refresh();
			}
		}

		internal static void RefreshNow()
		{
			Refresh();
		}

		internal static PlayerEntry FindByKey(string key)
		{
			if (string.IsNullOrEmpty(key))
			{
				return null;
			}
			for (int i = 0; i < Entries.Count; i++)
			{
				if (string.Equals(Entries[i].Key, key, StringComparison.Ordinal))
				{
					return Entries[i];
				}
			}
			return null;
		}

		private static void Refresh()
		{
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			_nextRefreshAt = Time.unscaledTime + ModConfig.RefreshInterval;
			string text = ComputeRoomKey();
			if (!string.Equals(text, RoomKey, StringComparison.Ordinal))
			{
				RoomKey = text;
				SteamNames.Clear();
				Action roomChanged = PlayerRoster.RoomChanged;
				if (roomChanged != null)
				{
					try
					{
						roomChanged();
					}
					catch (Exception ex)
					{
						Plugin.LogWarning("房间切换回调异常:" + ex.Message);
					}
				}
			}
			List<PlayerEntry> list = new List<PlayerEntry>();
			Dictionary<int, PlayerEntry> dictionary = new Dictionary<int, PlayerEntry>();
			Dictionary<string, PlayerEntry> byKey = new Dictionary<string, PlayerEntry>(StringComparer.Ordinal);
			Player[] array = null;
			try
			{
				if (PhotonNetwork.InRoom)
				{
					array = PhotonNetwork.PlayerList;
				}
			}
			catch
			{
				array = null;
			}
			if (array != null)
			{
				Player val = null;
				try
				{
					val = PhotonNetwork.MasterClient;
				}
				catch
				{
					val = null;
				}
				foreach (Player val2 in array)
				{
					if (val2 != null && !val2.IsInactive)
					{
						PlayerEntry entry = CreateFromPhoton(val2, val);
						if (AddEntry(list, dictionary, byKey, entry))
						{
							TryResolveSteamName(entry);
						}
					}
				}
			}
			List<Character> list2 = CollectCharacters();
			_ = Character.localCharacter;
			for (int j = 0; j < list2.Count; j++)
			{
				Character val3 = list2[j];
				if ((Object)(object)val3 == (Object)null || val3.isBot || val3.isZombie || val3.isScoutmaster)
				{
					continue;
				}
				PhotonView characterView = GetCharacterView(val3);
				Player val4 = (((Object)(object)characterView != (Object)null) ? characterView.Owner : null);
				int num = ((val4 != null) ? val4.ActorNumber : ((!val3.IsLocal) ? (-1) : 0));
				if (num < 0)
				{
					continue;
				}
				if (num > 0 && dictionary.TryGetValue(num, out var value))
				{
					ApplyCharacter(value, val3);
				}
				else if (num != 0 || val3.IsLocal)
				{
					value = CreateFromCharacter(val3, val4, num);
					if (AddEntry(list, dictionary, byKey, value))
					{
						TryResolveSteamName(value);
					}
				}
			}
			for (int k = 0; k < list.Count; k++)
			{
				PlayerEntry playerEntry = list[k];
				if (!playerEntry.HasCharacter)
				{
					playerEntry.IsLoading = true;
				}
				ColorCategory.Info info = ColorCategory.Describe(playerEntry.Color);
				playerEntry.ColorName = info.Name;
				if (playerEntry.SteamName.Length > 0 && playerEntry.PhotonName.Length > 0)
				{
					playerEntry.NameMismatch = !NameUtil.NamesEqual(playerEntry.SteamName, playerEntry.PhotonName);
				}
				else
				{
					playerEntry.NameMismatch = false;
				}
				Favorites.NoteSeen(playerEntry);
			}
			list.Sort(CompareEntries);
			Entries.Clear();
			Entries.AddRange(list);
			Action refreshed = PlayerRoster.Refreshed;
			if (refreshed != null)
			{
				try
				{
					refreshed();
				}
				catch (Exception ex2)
				{
					Plugin.LogWarning("名册刷新回调异常:" + ex2.Message);
				}
			}
		}

		private static bool AddEntry(List<PlayerEntry> result, Dictionary<int, PlayerEntry> byActor, Dictionary<string, PlayerEntry> byKey, PlayerEntry entry)
		{
			if (entry == null || string.IsNullOrEmpty(entry.Key))
			{
				return false;
			}
			if (byKey.TryGetValue(entry.Key, out var value))
			{
				if (!value.HasCharacter && entry.HasCharacter)
				{
					ApplyCharacter(value, entry.Character);
				}
				return false;
			}
			byKey[entry.Key] = entry;
			if (entry.ActorNumber > 0)
			{
				byActor[entry.ActorNumber] = entry;
			}
			result.Add(entry);
			return true;
		}

		private static PlayerEntry CreateFromPhoton(Player player, Player master)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			string photonName = NameUtil.Clean(player.NickName);
			TryGetSteamId(player, out var steamId);
			return new PlayerEntry
			{
				SteamId = steamId,
				PhotonUserId = (player.UserId ?? string.Empty),
				RawPhotonName = (player.NickName ?? string.Empty),
				PhotonName = photonName,
				PhotonPlayer = player,
				ActorNumber = player.ActorNumber,
				IsLocal = player.IsLocal,
				IsHost = (master != null && player.ActorNumber == master.ActorNumber),
				HasCharacter = false,
				IsLoading = true,
				Color = PlayerEntry.FallbackColor(PlayerEntry.BuildKey(steamId, player.UserId, player.NickName)),
				PlatformFamily = GetPlatformFamily(player),
				Platform = GetPlatformLabel(GetPlatformFamily(player)),
				Key = PlayerEntry.BuildKey(steamId, player.UserId, player.NickName)
			};
		}

		private static PlayerEntry CreateFromCharacter(Character character, Player owner, int actor)
		{
			string text = ((owner != null) ? owner.NickName : character.characterName);
			string photonName = NameUtil.Clean(text);
			ulong steamId = 0uL;
			Player val = null;
			try
			{
				val = PhotonNetwork.MasterClient;
			}
			catch
			{
			}
			if (owner != null)
			{
				TryGetSteamId(owner, out steamId);
			}
			PlayerEntry playerEntry = new PlayerEntry
			{
				SteamId = steamId,
				PhotonUserId = ((owner != null) ? (owner.UserId ?? string.Empty) : string.Empty),
				RawPhotonName = (text ?? string.Empty),
				PhotonName = photonName,
				PhotonPlayer = owner,
				ActorNumber = actor,
				IsLocal = character.IsLocal,
				IsHost = (val != null && owner != null && owner.ActorNumber == val.ActorNumber),
				IsLoading = false
			};
			playerEntry.Key = PlayerEntry.BuildKey(steamId, playerEntry.PhotonUserId, text);
			ApplyCharacter(playerEntry, character);
			playerEntry.PlatformFamily = ((owner != null) ? GetPlatformFamily(owner) : string.Empty);
			playerEntry.Platform = GetPlatformLabel(playerEntry.PlatformFamily);
			return playerEntry;
		}

		private static void ApplyCharacter(PlayerEntry entry, Character character)
		{
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			entry.Character = character;
			entry.HasCharacter = (Object)(object)character != (Object)null;
			entry.IsLoading = false;
			if ((Object)(object)character == (Object)null)
			{
				return;
			}
			try
			{
				entry.IsDead = (Object)(object)character.data != (Object)null && character.data.dead;
				entry.IsPassedOut = (Object)(object)character.data != (Object)null && character.data.passedOut;
				entry.IsFullyPassedOut = (Object)(object)character.data != (Object)null && character.data.fullyPassedOut;
			}
			catch
			{
				entry.IsDead = false;
				entry.IsPassedOut = false;
				entry.IsFullyPassedOut = false;
			}
			try
			{
				entry.Position = ((Component)character).transform.position;
				Color color = Color.white;
				if (character.refs != null && (Object)(object)character.refs.customization != (Object)null)
				{
					color = character.refs.customization.PlayerColor;
				}
				entry.Color = color;
			}
			catch
			{
				entry.Color = Color.white;
			}
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter != (Object)null) || !((Object)(object)character != (Object)(object)localCharacter))
			{
				return;
			}
			try
			{
				entry.Distance = Vector3.Distance(((Component)localCharacter).transform.position, ((Component)character).transform.position);
			}
			catch
			{
				entry.Distance = 0f;
			}
		}

		private static List<Character> CollectCharacters()
		{
			CharacterBuffer.Clear();
			CharacterSeen.Clear();
			try
			{
				List<Character> allCharacters = Character.AllCharacters;
				if (allCharacters != null)
				{
					for (int i = 0; i < allCharacters.Count; i++)
					{
						AddCharacter(allCharacters[i]);
					}
				}
			}
			catch
			{
			}
			try
			{
				IEnumerable<Character> allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters();
				if (allPlayerCharacters != null)
				{
					foreach (Character item in allPlayerCharacters)
					{
						AddCharacter(item);
					}
				}
			}
			catch
			{
			}
			if (Time.unscaledTime >= _nextSceneScanAt)
			{
				_nextSceneScanAt = Time.unscaledTime + 3f;
				try
				{
					_sceneCharacters = Object.FindObjectsByType<Character>((FindObjectsSortMode)0);
				}
				catch
				{
					_sceneCharacters = (Character[])(object)new Character[0];
				}
			}
			for (int j = 0; j < _sceneCharacters.Length; j++)
			{
				AddCharacter(_sceneCharacters[j]);
			}
			return CharacterBuffer;
		}

		private static void AddCharacter(Character character)
		{
			if (!((Object)(object)character == (Object)null))
			{
				int instanceID;
				try
				{
					instanceID = ((Object)character).GetInstanceID();
				}
				catch
				{
					return;
				}
				if (CharacterSeen.Add(instanceID))
				{
					CharacterBuffer.Add(character);
				}
			}
		}

		private static PhotonView GetCharacterView(Character character)
		{
			try
			{
				if (character.refs != null && (Object)(object)character.refs.view != (Object)null)
				{
					return character.refs.view;
				}
			}
			catch
			{
			}
			try
			{
				return ((Component)character).GetComponent<PhotonView>();
			}
			catch
			{
				return null;
			}
		}

		private static bool TryGetSteamId(Player player, out ulong steamId)
		{
			steamId = 0uL;
			if (player == null)
			{
				return false;
			}
			if (!AllowsSteamIdentity(GetPlatformFamily(player)))
			{
				return false;
			}
			try
			{
				Hashtable customProperties = player.CustomProperties;
				if (customProperties != null)
				{
					if (((Dictionary<object, object>)(object)customProperties).TryGetValue((object)"UserID", out object value) && value != null && TryParseSteamId(value.ToString(), out steamId))
					{
						return true;
					}
					if (TryGetSteamIdFromProperties(customProperties, out steamId))
					{
						return true;
					}
				}
			}
			catch
			{
			}
			if (TryParseSteamId(player.UserId, out steamId))
			{
				return true;
			}
			return false;
		}

		private static bool TryGetSteamIdFromProperties(Hashtable props, out ulong steamId)
		{
			steamId = 0uL;
			string[] array = new string[4] { "steamid", "steamId", "SteamId", "SteamID" };
			for (int i = 0; i < array.Length; i++)
			{
				if (((Dictionary<object, object>)(object)props).TryGetValue((object)array[i], out object value) && value != null && TryParseSteamId(value.ToString(), out steamId))
				{
					return true;
				}
			}
			return false;
		}

		private static bool TryParseSteamId(string value, out ulong steamId)
		{
			steamId = 0uL;
			if (string.IsNullOrWhiteSpace(value))
			{
				return false;
			}
			if (!ulong.TryParse(value.Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return false;
			}
			if (result < 76561197960265728L)
			{
				return false;
			}
			steamId = result;
			return true;
		}

		internal static string GetPlatformFamily(Player player)
		{
			try
			{
				Hashtable customProperties = player.CustomProperties;
				if (customProperties != null && ((Dictionary<object, object>)(object)customProperties).TryGetValue((object)"PlatformFamily", out object value) && value != null)
				{
					return Convert.ToString(value, CultureInfo.InvariantCulture) ?? string.Empty;
				}
			}
			catch
			{
			}
			return string.Empty;
		}

		private static bool AllowsSteamIdentity(string family)
		{
			if (string.IsNullOrWhiteSpace(family))
			{
				return true;
			}
			string text = family.Trim().ToLowerInvariant();
			switch (text)
			{
			default:
				return text == "osx";
			case "1":
			case "windows":
			case "2":
				return true;
			}
		}

		internal static string GetPlatformLabel(string family)
		{
			if (string.IsNullOrWhiteSpace(family))
			{
				return "未知";
			}
			switch (family.Trim().ToLowerInvariant())
			{
			case "1":
			case "windows":
				return "Steam / PC";
			case "2":
			case "osx":
				return "macOS";
			case "4":
			case "android":
				return "Android";
			case "8":
			case "ios":
				return "iOS";
			case "16":
			case "switch":
				return "Switch";
			case "32":
			case "playstation":
				return "PlayStation";
			case "64":
			case "xbox":
				return "Xbox";
			default:
				return family.Trim();
			}
		}

		private static void TryResolveSteamName(PlayerEntry entry)
		{
			if (entry != null && entry.SteamId != 0L)
			{
				entry.SteamName = SteamNames.GetPersona(entry.SteamId);
			}
		}

		private static int CompareEntries(PlayerEntry a, PlayerEntry b)
		{
			bool flag = Favorites.Contains(a);
			bool flag2 = Favorites.Contains(b);
			if (flag != flag2)
			{
				if (!flag)
				{
					return 1;
				}
				return -1;
			}
			if (a.IsHost != b.IsHost)
			{
				if (!a.IsHost)
				{
					return 1;
				}
				return -1;
			}
			int num = string.Compare(NameUtil.Normalize(a.PreferredName), NameUtil.Normalize(b.PreferredName), StringComparison.OrdinalIgnoreCase);
			if (num != 0)
			{
				return num;
			}
			return a.ActorNumber.CompareTo(b.ActorNumber);
		}

		private static string ComputeRoomKey()
		{
			try
			{
				if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null)
				{
					return (PhotonNetwork.CurrentRoom.Name ?? "room") + "|" + PhotonNetwork.CloudRegion;
				}
			}
			catch
			{
			}
			return "offline";
		}
	}
	internal static class StatusActions
	{
		internal static bool TryClear(Character target, out string error)
		{
			error = string.Empty;
			if ((Object)(object)target == (Object)null)
			{
				error = "目标角色不存在";
				return false;
			}
			CharacterAfflictions val = null;
			try
			{
				if (target.refs != null)
				{
					val = target.refs.afflictions;
				}
			}
			catch
			{
			}
			if ((Object)(object)val == (Object)null)
			{
				error = "目标没有 CharacterAfflictions";
				return false;
			}
			bool flag;
			try
			{
				flag = (Object)(object)target == (Object)(object)Character.localCharacter;
			}
			catch
			{
				flag = false;
			}
			if (flag)
			{
				try
				{
					val.ClearAllStatus(false, false);
					return true;
				}
				catch (Exception ex)
				{
					error = "本地清除异常:" + ex.Message;
					return false;
				}
			}
			if (!PhotonNetwork.InRoom)
			{
				error = "不在联机房间";
				return false;
			}
			if (!PhotonNetwork.IsMasterClient)
			{
				error = "只有房主可以清除远程玩家状态(非房主只能清自己)";
				return false;
			}
			float[] currentStatuses = val.currentStatuses;
			if (currentStatuses == null || currentStatuses.Length == 0)
			{
				error = "目标状态列表为空";
				return false;
			}
			float[] array = new float[currentStatuses.Length];
			bool flag2 = false;
			for (int i = 0; i < currentStatuses.Length; i++)
			{
				float num = Mathf.Max(0f, currentStatuses[i]);
				array[i] = 0f - num;
				if (num > 0.001f)
				{
					flag2 = true;
				}
			}
			if (!flag2)
			{
				return true;
			}
			PhotonView val2 = null;
			try
			{
				val2 = ((MonoBehaviourPun)val).photonView;
			}
			catch
			{
			}
			if ((Object)(object)val2 == (Object)null)
			{
				try
				{
					val2 = ((Component)val).GetComponent<PhotonView>();
				}
				catch
				{
				}
			}
			if ((Object)(object)val2 == (Object)null)
			{
				try
				{
					val2 = ((target.refs != null) ? target.refs.view : null);
				}
				catch
				{
				}
			}
			if ((Object)(object)val2 == (Object)null)
			{
				error = "目标没有 PhotonView";
				return false;
			}
			try
			{
				val2.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
				return true;
			}
			catch (Exception ex2)
			{
				error = "状态 RPC 失败:" + ex2.Message;
				return false;
			}
		}
	}
	internal static class SteamNames
	{
		private sealed class CacheEntry
		{
			public string Name;

			public float ExpiresAt;
		}

		private static readonly Dictionary<ulong, CacheEntry> Cache = new Dictionary<ulong, CacheEntry>();

		private static string _localName = string.Empty;

		private static float _localExpiresAt;

		private static float _nextRetryAt;

		internal static string LocalPersonaName
		{
			get
			{
				if (Time.unscaledTime < _localExpiresAt)
				{
					return _localName;
				}
				_localExpiresAt = Time.unscaledTime + 60f;
				try
				{
					if (SteamAPI.IsSteamRunning())
					{
						_localName = NameUtil.Clean(SteamFriends.GetPersonaName());
					}
				}
				catch (Exception ex)
				{
					_localName = string.Empty;
					Plugin.LogWarning("[Steam] 读取本机昵称失败:" + ex.Message);
				}
				return _localName;
			}
		}

		internal static string GetPersona(ulong steamId, bool forceRefresh = false)
		{
			if (steamId == 0L)
			{
				return string.Empty;
			}
			if (!forceRefresh && Cache.TryGetValue(steamId, out var value) && Time.unscaledTime < value.ExpiresAt)
			{
				return value.Name;
			}
			string text = ReadPersona(steamId);
			Cache[steamId] = new CacheEntry
			{
				Name = text,
				ExpiresAt = Time.unscaledTime + ((text.Length > 0) ? 120f : 20f)
			};
			return text;
		}

		internal static void Clear()
		{
			Cache.Clear();
			_localName = string.Empty;
			_localExpiresAt = 0f;
			_nextRetryAt = 0f;
		}

		private static string ReadPersona(ulong steamId)
		{
			//IL_003a: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			if (Time.unscaledTime < _nextRetryAt)
			{
				return string.Empty;
			}
			try
			{
				if (!SteamAPI.IsSteamRunning())
				{
					_nextRetryAt = Time.unscaledTime + 10f;
					return string.Empty;
				}
				CSteamID val = default(CSteamID);
				((CSteamID)(ref val))..ctor(steamId);
				string friendPersonaName = SteamFriends.GetFriendPersonaName(val);
				if (NameUtil.IsPlaceholderName(friendPersonaName, steamId))
				{
					SteamFriends.RequestUserInformation(val, true);
					friendPersonaName = SteamFriends.GetFriendPersonaName(val);
				}
				if (NameUtil.IsPlaceholderName(friendPersonaName, steamId))
				{
					return string.Empty;
				}
				return NameUtil.Clean(friendPersonaName);
			}
			catch (Exception ex)
			{
				_nextRetryAt = Time.unscaledTime + 30f;
				Plugin.LogWarning("[Steam] 查询昵称失败(" + steamId + "):" + ex.Message);
				return string.Empty;
			}
		}
	}
	internal static class StickTeleport
	{
		private sealed class Job
		{
			internal int ViewId;

			internal int OwnerActor;

			internal float UnstickAt;

			internal Vector3 HipPosition;
		}

		private const int MaxConcurrentJobs = 6;

		private const float GlobalSendCooldown = 0.1f;

		private static readonly Dictionary<int, Job> Jobs = new Dictionary<int, Job>();

		private static float _lastSendAt = -100f;

		internal static int ActiveJobCount => Jobs.Count;

		internal static bool IsPending(Character target)
		{
			if ((Object)(object)target == (Object)null)
			{
				return false;
			}
			PhotonView view = GetView(target);
			if ((Object)(object)view != (Object)null)
			{
				return Jobs.ContainsKey(view.ViewID);
			}
			return false;
		}

		internal static bool TryTeleport(Character target, Vector3 destination, out string error)
		{
			//IL_0008: 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_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_008b: 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_0098: 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_00d0: 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_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			error = string.Empty;
			if (!Validate(target, destination, out error))
			{
				return false;
			}
			PhotonView view = GetView(target);
			if ((Object)(object)view == (Object)null)
			{
				error = "目标没有 PhotonView";
				return false;
			}
			int viewID = view.ViewID;
			if (Jobs.ContainsKey(viewID))
			{
				error = "该目标已有硬传送任务";
				return false;
			}
			if (Jobs.Count >= 6)
			{
				error = "同时进行的硬传送过多";
				return false;
			}
			if (Time.unscaledTime - _lastSendAt < 0.1f)
			{
				error = "硬传送冷却中";
				return false;
			}
			Vector3 val = ComputeHipPosition(destination, out error);
			if (string.IsNullOrEmpty(error) && val == Vector3.zero && destination != Vector3.zero)
			{
				error = "无法计算安全落点";
			}
			if (!string.IsNullOrEmpty(error))
			{
				return false;
			}
			try
			{
				view.RPC("RPCA_Stick", (RpcTarget)0, new object[5]
				{
					(object)(BodypartType)0,
					val,
					val,
					(object)(STATUSTYPE)7,
					0f
				});
			}
			catch (Exception ex)
			{
				error = "RPCA_Stick 发送失败:" + ex.Message;
				return false;
			}
			Jobs[viewID] = new Job
			{
				ViewId = viewID,
				OwnerActor = ((view.Owner != null) ? view.Owner.ActorNumber : 0),
				UnstickAt = Time.unscaledTime + (float)ModConfig.StickUnstickDelay / 1000f,
				HipPosition = val
			};
			_lastSendAt = Time.unscaledTime;
			Plugin.LogInfo("[硬传送] " + SafeName(target) + " → " + Format(val) + "(Stick,稍后释放)");
			return true;
		}

		internal static void Tick()
		{
			if (Jobs.Count == 0)
			{
				return;
			}
			if (!PhotonNetwork.InRoom)
			{
				Jobs.Clear();
				return;
			}
			List<int> list = null;
			foreach (KeyValuePair<int, Job> job in Jobs)
			{
				if (Time.unscaledTime < job.Value.UnstickAt)
				{
					continue;
				}
				PhotonView val = PhotonView.Find(job.Key);
				if ((Object)(object)val != (Object)null && val.Owner != null && val.Owner.ActorNumber == job.Value.OwnerActor && !val.Owner.IsInactive)
				{
					try
					{
						val.RPC("RPCA_ClearJoint", (RpcTarget)0, new object[1] { (object)(BodypartType)0 });
					}
					catch (Exception ex)
					{
						Plugin.LogWarning("[硬传送] 释放关节失败:" + ex.Message);
					}
				}
				if (list == null)
				{
					list = new List<int>();
				}
				list.Add(job.Key);
			}
			if (list != null)
			{
				for (int i = 0; i < list.Count; i++)
				{
					Jobs.Remove(list[i]);
				}
			}
		}

		internal static void Reset()
		{
			Jobs.Clear();
		}

		private static bool Validate(Character target, Vector3 destination, out string error)
		{
			//IL_01d2: 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_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			error = string.Empty;
			if (!PhotonNetwork.InRoom || PhotonNetwork.OfflineMode)
			{
				error = "不在联机房间";
				return false;
			}
			if (PhotonNetwork.IsMasterClient)
			{
				error = "房主应使用 WarpPlayerRPC";
				return false;
			}
			if (LoadingScreenHandler.loading)
			{
				error = "正在加载场景";
				return false;
			}
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead || localCharacter.data.fullyPassedOut)
			{
				error = "本地角色不可用";
				return false;
			}
			if (localCharacter.refs == null)
			{
				error = "本地角色未初始化";
				return false;
			}
			try
			{
				if (localCharacter.inAirport)
				{
					error = "机场内不允许硬传送";
					return false;
				}
			}
			catch
			{
				error = "无法确认本地场景状态";
				return false;
			}
			if ((Object)(object)target == (Object)null)
			{
				error = "目标角色为空";
				return false;
			}
			if ((Object)(object)target == (Object)(object)localCharacter)
			{
				error = "目标不能是本地角色";
				return false;
			}
			if (target.isBot || target.isZombie || target.isScoutmaster)
			{
				error = "目标不是玩家";
				return false;
			}
			bool isRegisteredToPlayer;
			try
			{
				isRegisteredToPlayer = target.IsRegisteredToPlayer;
			}
			catch
			{
				error = "无法确认目标注册状态";
				return false;
			}
			if (!isRegisteredToPlayer)
			{
				error = "目标尚未绑定玩家";
				return false;
			}
			if (target.IsGhost)
			{
				error = "目标是幽灵状态";
				return false;
			}
			if ((Object)(object)target.data == (Object)null || target.data.dead)
			{
				error = "目标已死亡";
				return false;
			}
			if (target.warping)
			{
				error = "目标正在传送中";
				return false;
			}
			if (target.IsStuck())
			{
				error = "目标已被其它物体粘住";
				return false;
			}
			PhotonView view = GetView(target);
			if ((Object)(object)view == (Object)null || view.ViewID <= 0)
			{
				error = "目标没有有效 PhotonView";
				return false;
			}
			Player owner = view.Owner;
			if (owner == null || owner.IsInactive || owner.ActorNumber <= 0)
			{
				error = "目标 owner 不可用";
				return false;
			}
			if (owner == PhotonNetwork.LocalPlayer)
			{
				error = "目标 owner 是本地玩家";
				return false;
			}
			if (!PingMarker.IsFinite(destination) || destination == Vector3.zero)
			{
				error = "目标坐标无效";
				return false;
			}
			if (destination.y < -200f || destination.y > 3000f)
			{
				error = "目标坐标超出地图范围";
				return false;
			}
			float stickTeleportMaxRange = ModConfig.StickTeleportMaxRange;
			if (stickTeleportMaxRange > 0f && Vector3.Distance(TransporterCenter(target), destination) > stickTeleportMaxRange)
			{
				error = "目标超过硬传送最大距离 " + stickTeleportMaxRange.ToString("0") + "m";
				return false;
			}
			return true;
		}

		private static Vector3 ComputeHipPosition(Vector3 destination, out string error)
		{
			//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_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_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_001e: 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_002d: 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_003e: 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_005c: 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_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_00e7: 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_00fc: 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)
			error = string.Empty;
			Vector3 val = destination - Vector3.up * 0.35f;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val + Vector3.up * 2f, Vector3.down, ref val2, 8f, LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).point.y <= val.y + 0.5f)
			{
				float num = ((RaycastHit)(ref val2)).point.y + 0.95f;
				if (val.y < num)
				{
					val.y = num;
				}
			}
			for (int i = 0; i < 4; i++)
			{
				if (!Physics.CheckSphere(val, 0.28f, LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter), (QueryTriggerInteraction)1))
				{
					break;
				}
				val.y += 0.4f;
			}
			if (Physics.CheckSphere(val, 0.28f, LayerMask.op_Implicit(HelperFunctions.AllPhysicalExceptCharacter), (QueryTriggerInteraction)1))
			{
				error = "落点位于几何体内部";
				return Vector3.zero;
			}
			if (!PingMarker.IsFinite(val))
			{
				error = "落点无效";
				return Vector3.zero;
			}
			return val;
		}

		private static PhotonView GetView(Character character)
		{
			if ((Object)(object)character == (Object)null)
			{
				return null;
			}
			try
			{
				if (character.refs != null && (Object)(object)character.refs.view != (Object)null)
				{
					return character.refs.view;
				}
			}
			catch
			{
			}
			try
			{
				return ((Component)character).GetComponent<PhotonView>();
			}
			catch
			{
				return null;
			}
		}

		private static Vector3 TransporterCenter(Character character)
		{
			//IL_0001: 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_0007: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0030: 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_0024: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Vector3 center = character.Center;
				if (PingMarker.IsFinite(center))
				{
					return center;
				}
			}
			catch
			{
			}
			try
			{
				return ((Component)character).transform.position;
			}
			catch
			{
				return Vector3.zero;
			}
		}

		private static string SafeName(Character character)
		{
			try
			{
				return NameUtil.Clean(character.characterName);
			}
			catch
			{
				return "玩家";
			}
		}

		private static string Format(Vector3 value)
		{
			return value.x.ToString("0.0") + ", " + value.y.ToString("0.0") + ", " + value.z.ToString("0.0");
		}
	}
	internal static class Teleporter
	{
		private sealed class Job
		{
			internal Character Target;

			internal Func<Vector3> Position;

			internal string Label;
		}

		private const BindingFlags InstanceFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private static readonly List<Job> Jobs = new List<Job>();

		private static MethodInfo _warpPlayerMethod;

		private static float _nextJobAt;

		private static int _batchTotal;

		private static int _batchDone;

		private static int _batchFailed;

		private static string _batchLabel = string.Empty;

		internal static string Status = string.Empty;

		internal static float StatusAt = -100f;

		internal static bool IsBusy => Jobs.Count > 0;

		internal static void Init()
		{
			try
			{
				_warpPlayerMethod = typeof(Character).GetMethod("WarpPlayer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2]
				{
					typeof(Vector3),
					typeof(bool)
				}, null);
			}
			catch (Exception ex)
			{
				_warpPlayerMethod = null;
				Plugin.LogWarning("缓存 Character.WarpPlayer 失败:" + ex.Message);
			}
			if (_warpPlayerMethod == null)
			{
				Plugin.LogWarning("未找到 Character.WarpPlayer(Vector3,bool),本地传送将不可用。");
			}
		}

		internal static void SetStatus(string text)
		{
			Status = text ?? string.Empty;
			StatusAt = Time.unscaledTime;
			Plugin.LogInfo("[传送] " + Status);
		}

		internal static void ClearQueue()
		{
			Jobs.Clear();
			_batchTotal = 0;
			_batchDone = 0;
			_batchFailed = 0;
			_batchLabel = string.Empty;
		}

		internal static void Tick()
		{
			//IL_00b4: 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_0069: 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)
			if (Jobs.Count == 0 || Time.unscaledTime < _nextJobAt)
			{
				return;
			}
			_nextJobAt = Time.unscaledTime + (float)ModConfig.BatchDelay / 1000f;
			Job job = Jobs[0];
			Jobs.RemoveAt(0);
			bool flag;
			string error;
			if ((Object)(object)job.Target == (Object)null)
			{
				flag = false;
				error = "目标角色已消失";
			}
			else
			{
				Vector3 position = default(Vector3);
				try
				{
					position = ((job.Position != null) ? job.Position() : Vector3.zero);
				}
				catch (Exception ex)
				{
					((Vector3)(ref position))..ctor(float.NaN, float.NaN, float.NaN);
					Plugin.LogWarning("计算传送坐标失败:" + ex.Message);
				}
				flag = TryWarp(job.Target, position, out error);
			}
			if (flag)
			{
				_batchDone++;
			}
			else
			{
				_batchFailed++;
				Plugin.LogWarning("批量传送失败(" + job.Label + "):" + error);
			}
			if (Jobs.Count == 0)
			{
				SetStatus(_batchLabel + "完成:成功 " + _batchDone + ",失败 " + _batchFailed + "。");
				_batchTotal = 0;
				_batchDone = 0;
				_batchFailed = 0;
				_batchLabel = string.Empty;
			}
		}

		internal static bool TryTeleportLocalTo(Character target)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null)
			{
				SetStatus("目标玩家没有角色,无法传送。");
				return false;
			}
			if (!TryGetTeleportToPlayerPosition(Character.localCharacter, target, out var position))
			{
				SetStatus("无法计算目标附近的位置。");
				return false;
			}
			if (TryWarp(Character.localCharacter, position, out var error))
			{
				SetStatus("已传送到 " + SafeName(target) + " 附近。");
				return true;
			}
			SetStatus("传送失败:" + error);
			return false;
		}

		internal static bool TryTeleportToLocal(Character target)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)target == (Object)null)
			{
				SetStatus("目标玩家没有角色,无法传送。");
				return false;
			}
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				SetStatus("本地角色不存在。");
				return false;
			}
			if (!TryGetBesidePosition(localCharacter, 0, out var position))
			{
				SetStatus("无法计算本地角色附近的位置。");
				return false;
			}
			if (TryWarp(target, position, out var error))
			{
				SetStatus("已把 " + SafeName(target) + " 传送到你身边。");
				return true;
			}
			SetStatus("传送失败:" + error);
			return false;
		}

		internal static bool TryWarpLocalToPosition(Vector3 position, string successMessage)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				SetStatus("本地角色不存在。");
				return false;
			}
			if (TryWarp(localCharacter, position, out var error))
			{
				SetStatus(successMessage ?? "已传送。");
				return true;
			}
			SetStatus("传送失败:" + error);
			return false;
		}

		internal static int QueuePlayersToPositions(IList<Character> players, IList<Vector3> positions, string label)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: 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_00db: 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_00c5: 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)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (positions == null || positions.Count == 0)
			{
				SetStatus("没有可用的目标位置。");
				return 0;
			}
			if (players == null)
			{
				SetStatus("没有可传送的玩家。");
				return 0;
			}
			int num = 0;
			HashSet<int> hashSet = new HashSet<int>();
			for (int i = 0; i < players.Count; i++)
			{
				Character val = players[i];
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				int instanceID;
				try
				{
					instanceID = ((Object)val).GetInstanceID();
				}
				catch
				{
					continue;
				}
				if (hashSet.Add(instanceID))
				{
					int num2 = num;
					Vector3 val2 = positions[num2 % positions.Count];
					int num3 = num2 / positions.Count;
					if (num3 > 0)
					{
						float num4 = (float)num2 * 2.39996f;
						float num5 = 0.55f + 0.45f * (float)num3;
						val2 += new Vector3(Mathf.Cos(num4), 0f, Mathf.Sin(num4)) * num5;
					}
					Vector3 targetPosition = val2;
					Enqueue(val, () => targetPosition, label);
					num++;
				}
			}
			if (num == 0)
			{
				SetStatus("没有需要传送的玩家。");
				return 0;
			}
			SetStatus(label + ":已排队 " + num + " 人。");
			return num;
		}

		internal static void EnqueueToLocal(Character target, string label)
		{
			Character me = Character.localCharacter;
			if ((Object)(object)me == (Object)null)
			{
				SetStatus("本地角色不存在。");
				return;
			}
			int slot = Jobs.Count;
			Enqueue(target, () => TryGetBesidePosition(me, slot, out var position) ? position : (SafeCenter(me) + Vector3.up), label);
		}

		internal static void EnqueueToAnchor(Character target, Character anchor, int slot, string label)
		{
			Enqueue(target, delegate
			{
				//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_0047: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				if (arrowAnchorValid(anchor) && TryGetBesidePosition(anchor, slot, out var position))
				{
					return position;
				}
				return (!arrowAnchorValid(anchor)) ? Vector3.zero : (SafeCenter(anchor) + Vector3.up);
			}, label);
		}

		private static bool arrowAnchorValid(Character anchor)
		{
			return (Object)(object)anchor != (Object)null;
		}

		private static void Enqueue(Character target, Func<Vector3> position, string label)
		{
			if (!((Object)(object)target == (Object)null))
			{
				if (Jobs.Count == 0)
				{
					_batchTotal = 0;
					_batchDone = 0;
					_batchFailed = 0;
					_batchLabel = (string.IsNullOrEmpty(label) ? "批量传送" : label);
				}
				_batchTotal++;
				Jobs.Add(new Job
				{
					Target = target,
					Position = position,
					Label = (label ?? SafeName(target))
				});
			}
		}

		internal static int QueueBatchToAnchor(IEnumerable<Character> targets, Character anchor, string label)
		{
			if ((Object)(object)anchor == (Object)null)
			{
				SetStatus("没有可用的目标玩家。");
				return 0;
			}
			int num = 0;
			HashSet<int> hashSet = new HashSet<int>();
			foreach (Character target in targets)
			{
				if (!((Object)(object)target == (Object)null) && !((Object)(object)target == (Object)(object)anchor))
				{
					int instanceID;
					try
					{
						instanceID = ((Object)target).GetInstanceID();
					}
					catch
					{
						continue;
					}
					if (hashSet.Add(instanceID))
					{
						EnqueueToAnchor(target, anchor, num, label);
						num++;
					}
				}
			}
			if (num == 0)
			{
				SetStatus("没有需要传送的玩家。");
				return 0;
			}
			SetStatus(label + ":已排队 " + num + " 人。");
			return num;
		}

		internal static int QueueBatchToLocal(IEnumerable<Character> targets, string label)
		{
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				SetStatus("本地角色不存在。");
				return 0;
			}
			int num = 0;
			HashSet<int> hashSet = new HashSet<int>();
			foreach (Character target in targets)
			{
				if (!((Object)(object)target == (Object)null) && !((Object)(object)target == (Object)(object)localCharacter))
				{
					int instanceID;
					try
					{
						instanceID = ((Object)target).GetInstanceID();
					}
					catch
					{
						continue;
					}
					if (hashSet.Add(instanceID))
					{
						EnqueueToLocal(target, label);
						num++;
					}
				}
			}
			if (num == 0)
			{
				SetStatus("没有需要传送的玩家。");
				return 0;
			}
			SetStatus(label + ":已排队 " + num + " 人。");
			return num;
		}

		internal static bool TryWarp(Character target, Vector3 position, out string error)
		{
			//IL_0019: 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_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			error = string.Empty;
			if ((Object)(object)target == (Object)null)
			{
				error = "目标角色不存在";
				return false;
			}
			if (!IsFinite(position))
			{
				error = "坐标无效";
				return false;
			}
			bool flag;
			try
			{
				flag = (Object)(object)target == (Object)(object)Character.localCharacter;
			}
			catch
			{
				flag = false;
			}
			if (flag)
			{
				if (_warpPlayerMethod == null)
				{
					error = "Character.WarpPlayer 不可用";
					return false;
				}
				try
				{
					if (target.warping)
					{
						error = "本地角色正在传送中";
						return false;
					}
					Stabilize(target);
					_warpPlayerMethod.Invoke(target, new object[2]
					{
						position,
						ModConfig.TeleportPoof != null && ModConfig.TeleportPoof.Value
					});
					Stabilize(target);
					return true;
				}
				catch (Exception ex)
				{
					error = "本地传送异常:" + ((ex.InnerException != null) ? ex.InnerException.Message : ex.Message);
					return false;
				}
			}
			PhotonView val = null;
			try
			{
				if (target.refs != null)
				{
					val = target.refs.view;
				}
			}
			catch
			{
			}
			if ((Object)(object)val == (Object)null)
			{
				error = "目标没有 PhotonView";
				return false;
			}
			if (!PhotonNetwork.InRoom)
			{
				error = "不在联机房间内";
				return false;
			}
			try
			{
				if (target.warping)
				{
					return true;
				}
			}
			catch
			{
			}
			bool flag2 = ModConfig.TeleportPoof == null || ModConfig.TeleportPoof.Value;
			if (PhotonNetwork.IsMasterClient)
			{
				try
				{
					val.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { position, flag2 });
					Stabilize(target);
					return true;
				}
				catch (Exception ex2)
				{
					error = "RPC 发送失败:" + ex2.Message;
					return false;
				}
			}
			if (StickTeleport.IsPending(target))
			{
				return true;
			}
			if (NonHostTeleport.IsPending(target))
			{
				return true;
			}
			bool flag3 = true;
			try
			{
				flag3 = (Object)(object)target.data != (Object)null && !target.data.dead && !target.data.fullyPassedOut;
			}
			catch
			{
			}
			if (flag3)
			{
				if (StickTeleport.TryTeleport(target, position, out var error2))
				{
					return true;
				}
				Plugin.LogWarning("[传送] 保留状态的硬传送失败:" + error2);
				if (ModConfig.AllowReviveFallback == null || !ModConfig.AllowReviveFallback.Value)
				{
					error = "硬传送失败(未回退复活,避免状态重置):" + error2;
					return false;
				}
			}
			if (NonHostTeleport.TryTeleport(target, val, position, ModConfig.NonHostItemRecovery != null && ModConfig.NonHostItemRecovery.Value))
			{
				return true;
			}
			error = (flag3 ? "非房主传送被拒绝(硬传送失败,目标未就绪或正在传送)" : "非房主复活传送被拒绝(目标未就绪或正在传送)");
			return false;
		}

		internal static bool TryGetTeleportToPlayerPosition(Character local, Character